Version 2.1.13.0: cabecera de la NC en un solo metodo (CabeceraNotaCredito.Completar)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5.5 committed 2026-10-19 16:52:23 -05:00
1 parent 2fb7509fc2
commit a65cd4d90a
5 files changed
+70 -64

No files matched your search

+6 -1
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.12.0** (rama `limpieza-2.1.8.0`; `main` = 2.1.7.0) (`Net.Business.Services.csproj`: `Version`, - **Versión actual: 2.1.13.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` =
@@ -140,6 +140,11 @@ transferencias siempre, sin depender de `Notificacion`. Detalle y tabla en
(rama "Privado"), `Program.cs` (`CreateHostBuilder` viejo), `ConnectionServiceLayer` (líneas de header/éxito y un (rama "Privado"), `Program.cs` (`CreateHostBuilder` viejo), `ConnectionServiceLayer` (líneas de header/éxito y un
`if` de `NoContent` vacío), `CreditNotesRepository`, `ReciboRepository`, `InventarioRepository`, `ConnectionSQL`, `DBParameter` y `if` de `NoContent` vacío), `CreditNotesRepository`, `ReciboRepository`, `InventarioRepository`, `ConnectionSQL`, `DBParameter` y
`BE_BusinessPartners` (ya no queda código comentado). Sigue pendiente `PatchAsyncSBA` y la redundancia de serie/cabecera de la NC. `BE_BusinessPartners` (ya no queda código comentado). Sigue pendiente `PatchAsyncSBA` y la redundancia de serie/cabecera de la NC.
- **v2.1.13.0 — cabecera única de la NC** (sin cambios de comportamiento): la serie (`BC10` si el tipo del
documento origen es `03`, si no `FC10`), el correlativo (`HelperCorrelativo`) y los ~15 campos de la cabecera de
la NC estaban copiados en Picking DESPACHO, Picking PICKING (estado 13) y Recibo Devolución; ahora están en
`Net.Data/ServicesLayer/CreditNotes/CabeceraNotaCredito.Completar` (con comentarios de la regla de la 2.1.7.0).
Cada llamador pasa los datos de su origen (factura o, en Recibo sin factura, la solicitud de devolución).
- 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.
@@ -3,7 +3,7 @@
<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.12.0</Version> <Version>2.1.13.0</Version>
<AssemblyVersion>2.1.12.0</AssemblyVersion> <AssemblyVersion>2.1.12.0</AssemblyVersion>
<FileVersion>2.1.12.0</FileVersion> <FileVersion>2.1.12.0</FileVersion>
<UserSecretsId>24763424-3300-4c85-87e3-503f8fdebd14</UserSecretsId> <UserSecretsId>24763424-3300-4c85-87e3-503f8fdebd14</UserSecretsId>
@@ -0,0 +1,53 @@
using Net.Business.Entities.ServicesLayer.CreditNotes;
using Net.Data.HelperData.Correlativo;
using System;
namespace Net.Data.ServicesLayer.CreditNotes
{
// Cabecera de la nota de credito (Picking DESPACHO, Picking PICKING estado 13 y Recibo Devolucion).
// Antes la serie, el correlativo y estos campos estaban copiados 3 veces.
public static class CabeceraNotaCredito
{
// Completa la cabecera de la NC con los datos del documento origen (la factura o, en Recibo sin factura,
// la solicitud de devolucion). Las lineas las arma cada llamador.
// tipoOrigen/serieOrigen/correlativoOrigen: U_SYP_MDTD / U_SYP_MDSD / U_SYP_MDCD del documento origen.
public static void Completar(BE_CreditNotesNotes nc, string docCurrency, string cardCode, string cardName, string paymentGroupCode,
string tipoOrigen, string serieOrigen, string correlativoOrigen, DateTime fechaOrigen, string motivo, string tipoMotivo)
{
// v2.1.7.0: la serie sale del TIPO del documento origen (03 = boleta -> BC10, otro -> FC10), no de su serie.
// En Recibo se comparaba la serie origen (p. ej. B005) con "03" y siempre salia FC10.
// Pendiente: validar con contabilidad la serie de boletas.
string serie = SerieNotaCredito(tipoOrigen);
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo)
string correlativo = HelperCorrelativo.Get(serie);
nc.DocCurrency = docCurrency;
nc.CardCode = cardCode;
nc.CardName = cardName;
nc.PaymentGroupCode = paymentGroupCode;
nc.DocDate = DateTime.Now;
nc.DocDueDate = DateTime.Now;
// Documento origen (el que se devuelve)
nc.U_SYP_MDTO = tipoOrigen;
nc.U_SYP_MDCO = correlativoOrigen;
nc.U_SYP_MDSO = serieOrigen;
nc.U_SYP_FECHAREF = fechaOrigen.ToString("yyyy-MM-dd");
nc.U_SYP_MOTNC = motivo;
nc.U_SYP_TPONC = tipoMotivo;
// La NC misma: tipo 07, con la serie y el correlativo elegidos arriba
nc.U_SYP_MDTD = "07";
nc.U_SYP_MDSD = serie;
nc.U_SYP_MDCD = correlativo;
nc.NumAtCard = "07-" + serie + "-" + correlativo;
}
public static string SerieNotaCredito(string tipoOrigen)
{
return tipoOrigen == "03" ? "BC10" : "FC10";
}
}
}
+6 -41
View File
@@ -15,7 +15,6 @@ using Net.Business.Entities.WMS.ProcesoPicking;
using Net.Connection; using Net.Connection;
using Net.Connection.ServiceLayer; using Net.Connection.ServiceLayer;
using Net.CrossCotting; using Net.CrossCotting;
using Net.Data.HelperData.Correlativo;
using Net.Data.HelperData.HelperProcesoPermitido; using Net.Data.HelperData.HelperProcesoPermitido;
using Net.Data.HelperData.Stock; using Net.Data.HelperData.Stock;
using Net.Data.ServicesLayer; using Net.Data.ServicesLayer;
@@ -171,26 +170,9 @@ 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. // Cabecera de la NC (serie BC10/FC10 por tipo de la factura, correlativo, documento origen)
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo) CabeceraNotaCredito.Completar(creditNotesNotes, _invoices.DocCurrency, _invoices.CardCode, _invoices.CardName, _invoices.PaymentGroupCode,
string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10"; _invoices.U_SYP_MDTD, _invoices.U_SYP_MDSD, _invoices.U_SYP_MDCD, _invoices.DocDate, DescripcionMotivo, MotivoNotaCredito);
string Correlativo = HelperCorrelativo.Get(Serie);
creditNotesNotes.DocCurrency = _invoices.DocCurrency;
creditNotesNotes.CardCode = _invoices.CardCode;
creditNotesNotes.CardName = _invoices.CardName;
creditNotesNotes.PaymentGroupCode = _invoices.PaymentGroupCode;
creditNotesNotes.DocDate = DateTime.Now;
creditNotesNotes.DocDueDate = DateTime.Now;
creditNotesNotes.U_SYP_MDTO = _invoices.U_SYP_MDTD;
creditNotesNotes.U_SYP_MDCO = _invoices.U_SYP_MDCD;
creditNotesNotes.U_SYP_MDSO = _invoices.U_SYP_MDSD;
creditNotesNotes.U_SYP_MOTNC = DescripcionMotivo;
creditNotesNotes.U_SYP_TPONC = MotivoNotaCredito;
creditNotesNotes.U_SYP_MDCD = Correlativo;
creditNotesNotes.U_SYP_MDSD = Serie;
creditNotesNotes.U_SYP_MDTD = "07";
creditNotesNotes.U_SYP_FECHAREF = _invoices.DocDate.ToString("yyyy-MM-dd");
creditNotesNotes.NumAtCard = ("07-" + Serie + "-" + Correlativo);
entidad.Detalle.ForEach(x => entidad.Detalle.ForEach(x =>
{ {
@@ -437,26 +419,9 @@ namespace Net.Data.WMS.Picking
} }
} }
// Serie segun el tipo de documento de la factura (03 = boleta -> BC10, otro -> FC10) // Cabecera de la NC (serie BC10/FC10 por tipo de la factura, correlativo, documento origen)
string Serie = _invoices.U_SYP_MDTD == "03" ? "BC10" : "FC10"; CabeceraNotaCredito.Completar(creditNotesNotes, _invoices.DocCurrency, _invoices.CardCode, _invoices.CardName, _invoices.PaymentGroupCode,
string Correlativo = HelperCorrelativo.Get(Serie); _invoices.U_SYP_MDTD, _invoices.U_SYP_MDSD, _invoices.U_SYP_MDCD, _invoices.DocDate, DescripcionMotivo, MotivoNotaCredito);
creditNotesNotes.DocCurrency = _invoices.DocCurrency;
creditNotesNotes.CardCode = _invoices.CardCode;
creditNotesNotes.CardName = _invoices.CardName;
creditNotesNotes.PaymentGroupCode = _invoices.PaymentGroupCode;
creditNotesNotes.DocDate = DateTime.Now;
creditNotesNotes.DocDueDate = DateTime.Now;
creditNotesNotes.U_SYP_MDTO = _invoices.U_SYP_MDTD;
creditNotesNotes.U_SYP_MDCO = _invoices.U_SYP_MDCD;
creditNotesNotes.U_SYP_MDSO = _invoices.U_SYP_MDSD;
creditNotesNotes.U_SYP_MOTNC = DescripcionMotivo;
creditNotesNotes.U_SYP_TPONC = MotivoNotaCredito;
creditNotesNotes.U_SYP_MDCD = Correlativo;
creditNotesNotes.U_SYP_MDSD = Serie;
creditNotesNotes.U_SYP_MDTD = "07";
creditNotesNotes.U_SYP_FECHAREF = _invoices.DocDate.ToString("yyyy-MM-dd");
creditNotesNotes.NumAtCard = ("07-" + Serie+ "-" + Correlativo);
entidad.Detalle.ForEach(x => entidad.Detalle.ForEach(x =>
{ {
+4 -21
View File
@@ -13,7 +13,6 @@ using Net.Business.Entities.ServicesLayer.StockTransfer;
using Net.Business.Entities.WMS.Recibo; using Net.Business.Entities.WMS.Recibo;
using Net.Connection; using Net.Connection;
using Net.CrossCotting; using Net.CrossCotting;
using Net.Data.HelperData.Correlativo;
using Net.Data.HelperData.Stock; using Net.Data.HelperData.Stock;
using Net.Data.ServicesLayer; using Net.Data.ServicesLayer;
using Net.Data.ServicesLayer.CreditNotes; using Net.Data.ServicesLayer.CreditNotes;
@@ -402,26 +401,10 @@ namespace Net.Data.WMS.Recibo
} }
#endregion #endregion
// Serie segun el TIPO de documento origen (03 = boleta), no segun su serie // Cabecera de la NC: serie BC10/FC10 por el TIPO del documento origen (v2.1.7.0), correlativo y documento origen.
// El correlativo sale de @SYP_NUMDOC (HelperCorrelativo) // El origen es la factura de la solicitud de devolucion o, si no hay, la propia solicitud
string Serie = U_SYP_MDTO == "03" ? "BC10" : "FC10"; CabeceraNotaCredito.Completar(creditNotesNotes, returnRequest.DocCurrency, returnRequest.CardCode, returnRequest.CardName, returnRequest.PaymentGroupCode,
string Correlativo = HelperCorrelativo.Get(Serie); U_SYP_MDTO, U_SYP_MDSO, U_SYP_MDCO, DocDate, returnRequest.U_SYP_MOTNC, returnRequest.U_SYP_TPONC);
creditNotesNotes.DocCurrency = returnRequest.DocCurrency;
creditNotesNotes.CardCode = returnRequest.CardCode;
creditNotesNotes.CardName = returnRequest.CardName;
creditNotesNotes.PaymentGroupCode = returnRequest.PaymentGroupCode;
creditNotesNotes.DocDate = DateTime.Now;
creditNotesNotes.DocDueDate = DateTime.Now;
creditNotesNotes.NumAtCard = ("07-" + Serie +"-" + Correlativo);
creditNotesNotes.U_SYP_MDTO = U_SYP_MDTO;
creditNotesNotes.U_SYP_MDCO = U_SYP_MDCO;
creditNotesNotes.U_SYP_MDSO = U_SYP_MDSO;
creditNotesNotes.U_SYP_MOTNC = returnRequest.U_SYP_MOTNC;
creditNotesNotes.U_SYP_TPONC = returnRequest.U_SYP_TPONC;
creditNotesNotes.U_SYP_MDCD = Correlativo;
creditNotesNotes.U_SYP_MDSD = Serie;
creditNotesNotes.U_SYP_MDTD = "07";
creditNotesNotes.U_SYP_FECHAREF = DocDate.ToString("yyyy-MM-dd");
entidad.Detalle.ForEach(x => entidad.Detalle.ForEach(x =>
{ {
var Item = returnRequest.DocumentLines.ToList().FirstOrDefault(t => t.LineNum == x.Item); var Item = returnRequest.DocumentLines.ToList().FirstOrDefault(t => t.LineNum == x.Item);