Commit inicial: ITCA_API_SAP_WMS (.NET Core 3.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2b82744eb8
168 files changed
+11066
No files matched your search
@@ -0,0 +1,106 @@
|
||||
using Net.Business.Entities.WMS.ProcesoPicking;
|
||||
using Sap.Data.Hana;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace Net.Data.HelperData.HelperProcesoPermitido
|
||||
{
|
||||
public class HelperProcesoPermitido
|
||||
{
|
||||
public static int Get(string Proceso, int IdEstado, string Endpoint, out List<BE_ProcesoPicking> ListaProceso)
|
||||
{
|
||||
List<BE_ProcesoPicking> list = new List<BE_ProcesoPicking>();
|
||||
DataTable dt = new DataTable();
|
||||
using (HanaConnection con = new HanaConnection(LocalData.ConnectionString))
|
||||
{
|
||||
con.Open();
|
||||
HanaCommand cmd = new HanaCommand($"SELECT * FROM \"{LocalData.Schema}\".\"@ITCA_PROWMS\" WHERE \"U_ITCA_PROCESO\" = ? AND \"U_ITCA_ESTADO\" = ? AND \"U_ITCA_ENDPOINT\" = ?", con);
|
||||
cmd.Parameters.Add("Proceso", HanaDbType.VarChar).Value = (Proceso ?? "").ToUpper();
|
||||
cmd.Parameters.Add("IdEstado", HanaDbType.VarChar).Value = IdEstado.ToString();
|
||||
cmd.Parameters.Add("Endpoint", HanaDbType.VarChar).Value = Endpoint ?? "";
|
||||
HanaDataAdapter da = new HanaDataAdapter(cmd);
|
||||
if (da != null)
|
||||
{
|
||||
da.Fill(dt);
|
||||
}
|
||||
|
||||
for (int x = 0; x < dt.Rows.Count; x++)
|
||||
{
|
||||
list.Add(new BE_ProcesoPicking()
|
||||
{
|
||||
Code = (dt.Rows[x]["Code"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Code"]) : string.Empty,
|
||||
U_ITCA_ESTADO = (dt.Rows[x]["U_ITCA_ESTADO"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["U_ITCA_ESTADO"]) : string.Empty,
|
||||
U_ITCA_GNRPROC = (dt.Rows[x]["U_ITCA_GNRPROC"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["U_ITCA_GNRPROC"]) : string.Empty,
|
||||
U_ITCA_PROCESO = (dt.Rows[x]["U_ITCA_PROCESO"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["U_ITCA_PROCESO"]) : string.Empty,
|
||||
});
|
||||
}
|
||||
con.Close();
|
||||
}
|
||||
ListaProceso = list;
|
||||
return dt.Rows.Count;
|
||||
}
|
||||
|
||||
public static string GetMotivoAlmacen(string CodEstado, out bool Reproceso, out string MotivoNotaCredito, out string DescripcionMotivo)
|
||||
{
|
||||
string Almacen = "";
|
||||
Reproceso = false;
|
||||
MotivoNotaCredito = "";
|
||||
DescripcionMotivo = "";
|
||||
DataTable dt = new DataTable();
|
||||
using (HanaConnection con = new HanaConnection(LocalData.ConnectionString))
|
||||
{
|
||||
con.Open();
|
||||
HanaCommand cmd = new HanaCommand($"SELECT * FROM \"{LocalData.Schema}\".\"@SYP_MOTIVOS\" WHERE \"Code\" = ?", con);
|
||||
cmd.Parameters.Add("Code", HanaDbType.VarChar).Value = (CodEstado ?? "").ToUpper();
|
||||
HanaDataAdapter da = new HanaDataAdapter(cmd);
|
||||
if (da != null)
|
||||
{
|
||||
da.Fill(dt);
|
||||
}
|
||||
|
||||
for (int x = 0; x < dt.Rows.Count; x++)
|
||||
{
|
||||
Reproceso = (dt.Rows[x]["U_ITC_WMS_RPG"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["U_ITC_WMS_RPG"]) == "Y" : false;
|
||||
Almacen = (dt.Rows[x]["U_ITC_WMS_WHS"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["U_ITC_WMS_WHS"]) : string.Empty;
|
||||
MotivoNotaCredito = (dt.Rows[x]["U_SYP_CODMO"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["U_SYP_CODMO"]) : string.Empty;
|
||||
DescripcionMotivo = (dt.Rows[x]["Name"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Name"]) : string.Empty;
|
||||
}
|
||||
con.Close();
|
||||
}
|
||||
return Almacen;
|
||||
}
|
||||
|
||||
public static int? ConvertTimeToSeconds(string timeString)
|
||||
{
|
||||
string[] parts = timeString.Split(':');
|
||||
if (parts.Length != 3)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int hours = int.Parse(parts[0]);
|
||||
int minutes = int.Parse(parts[1]);
|
||||
int seconds = int.Parse(parts[2]);
|
||||
|
||||
return (hours * 3600) + (minutes * 60) + seconds;
|
||||
}
|
||||
|
||||
public static int? ConvertTimeToInteger(string timeString)
|
||||
{
|
||||
// Split the time string into hours and minutes
|
||||
string[] parts = timeString.Split(':');
|
||||
if (parts.Length == 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int hours = int.Parse(parts[0]);
|
||||
int minutes = int.Parse(parts[1]);
|
||||
|
||||
// Combine hours and minutes into a single integer (e.g., 10:30 becomes 1030)
|
||||
int result = (hours * 100) + minutes;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user