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:
1 parent
57b4578f1f
commit
a5a4160471
9 files changed
+66
-26
No files matched your search
@@ -52,6 +52,10 @@ namespace Net.Data.WMS.Picking
|
||||
_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)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
@@ -67,6 +71,7 @@ namespace Net.Data.WMS.Picking
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
// Todas las lineas completas: no hay nada que devolver (el tipo de documento 9 sigue el flujo)
|
||||
if(TotalDetalle == TotalDetalle_Completo && entidad.IdTipoDoc != 9)
|
||||
{
|
||||
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
|
||||
|
||||
// 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.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 Correlativo = HelperCorrelativo.Get(Serie);
|
||||
creditNotesNotes.DocCurrency = _invoices.DocCurrency;
|
||||
@@ -290,6 +299,7 @@ namespace Net.Data.WMS.Picking
|
||||
}
|
||||
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<int> ListDocEntry = new List<int>();
|
||||
ListaUnicaAlmacen.ForEach(Almacen =>
|
||||
@@ -355,6 +365,7 @@ namespace Net.Data.WMS.Picking
|
||||
//=== CREA INSTANCIA PARA CONECTAR A SAP
|
||||
StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration);
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -368,6 +379,7 @@ namespace Net.Data.WMS.Picking
|
||||
});
|
||||
|
||||
|
||||
// Referencia las transferencias creadas en la NC
|
||||
if (ListDocEntry.Count > 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 Correlativo = HelperCorrelativo.Get(Serie);
|
||||
|
||||
@@ -584,6 +598,7 @@ namespace Net.Data.WMS.Picking
|
||||
else
|
||||
{
|
||||
|
||||
// Transferencias automaticas por almacen origen/destino (igual que en DESPACHO)
|
||||
List<string> ListaUnicaAlmacen = creditNotesNotes.DocumentLines.Select(x => x.WarehouseCode).Distinct().ToList();
|
||||
List<int> ListDocEntry = new List<int>();
|
||||
ListaUnicaAlmacen.ForEach(Almacen =>
|
||||
@@ -646,6 +661,7 @@ namespace Net.Data.WMS.Picking
|
||||
//=== CREA INSTANCIA PARA CONECTAR A SAP
|
||||
StockTransferRepository stockTransferRepository = new StockTransferRepository(_clientFactory, _configuration);
|
||||
var ResultTransfer = stockTransferRepository.StockTransfer(Transfer).Result;
|
||||
// OJO: si la transferencia falla se ignora (la NC ya esta creada)
|
||||
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);
|
||||
}
|
||||
}
|
||||
// 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(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)
|
||||
{
|
||||
_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);
|
||||
if (entidad.Proceso == "Picking")
|
||||
{
|
||||
//=== IDENTIFICA DESCRIPCION DE ESTADO
|
||||
}
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(entidad.DocEntry, entidad.DocEntry.ToString(), "Registrado Correctamente", entidad);
|
||||
}
|
||||
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)
|
||||
{
|
||||
_metodoName = "CerrarHojaRuta";
|
||||
|
||||
Reference in new issue
Block a user