Correcion existencias servicio de ecommerce E141

This commit is contained in:
2021-06-09 15:07:49 -07:00
parent c3eb04343b
commit a5ed1c360b

View File

@@ -406,6 +406,8 @@ Public Class E141 : Implements IHttpHandler
Else
retorno = "False"
End If
Case "ActualizarPreciosJson"
retorno = ActualizarPreciosJson(If(FiltrarTodos = "1", True, False))
Case "ActualizarExistencias"
respuesta = ActualizarExistencias()
If respuesta Then
@@ -413,6 +415,8 @@ Public Class E141 : Implements IHttpHandler
Else
retorno = "False"
End If
Case "ActualizarExistenciasJson"
retorno = ActualizarExistenciasJson(If(FiltrarTodos = "1", True, False))
Case "ActualizarVendedores"
respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False))
If respuesta Then
@@ -2118,6 +2122,26 @@ Public Class E141 : Implements IHttpHandler
Return Retorno
End Function
Private Function ActualizarPreciosJson(Todos As Boolean) As String
Dim payload = New JObject()
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
Dim DtPS As DataTable = Nothing
Using ObjPS As New ClsProductosServicios
'OBTERNER PRECIOS DE PUBLICO GENERAL
If ObjPS.GetPreciosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then
DtPS = ObjPS.DtResultados.Copy()
End If
End Using
If DtPS IsNot Nothing Then
payload.Add(New JProperty("products", GenerarPayloadPrecios(DtPS)))
End If
Return payload.ToString()
End Function
Private Function GenerarPayloadPrecios(DtPS As DataTable) As JArray
Dim ArrayPS As New JArray
For Each RowPS As DataRow In DtPS.Rows
@@ -2215,6 +2239,25 @@ Public Class E141 : Implements IHttpHandler
Return Retorno
End Function
Private Function ActualizarExistenciasJson(Todos As Boolean) As String
Dim payload = New JObject()
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
Dim DtPS As DataTable = Nothing
Using ObjPS As New ClsProductosServicios
If ObjPS.GetExistenciasEmpresa("-1", CveEmpresa) Then
DtPS = ObjPS.DtResultados.Copy()
End If
End Using
If DtPS IsNot Nothing Then
payload.Add(New JProperty("stock", GenerarPayloadExistencias(DtPS)))
End If
Return payload.ToString()
End Function
Private Function GenerarPayloadExistencias(DtPS As DataTable) As JArray
Dim ArrayPS As New JArray
For Each RowPS As DataRow In DtPS.Rows
@@ -2233,7 +2276,7 @@ Public Class E141 : Implements IHttpHandler
#End Region
#Region "A C T U A L I Z A R - E X I S T E N C I A S"
#Region "A C T U A L I Z A R - V E N D E D O R E S"
Private Function ActualizarVendedores(Todos As Boolean) As Boolean
Dim Retorno As Boolean = False