mirror of
https://github.com/KeymonSoft/DBCheck.git
synced 2026-04-17 19:37:09 +00:00
VERSION 6.03.19
- Correcion en envio de datos de venta y reparto
This commit is contained in:
@@ -102,8 +102,6 @@ Sub Class_Globals
|
||||
Dim l_vPedidos2 As Label
|
||||
Dim l_vNoVenta2 As Label
|
||||
Dim i_progress As B4XGifView
|
||||
Dim in As Intent
|
||||
Dim intentUsado As Boolean = False
|
||||
Dim Guna_Reparto As C_Guna_Reparto
|
||||
Dim Intmex_Reparto As C_Intmex_Reparto
|
||||
Dim Marquez_Reparto As C_Marquez_Reparto
|
||||
@@ -136,6 +134,7 @@ Sub Class_Globals
|
||||
Private l_montoaliquidar As Label
|
||||
Private l_rutasP As Label
|
||||
Private l_rutaRep As Label
|
||||
Dim importador As C_ImportaBD
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
@@ -199,54 +198,23 @@ Sub B4XPage_Created (Root1 As B4XView)
|
||||
Marquez.Initialize
|
||||
Mazapa.Initialize
|
||||
Profina.Initialize
|
||||
importador.Initialize
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
Log("INICIO")
|
||||
If Not(in.IsInitialized) Then in = B4XPages.GetNativeParent(Me).GetStartingIntent
|
||||
If Not(intentUsado) And in <> Null Then
|
||||
Log(in)
|
||||
' Dim action As String = in.Action
|
||||
' Log("Action: " & action) ' Ej: "android.intent.action.VIEW"
|
||||
' Dim uri As Object = in.GetData ' Obtiene la URI (content://...)
|
||||
' Log(in.GetData)
|
||||
' If uri <> Null Then
|
||||
' Dim uriString As String = uri
|
||||
' Log("URI: " & uriString) ' Ej: "content://com.whatsapp.provider.media/..."
|
||||
' Else
|
||||
' Log("El Intent no tiene URI asociada.")
|
||||
' End If
|
||||
' Dim mimeType As String = in.GetData
|
||||
' Log("MIME Type: " & mimeType) ' Ej: "application/x-sqlite3"
|
||||
' If in.HasExtra("android.intent.extra.STREAM") Then
|
||||
' Dim extraUri As Object = in.GetExtra("android.intent.extra.STREAM")
|
||||
' Log("Extra URI: " & extraUri) ' Ej: "content://..."
|
||||
' Else
|
||||
' Log("No hay extras con android.intent.extra.STREAM")
|
||||
' End If
|
||||
intentUsado = True
|
||||
' Log(in.GetData)
|
||||
If in.GetData <> Null Then
|
||||
Dim XmlData As String
|
||||
XmlData = in.GetData
|
||||
ToastMessageShow(XmlData, False)
|
||||
' Send_Make_somthing(in)
|
||||
' Activity.Finish
|
||||
Try
|
||||
Dim OutStr As OutputStream = File.OpenOutput(File.DirInternal,"kmt.db",False)
|
||||
Dim InStr As InputStream = File.OpenInput("ContentDir",XmlData)
|
||||
File.Copy2(InStr,OutStr)
|
||||
LogColor("BD copiada a interna.", Colors.Blue)
|
||||
OutStr.Close
|
||||
If in.As(String).Contains("whatsapp") Then B4XPages.SetTitle(Me, "BD cargada desde Whatsapp")
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
' ExitApplication
|
||||
End If
|
||||
' CODIGO PARA INTENT DE IMPORTAR BD DESDE WHATSAPP
|
||||
' 1. Obtener el Intent del activity padre (Esto SE QUEDA fuera de la clase)
|
||||
Dim in As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent
|
||||
' 2. Pasamos la bolita a la clase
|
||||
If importador.ProcesarIntent(in) Then
|
||||
ToastMessageShow("BD importada correctamente", False)
|
||||
If importador.EsDeWhatsapp(in) Then B4XPages.SetTitle(Me, "BD cargada desde Whatsapp")
|
||||
End If
|
||||
' TERMINA CODIGO DE IMPORTACION
|
||||
|
||||
' Log($"Existe BD: ${File.Exists(File.DirInternal, "kmt.db") }"$)
|
||||
If File.Exists(File.DirInternal, "kmt.db") Then
|
||||
If Not(skmt.IsInitialized) Then skmt.Initialize(File.DirInternal,"kmt.db", True)
|
||||
@@ -720,7 +688,8 @@ Sub b_enviar_Click
|
||||
' envioIzca
|
||||
Izca.ConfigurarYEnviar("http://keymon.net:1781")
|
||||
else if empresa.ToUpperCase.Contains("DURAKELO") Then
|
||||
envioDurakelo
|
||||
' envioDurakelo
|
||||
Durakelo.ConfigurarYEnviar("http://keymon.net:1781")
|
||||
else if empresa.ToUpperCase.Contains("MARQUEZ") Then
|
||||
' envioMarquez
|
||||
Marquez.ConfigurarYEnviar("http://keymon.net:1781")
|
||||
@@ -955,6 +924,7 @@ Sub p_principal_Click
|
||||
p_editaAlmacen.Visible = False
|
||||
p_editaRuta.Visible = False
|
||||
p_clientes.Visible = False
|
||||
p_editaUsuario.Visible = False
|
||||
p_validacion.Visible = False
|
||||
ime.HideKeyboard
|
||||
End Sub
|
||||
@@ -1220,7 +1190,7 @@ Sub envioGuna 'ignore
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE ")
|
||||
d.Position=0
|
||||
Private cuantos_pedidosc As String = D.GetString("CUANTOS_PEDIDOSC")
|
||||
cuantos_pedidosc = D.GetString("CUANTOS_PEDIDOSC")
|
||||
d.Close
|
||||
|
||||
' ENVIO DE LOS CODIGOS QR
|
||||
@@ -1498,7 +1468,7 @@ Sub valida(identificador As String)
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE ")
|
||||
d.Position = 0
|
||||
Private cuantos_pedidosc As String = D.GetString("CUANTOS_PEDIDOSC")
|
||||
cuantos_pedidosc = D.GetString("CUANTOS_PEDIDOSC")
|
||||
d.Close
|
||||
|
||||
cmd.Initialize
|
||||
|
||||
@@ -21,7 +21,6 @@ End Sub
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
' reqManager.Initialize(Me, "http://keymon.lat:1781")
|
||||
reqManager.Initialize(Me, "http://keymon.net:1781")
|
||||
l_ruta.Initialize("")
|
||||
L_ABORDO.Initialize("")
|
||||
l_porvisitar.Initialize("")
|
||||
@@ -31,14 +30,13 @@ End Sub
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
'load the layout to Root
|
||||
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub envia
|
||||
carga = "SUBIR"
|
||||
enviando = True
|
||||
carga = "SUBIR"
|
||||
almacen = Subs.traeAlmacen
|
||||
l_ruta.TEXT = Subs.traeRuta
|
||||
Dim fecha As String = DateTime.Date(DateTime.Now)
|
||||
@@ -305,127 +303,88 @@ Sub envia
|
||||
' S_CP.Text = "VALIDANDO"
|
||||
' End If
|
||||
' End If
|
||||
T4.Initialize("T4", 3000)
|
||||
T4.Enabled = True
|
||||
' T4.Initialize("T4", 3000)
|
||||
' T4.Enabled = True
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE DURAKELO")
|
||||
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||
LogColor($">>>>>>>>>> Llega ${Job.tag} <<<<<<<<<<"$, Colors.Blue)
|
||||
If reqManager.reqsList.IndexOf(Job.tag) <> -1 Then
|
||||
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(Job.tag))
|
||||
' LogColor($">>>>>> Quitamos ${Job.tag}"$, Colors.Blue)
|
||||
End If
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, 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 Job.Success = False Then
|
||||
LogColor("############################################", Colors.red)
|
||||
LogColor("#### Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
|
||||
LogColor("############################################", Colors.red)
|
||||
|
||||
If Not(Job.Success) Then
|
||||
LogColor("Error en red: " & Job.tag & " : " & Subs.parseHTTPError(Job.ErrorMessage), Colors.Red)
|
||||
Else
|
||||
LogColor("JobDone: '" & reqManager.HandleJob(Job).tag & "' - Registros: " & reqManager.HandleJob(Job).Rows.Size, Colors.Green) 'Mod por CHV - 211027
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||
If reqManager.reqsList.IndexOf(RESULT.tag) <> -1 Then
|
||||
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(RESULT.tag))
|
||||
LogColor($"*** Quitamos ${RESULT.tag}"$, Colors.Magenta)
|
||||
T4.Initialize("T4", 2000)
|
||||
End If
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.red)
|
||||
End If
|
||||
End If
|
||||
' 2. Procesamos validaciones
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "ins_pedido" Then 'query tag
|
||||
' For Each records() As Object In RESULT.Rows
|
||||
' PB2.Progress = PB2.Progress + 5
|
||||
' Next
|
||||
' PB2.Progress = 100
|
||||
' S_CP.Text = "LISTO"
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "valida_pedido" Then 'query tag
|
||||
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"))
|
||||
Log(CUANTOSP)
|
||||
B4XPages.MainPage.l_vProds2.Text = $"${CUANTOSP}/${cuantos_pedido}"$
|
||||
' Mantenemos tu lógica permisiva
|
||||
If cuantos_pedido <= CUANTOSP Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
' S_CP.Text = "INFO OK"
|
||||
ToastMessageShow("INFO OK", False)
|
||||
Else
|
||||
' S_CP.Text = "ENVIAR DATOS (K-2)"
|
||||
ToastMessageShow($"No se cargo bien la info de pedido.${CRLF}Envíe nuevamente: "$ & CUANTOSP & "/" & cuantos_pedido, True)
|
||||
ToastMessageShow("ENVIAR DATOS (K-2)", True)
|
||||
Log("No se cargo bien la info de pedido. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido)
|
||||
LogColor("Faltan pedidos. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido, Colors.Red)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "valida_pedidoc" Then 'query tag
|
||||
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}"$
|
||||
If cuantos_pedidosc = CUANTOSC Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
Else
|
||||
ToastMessageShow($"No se cargo bien la info de pedido_cliente.${CRLF}Envíe nuevamente: "$ & CUANTOSC & "/" & cuantos_pedidosc, True)
|
||||
Log("No se cargo bien la info de pedido_cliente. Envíe nuevamente: " & CUANTOSC & "/" & cuantos_pedidosc)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "valida_noventa" Then 'query tag
|
||||
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}"$
|
||||
If cuantos_noventa = CUANTOSN Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
Else
|
||||
ToastMessageShow($"No se cargo bien la info de NoVenta.${CRLF}Envíe nuevamente: "$ & CUANTOSN & "/" & cuantos_noventa, True)
|
||||
Log("No se cargo bien la info de NoVenta. Envíe nuevamente:" & CUANTOSN & "/" & cuantos_noventa)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
If reqManager.reqsList.size = 0 Then T4.Enabled = True Else T4.Enabled = False
|
||||
Job.Release
|
||||
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
|
||||
validando = True
|
||||
almacen = Subs.traeAlmacen
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
d.Position = 0
|
||||
cuantos_pedido = d.GetString("CUANTOS_PEDIDO")
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE ")
|
||||
d.Position = 0
|
||||
cuantos_pedidosc = d.GetString("CUANTOS_PEDIDOSC")
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
d.Position = 0
|
||||
cuantos_noventa = d.GetString("CUANTOS_NOVENTA")
|
||||
d.Close
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
' d.Position = 0
|
||||
' cuantos_pedido = d.GetString("CUANTOS_PEDIDO")
|
||||
'
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE ")
|
||||
' d.Position = 0
|
||||
' cuantos_pedidosc = d.GetString("CUANTOS_PEDIDOSC")
|
||||
'
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
' d.Position = 0
|
||||
' cuantos_noventa = d.GetString("CUANTOS_NOVENTA")
|
||||
' d.Close
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cuantos_pedido_DUR"
|
||||
@@ -442,7 +401,7 @@ Sub valida
|
||||
cmd.Name = "select_cuantos_pedidoc_DUR"
|
||||
cmd.Parameters = Array As Object(almacen, Subs.traeRuta)
|
||||
reqManager.ExecuteQuery(cmd , 0, "valida_pedidoc")
|
||||
Log("http://keymon.net:1781")
|
||||
' Log("http://keymon.net:1781")
|
||||
|
||||
B4XPages.MainPage.l_vPedidos2.Text = ""
|
||||
B4XPages.MainPage.l_vProds2.Text = ""
|
||||
|
||||
@@ -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
|
||||
@@ -12,16 +12,19 @@ Sub Class_Globals
|
||||
Dim usuario, almacen As String
|
||||
Dim datos_iguales, almacen, carga, paso, conteo, porcentaje, perfil, cuantos, NUMERO_PEDIDO, usuario, cuantos_exib, cuantos_pedidosc, cuantos_noventa, cuantos_ped, cuantos_pedido As String
|
||||
Dim l_ruta As Label
|
||||
Dim enviando As Boolean = False
|
||||
Dim validando As Boolean = False
|
||||
End Sub
|
||||
|
||||
'Initializes the object. You can add parameters to this method if needed.
|
||||
Public Sub Initialize
|
||||
reqManager.Initialize(Me, "http://keymon.net:1782")
|
||||
' reqManager.Initialize(Me, "http://keymon.net:1782")
|
||||
l_ruta.Initialize("l")
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
' NOVENTA
|
||||
l_ruta.text = Subs.traeRuta
|
||||
c = B4XPages.MainPage.skmt.ExecQuery("SELECT NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON, NV_FOTO,NV_FOTO2, NV_REPROGRAMAR FROM NOVENTA")
|
||||
@@ -238,3 +241,71 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
|
||||
reqManager.Initialize(Me, ServidorURL)
|
||||
envia ' Llama a la función de envío original de C_Intmex
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
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
|
||||
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
|
||||
86
B4A/C_ImportaBD.bas
Normal file
86
B4A/C_ImportaBD.bas
Normal file
@@ -0,0 +1,86 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
' ====================================================================================
|
||||
' CLASE: C_ImportaBD
|
||||
' DESCRIPCION: Gestor aislado para atrapar Intents (ej. compartir desde WhatsApp)
|
||||
' y poner la BD en la ruta interna de la app como "kmt.db".
|
||||
' ====================================================================================
|
||||
' INSTRUCCIONES (En cualquier B4XPage, usualmente B4XMainPage):
|
||||
'
|
||||
' 1. En Class_Globals se declara la instancia:
|
||||
' Private importador As C_ImportaBD
|
||||
'
|
||||
' 2. En B4XPage_Created se inicializa la clase:
|
||||
' importador.Initialize
|
||||
'
|
||||
' 3. En B4XPage_Appear se captura el Intent padre y se procesa:
|
||||
' Dim in As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent
|
||||
'
|
||||
' If importador.ProcesarIntent(in) Then
|
||||
' ' Si entra aquí, la BD ya se copió exitosamente a File.DirInternal con el nombre "kmt.db"
|
||||
' ToastMessageShow("BD importada correctamente", False)
|
||||
'
|
||||
' ' (Opcional) Identificar si el origen fue WhatsApp:
|
||||
' If importador.EsDeWhatsapp(in) Then
|
||||
' B4XPages.SetTitle(Me, "BD cargada desde Whatsapp")
|
||||
' End If
|
||||
'
|
||||
' ' --> AQUI DEBES REINICIALIZAR TU CONEXION SQL <--
|
||||
' ' Ej: skmt.Initialize(File.DirInternal, "kmt.db", True)
|
||||
' End If
|
||||
|
||||
' 4. Agregar esta sccion al manifiesto de la aplicacion
|
||||
' 'Para que se registre para abrir bases de datos
|
||||
' AddActivityText(Main,
|
||||
' <intent-filter>
|
||||
' <action android:name="android.intent.action.VIEW" />
|
||||
' <category android:name="android.intent.category.DEFAULT" />
|
||||
' <data android:pathPattern=".*\\.db" />
|
||||
' <data android:mimeType="*/*" />
|
||||
' </intent-filter>)
|
||||
' ====================================================================================
|
||||
|
||||
Sub Class_Globals
|
||||
Private intentUsado As Boolean = False
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
intentUsado = False
|
||||
End Sub
|
||||
|
||||
' Procesa el intent. Retorna True si efectivamente copió una base de datos.
|
||||
Public Sub ProcesarIntent(in As Intent) As Boolean
|
||||
If intentUsado Or in = Null Then Return False
|
||||
If Not(in.IsInitialized) Then Return False
|
||||
|
||||
intentUsado = True ' Sellamos para que no vuelva a procesar el mismo intent
|
||||
|
||||
If in.GetData <> Null Then
|
||||
Dim XmlData As String = in.GetData
|
||||
Log("Intent recibido: " & XmlData)
|
||||
Try
|
||||
Dim OutStr As OutputStream = File.OpenOutput(File.DirInternal, "kmt.db", False)
|
||||
Dim InStr As InputStream = File.OpenInput("ContentDir", XmlData)
|
||||
File.Copy2(InStr, OutStr)
|
||||
OutStr.Close
|
||||
LogColor("BD copiada a interna.", Colors.Blue)
|
||||
Return True
|
||||
Catch
|
||||
Log("Error al copiar BD desde Intent: " & LastException)
|
||||
Return False
|
||||
End Try
|
||||
End If
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
' Método auxiliar para revisar el origen
|
||||
Public Sub EsDeWhatsapp(in As Intent) As Boolean
|
||||
If in <> Null And in.IsInitialized Then
|
||||
If in.As(String).Contains("whatsapp") Then Return True
|
||||
End If
|
||||
Return False
|
||||
End Sub
|
||||
156
B4A/C_Intmex.bas
156
B4A/C_Intmex.bas
@@ -203,155 +203,83 @@ Sub envia
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE INTMEX")
|
||||
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)
|
||||
End If
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, 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 Job.Success = False Then
|
||||
Log("ERROR")
|
||||
LogColor("Error: " & reqManager.HandleJob(Job).tag & " : " & Job.ErrorMessage, Colors.red)
|
||||
' Job.Release
|
||||
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
|
||||
'Verificamos que el usuario guardado en BD sea VALIDO.
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "update_gps" Then
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Log("==========================REGISTROS="&RESULT.Rows)
|
||||
For Each k As String In RESULT.Columns.Keys
|
||||
Log(RESULT.Tag & ": " & k & ": " & records(RESULT.Columns.Get(k)))
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
If RESULT.Tag = "ins_pedidos" Then
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Log("==========================REGISTROS="&RESULT.Rows)
|
||||
For Each k As String In RESULT.Columns.Keys
|
||||
Log(RESULT.Tag & ": " & k & ": " & records(RESULT.Columns.Get(k)))
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
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
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "valida_pedido" Then 'query tag
|
||||
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"))
|
||||
Log(CUANTOSP)
|
||||
B4XPages.MainPage.l_vProds2.Text = $"${CUANTOSP}/${cuantos_pedido}"$
|
||||
' Mantenemos tu lógica permisiva
|
||||
If cuantos_pedido <= CUANTOSP Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
' S_CP.Text = "INFO OK"
|
||||
ToastMessageShow("INFO OK", False)
|
||||
Else
|
||||
' S_CP.Text = "ENVIAR DATOS (K-2)"
|
||||
ToastMessageShow($"No se cargo bien la info de pedido.${CRLF}Envíe nuevamente: "$ & CUANTOSP & "/" & cuantos_pedido, True)
|
||||
ToastMessageShow("ENVIAR DATOS (K-2)", True)
|
||||
Log("No se cargo bien la info de pedido. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido)
|
||||
LogColor("Faltan pedidos. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido, Colors.Red)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "valida_pedidoc" Then 'query tag
|
||||
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}"$
|
||||
If cuantos_pedidosc = CUANTOSC Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
Else
|
||||
ToastMessageShow($"No se cargo bien la info de pedido_cliente.${CRLF}Envíe nuevamente: "$ & CUANTOSC & "/" & cuantos_pedidosc, True)
|
||||
Log("No se cargo bien la info de pedido_cliente. Envíe nuevamente: " & CUANTOSC & "/" & cuantos_pedidosc)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "valida_noventa" Then 'query tag
|
||||
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}"$
|
||||
If cuantos_noventa = CUANTOSN Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
Else
|
||||
ToastMessageShow($"No se cargo bien la info de NoVenta.${CRLF}Envíe nuevamente: "$ & CUANTOSN & "/" & cuantos_noventa, True)
|
||||
Log("No se cargo bien la info de NoVenta. Envíe nuevamente:" & CUANTOSN & "/" & cuantos_noventa)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "ins_pedido" Then 'query tag
|
||||
For Each records() As Object In RESULT.Rows
|
||||
' PB2.Progress = PB2.Progress + 5
|
||||
' S_CP.Text = "SUBIENDO"
|
||||
Next
|
||||
' PB2.Progress = 100
|
||||
Log("PROGRESO 100")
|
||||
' S_CP.Text = "REVISANDO ..."
|
||||
ToastMessageShow("REVISANDO", False)
|
||||
Log("REVISANDO")
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "ins_cuestionario" Then 'query tag
|
||||
Subs.logJobDoneResultados(RESULT)
|
||||
End If
|
||||
End If
|
||||
If reqManager.reqsList.size = 0 Then ' Si ya no hay consultas pendientes ...
|
||||
|
||||
Job.Release
|
||||
|
||||
' 3. Control de flujo seguro
|
||||
If reqManager.reqsList.size = 0 Then
|
||||
B4XPages.MainPage.p_progressDialog.Visible = False
|
||||
If enviando Then ' Si terminamos de enviar pedido ...
|
||||
Sleep(200)
|
||||
B4XPages.MainPage.l_progressDialog.Text = "Validando " ' Mostramos el panel de progreso.
|
||||
B4XPages.MainPage.p_progressDialog.Visible = True
|
||||
valida ' Iniciamos la validación
|
||||
If enviando Then
|
||||
enviando = False
|
||||
End If
|
||||
If validando Then
|
||||
B4XPages.MainPage.l_progressDialog.Text = "Validando "
|
||||
B4XPages.MainPage.p_progressDialog.Visible = True
|
||||
Sleep(200)
|
||||
valida
|
||||
Else If validando Then
|
||||
validando = False
|
||||
Sleep(300)
|
||||
'Mostramos el panel de Validación.
|
||||
B4XPages.MainPage.p_validacion.Visible = True
|
||||
End If
|
||||
End If
|
||||
Job.Release
|
||||
End Sub
|
||||
|
||||
Sub valida
|
||||
validando = True
|
||||
almacen = Subs.traeAlmacen
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
d.Position = 0
|
||||
cuantos_pedido = d.GetString("CUANTOS_PEDIDO")
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE ")
|
||||
d.Position = 0
|
||||
cuantos_pedidosc = d.GetString("CUANTOS_PEDIDOSC")
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
d.Position = 0
|
||||
cuantos_noventa = d.GetString("CUANTOS_NOVENTA")
|
||||
d.Close
|
||||
' almacen = Subs.traeAlmacen
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
' d.Position = 0
|
||||
' cuantos_pedido = d.GetString("CUANTOS_PEDIDO")
|
||||
'
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE ")
|
||||
' d.Position = 0
|
||||
' cuantos_pedidosc = d.GetString("CUANTOS_PEDIDOSC")
|
||||
'
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
' d.Position = 0
|
||||
' cuantos_noventa = d.GetString("CUANTOS_NOVENTA")
|
||||
' d.Close
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cuantos_pedido_INTMEX"
|
||||
@@ -368,7 +296,7 @@ Sub valida
|
||||
cmd.Name = "select_cuantos_pedidoc_INTMEX"
|
||||
cmd.Parameters = Array As Object(almacen, Subs.traeRuta)
|
||||
reqManager.ExecuteQuery(cmd , 0, "valida_pedidoc")
|
||||
Log("http://keymon.net:1781")
|
||||
' Log("http://keymon.net:1781")
|
||||
|
||||
B4XPages.MainPage.l_vPedidos2.Text = ""
|
||||
B4XPages.MainPage.l_vProds2.Text = ""
|
||||
|
||||
@@ -10,15 +10,19 @@ Sub Class_Globals
|
||||
Dim b, c, d, f As Cursor
|
||||
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 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.
|
||||
Public Sub Initialize
|
||||
reqManager.Initialize(Me, "http://keymon.net:1781")
|
||||
' reqManager.Initialize(Me, "http://keymon.net:1781")
|
||||
l_ruta.Initialize("l")
|
||||
End Sub
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
almacen = Subs.traeAlmacen
|
||||
Dim foto1() As Byte
|
||||
' NOVENTA
|
||||
@@ -232,21 +236,69 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE INTMEX REPARTO")
|
||||
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
|
||||
@@ -11,6 +11,8 @@ Sub Class_Globals
|
||||
Dim cmd As DBCommand
|
||||
Dim b, c, d As Cursor
|
||||
Dim usuario, almacen As String
|
||||
Dim enviando As Boolean = False
|
||||
Dim validando As Boolean = False
|
||||
Dim datos_iguales, almacen, carga, paso, conteo, porcentaje, perfil, cuantos, NUMERO_PEDIDO, usuario, cuantos_exib, cuantos_pedidosc, cuantos_noventa, cuantos_ped, cuantos_pedido As String
|
||||
End Sub
|
||||
|
||||
@@ -21,6 +23,7 @@ Public Sub Initialize
|
||||
End Sub
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
' carga = "SUBIR"
|
||||
' p_mandaInfo.Width = Root.Width
|
||||
' p_mandaInfo.Height = Root.Height
|
||||
@@ -209,7 +212,7 @@ Sub envia
|
||||
|
||||
' PEDIDO
|
||||
c = B4XPages.MainPage.skmt.ExecQuery("SELECT PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO, PE_COSTO_SIN, PE_RUTA, PE_DESC, PE_FOLIO, PE_CANTC, PE_BCAJAS FROM PEDIDO WHERE PE_FOLIO <> 'RECARGA'")
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO WHERE PE_FOLIO <> 'RECARGA'")
|
||||
If c.RowCount > 0 Then
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
@@ -423,3 +426,66 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
|
||||
reqManager.Initialize(Me, ServidorURL)
|
||||
envia ' Llama a la función de envío original de C_Intmex
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
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
|
||||
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
|
||||
@@ -13,6 +13,9 @@ Sub Class_Globals
|
||||
Dim foto1(), foto2(), foto3(), foto4() As Byte
|
||||
Dim PORCENTAJE, PASO, PERFIL, NUMERO_PEDIDO, l_ruta As String
|
||||
Dim contador_env, contador_strem, reqTotales As Int
|
||||
Dim enviando As Boolean = False
|
||||
Dim validando As Boolean = False
|
||||
Dim datos_iguales As String
|
||||
End Sub
|
||||
|
||||
' Initializes the object.
|
||||
@@ -37,13 +40,14 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
|
||||
reqTotales = reqManager.reqsList.Size
|
||||
If reqTotales > 0 Then
|
||||
Dim t1 As Timer
|
||||
t1.Initialize("T1", 20000)
|
||||
t1.Enabled = True
|
||||
' t1.Initialize("T1", 20000)
|
||||
' t1.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' **FUNCIÓN ESTANDARIZADA:** Ejecuta la subida de datos (equivalente a Subir_Click -> SUBIR_INFO_PEDIDO)
|
||||
Public Sub envia
|
||||
enviando = True
|
||||
' 1. Limpieza y preparación inicial (lógica de Subir_Click)
|
||||
SUBIR_INFO_PREPARACION
|
||||
|
||||
@@ -291,88 +295,73 @@ Private Sub enviaPedido(filtro As String)
|
||||
End If
|
||||
|
||||
reqManager.ExecuteCommand(cmd , $"ins_pedido_${cPed.GetString("PE_CLIENTE")}"$)
|
||||
contador_env = contador_env + 1
|
||||
Next
|
||||
cPed.Close
|
||||
End If
|
||||
contador_env = contador_env + 1
|
||||
Next
|
||||
cPed.Close
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' El callback se maneja aquí, ya que 'Me' fue C_Kelloggs en la inicialización del reqManager
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE KELLOGGS")
|
||||
' Lógica para manejar errores y remover de reqsList
|
||||
' reqManager.trackNext(Job)
|
||||
Log("JOBDONE - " & almacen)
|
||||
|
||||
If Not(Job.Success) Then
|
||||
LogColor("Error: " & Job.tag & " : " & Subs.parseHTTPError(Job.ErrorMessage), Colors.red)
|
||||
Else ' Si Job.Success es True
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
' 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
|
||||
|
||||
LogColor("JobDone: '" & RESULT.tag & "' - Registros: " & RESULT.Rows.Size, Colors.Green)
|
||||
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 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
|
||||
End If
|
||||
|
||||
' Manejo de comandos de INSERCIÓN (Actualización de estados en DB local)
|
||||
If RESULT.Tag.As(String).StartsWith("ins_pedido_") Then ' Procesa insert_pedido_KELL
|
||||
Private temp() As String = Regex.Split("_", RESULT.Tag)
|
||||
If temp.Length > 1 Then
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update pedido set pe_enviado = 1 where pe_cliente = '${temp(2)}'"$)
|
||||
End If
|
||||
Job.Release
|
||||
|
||||
Else If RESULT.Tag.As(String).StartsWith("ins_pedidos_") Then ' Procesa insert_pedidos_KELL (Cabeceras)
|
||||
Private temp() As String = Regex.Split("_", RESULT.Tag)
|
||||
If temp.Length > 1 Then
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update pedido_cliente set pc_enviado = 1 where pc_cliente = '${temp(2)}'"$)
|
||||
End If
|
||||
|
||||
Else If RESULT.Tag = "valida_pedido" Then ' Procesa select_cuantos_pedido_KELL
|
||||
' Lógica de validación de pedidos (productos)
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Dim CUANTOSP As Int = records(RESULT.Columns.Get("CUANTOSP"))
|
||||
If cuantos_pedido <= CUANTOSP Then
|
||||
Log($"Validación Pedidos OK: ${CUANTOSP}/${cuantos_pedido}"$)
|
||||
Else
|
||||
LogColor($"Validación Pedidos FALLÓ: ${CUANTOSP}/${cuantos_pedido}. Se requiere reenvío."$, Colors.Red)
|
||||
End If
|
||||
Next
|
||||
|
||||
Else If RESULT.Tag = "valida_pedidoc" Then ' Procesa select_cuantos_pedidoc_KELL
|
||||
' Lógica de validación de pedidos cliente (cabeceras)
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Dim CUANTOSC As Int = records(RESULT.Columns.Get("CUANTOSC"))
|
||||
If cuantos_pedidosc = CUANTOSC Then
|
||||
Log($"Validación Pedidos Cliente OK: ${CUANTOSC}/${cuantos_pedidosc}"$)
|
||||
Else
|
||||
LogColor($"Validación Pedidos Cliente FALLÓ: ${CUANTOSC}/${cuantos_pedidosc}. Se requiere reenvío."$, Colors.Red)
|
||||
End If
|
||||
Next
|
||||
|
||||
Else If RESULT.Tag = "valida_noventa" Then ' Procesa select_cuantos_noventa_KELL
|
||||
' Lógica de validación de no venta
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Dim CUANTOSN As Int = records(RESULT.Columns.Get("CUANTOSN"))
|
||||
If cuantos_noventa = CUANTOSN Then
|
||||
Log($"Validación NoVenta OK: ${CUANTOSN}/${cuantos_noventa}"$)
|
||||
Else
|
||||
LogColor($"Validación NoVenta FALLÓ: ${CUANTOSN}/${cuantos_noventa}. Se requiere reenvío."$, Colors.Red)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Job.Release
|
||||
|
||||
' Lógica de finalización: Inicia la validación al terminar todos los envíos
|
||||
If reqManager.reqsList.Size = 0 Then
|
||||
If PASO = "1" Then ' Si terminamos la fase de envío
|
||||
PASO = "2"
|
||||
Dim t1 As Timer
|
||||
t1.Initialize("T1", 2000)
|
||||
t1.Enabled = True
|
||||
Log("Envío finalizado. Se inicia TIMER T1 para validación.")
|
||||
End If
|
||||
End If
|
||||
' 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
|
||||
|
||||
' Lógica de validación forzada (simula T1_Tick)
|
||||
|
||||
@@ -22,12 +22,11 @@ End Sub
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
' reqManager.Initialize(Me, "http://keymon.lat:1781")
|
||||
reqManager.Initialize(Me, "http://keymon.net:1781")
|
||||
l_ruta.Initialize("")
|
||||
L_ABORDO.Initialize("")
|
||||
l_porvisitar.Initialize("")
|
||||
T4.Initialize("T4", 3000)
|
||||
T4.Enabled = False
|
||||
' T4.Initialize("T4", 3000)
|
||||
' T4.Enabled = False
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
@@ -40,6 +39,7 @@ End Sub
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
carga = "SUBIR"
|
||||
almacen = Subs.traeAlmacen
|
||||
l_ruta.TEXT = Subs.traeRuta
|
||||
@@ -324,185 +324,115 @@ Sub envia
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
T4.Initialize("T4", 3000)
|
||||
T4.Enabled = True
|
||||
' T4.Initialize("T4", 3000)
|
||||
' T4.Enabled = True
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE MARQUEZ")
|
||||
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||
LogColor($">>>>>>>>>> Llega ${Job.tag} <<<<<<<<<<"$, Colors.Blue)
|
||||
If reqManager.reqsList.IndexOf(Job.tag) <> -1 Then
|
||||
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(Job.tag))
|
||||
' LogColor($">>>>>> Quitamos ${Job.tag}"$, Colors.Blue)
|
||||
End If
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.Blue)
|
||||
End If
|
||||
If Job.Success = False Then
|
||||
LogColor("############################################", Colors.red)
|
||||
LogColor("#### Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
|
||||
LogColor("############################################", Colors.red)
|
||||
Else
|
||||
' Log(3)
|
||||
LogColor("JobDone: '" & reqManager.HandleJob(Job).tag & "' - Registros: " & reqManager.HandleJob(Job).Rows.Size, Colors.RGB(0,160,0)) 'Mod por CHV - 211027
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||
If reqManager.reqsList.IndexOf(RESULT.tag) <> -1 Then
|
||||
reqManager.reqsList.RemoveAt(reqManager.reqsList.IndexOf(RESULT.tag))
|
||||
LogColor($"*** Quitamos ${RESULT.tag}"$, Colors.Magenta)
|
||||
T4.Initialize("T4", 2000)
|
||||
End If
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.red)
|
||||
End If
|
||||
End If
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "ins_pedidos" Then
|
||||
For Each records() As Object In RESULT.Rows
|
||||
' Log("==========================REGISTROS="&RESULT.Rows)
|
||||
For Each k As String In RESULT.Columns.Keys
|
||||
Log(RESULT.Tag & ": " & k & ": " & records(RESULT.Columns.Get(k)))
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
Dim resultado As DBResult = reqManager.HandleJob(Job)
|
||||
If resultado.Tag = "piezas" Then 'query tag
|
||||
' B4XPages.MainPage.picking.cl_picking.Clear
|
||||
Dim piezasexiste As Int
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
For Each records() As Object In resultado.Rows
|
||||
piezasexiste = records(resultado.Columns.Get("COUNT(*)"))
|
||||
Log(piezasexiste)
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
DateTime.TimeFormat = "HH:mm:ss"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
If piezasexiste = 0 Then
|
||||
Dim PCNoArts As String
|
||||
Dim PCMonto As String
|
||||
c = B4XPages.MainPage.skmt.ExecQuery2("SELECT * FROM PEDIDO_CLIENTE WHERE PC_CLIENTE = ? AND PC_CLIENTE <> 1", Array As String(userpiezas))
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
PCNoArts = c.GetString("PC_NOART")
|
||||
PCMonto = c.GetString("PC_MONTO")
|
||||
End If
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "insert_HVC_MARQUEZ"
|
||||
cmd.Parameters = Array As Object((sDate & " " & sTime), userpiezas, PCNoArts, PCMonto, almacen, l_ruta.Text)
|
||||
reqManager.ExecuteCommand(cmd , "insert_hvc")
|
||||
' reqManager.ExecuteCommand(cmd , $"ins_abonosPendientes_${ab.GetString("a_cliente")}"$)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Log("JOBDONE - " & almacen)
|
||||
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
' If RESULT.Tag = "valida_pedido" Then 'query tag
|
||||
' For Each records() As Object In RESULT.Rows
|
||||
' Dim CUANTOSP As Int = records(RESULT.Columns.Get("CUANTOSP"))
|
||||
' If cuantos_pedido <= CUANTOSP Then
|
||||
' ' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
' datos_iguales = "ok"
|
||||
' ToastMessageShow("INFO OK", False)
|
||||
' Else
|
||||
'' If Starter.marcaCel <> "Sony" Then ToastMessageShow("No se cargo bien la info P. Sync Nuevamente" & CUANTOSP & " " & cuantos_pedido, True)
|
||||
' ToastMessageShow("ENVIAR DATOS (K-2)", False)
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
If RESULT.Tag = "valida_pedido" Then 'query tag
|
||||
' 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"))
|
||||
Log(CUANTOSP)
|
||||
B4XPages.MainPage.l_vProds2.Text = $"${CUANTOSP}/${cuantos_pedido}"$
|
||||
' Mantenemos tu lógica permisiva
|
||||
If cuantos_pedido <= CUANTOSP Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
' S_CP.Text = "INFO OK"
|
||||
ToastMessageShow("INFO OK", False)
|
||||
Else
|
||||
' S_CP.Text = "ENVIAR DATOS (K-2)"
|
||||
ToastMessageShow($"No se cargo bien la info de pedido.${CRLF}Envíe nuevamente: "$ & CUANTOSP & "/" & cuantos_pedido, True)
|
||||
ToastMessageShow("ENVIAR DATOS (K-2)", True)
|
||||
Log("No se cargo bien la info de pedido. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido)
|
||||
LogColor("Faltan pedidos. Envíe nuevamente: " & CUANTOSP & "/" & cuantos_pedido, Colors.Red)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If RESULT.Tag = "valida_pedidoc" Then 'query tag
|
||||
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}"$
|
||||
If cuantos_pedidosc = CUANTOSC Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
Else
|
||||
ToastMessageShow($"No se cargo bien la info de pedido_cliente.${CRLF}Envíe nuevamente: "$ & CUANTOSC & "/" & cuantos_pedidosc, True)
|
||||
Log("No se cargo bien la info de pedido_cliente. Envíe nuevamente: " & CUANTOSC & "/" & cuantos_pedidosc)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If RESULT.Tag = "valida_noventa" Then 'query tag
|
||||
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}"$
|
||||
If cuantos_noventa = CUANTOSN Then
|
||||
' ToastMessageShow("rojo val ok 1 cuantosp." , True)
|
||||
datos_iguales = "ok"
|
||||
Else
|
||||
ToastMessageShow($"No se cargo bien la info de NoVenta.${CRLF}Envíe nuevamente: "$ & CUANTOSN & "/" & cuantos_noventa, True)
|
||||
Log("No se cargo bien la info de NoVenta. Envíe nuevamente:" & CUANTOSN & "/" & cuantos_noventa)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "ins_pedido" Then 'query tag
|
||||
For Each records() As Object In RESULT.Rows
|
||||
' PB2.Progress = PB2.Progress + 5
|
||||
' S_CP.Text = "SUBIENDO"
|
||||
Next
|
||||
' PB2.Progress = 100
|
||||
' S_CP.Text = "REVISANDO ..."
|
||||
' Log("5")
|
||||
End If
|
||||
|
||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||
If RESULT.Tag = "ins_cuestionario" Then 'query tag
|
||||
Subs.logJobDoneResultados(RESULT)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' Log(reqManager.reqsList.size)
|
||||
If reqManager.reqsList.size = 0 Then
|
||||
T4.Enabled = True
|
||||
Else
|
||||
T4.Enabled = False
|
||||
|
||||
If RESULT.Tag = "piezas" Then 'query tag
|
||||
Dim piezasexiste As Int
|
||||
For Each records() As Object In RESULT.Rows
|
||||
piezasexiste = records(RESULT.Columns.Get("COUNT(*)"))
|
||||
Log(piezasexiste)
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
DateTime.TimeFormat = "HH:mm:ss"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
If piezasexiste = 0 Then
|
||||
Dim PCNoArts As String
|
||||
Dim PCMonto As String
|
||||
c = B4XPages.MainPage.skmt.ExecQuery2("SELECT * FROM PEDIDO_CLIENTE WHERE PC_CLIENTE = ? AND PC_CLIENTE <> 1", Array As String(userpiezas))
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
PCNoArts = c.GetString("PC_NOART")
|
||||
PCMonto = c.GetString("PC_MONTO")
|
||||
End If
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "insert_HVC_MARQUEZ"
|
||||
cmd.Parameters = Array As Object((sDate & " " & sTime), userpiezas, PCNoArts, PCMonto, almacen, l_ruta.Text)
|
||||
reqManager.ExecuteCommand(cmd , "insert_hvc")
|
||||
End If
|
||||
Next
|
||||
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
|
||||
validando = True
|
||||
almacen = Subs.traeAlmacen
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
d.Position = 0
|
||||
cuantos_pedido = d.GetString("CUANTOS_PEDIDO")
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE")
|
||||
d.Position = 0
|
||||
cuantos_pedidosc = d.GetString("CUANTOS_PEDIDOSC")
|
||||
|
||||
d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
d.Position = 0
|
||||
cuantos_noventa = d.GetString("CUANTOS_NOVENTA")
|
||||
d.Close
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDO FROM PEDIDO")
|
||||
' d.Position = 0
|
||||
' cuantos_pedido = d.GetString("CUANTOS_PEDIDO")
|
||||
'
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) as CUANTOS_PEDIDOSC FROM PEDIDO_CLIENTE")
|
||||
' d.Position = 0
|
||||
' cuantos_pedidosc = d.GetString("CUANTOS_PEDIDOSC")
|
||||
'
|
||||
' d = B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
' d.Position = 0
|
||||
' cuantos_noventa = d.GetString("CUANTOS_NOVENTA")
|
||||
' d.Close
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cuantos_pedido_MARQUEZ"
|
||||
@@ -518,7 +448,7 @@ Sub valida
|
||||
cmd.Name = "select_cuantos_pedidoc_MARQUEZ"
|
||||
cmd.Parameters = Array As Object(almacen,l_ruta.text)
|
||||
reqManager.ExecuteQuery(cmd , 0, "valida_pedidoc")
|
||||
Log("http://keymon.net:1781")
|
||||
' Log("http://keymon.net:1781")
|
||||
|
||||
B4XPages.MainPage.l_vPedidos2.Text = ""
|
||||
B4XPages.MainPage.l_vProds2.Text = ""
|
||||
|
||||
@@ -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
|
||||
' NOVENTA
|
||||
c = B4XPages.MainPage.skmt.ExecQuery("SELECT NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON, NV_FOTO FROM NOVENTA")
|
||||
D=B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
@@ -215,21 +219,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
|
||||
@@ -11,6 +11,8 @@ Sub Class_Globals
|
||||
Dim cmd As DBCommand
|
||||
Dim c, d As Cursor
|
||||
Dim usuario, almacen As String
|
||||
Dim enviando As Boolean = False
|
||||
Dim validando As Boolean = False
|
||||
Dim datos_iguales, almacen, carga, paso, conteo, porcentaje, perfil, cuantos, NUMERO_PEDIDO, usuario, cuantos_exib, cuantos_pedidosc, cuantos_noventa, cuantos_ped, cuantos_pedido As String
|
||||
End Sub
|
||||
|
||||
@@ -30,6 +32,7 @@ End Sub
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
checaPedido
|
||||
almacen = Subs.traeAlmacen
|
||||
' CARGA = "SUBIR"
|
||||
@@ -322,3 +325,66 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
|
||||
reqManager.Initialize(Me, ServidorURL)
|
||||
envia ' Llama a la función de envío original de C_Intmex
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
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
|
||||
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
|
||||
@@ -15,6 +15,9 @@ Sub Class_Globals
|
||||
Dim totalRegistros As Int = 0
|
||||
Dim totalRegistrosTotales As Int = 0
|
||||
Dim todosRequest As Int = 0
|
||||
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.
|
||||
@@ -23,6 +26,7 @@ Public Sub Initialize
|
||||
End Sub
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
Log("*** Entramos a envia info***")
|
||||
Log("--- Entramos a envia info---")
|
||||
Log("### Entramos a envia info###")
|
||||
@@ -309,21 +313,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
|
||||
@@ -13,6 +13,8 @@ Sub Class_Globals
|
||||
Dim usuario, almacen As String
|
||||
Dim datos_iguales, almacen, carga, paso, conteo, porcentaje, perfil, cuantos, NUMERO_PEDIDO, usuario, cuantos_exib, cuantos_pedidosc, cuantos_noventa, cuantos_ped, cuantos_pedido As String
|
||||
Dim l_ruta As Label
|
||||
Dim enviando As Boolean = False
|
||||
Dim validando As Boolean = False
|
||||
End Sub
|
||||
|
||||
'Initializes the object. You can add parameters to this method if needed.
|
||||
@@ -23,6 +25,7 @@ Public Sub Initialize
|
||||
End Sub
|
||||
|
||||
Sub envia
|
||||
enviando = True
|
||||
l_ruta.text = Subs.traeRuta
|
||||
' carga = "SUBIR"
|
||||
' P1.Visible = True
|
||||
@@ -299,3 +302,66 @@ Public Sub ConfigurarYEnviar(ServidorURL As String)
|
||||
reqManager.Initialize(Me, ServidorURL)
|
||||
envia ' Llama a la función de envío original de C_Intmex
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
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
|
||||
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
|
||||
@@ -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
|
||||
' NOVENTA
|
||||
c = B4XPages.MainPage.skmt.ExecQuery("SELECT NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON, NV_FOTO,NV_FOTO2, NV_REPROGRAMAR FROM NOVENTA")
|
||||
D=B4XPages.MainPage.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
@@ -262,21 +266,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
|
||||
@@ -25,33 +25,34 @@ Library8=randomaccessfile
|
||||
Library9=sql
|
||||
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~AddPermission(android.permission.INTERNET)~\n~AddPermission(android.permission.READ_EXTERNAL_STORAGE)~\n~AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)~\n~SetApplicationAttribute(android:allowBackup, "false")~\n~~\n~'AddActivityText(main,~\n~'<intent-filter>~\n~'<action android:name="android.intent.action.VIEW" />~\n~'<category android:name="android.intent.category.DEFAULT" />~\n~'<data android:mimeType="application/octet-stream" />~\n~'</intent-filter>)~\n~~\n~AddActivityText(main,~\n~<intent-filter>~\n~<action android:name="android.intent.action.VIEW" />~\n~<category android:name="android.intent.category.DEFAULT" />~\n~ <data android:mimeType="application/x-sqlite3" /> <!-- Para bases de datos -->~\n~ <data android:mimeType="application/octet-stream" /> <!-- Para otros archivos binarios -->~\n~ <data android:scheme="content" /> <!-- Filtra URIs tipo content:// -->~\n~</intent-filter>)
|
||||
Module1=B4XMainPage
|
||||
Module10=C_Marquez
|
||||
Module11=C_Marquez_Reparto
|
||||
Module12=C_Mazapa
|
||||
Module13=C_Mazapa_Reparto
|
||||
Module14=C_Profina
|
||||
Module15=C_Profina_Reparto
|
||||
Module16=DBRequestManager
|
||||
Module17=FileHandler
|
||||
Module18=Starter
|
||||
Module19=Subs
|
||||
Module10=C_Kelloggs
|
||||
Module11=C_Marquez
|
||||
Module12=C_Marquez_Reparto
|
||||
Module13=C_Mazapa
|
||||
Module14=C_Mazapa_Reparto
|
||||
Module15=C_Profina
|
||||
Module16=C_Profina_Reparto
|
||||
Module17=DBRequestManager
|
||||
Module18=FileHandler
|
||||
Module19=Starter
|
||||
Module2=C_Durakelo
|
||||
Module20=Subs
|
||||
Module3=C_Durakelo_Reparto
|
||||
Module4=C_Envios
|
||||
Module5=C_Guna_Reparto
|
||||
Module6=C_Intmex
|
||||
Module7=C_Intmex_Reparto
|
||||
Module8=C_Izca
|
||||
Module9=C_Kelloggs
|
||||
Module6=C_ImportaBD
|
||||
Module7=C_Intmex
|
||||
Module8=C_Intmex_Reparto
|
||||
Module9=C_Izca
|
||||
NumberOfFiles=6
|
||||
NumberOfLibraries=11
|
||||
NumberOfModules=19
|
||||
NumberOfModules=20
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: DBCheck
|
||||
#VersionCode: 1
|
||||
#VersionName: 6.03.18
|
||||
#VersionName: 6.03.19
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
|
||||
@@ -11,6 +11,7 @@ ModuleBookmarks17=
|
||||
ModuleBookmarks18=
|
||||
ModuleBookmarks19=
|
||||
ModuleBookmarks2=
|
||||
ModuleBookmarks20=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
@@ -31,6 +32,7 @@ ModuleBreakpoints17=
|
||||
ModuleBreakpoints18=
|
||||
ModuleBreakpoints19=
|
||||
ModuleBreakpoints2=
|
||||
ModuleBreakpoints20=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
@@ -39,25 +41,26 @@ ModuleBreakpoints7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=2,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
|
||||
ModuleClosedNodes10=3,6
|
||||
ModuleClosedNodes11=3
|
||||
ModuleClosedNodes12=4
|
||||
ModuleClosedNodes13=3
|
||||
ModuleClosedNodes1=28,45
|
||||
ModuleClosedNodes10=5,6,7,8
|
||||
ModuleClosedNodes11=3,5,6
|
||||
ModuleClosedNodes12=
|
||||
ModuleClosedNodes13=5,6
|
||||
ModuleClosedNodes14=
|
||||
ModuleClosedNodes15=3
|
||||
ModuleClosedNodes15=4
|
||||
ModuleClosedNodes16=
|
||||
ModuleClosedNodes17=
|
||||
ModuleClosedNodes18=1
|
||||
ModuleClosedNodes19=12,13,14
|
||||
ModuleClosedNodes2=4,6,7
|
||||
ModuleClosedNodes3=3
|
||||
ModuleClosedNodes18=
|
||||
ModuleClosedNodes19=1
|
||||
ModuleClosedNodes2=5,6
|
||||
ModuleClosedNodes20=12,13,14
|
||||
ModuleClosedNodes3=5
|
||||
ModuleClosedNodes4=4,5
|
||||
ModuleClosedNodes5=3
|
||||
ModuleClosedNodes5=5
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=3,4
|
||||
ModuleClosedNodes9=5,6,7,8
|
||||
NavigationStack=B4XMainPage,B4XPage_Created,141,0,Main,Globals,21,0,C_Intmex_Reparto,Class_Globals,0,0,C_Intmex,Initialize,20,0,C_Intmex,envia,30,0,B4XMainPage,B4XPage_Appear,292,6,B4XMainPage,ActualizarEtiquetasReparto,581,6,C_Guna_Reparto,Class_Globals,9,0,C_Marquez,Initialize,17,0,C_Marquez,Class_Globals,10,0,Main,Process_Globals,19,0
|
||||
ModuleClosedNodes7=4,5
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Intmex_Reparto,valida,296,0,C_Izca,envia,19,0,C_Kelloggs,ConfigurarYEnviar,36,0,C_Kelloggs,envia,43,0,C_Marquez_Reparto,valida,279,0,C_Mazapa_Reparto,valida,373,0,C_Profina,JobDone,352,0,C_Profina,envia,21,0,C_Profina_Reparto,valida,326,0,B4XMainPage,valida,1446,0,C_ImportaBD,Class_Globals,30,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,18,6,19,7,10,5
|
||||
VisibleModules=1,19,7,11,2,5,20,13,3,8,6
|
||||
|
||||
Reference in New Issue
Block a user