VERSION 6.03.19

- Correcion en envio de datos de venta y reparto
This commit is contained in:
2026-04-13 11:00:14 -06:00
parent dbf0c58c0b
commit 2b62580240
17 changed files with 980 additions and 585 deletions

View File

@@ -11,6 +11,9 @@ Sub Class_Globals
Dim almacen, perfil, cuantos, NUMERO_PEDIDO, usuario, cuantos_exib, cuantos_pedidosc, cuantos_noventa, cuantos_ped, cuantos_pedido As String
Dim l_ruta As Label
Dim foto1() As Byte
Dim enviando As Boolean = False
Dim validando As Boolean = False
Dim datos_iguales As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
@@ -19,6 +22,7 @@ Public Sub Initialize
End Sub
Sub envia
enviando = True
c=B4XPages.MainPage.skmt.ExecQuery("select usuario from usuarioa")
c.Position = 0
usuario = c.GetString("USUARIO")
@@ -68,21 +72,69 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
End Sub
Sub JobDone(Job As HttpJob)
Log("JOBDONE")
Log(reqManager.link)
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
If reqManager.reqsList.IndexOf(Job.tag) <> -1 Then
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(Job.tag))
LogColor($">>>>>> Quitamos ${Job.tag}"$, Colors.Blue)
Log("JOBDONE - " & almacen)
' 1. Tachamos el request de la lista
If reqManager.reqsList.IsInitialized Then
Dim index As Int = reqManager.reqsList.IndexOf(Job.tag)
If index <> -1 Then reqManager.reqsList.RemoveAt(index)
End If
If Not(Job.Success) Then
LogColor("Error en red: " & Job.tag & " : " & Subs.parseHTTPError(Job.ErrorMessage), Colors.Red)
Else
' 2. Procesamos validaciones
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If Job.JobName = "DBRequest" Then
If RESULT.Tag = "valida_pedido" Then
Subs.logJobDoneResultados(RESULT)
For Each records() As Object In RESULT.Rows
Dim CUANTOSP As Int = records(RESULT.Columns.Get("CUANTOSP"))
B4XPages.MainPage.l_vProds2.Text = $"${CUANTOSP}/${cuantos_pedido}"$
' Mantenemos tu lógica permisiva
If cuantos_pedido <= CUANTOSP Then
datos_iguales = "ok"
Else
LogColor("Faltan pedidos. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido, Colors.Red)
End If
Next
Else If RESULT.Tag = "valida_pedidoc" Then
Subs.logJobDoneResultados(RESULT)
For Each records() As Object In RESULT.Rows
Dim CUANTOSC As Int = records(RESULT.Columns.Get("CUANTOSC"))
B4XPages.MainPage.l_vPedidos2.Text = $"${CUANTOSC}/${cuantos_pedidosc}"$
Next
Else If RESULT.Tag = "valida_noventa" Then
Subs.logJobDoneResultados(RESULT)
For Each records() As Object In RESULT.Rows
Dim CUANTOSN As Int = records(RESULT.Columns.Get("CUANTOSN"))
B4XPages.MainPage.l_vNoVenta2.Text = $"${CUANTOSN}/${cuantos_noventa}"$
Next
End If
End If
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.Blue)
End If
If Job.Success = False Then
LogColor("Error: " & reqManager.HandleJob(Job).tag & " : " & Job.ErrorMessage, Colors.red)
Else 'If Job Success then ...
LogColor("JobDone: '" & reqManager.HandleJob(Job).tag & "' - Registros: " & reqManager.HandleJob(Job).Rows.Size, Colors.RGB(0,160,0)) 'Mod por CHV - 211027
Log(reqManager.reqsList.size)
If reqManager.reqsList.size = 0 Then B4XPages.MainPage.p_progressDialog.Visible = False
End If
Job.Release
' 3. Control de flujo seguro
If reqManager.reqsList.size = 0 Then
B4XPages.MainPage.p_progressDialog.Visible = False
If enviando Then
enviando = False
B4XPages.MainPage.l_progressDialog.Text = "Validando "
B4XPages.MainPage.p_progressDialog.Visible = True
Sleep(200)
valida
Else If validando Then
validando = False
Sleep(300)
B4XPages.MainPage.p_validacion.Visible = True
End If
End If
End Sub
Sub valida
B4XPages.MainPage.p_progressDialog.Visible = False
ToastMessageShow("Envío de Reparto Finalizado", True)
End Sub