Limpieza: comentarios en el codigo, if vacio de CreateHojaRuta y documentacion. Versión 2.1.8.0

Sin cambios de comportamiento. Comentarios en Picking, Recibo,
ConnectionServiceLayer, CreditNotesRepository, InvoiceRepository y
RepositoryWrapper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5.5 committed 2026-10-14 19:31:06 -05:00
1 parent 57b4578f1f
commit a5a4160471
9 files changed
+66 -26

No files matched your search

+16 -13
View File
@@ -10,7 +10,7 @@ comprimido (versión antigua)**.
## Versión y control de versiones ## Versión y control de versiones
- **Versión actual: 2.1.7.0** (`Net.Business.Services.csproj`: `Version`, - **Versión actual: 2.1.8.0** (rama `limpieza-2.1.8.0`; `main` = 2.1.7.0) (`Net.Business.Services.csproj`: `Version`,
`AssemblyVersion`, `FileVersion`). Cada versión tiene su commit; al publicar `AssemblyVersion`, `FileVersion`). Cada versión tiene su commit; al publicar
se sube la versión (ver `publicar.ps1`). se sube la versión (ver `publicar.ps1`).
- **Git**: rama `main`, remoto `origin` = - **Git**: rama `main`, remoto `origin` =
@@ -86,6 +86,15 @@ transferencias siempre, sin depender de `Notificacion`. Detalle y tabla en
comparaba la serie origen (p. ej. `B005`) con `"03"` y siempre salía `FC10`. comparaba la serie origen (p. ej. `B005`) con `"03"` y siempre salía `FC10`.
Pendiente: validar con contabilidad la serie de boletas, y que Recibo no Pendiente: validar con contabilidad la serie de boletas, y que Recibo no
genera transferencias por almacén destino (nunca llena `U_ITC_ALMDES`). genera transferencias por almacén destino (nunca llena `U_ITC_ALMDES`).
- **v2.1.8.0 — limpieza y comentarios** (rama `limpieza-2.1.8.0`, sin cambios de
comportamiento): se quitó código sin uso (`ValidarCertificado`, `Logout`,
`CancelAsyncSBA`, `DeleteAsyncSBA`, el `throw` inalcanzable de `PatchAsyncSBA`,
`HelperDB`, 11 propiedades de `RepositoryWrapper` sin uso, variables
`TotalDetalle_Parcial`/`_Invoice`/`SerieOrigen` y un `if` vacío en
`CreateHojaRuta`) y se agregaron comentarios en Picking, Recibo,
`ConnectionServiceLayer`, `CreditNotesRepository`, `InvoiceRepository` y
`RepositoryWrapper`. Sigue pendiente: código comentado, `Login`/`LoginPost`
duplicados y `PatchAsyncSBA`.
- Sin probar contra SAP: confirmar con la factura 292410 que SAP devuelve - Sin probar contra SAP: confirmar con la factura 292410 que SAP devuelve
`BaseType`/`BaseEntry` en las líneas y `BatchNumbers` en las de la Entrega. `BaseType`/`BaseEntry` en las líneas y `BatchNumbers` en las de la Entrega.
@@ -139,11 +148,9 @@ Picking, columna `HORA` en `B_Log`. Lo que **no** se trajo: `Chatbots` y
- `BE_ResultadoTransaccion<T>.NombreEstacion`: setter con recursión infinita - `BE_ResultadoTransaccion<T>.NombreEstacion`: setter con recursión infinita
(bomba de tiempo; hoy nada lo asigna). (bomba de tiempo; hoy nada lo asigna).
- `ConnectionServiceLayer.PatchAsyncSBA<T>`: con un `204` real devuelve `null` - `ConnectionServiceLayer.PatchAsyncSBA<T>`: con un `204` real devuelve `null`
sin marcar éxito. `Login()`/`LoginPost()` duplicados; `throw` inalcanzable sin marcar éxito. `Login()`/`LoginPost()` duplicados.
tras `return` en varios `catch`. - El cliente HTTP `bypass-ssl-validation` acepta cualquier certificado TLS hacia
- `ValidarCertificado` acepta cualquier certificado TLS (siempre `true`). el Service Layer (se quitó el método `ValidarCertificado`, que no se usaba).
- `HelperDB.SET(string query)` ejecuta SQL arbitrario; hoy sin llamadores
(candidato a borrar).
- `appsettings.json` (fuera de git, en `.gitignore`) contiene credenciales - `appsettings.json` (fuera de git, en `.gitignore`) contiene credenciales
reales en texto plano (SAP Service Layer, **HANA `B1ADMIN`**, semilla JWT). reales en texto plano (SAP Service Layer, **HANA `B1ADMIN`**, semilla JWT).
Rotar la contraseña de `B1ADMIN` (estuvo en el código fuente) y evaluar un Rotar la contraseña de `B1ADMIN` (estuvo en el código fuente) y evaluar un
@@ -152,13 +159,9 @@ Picking, columna `HORA` en `B_Log`. Lo que **no** se trajo: `Chatbots` y
`ITC_WMS_SAP` (`ITCA_LOG_INTEGRACION`), no en `LocalData.Schema`; si la tabla `ITC_WMS_SAP` (`ITCA_LOG_INTEGRACION`), no en `LocalData.Schema`; si la tabla
está en otro esquema el `INSERT` falla. `B_Log.Add` no tiene `try/catch`, así está en otro esquema el `INSERT` falla. `B_Log.Add` no tiene `try/catch`, así
que un fallo del log puede devolver 500 tras haber creado el documento en SAP. que un fallo del log puede devolver 500 tras haber creado el documento en SAP.
- Código sin uso (limpieza prevista en 2.1.8.0): `CancelAsyncSBA`, - En Picking y Recibo, si la transferencia automática de stock falla, el `if`
`DeleteAsyncSBA`, `Logout`, `ValidarCertificado`, `HelperDB.SET`; 11 de error está vacío: el fallo se ignora (la NC ya está creada) y no se informa
propiedades de `RepositoryWrapper` que ningún controller usa al consumidor.
(`CreditNotes`, `InvoiceRepository`, `ReturnRequest`, `StockTransfer`, etc.);
`TotalDetalle_Parcial` y `var _Invoice` (bloque PICKING) en
`PickingRepository`; `SerieOrigen` en `ReciboRepository`; el `if` vacío tras
`StockTransfer` en Picking (un fallo de la transferencia se ignora).
## Despliegue ## Despliegue
@@ -3,9 +3,9 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>ITCA_API_SAP_WMS</AssemblyName> <AssemblyName>ITCA_API_SAP_WMS</AssemblyName>
<Version>2.1.7</Version> <Version>2.1.8</Version>
<AssemblyVersion>2.1.7.0</AssemblyVersion> <AssemblyVersion>2.1.8.0</AssemblyVersion>
<FileVersion>2.1.7.0</FileVersion> <FileVersion>2.1.8.0</FileVersion>
<UserSecretsId>24763424-3300-4c85-87e3-503f8fdebd14</UserSecretsId> <UserSecretsId>24763424-3300-4c85-87e3-503f8fdebd14</UserSecretsId>
<!-- Antes solo estaba condicionado a Debug|AnyCPU - un "dotnet publish -c Release" <!-- Antes solo estaba condicionado a Debug|AnyCPU - un "dotnet publish -c Release"
(lo normal para IIS) se quedaba sin este archivo, y Startup.cs revienta con (lo normal para IIS) se quedaba sin este archivo, y Startup.cs revienta con
@@ -48,6 +48,7 @@ namespace Net.Connection.ServiceLayer
_responseLoginServiceLayer = new ResponseLoginServiceLayer(); _responseLoginServiceLayer = new ResponseLoginServiceLayer();
} }
// Inicia sesion en el Service Layer (cookie B1SESSION). Usa SapServiceLayer:company/user/password de appsettings.json
public async Task<ResponseLoginServiceLayer> Login() public async Task<ResponseLoginServiceLayer> Login()
{ {
try try
@@ -135,6 +136,7 @@ namespace Net.Connection.ServiceLayer
return _responseLoginServiceLayer; return _responseLoginServiceLayer;
} }
} }
// Igual que Login(); duplicado historico (candidato a unificar)
public async Task<ResponseLoginServiceLayer> LoginPost() public async Task<ResponseLoginServiceLayer> LoginPost()
{ {
try try
@@ -223,6 +225,7 @@ namespace Net.Connection.ServiceLayer
return _responseLoginServiceLayer; return _responseLoginServiceLayer;
} }
} }
// GET al Service Layer. dinamico = true: la respuesta es una sola entidad (ej. Invoices(123)); false: coleccion { value: [...] }
public async Task<List<T>> GetAsync<T>(string Query, int maxpagesize,bool dinamico = false) public async Task<List<T>> GetAsync<T>(string Query, int maxpagesize,bool dinamico = false)
{ {
try try
@@ -304,6 +307,8 @@ namespace Net.Connection.ServiceLayer
// PASAMOS LA EXCEPCIÓN A LA APP. // PASAMOS LA EXCEPCIÓN A LA APP.
} }
} }
// POST con cuerpo JSON. Reintenta una vez si la sesion expiro (401). Si SAP rechaza, devuelve Exito = false y guarda
// el JSON enviado con ErrorLogger (tabla ITCA_LOG_INTEGRACION)
public async Task<T> PostAsync<T>(string Query, object obj) public async Task<T> PostAsync<T>(string Query, object obj)
{ {
@@ -434,6 +439,7 @@ namespace Net.Connection.ServiceLayer
// PASAMOS LA EXCEPCIÓN A LA APP. // PASAMOS LA EXCEPCIÓN A LA APP.
} }
} }
// POST sin cuerpo para reabrir un documento (ej. Invoices(n)/Reopen). SAP responde 204 sin contenido y se toma como exito
public async Task<T> PostReOpen<T>(string Query) public async Task<T> PostReOpen<T>(string Query)
{ {
@@ -566,6 +572,7 @@ namespace Net.Connection.ServiceLayer
// PASAMOS LA EXCEPCIÓN A LA APP. // PASAMOS LA EXCEPCIÓN A LA APP.
} }
} }
// POST sin cuerpo para cerrar un documento (.../Close)
public async Task<T> PostClose<T>(string Query) public async Task<T> PostClose<T>(string Query)
{ {
@@ -694,6 +701,7 @@ namespace Net.Connection.ServiceLayer
// PASAMOS LA EXCEPCIÓN A LA APP. // PASAMOS LA EXCEPCIÓN A LA APP.
} }
} }
// PATCH con cuerpo JSON. OJO: con un 204 real devuelve null sin marcar exito (bug conocido); para PATCH sin respuesta usar PatchNoContentAsync
public async Task<T> PatchAsyncSBA<T>(string Query, object obj) public async Task<T> PatchAsyncSBA<T>(string Query, object obj)
{ {
try try
@@ -21,6 +21,8 @@ using System.Net.Http;
namespace Net.Data namespace Net.Data
{ {
// Expone solo los repositorios que usan los controllers. Los de Service Layer (CreditNotes, Invoice, StockTransfer, ReturnRequest...)
// se instancian directamente con new donde se necesitan.
public class RepositoryWrapper : IRepositoryWrapper public class RepositoryWrapper : IRepositoryWrapper
{ {
#region Variables de conexion #region Variables de conexion
@@ -36,6 +36,8 @@ namespace Net.Data.ServicesLayer.CreditNotes
_context = context; _context = context;
} }
// Crea la nota de credito en SAP (POST CreditNotes). Si SAP rechaza, devuelve StatusCode -1 con el mensaje de SAP;
// el JSON enviado queda en el log (ver ConnectionServiceLayer.PostAsync)
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateCreditNotes(BE_CreditNotesNotes entidad) public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateCreditNotes(BE_CreditNotesNotes entidad)
{ {
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString(); _metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
@@ -62,6 +64,7 @@ namespace Net.Data.ServicesLayer.CreditNotes
} }
// Actualiza una NC ya creada (PATCH); se usa para agregar las referencias de las transferencias automaticas
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> UpdateCreateCreditNotes(dynamic entidad, int DocEntry) public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> UpdateCreateCreditNotes(dynamic entidad, int DocEntry)
{ {
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString(); _metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
@@ -72,6 +72,7 @@ namespace Net.Data.ServicesLayer
} }
// GET INVOICES // GET INVOICES
// Lee una factura de venta (GET Invoices(docEntry)): cabecera, campos U_SYP_*, lineas con BaseType/BaseEntry/BaseLine y lotes
public async Task<BE_ResultadoTransaccion<BE_InvoicesConsulta>> GetInvoice(int docEntry) public async Task<BE_ResultadoTransaccion<BE_InvoicesConsulta>> GetInvoice(int docEntry)
{ {
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString(); _metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
@@ -111,6 +112,7 @@ namespace Net.Data.ServicesLayer
} }
} }
// Reabre una factura cerrada (POST Invoices(n)/Reopen); la NC solo se puede crear sobre una factura abierta
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> ReOpen(int docEntry) public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> ReOpen(int docEntry)
{ {
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString(); _metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
+20 -5
View File
@@ -52,6 +52,10 @@ namespace Net.Data.WMS.Picking
_aplicacionName = GetType().Name; _aplicacionName = GetType().Name;
} }
// POST /api/Picking: actualiza el estado de la factura en HANA y, segun Proceso + IdEstadoCubico, genera documentos en SAP:
// DESPACHO (estado 5/6) -> NC por lo no entregado + transferencias a los almacenes destino (U_ITC_ALMDES)
// PICKING (estado 13) -> NC con un lote nuevo por linea + transferencias
// ULTIMA MILLA (estado 23, solo con Notificacion = "cierre") -> Solicitud de Devolucion
public async Task<BE_ResultadoTransaccion<object>> Create(BE_PickingRequest entidad) public async Task<BE_ResultadoTransaccion<object>> Create(BE_PickingRequest entidad)
{ {
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString(); _metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
@@ -67,6 +71,7 @@ namespace Net.Data.WMS.Picking
{ {
try try
{ {
// Datos del motivo (@SYP_MOTIVOS): almacen destino, si es reproceso y tipo/descripcion de la NC
var Almacen = HelperProcesoPermitido.GetMotivoAlmacen(entidad.CodMotivo, out bool Reproceso, out string MotivoNotaCredito, out string DescripcionMotivo); var Almacen = HelperProcesoPermitido.GetMotivoAlmacen(entidad.CodMotivo, out bool Reproceso, out string MotivoNotaCredito, out string DescripcionMotivo);
if (string.IsNullOrEmpty(entidad.Proceso)) if (string.IsNullOrEmpty(entidad.Proceso))
@@ -126,6 +131,7 @@ namespace Net.Data.WMS.Picking
{ {
return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.NumOrden, "Estado actualizado correctamente", entidad); return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.NumOrden, "Estado actualizado correctamente", entidad);
} }
// Todas las lineas completas: no hay nada que devolver (el tipo de documento 9 sigue el flujo)
if(TotalDetalle == TotalDetalle_Completo && entidad.IdTipoDoc != 9) if(TotalDetalle == TotalDetalle_Completo && entidad.IdTipoDoc != 9)
{ {
return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.NumOrden, "Se registro correctamente...!!!", entidad); return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.NumOrden, "Se registro correctamente...!!!", entidad);
@@ -133,6 +139,7 @@ namespace Net.Data.WMS.Picking
#region PROCESO DE NOTA DE CREDITO #region PROCESO DE NOTA DE CREDITO
// DESPACHO (estado 5 o 6): NC desde la factura; no aplica para IdTipoDoc 9
if (entidad.Proceso.ToUpper() == "DESPACHO" && (entidad.IdEstadoCubico == 6 || entidad.IdEstadoCubico == 5)) if (entidad.Proceso.ToUpper() == "DESPACHO" && (entidad.IdEstadoCubico == 6 || entidad.IdEstadoCubico == 5))
{ {
if (entidad.IdTipoDoc != 9) if (entidad.IdTipoDoc != 9)
@@ -164,6 +171,8 @@ namespace Net.Data.WMS.Picking
} }
} }
// Serie de la NC segun el TIPO de documento de la factura (U_SYP_MDTD): 03 = boleta -> BC10, otro -> FC10.
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo)
string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10"; string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10";
string Correlativo = HelperCorrelativo.Get(Serie); string Correlativo = HelperCorrelativo.Get(Serie);
creditNotesNotes.DocCurrency = _invoices.DocCurrency; creditNotesNotes.DocCurrency = _invoices.DocCurrency;
@@ -290,6 +299,7 @@ namespace Net.Data.WMS.Picking
} }
else else
{ {
// Por cada almacen de origen y almacen destino (U_ITC_ALMDES) distintos se crea una transferencia de stock automatica
List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList(); List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList();
List<int> ListDocEntry = new List<int>(); List<int> ListDocEntry = new List<int>();
ListaUnicaAlmacen.ForEach(Almacen => ListaUnicaAlmacen.ForEach(Almacen =>
@@ -355,6 +365,7 @@ namespace Net.Data.WMS.Picking
//=== CREA INSTANCIA PARA CONECTAR A SAP //=== CREA INSTANCIA PARA CONECTAR A SAP
StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration); StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration);
var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result; var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result;
// OJO: si la transferencia falla se ignora (la NC ya esta creada) y no se informa al consumidor
if (ResultTransfer.StatusCode == -1) if (ResultTransfer.StatusCode == -1)
{ {
@@ -368,6 +379,7 @@ namespace Net.Data.WMS.Picking
}); });
// Referencia las transferencias creadas en la NC
if (ListDocEntry.Count > 0) if (ListDocEntry.Count > 0)
{ {
var listaReferencia = new List<BE_CreditNotesDocumentReferences>(); var listaReferencia = new List<BE_CreditNotesDocumentReferences>();
@@ -497,6 +509,7 @@ namespace Net.Data.WMS.Picking
} }
} }
// PICKING (estado 13): NC con un lote nuevo (fecha y hora) por linea, sin usar los lotes de la factura; solo lineas con diferencia
if (entidad.Proceso.ToUpper() == "PICKING" && entidad.IdEstadoCubico == 13) if (entidad.Proceso.ToUpper() == "PICKING" && entidad.IdEstadoCubico == 13)
{ {
CreditNotesRepository _creditNotesRepository = new CreditNotesRepository(_clientFactory, _configuration, context); CreditNotesRepository _creditNotesRepository = new CreditNotesRepository(_clientFactory, _configuration, context);
@@ -524,6 +537,7 @@ namespace Net.Data.WMS.Picking
} }
} }
// Serie segun el tipo de documento de la factura (03 = boleta -> BC10, otro -> FC10)
string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10"; string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10";
string Correlativo = HelperCorrelativo.Get(Serie); string Correlativo = HelperCorrelativo.Get(Serie);
@@ -584,6 +598,7 @@ namespace Net.Data.WMS.Picking
else else
{ {
// Transferencias automaticas por almacen origen/destino (igual que en DESPACHO)
List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList(); List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList();
List<int> ListDocEntry = new List<int>(); List<int> ListDocEntry = new List<int>();
ListaUnicaAlmacen.ForEach(Almacen => ListaUnicaAlmacen.ForEach(Almacen =>
@@ -646,6 +661,7 @@ namespace Net.Data.WMS.Picking
//=== CREA INSTANCIA PARA CONECTAR A SAP //=== CREA INSTANCIA PARA CONECTAR A SAP
StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration); StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration);
var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result; var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result;
// OJO: si la transferencia falla se ignora (la NC ya esta creada)
if (ResultTransfer.StatusCode == -1) if (ResultTransfer.StatusCode == -1)
{ {
@@ -686,6 +702,8 @@ namespace Net.Data.WMS.Picking
return resultadoTransaccion.GetInformacionResultado((int)entidad.DocEntry, entidad.NumOrden.ToString(), "Se registro correctamente...!!!", entidad); return resultadoTransaccion.GetInformacionResultado((int)entidad.DocEntry, entidad.NumOrden.ToString(), "Se registro correctamente...!!!", entidad);
} }
} }
// ULTIMA MILLA (estado 23): con Notificacion = "cierre" (el filtro esta arriba) y el proceso configurado como SOLICITUD DEV,
// crea la Solicitud de Devolucion con lo no entregado; no genera NC ni transferencias
if(entidad.Proceso.ToUpper() == "ULTIMA MILLA" && entidad.IdEstadoCubico == 23) if(entidad.Proceso.ToUpper() == "ULTIMA MILLA" && entidad.IdEstadoCubico == 23)
{ {
if(Proceso.U_ITCA_GNRPROC == "SOLICITUD DEV" && !Reproceso) if(Proceso.U_ITCA_GNRPROC == "SOLICITUD DEV" && !Reproceso)
@@ -765,6 +783,7 @@ namespace Net.Data.WMS.Picking
}); });
} }
// POST /api/Picking/ruta: registra el estado de la hoja de ruta (inicio/fin de ruta) en HANA; no crea documentos en SAP
public async Task<BE_ResultadoTransaccion<object>> CreateHojaRuta(BE_HojaRutaEntities entidad) public async Task<BE_ResultadoTransaccion<object>> CreateHojaRuta(BE_HojaRutaEntities entidad)
{ {
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString(); _metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
@@ -797,11 +816,6 @@ namespace Net.Data.WMS.Picking
} }
HelperProcesoPiciking.Set(entidad.Proceso, entidad.IdEstadoCubico, entidad.DocEntry, HelperProcesoPermitido.ConvertTimeToInteger(entidad.HoraInicio), HelperProcesoPermitido.ConvertTimeToInteger(entidad.FinRuta), entidad.CodMotivo, ListaProceso.FirstOrDefault().Code); HelperProcesoPiciking.Set(entidad.Proceso, entidad.IdEstadoCubico, entidad.DocEntry, HelperProcesoPermitido.ConvertTimeToInteger(entidad.HoraInicio), HelperProcesoPermitido.ConvertTimeToInteger(entidad.FinRuta), entidad.CodMotivo, ListaProceso.FirstOrDefault().Code);
if (entidad.Proceso == "Picking")
{
//=== IDENTIFICA DESCRIPCION DE ESTADO
}
return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.DocEntry.ToString(), "Registrado Correctamente", entidad); return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.DocEntry.ToString(), "Registrado Correctamente", entidad);
} }
catch (Exception ex) catch (Exception ex)
@@ -811,6 +825,7 @@ namespace Net.Data.WMS.Picking
}); });
} }
// POST /api/Picking/HojaRuta/{docEntry}/Cerrar: cierra el UDO ARD_PHR en SAP (se llama una sola vez al terminar la ruta)
public async Task<BE_ResultadoTransaccion<object>> CerrarHojaRuta(int docEntry) public async Task<BE_ResultadoTransaccion<object>> CerrarHojaRuta(int docEntry)
{ {
_metodoName = "CerrarHojaRuta"; _metodoName = "CerrarHojaRuta";
+7
View File
@@ -345,6 +345,8 @@ namespace Net.Data.WMS.Recibo
#endregion #endregion
// DEVOLUCION: NC (oCreditNotes) con base en la Solicitud de Devolucion (BaseType 234000031).
// Si las lineas de la solicitud vienen de una factura se usan los datos y lotes de la factura; si no, los de la solicitud y el stock de HANA
#region PROCESO DE NOTA DE CREDITO #region PROCESO DE NOTA DE CREDITO
if (entidad.IdTipo == EnumRecibo.DEVOLUCION) if (entidad.IdTipo == EnumRecibo.DEVOLUCION)
@@ -401,6 +403,7 @@ namespace Net.Data.WMS.Recibo
#endregion #endregion
// Serie segun el TIPO de documento origen (03 = boleta), no segun su serie // Serie segun el TIPO de documento origen (03 = boleta), no segun su serie
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo)
string Serie = U_SYP_MDTO == "03" ? "BC10" : "FC10"; string Serie = U_SYP_MDTO == "03" ? "BC10" : "FC10";
string Correlativo = HelperCorrelativo.Get(Serie); string Correlativo = HelperCorrelativo.Get(Serie);
creditNotesNotes.DocCurrency = returnRequest.DocCurrency; creditNotesNotes.DocCurrency = returnRequest.DocCurrency;
@@ -449,6 +452,8 @@ namespace Net.Data.WMS.Recibo
} }
}); });
// Lotes de cada linea: sin factura relacionada, FIFO por vencimiento del stock de HANA; con factura, los lotes de la factura.
// En ambos casos se parte de la lista vacia para que los lotes sumen exactamente la cantidad de la linea
if (_Invoice == null) if (_Invoice == null)
{ {
//=== REALIZA DISTRIBUCION DE STOCK POR LOTE //=== REALIZA DISTRIBUCION DE STOCK POR LOTE
@@ -532,6 +537,7 @@ namespace Net.Data.WMS.Recibo
} }
else else
{ {
// Transferencias por almacen destino (U_ITC_ALMDES). OJO: en Recibo las lineas de la NC no llenan U_ITC_ALMDES, por lo que hoy no se genera ninguna
List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList(); List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList();
List<int> ListDocEntry = new List<int>(); List<int> ListDocEntry = new List<int>();
ListaUnicaAlmacen.ForEach(Almacen => ListaUnicaAlmacen.ForEach(Almacen =>
@@ -594,6 +600,7 @@ namespace Net.Data.WMS.Recibo
//=== CREA INSTANCIA PARA CONECTAR A SAP //=== CREA INSTANCIA PARA CONECTAR A SAP
StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration); StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration);
var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result; var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result;
// OJO: si la transferencia falla se ignora (la NC ya esta creada)
if (ResultTransfer.StatusCode == -1) if (ResultTransfer.StatusCode == -1)
{ {
+5 -5
View File
@@ -76,7 +76,7 @@ dotnet publish Net.Business.Services/Net.Business.Services.csproj -c Release -r
## Versión y script de publish ## Versión y script de publish
- La versión sale de `<Version>`/`<AssemblyVersion>`/`<FileVersion>` en - La versión sale de `<Version>`/`<AssemblyVersion>`/`<FileVersion>` en
`Net.Business.Services/Net.Business.Services.csproj` (actual: **2.1.7.0**); `Net.Business.Services/Net.Business.Services.csproj` (actual: **2.1.8.0** en la rama de limpieza; `main` = 2.1.7.0);
súbela en cada publish. súbela en cada publish.
- `publicar.ps1` (solo Windows) genera `dist\ITCA_API_SAP_WMS_v<versión>.zip` sin - `publicar.ps1` (solo Windows) genera `dist\ITCA_API_SAP_WMS_v<versión>.zip` sin
`appsettings.json`. Desde macOS se hace el mismo `dotnet publish` a mano con `appsettings.json`. Desde macOS se hace el mismo `dotnet publish` a mano con
@@ -198,7 +198,7 @@ para armar el body del `Login` contra el Service Layer.
ejecutar los `ITCA_*` y leer algunas tablas. Conviene un usuario HANA de ejecutar los `ITCA_*` y leer algunas tablas. Conviene un usuario HANA de
permisos mínimos y rotar la contraseña (estuvo en texto plano en el código permisos mínimos y rotar la contraseña (estuvo en texto plano en el código
y en el historial git del repo antiguo archivado). y en el historial git del repo antiguo archivado).
- `ValidarCertificado` en `ConnectionServiceLayer.cs` acepta cualquier - El cliente HTTP `bypass-ssl-validation` (usado por `ConnectionServiceLayer`)
certificado TLS (`return true;` siempre) — bypass de validación de acepta cualquier certificado TLS — bypass de validación de certificado hacia
certificado hacia el Service Layer, igual criterio que el Service Layer, igual criterio que `SERVICE_LAYER_VERIFY_SSL=false` en la
`SERVICE_LAYER_VERIFY_SSL=false` en la reescritura Python. reescritura Python. (Se quitó el método `ValidarCertificado`, que no se usaba.)