mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-21 20:09:13 +00:00
- Se agregaron validaciones de conexion al hacer clic en el boton de CONECTAR en la pantalla principal
This commit is contained in:
@@ -290,6 +290,8 @@ End Sub
|
|||||||
|
|
||||||
Sub B4XPage_Appear
|
Sub B4XPage_Appear
|
||||||
' Log(Subs.traeDiaSemana)
|
' Log(Subs.traeDiaSemana)
|
||||||
|
Starter.errorConnDBReq = False
|
||||||
|
connecta.TextColor = Colors.White
|
||||||
StartBluetooth
|
StartBluetooth
|
||||||
' If Not(kh.CheckNotificationAccess) Then
|
' If Not(kh.CheckNotificationAccess) Then
|
||||||
' Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "", "", Null, True)
|
' Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "", "", Null, True)
|
||||||
@@ -879,6 +881,11 @@ Sub JobDone(Job As HttpJob)
|
|||||||
reqManager.trackNext(Job)
|
reqManager.trackNext(Job)
|
||||||
If Not(Job.Success) Then
|
If Not(Job.Success) Then
|
||||||
LogColor("Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
|
LogColor("Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
|
||||||
|
If Job.Tag = "version" Then
|
||||||
|
Starter.errorConnDBReq = True
|
||||||
|
connecta.TextColor = Colors.red
|
||||||
|
ToastMessageShow("Error al conectarse con Keymon, revise su conexión y reintente!", True)
|
||||||
|
End If
|
||||||
If Job.ErrorMessage = "STREAM" Then
|
If Job.ErrorMessage = "STREAM" Then
|
||||||
contador_strem = contador_strem + 1
|
contador_strem = contador_strem + 1
|
||||||
If CARGA = "SUBIR" Then
|
If CARGA = "SUBIR" Then
|
||||||
@@ -1571,6 +1578,7 @@ Sub JobDone(Job As HttpJob)
|
|||||||
If Job.JobName = "DBRequest" Then
|
If Job.JobName = "DBRequest" Then
|
||||||
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
Dim RESULT As DBResult = reqManager.HandleJob(Job)
|
||||||
If RESULT.Tag = "version" Then 'query tag
|
If RESULT.Tag = "version" Then 'query tag
|
||||||
|
connecta.TextColor = Colors.White
|
||||||
For Each records() As Object In RESULT.Rows
|
For Each records() As Object In RESULT.Rows
|
||||||
Starter.skmt.ExecNonQuery("delete from VERSION")
|
Starter.skmt.ExecNonQuery("delete from VERSION")
|
||||||
Dim CAT_VE_VERSION As String = records(RESULT.Columns.Get("CAT_VE_VERSION"))
|
Dim CAT_VE_VERSION As String = records(RESULT.Columns.Get("CAT_VE_VERSION"))
|
||||||
@@ -1984,7 +1992,13 @@ Sub Activity_KeyPress (key As Int) As Boolean
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub connecta_Click
|
Sub connecta_Click
|
||||||
|
' wait for (kh.ping) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
||||||
|
If Not(IsConnectedToInternet) Then
|
||||||
|
connecta.TextColor = Colors.Red
|
||||||
|
ToastMessageShow("No hay conexión a internet, por favor establecer una conexión y reintentar!!", True)
|
||||||
|
Else
|
||||||
|
connecta.TextColor = Colors.White
|
||||||
|
End If
|
||||||
' Log("################# PERMISOS BT: " & Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
' Log("################# PERMISOS BT: " & Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
||||||
' Log("Permisos BT: " & Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
' Log("Permisos BT: " & Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
||||||
' Log("REVISAMOS PERMISOS DE BT")
|
' Log("REVISAMOS PERMISOS DE BT")
|
||||||
@@ -2043,6 +2057,24 @@ Sub connecta_Click
|
|||||||
' End If
|
' End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub connecta_LongClick
|
||||||
|
Private h As ResultSet = Starter.skmt.ExecQuery($"select * from bitacoraGPS"$)
|
||||||
|
Do While h.nextrow
|
||||||
|
cmd.Initialize
|
||||||
|
cmd.Name = "mandaBitacora"
|
||||||
|
' TMP_ALMACEN, TMP_USUARIO, TMP_RUTA, TMP_EVENTO, TMP_ID_CLIENTE, TMP_NOMBRE_CLIENTE, TMP_INICIO, TMP_FINAL, TMP_LATITUD, TMP_LONGITUD, TMP_PRESICION, TMP_MOTIVO_NO_VENTA, TMP_MOTIVO_NO_VISITA, TMP_FECHA_SINC
|
||||||
|
cmd.Parameters = Array As Object(h.GetString("almacenb"), h.GetString("usuariob"), h.GetString("rutab"), h.GetString("eventob"), h.GetString("clienteb"), h.GetString("clienteb"), h.GetString("iniciob"), h.GetString("finb"), h.GetString("latitudb"), h.GetString("longitudb"), h.GetString("precision"), h.GetString("motivonoventa"), h.GetString("motivonovisita"))
|
||||||
|
reqManager.ExecuteCommand(cmd , "mandaBitacora")
|
||||||
|
' cmd.Name = "borraBitacora"
|
||||||
|
' cmd.Parameters = Array As Object(c.GetString("almacenb"), c.GetString("rutab"), c.GetString("usuariob"), c.GetString("almacenb"))
|
||||||
|
Loop
|
||||||
|
' End If
|
||||||
|
Log("MANDAMOS BITACORA")
|
||||||
|
' Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario,ALMACEN,l_ruta.Text,"Carga día", "",Subs.fechanormal(DateTime.Now),Subs.fechanormal(DateTime.Now),Starter.lat_gps,Starter.lon_gps,"2","","")
|
||||||
|
' sql.mandaBitacora = insert into KELLOGGS.TMP_GPS_DIARIO (TMP_ALMACEN, TMP_USUARIO, TMP_RUTA, TMP_EVENTO, TMP_ID_CLIENTE, TMP_NOMBRE_CLIENTE, TMP_INICIO, TMP_FINAL, TMP_LATITUD, _
|
||||||
|
' TMP_LONGITUD, TMP_PRESICION, TMP_MOTIVO_NO_VENTA, TMP_MOTIVO_NO_VISITA, TMP_FECHA_SINC) values ((?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),sysdate)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Sub BUSCA_Click
|
Sub BUSCA_Click
|
||||||
Subs.iniciaActividad("TicketsDia")
|
Subs.iniciaActividad("TicketsDia")
|
||||||
End Sub
|
End Sub
|
||||||
@@ -3322,24 +3354,6 @@ Sub GetBA As Object
|
|||||||
Return jo.RunMethod("getBA", Null)
|
Return jo.RunMethod("getBA", Null)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub connecta_LongClick
|
|
||||||
Private h As ResultSet = Starter.skmt.ExecQuery($"select * from bitacoraGPS"$)
|
|
||||||
Do While h.nextrow
|
|
||||||
cmd.Initialize
|
|
||||||
cmd.Name = "mandaBitacora"
|
|
||||||
' TMP_ALMACEN, TMP_USUARIO, TMP_RUTA, TMP_EVENTO, TMP_ID_CLIENTE, TMP_NOMBRE_CLIENTE, TMP_INICIO, TMP_FINAL, TMP_LATITUD, TMP_LONGITUD, TMP_PRESICION, TMP_MOTIVO_NO_VENTA, TMP_MOTIVO_NO_VISITA, TMP_FECHA_SINC
|
|
||||||
cmd.Parameters = Array As Object(h.GetString("almacenb"), h.GetString("usuariob"), h.GetString("rutab"), h.GetString("eventob"), h.GetString("clienteb"), h.GetString("clienteb"), h.GetString("iniciob"), h.GetString("finb"), h.GetString("latitudb"), h.GetString("longitudb"), h.GetString("precision"), h.GetString("motivonoventa"), h.GetString("motivonovisita"))
|
|
||||||
reqManager.ExecuteCommand(cmd , "mandaBitacora")
|
|
||||||
' cmd.Name = "borraBitacora"
|
|
||||||
' cmd.Parameters = Array As Object(c.GetString("almacenb"), c.GetString("rutab"), c.GetString("usuariob"), c.GetString("almacenb"))
|
|
||||||
Loop
|
|
||||||
' End If
|
|
||||||
Log("MANDAMOS BITACORA")
|
|
||||||
' Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario,ALMACEN,l_ruta.Text,"Carga día", "",Subs.fechanormal(DateTime.Now),Subs.fechanormal(DateTime.Now),Starter.lat_gps,Starter.lon_gps,"2","","")
|
|
||||||
' sql.mandaBitacora = insert into KELLOGGS.TMP_GPS_DIARIO (TMP_ALMACEN, TMP_USUARIO, TMP_RUTA, TMP_EVENTO, TMP_ID_CLIENTE, TMP_NOMBRE_CLIENTE, TMP_INICIO, TMP_FINAL, TMP_LATITUD, _
|
|
||||||
' TMP_LONGITUD, TMP_PRESICION, TMP_MOTIVO_NO_VENTA, TMP_MOTIVO_NO_VISITA, TMP_FECHA_SINC) values ((?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),sysdate)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
'Borramos los clientes nuevosd que no tengan venta.
|
'Borramos los clientes nuevosd que no tengan venta.
|
||||||
Sub borraClientesNuevosSinVenta 'ignore
|
Sub borraClientesNuevosSinVenta 'ignore
|
||||||
Private x As Cursor = Starter.skmt.ExecQuery("Select CAT_CL_CODIGO from kmt_info where CAT_CL_CODIGO like 'N%' and CAT_CL_CODIGO not in (Select pe_cliente from pedido)")
|
Private x As Cursor = Starter.skmt.ExecQuery("Select CAT_CL_CODIGO from kmt_info where CAT_CL_CODIGO like 'N%' and CAT_CL_CODIGO not in (Select pe_cliente from pedido)")
|
||||||
@@ -3367,3 +3381,14 @@ End Sub
|
|||||||
Private Sub p_resumenAcumulado_Click
|
Private Sub p_resumenAcumulado_Click
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub IsConnectedToInternet As Boolean 'ignore
|
||||||
|
Dim r As Reflector
|
||||||
|
r.Target = r.GetContext
|
||||||
|
r.Target = r.RunMethod2("getSystemService", "connectivity", "java.lang.String")
|
||||||
|
r.Target = r.RunMethod("getActiveNetworkInfo")
|
||||||
|
If r.Target <> Null Then
|
||||||
|
Return r.RunMethod("isConnectedOrConnecting")
|
||||||
|
End If
|
||||||
|
Return False
|
||||||
|
End Sub
|
||||||
@@ -47,6 +47,23 @@ Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
|||||||
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'Sends a query request.
|
||||||
|
'Command - Query name and parameters.
|
||||||
|
'Limit - Maximum rows to return or 0 for no limit.
|
||||||
|
'Tag - An object that will be returned in the result.
|
||||||
|
'Timeout - The http request timeout in ms, or 0 if default (30 secs)
|
||||||
|
Public Sub ExecuteQuery3(Command As DBCommand, Limit As Int, Tag As Object, Timeout As Int) 'Mod por CHV, agregué el parametro Timeout - 211229
|
||||||
|
Dim j As HttpJob
|
||||||
|
Dim ms As OutputStream
|
||||||
|
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||||
|
WriteObject(Command.Name, out2)
|
||||||
|
WriteInt(Limit, out2)
|
||||||
|
WriteList(Command.Parameters, out2)
|
||||||
|
out2.Close
|
||||||
|
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
||||||
|
If Timeout <> 0 Then j.GetRequest.Timeout = Timeout
|
||||||
|
End Sub
|
||||||
|
|
||||||
'Executes a batch of (non-select) commands.
|
'Executes a batch of (non-select) commands.
|
||||||
'ListOfCommands - List of the commands that will be executes.
|
'ListOfCommands - List of the commands that will be executes.
|
||||||
'Tag - An object that will be returned in the result.
|
'Tag - An object that will be returned in the result.
|
||||||
|
|||||||
@@ -869,7 +869,7 @@ Version=12.8
|
|||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Kelloggs Venta
|
#ApplicationLabel: Kelloggs Venta
|
||||||
#VersionCode: 3000
|
#VersionCode: 3000
|
||||||
#VersionName: 4.04.15
|
#VersionName: 4.04.22
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
#BridgeLogger:true
|
#BridgeLogger:true
|
||||||
|
|||||||
@@ -88,6 +88,6 @@ ModuleClosedNodes6=
|
|||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=
|
ModuleClosedNodes8=
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=C_Principal,Class_Globals,0,0,C_Principal,cargar_Click,642,0,C_Principal,JobDone,1821,0,C_Principal,connecta_Click,1993,0,C_Principal,trabajar_Click,447,0,C_CheckList,B4XPage_Appear,148,0,C_Cliente,Cuestionario,2125,6,C_Productos,Class_Globals,0,0,C_Productos,cuentaProds,822,1,B4XMainPage,B4XPage_Created,189,0
|
NavigationStack=DBRequestManager,ExecuteQuery,35,0,DBRequestManager,Initialize,24,0,Starter,Process_Globals,49,4,C_Principal,B4XPage_Created,272,0,C_Principal,B4XPage_Appear,287,6,C_Principal,connecta_LongClick,2011,0,kms_helperSubs,traeDescXSku,1059,0,kms_helperSubs,ping,1063,6,C_Principal,connecta_Click,1987,6,C_Principal,JobDone,1592,0,B4XMainPage,Class_Globals,97,0
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=1,27,11,3,12,4,28,2,23,22,17
|
VisibleModules=1,27,11,3,12,4,28,2,23,22,17
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ Sub Process_Globals
|
|||||||
Dim sesion As Map
|
Dim sesion As Map
|
||||||
' dim cp_running as Boolean = false
|
' dim cp_running as Boolean = false
|
||||||
Dim enVenta As Boolean = False
|
Dim enVenta As Boolean = False
|
||||||
|
Dim pingShell As Boolean = False
|
||||||
|
Dim errorConnDBReq As Boolean = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub Service_Create
|
Sub Service_Create
|
||||||
|
|||||||
@@ -1063,3 +1063,32 @@ Sub traeDescXSku(clienteId As String, prodId As String) As String 'ignore
|
|||||||
End If
|
End If
|
||||||
Return desc
|
Return desc
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub ping As ResumableSub
|
||||||
|
Private ph As Phone
|
||||||
|
Wait For (ph.ShellAsync("ping", Array As String("-c 1","-W 5", "8.8.8.8"))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
||||||
|
If Success Then
|
||||||
|
' Log("ExitValue:" & ExitValue)
|
||||||
|
' Log("StdError:" & StdErr)
|
||||||
|
Private res() As String = Regex.Split(",", StdOut)
|
||||||
|
For i = 0 To res.Length - 1
|
||||||
|
If res(i).Contains("1 received") Then
|
||||||
|
If Starter.logger Then LogColor(">>> HAY CONEXION", Colors.Green)
|
||||||
|
Starter.pingShell = True
|
||||||
|
Else If res(i).Contains("0 received") Then
|
||||||
|
If Starter.logger Then LogColor(">>> NO HAY CONEXION", Colors.Red)
|
||||||
|
Starter.pingShell = False
|
||||||
|
End If
|
||||||
|
' Log(res(i))
|
||||||
|
Next
|
||||||
|
' LogColor("StdOut: " & res, Colors.Blue)
|
||||||
|
' If B4XPages.IsInitialized Then B4XPages.MainPage.cb_internet.Checked = Starter.ping
|
||||||
|
If Not(Starter.pingShell) Then
|
||||||
|
If Starter.logger Then Log("Sin conexión a Google!!!")
|
||||||
|
' notiLowReturn("SIN INTERNET ❌", "NO hay conexion a Google.", Monitor.nid)
|
||||||
|
' If B4XPages.IsInitialized Then B4XPages.MainPage.l_status.Text = "NO hay conexión a Google!!"
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Log("Error: " & LastException)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
Reference in New Issue
Block a user