Transferencia desde ALM99: elegir la entrada de la factura de reserva por articulos/cantidades y que no tenga transferencia. Version 2.1.9.0
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
31b0929342
commit
baaf85554a
7 files changed
+198
-26
No files matched your search
@@ -1,5 +1,7 @@
|
||||
using Sap.Data.Hana;
|
||||
using Net.Business.Entities.WMS.Transferencia;
|
||||
using Sap.Data.Hana;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace Net.Data.HelperData.Invoices
|
||||
@@ -30,5 +32,47 @@ namespace Net.Data.HelperData.Invoices
|
||||
|
||||
return DocEntry;
|
||||
}
|
||||
|
||||
// Lineas de todas las Entradas de Mercaderia (no anuladas) enlazadas (BaseType 18) a la Factura de Reserva
|
||||
// de proveedores con ese DocNum (isIns = 'Y'). Si una linea ya tiene transferencia de stock (TargetType 67)
|
||||
// y esa transferencia no esta anulada, TransferenciaDocEntry trae su DocEntry; si no, 0.
|
||||
public static List<BE_EntradaImportacionLinea> GetEntradasPorFactura(string DocNum)
|
||||
{
|
||||
var lista = new List<BE_EntradaImportacionLinea>();
|
||||
DataTable dt = new DataTable();
|
||||
string esquema = LocalData.Schema;
|
||||
using (HanaConnection con = new HanaConnection(LocalData.ConnectionString))
|
||||
{
|
||||
con.Open();
|
||||
HanaCommand cmd = new HanaCommand(
|
||||
$"SELECT E.\"DocEntry\", E.\"DocNum\", L.\"LineNum\", L.\"ItemCode\", L.\"Quantity\", " +
|
||||
$"CASE WHEN L.\"TargetType\" = 67 AND W.\"DocEntry\" IS NOT NULL AND W.\"CANCELED\" = 'N' THEN W.\"DocEntry\" ELSE 0 END AS \"TransferenciaDocEntry\" " +
|
||||
$"FROM \"{esquema}\".\"OPCH\" F " +
|
||||
$"INNER JOIN \"{esquema}\".\"PDN1\" L ON L.\"BaseType\" = 18 AND L.\"BaseEntry\" = F.\"DocEntry\" " +
|
||||
$"INNER JOIN \"{esquema}\".\"OPDN\" E ON E.\"DocEntry\" = L.\"DocEntry\" " +
|
||||
$"LEFT JOIN \"{esquema}\".\"OWTR\" W ON L.\"TargetType\" = 67 AND W.\"DocEntry\" = L.\"TrgetEntry\" " +
|
||||
$"WHERE F.\"DocNum\" = ? AND F.\"isIns\" = 'Y' AND E.\"CANCELED\" = 'N' " +
|
||||
$"ORDER BY E.\"DocEntry\", L.\"LineNum\"", con);
|
||||
cmd.Parameters.Add("DocNum", HanaDbType.VarChar).Value = DocNum ?? "";
|
||||
HanaDataAdapter da = new HanaDataAdapter(cmd);
|
||||
da.Fill(dt);
|
||||
con.Close();
|
||||
}
|
||||
|
||||
for (int x = 0; x < dt.Rows.Count; x++)
|
||||
{
|
||||
lista.Add(new BE_EntradaImportacionLinea()
|
||||
{
|
||||
DocEntry = Convert.ToInt32(dt.Rows[x]["DocEntry"]),
|
||||
DocNum = Convert.ToInt32(dt.Rows[x]["DocNum"]),
|
||||
LineNum = Convert.ToInt32(dt.Rows[x]["LineNum"]),
|
||||
ItemCode = Convert.ToString(dt.Rows[x]["ItemCode"]),
|
||||
Quantity = Convert.ToDecimal(dt.Rows[x]["Quantity"]),
|
||||
TransferenciaDocEntry = Convert.ToInt32(dt.Rows[x]["TransferenciaDocEntry"]),
|
||||
});
|
||||
}
|
||||
|
||||
return lista;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user