Ajustes RepPreciosVentaManifiesto, Ajustes carta prote timbrado
This commit is contained in:
121
Ashx/E158.ashx
121
Ashx/E158.ashx
@@ -77,8 +77,8 @@ Public Class E158 : Implements IHttpHandler, IReadOnlySessionState
|
||||
End Sub
|
||||
|
||||
Private Function PreciosVentaCultivo(ByVal CveEmpresa As Integer, ByVal context As HttpContext) As Boolean
|
||||
Dim Respuesta As Boolean = False
|
||||
Dim Usuario As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
|
||||
Dim Respuesta As Boolean = True
|
||||
Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
|
||||
|
||||
' Crear una instancia del servicio web
|
||||
Dim wsservice As New GrowerService.Service()
|
||||
@@ -94,13 +94,120 @@ Public Class E158 : Implements IHttpHandler, IReadOnlySessionState
|
||||
Dim Parametro6 As Integer = 0
|
||||
Dim Parametro6Date As Date = Now.AddDays(-3)
|
||||
|
||||
Dim DTresp As DataTable = wsservice.GetSales(Parametro1, Parametro2, Parametro3, Parametro4, Parametro5, Parametro6)
|
||||
DTresp.WriteXml("C:\temp\GrowerService\Sales.xml", XmlWriteMode.WriteSchema)
|
||||
DTresp.FiltraParametros("", "", {"CommodityDesc"}).WriteXml("C:\temp\GrowerService\CommodityDesc.xml", XmlWriteMode.WriteSchema)
|
||||
DTresp.FiltraParametros("", "", {"VarietyDesc"}).WriteXml("C:\temp\GrowerService\VarietyDesc.xml", XmlWriteMode.WriteSchema)
|
||||
DTresp.FiltraParametros("", "", {"SizeDesc"}).WriteXml("C:\temp\GrowerService\SizeDesc.xml", XmlWriteMode.WriteSchema)
|
||||
|
||||
|
||||
Dim DTresp As DataTable = wsservice.GetSales(Parametro1, Parametro2, Parametro3, Parametro4, Parametro5, Parametro6)
|
||||
'DTresp.WriteXml("C:\temp\GrowerService\Sales.xml", XmlWriteMode.WriteSchema)
|
||||
'DTresp.FiltraParametros("", "", {"CommodityDesc"}).WriteXml("C:\temp\GrowerService\CommodityDesc.xml", XmlWriteMode.WriteSchema)
|
||||
'DTresp.FiltraParametros("", "", {"VarietyDesc"}).WriteXml("C:\temp\GrowerService\VarietyDesc.xml", XmlWriteMode.WriteSchema)
|
||||
'DTresp.FiltraParametros("", "", {"SizeDesc"}).WriteXml("C:\temp\GrowerService\SizeDesc.xml", XmlWriteMode.WriteSchema)
|
||||
|
||||
|
||||
DTresp.Columns.Add("InvoiceDateReal", GetType(DateTime))
|
||||
|
||||
For Each row As DataRow In DTresp.Rows
|
||||
Dim fechaTexto As String = row("InvoiceDate").ToString().Trim()
|
||||
|
||||
If DateTime.TryParseExact(fechaTexto, "MM/dd/yy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, Nothing) Then
|
||||
row("InvoiceDateReal") = DateTime.ParseExact(fechaTexto, "MM/dd/yy", System.Globalization.CultureInfo.InvariantCulture)
|
||||
Else
|
||||
row("InvoiceDateReal") = DBNull.Value
|
||||
End If
|
||||
Next
|
||||
|
||||
DTresp = DTresp.FiltraParametros(" InvoiceDateReal >= #01/01/2025# ")
|
||||
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim DTCultivo As New DataTable
|
||||
Dim DTCultivoVariedad As New DataTable
|
||||
Dim DTTamaño As New DataTable
|
||||
|
||||
If ObjVentas.GetCultivos(-1, CveEmpresa) Then
|
||||
DTCultivo = ObjVentas.DtResultados
|
||||
Else
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
If ObjVentas.GetCultivosVariedad(-1, -1, CveEmpresa) Then
|
||||
DTCultivoVariedad = ObjVentas.DtResultados
|
||||
Else
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
If ObjVentas.GetEmbarqueTamaño(-1, -1, CveEmpresa) Then
|
||||
DTTamaño = ObjVentas.DtResultados
|
||||
Else
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
If Respuesta Then
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
For Each dRow As DataRow In DTresp.Rows
|
||||
|
||||
Dim PalletNum As String = dRow("PalletNum").ToString
|
||||
|
||||
Try
|
||||
Dim CveCultivo As Integer = DTCultivo.FiltroPrimeroValor("CveCultivo", $" Alias = '{dRow("CommodityDesc").ToString}' ").ToEntero
|
||||
If Not CveCultivo > 0 Then
|
||||
GuardaLog($"No se encontro el cultivo {dRow("CommodityDesc").ToString}")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim CveCultivoVariedad As Integer = DTCultivoVariedad.FiltroPrimeroValor("CveCultivoVariedad", $" Alias = '{dRow("VarietyDesc").ToString}' ").ToEntero
|
||||
If Not CveCultivoVariedad > 0 Then
|
||||
GuardaLog($"No se encontro la variedad {dRow("VarietyDesc").ToString}")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim CveTamaño As Integer = DTTamaño.FiltroPrimeroValor("CveTamaño", $" Alias = '{dRow("SizeDesc").ToString.Replace("'", "''")}' ").ToEntero
|
||||
If Not CveTamaño > 0 Then
|
||||
GuardaLog($"No se encontro el tamaño {dRow("SizeDesc").ToString}")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim LoadDate As Date = DateTime.ParseExact(dRow("LoadDate").ToString, "MM/dd/yy", System.Globalization.CultureInfo.InvariantCulture)
|
||||
Dim InvoiceDate As Date = DateTime.ParseExact(dRow("InvoiceDate").ToString, "MM/dd/yy", System.Globalization.CultureInfo.InvariantCulture)
|
||||
|
||||
Dim PaidDate As Date = MinFecha
|
||||
If dRow("PaidDate").ToString.Trim.Length > 0 Then
|
||||
PaidDate = DateTime.ParseExact(dRow("PaidDate").ToString, "MM/dd/yy", System.Globalization.CultureInfo.InvariantCulture)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not ObjVentas.AddPreciosVentaManifiesto(dRow("PalletNum").ToString, CveCultivo, CveTamaño, CveCultivoVariedad, dRow("GroReference").ToString,
|
||||
LoadDate, InvoiceDate, PaidDate,
|
||||
dRow("InvPkgs").ToString.ToDecimal, dRow("NetProdPrice").ToString.ToDecimal, dRow("ProductDesc").ToString,
|
||||
UsuarioActual.CveUsuario, CveEmpresa) Then
|
||||
Respuesta = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
GuardaLog($"Error PalletNum: {PalletNum} {ex.Message} --> {ex.StackTrace}")
|
||||
Respuesta = False
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
Next
|
||||
|
||||
|
||||
If Respuesta Then
|
||||
ObjVentas.Commit()
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
|
||||
'For Each dRow As DataRow In DTresp.Rows
|
||||
|
||||
|
||||
Reference in New Issue
Block a user