# Conflicts:
#	Durakelo_reparto.b4a
#	Durakelo_reparto.b4a.meta
#	Starter.bas
This commit is contained in:
cvaldes1201
2023-11-06 20:19:17 -06:00
6 changed files with 37 additions and 17 deletions

View File

@@ -4,7 +4,7 @@ ModulesStructureVersion=1
Type=Class Type=Class
Version=6.8 Version=6.8
@EndOfDesignText@ @EndOfDesignText@
'Class module ''Class module
Sub Class_Globals Sub Class_Globals
Private mTarget As Object Private mTarget As Object
Type DBResult (Tag As Object, Columns As Map, Rows As List) Type DBResult (Tag As Object, Columns As Map, Rows As List)
@@ -15,6 +15,8 @@ Sub Class_Globals
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte ,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
Private VERSION As Float = 0.9 Private VERSION As Float = 0.9
Private tempArray(1) As Object Private tempArray(1) As Object
Dim jobTagAnterior As String = "" 'Mod por CHV - 211109
Dim reqsList As List
End Sub End Sub
'Target - The module that handles JobDone (usually Me). 'Target - The module that handles JobDone (usually Me).
@@ -22,6 +24,7 @@ End Sub
Public Sub Initialize (Target As Object, ConnectorLink As String) Public Sub Initialize (Target As Object, ConnectorLink As String)
mTarget = Target mTarget = Target
link = ConnectorLink link = ConnectorLink
reqsList.Initialize
End Sub End Sub
'Sends a query request. 'Sends a query request.
@@ -32,7 +35,8 @@ Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
Dim j As HttpJob Dim j As HttpJob
Dim ms As OutputStream Dim ms As OutputStream
Dim out2 As OutputStream = StartJob(j,ms, Tag) Dim out2 As OutputStream = StartJob(j,ms, Tag)
If reqsList.IsInitialized Then reqsList.Add(Tag)
WriteObject(Command.Name, out2) WriteObject(Command.Name, out2)
WriteInt(Limit, out2) WriteInt(Limit, out2)
WriteList(Command.Parameters, out2) WriteList(Command.Parameters, out2)
@@ -58,6 +62,7 @@ End Sub
'Similar to ExecuteBatch. Sends a single command. 'Similar to ExecuteBatch. Sends a single command.
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object) Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
If reqsList.IsInitialized Then reqsList.Add(Tag)
ExecuteBatch(Array As DBCommand(Command), Tag) ExecuteBatch(Array As DBCommand(Command), Tag)
End Sub End Sub
@@ -112,7 +117,7 @@ Private Sub WriteObject(o As Object, out As OutputStream)
Else If GetType(tempArray(0)) = "[B" Then Else If GetType(tempArray(0)) = "[B" Then
data = o data = o
out.WriteBytes(Array As Byte(T_BLOB), 0, 1) out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
WriteInt(data.Length, out) WriteInt(data.Length, out)
Else 'If o Is String Then (treat all other values as string) Else 'If o Is String Then (treat all other values as string)
out.WriteBytes(Array As Byte(T_STRING), 0, 1) out.WriteBytes(Array As Byte(T_STRING), 0, 1)
data = bc.StringToBytes(o, "UTF8") data = bc.StringToBytes(o, "UTF8")
@@ -185,7 +190,7 @@ End Sub
'Handles the Job result and returns a DBResult. 'Handles the Job result and returns a DBResult.
Public Sub HandleJob(Job As HttpJob) As DBResult Public Sub HandleJob(Job As HttpJob) As DBResult
Dim start As Long = DateTime.Now Dim start As Long = DateTime.Now 'ignore
Dim In As InputStream = Job.GetInputStream Dim In As InputStream = Job.GetInputStream
Dim cs As CompressedStreams Dim cs As CompressedStreams
In = cs.WrapInputStream(In, "gzip") In = cs.WrapInputStream(In, "gzip")
@@ -196,6 +201,8 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
table.Columns.Initialize table.Columns.Initialize
table.rows.Initialize table.rows.Initialize
table.Tag = Job.Tag table.Tag = Job.Tag
If jobTagAnterior <> Job.Tag Then LogColor("HandleJob: '"&Job.Tag&"'", Colors.Blue) 'Mod por CHV - 211109
jobTagAnterior = Job.Tag 'Mod por CHV - 211109
If method = "query" Then If method = "query" Then
Dim numberOfColumns As Int = ReadInt(In) Dim numberOfColumns As Int = ReadInt(In)
For i = 0 To numberOfColumns - 1 For i = 0 To numberOfColumns - 1
@@ -217,7 +224,7 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
Next Next
End If End If
In.Close In.Close
Log("HandleJob: " & (DateTime.Now - start)) ' Log("HandleJob: " & (DateTime.Now - start))'Comentado por CHV - 211112
Return table Return table
End Sub End Sub
'Reads a file and returns the file as a bytes array. 'Reads a file and returns the file as a bytes array.

View File

@@ -42,7 +42,7 @@ ModuleBreakpoints6=
ModuleBreakpoints7= ModuleBreakpoints7=
ModuleBreakpoints8= ModuleBreakpoints8=
ModuleBreakpoints9= ModuleBreakpoints9=
ModuleClosedNodes0=7 ModuleClosedNodes0=
ModuleClosedNodes1= ModuleClosedNodes1=
ModuleClosedNodes10= ModuleClosedNodes10=
ModuleClosedNodes11= ModuleClosedNodes11=
@@ -51,7 +51,7 @@ ModuleClosedNodes13=
ModuleClosedNodes14= ModuleClosedNodes14=
ModuleClosedNodes15= ModuleClosedNodes15=
ModuleClosedNodes16=9 ModuleClosedNodes16=9
ModuleClosedNodes17=13,14,15,16,17,18,19,20,21,22,23 ModuleClosedNodes17=
ModuleClosedNodes18= ModuleClosedNodes18=
ModuleClosedNodes19= ModuleClosedNodes19=
ModuleClosedNodes2= ModuleClosedNodes2=
@@ -64,6 +64,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7= ModuleClosedNodes7=
ModuleClosedNodes8=3,6,8,17,18,19 ModuleClosedNodes8=3,6,8,17,18,19
ModuleClosedNodes9= ModuleClosedNodes9=
NavigationStack=seleccion,to_number_vb,410,0,colonia,Activity_Create,33,0,seleccion,Activity_Create,110,0,Main,Activity_Create,76,0,Starter,ENVIA_ULTIMA_GPS,82,0,Diseñador Visual,seleccion.bal,-100,1,seleccion,Activity_Resume,197,5,MAPA_RUTAS,MapFragment1_Ready,146,0,seleccion,JobDone,626,6,seleccion,cargar_Click,549,6 NavigationStack=MAPA_RUTAS,MapFragment1_Ready,146,0,seleccion,JobDone,626,6,seleccion,cargar_Click,549,6,Main,Activity_Create,58,0,Diseñador Visual,fila.bal,-100,1,Starter,pe_BatteryChanged,43,0,colonia,Activity_Resume,64,5,colonia,ListView1_ItemClick,141,2,colonia,BUSCA_TextChanged,195,2,Main,Process_Globals,37,0
SelectedBuild=0 SelectedBuild=0
VisibleModules=18,21,10,9,12,8,4,14,11,2,17 VisibleModules=18,21,10,9,12,8,4,14,11,2,17

Binary file not shown.

View File

@@ -46,7 +46,10 @@ End Sub
Sub pe_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent) Sub pe_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Main.batt=Level Main.batt=Level
Log(Main.batt)
' Log(Main.batt)
' Log(main.batt)
End Sub End Sub
Private Sub Timer1_Tick Private Sub Timer1_Tick

View File

@@ -68,11 +68,13 @@ skmt.Initialize(ruta,"kmt.db", True)
Dim label1 As Label Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 22 label1.TextSize = 22
label1.TextColor = Colors.White ' label1.TextColor = Colors.White
label1.TextColor = Colors.Black
Dim label2 As Label Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 22 label2.TextSize = 22
label2.TextColor = Colors.White ' label2.TextColor = Colors.White
label2.TextColor = Colors.Black
ListView1.AddTwoLines(c.GetString("CAT_CL_RUTA"),c.GetString("cuantos")) ListView1.AddTwoLines(c.GetString("CAT_CL_RUTA"),c.GetString("cuantos"))
Next Next
End If End If
@@ -139,11 +141,11 @@ Sub ListView1_ItemClick (Position As Int, Value As Object)
Dim label1 As Label Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 22 label1.TextSize = 22
label1.TextColor = Colors.White label1.TextColor = Colors.Black
Dim label2 As Label Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 22 label2.TextSize = 22
label2.TextColor = Colors.White label2.TextColor = Colors.Black
ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE")) ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE"))
Next Next
End If End If
@@ -193,11 +195,11 @@ Sub BUSCA_TextChanged (Old As String, New As String)
Dim label1 As Label Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 22 label1.TextSize = 22
label1.TextColor = Colors.White label1.TextColor = Colors.Black
Dim label2 As Label Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 22 label2.TextSize = 22
label2.TextColor = Colors.White label2.TextColor = Colors.Black
ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE")) ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE"))
Next Next
End If End If

View File

@@ -623,9 +623,17 @@ Sub cargar_Click
ToastMessageShow("Se Actualizaran los datos, Este proceso podria tardar hasta un minuto, gracias" , True) ToastMessageShow("Se Actualizaran los datos, Este proceso podria tardar hasta un minuto, gracias" , True)
End Sub End Sub
Sub JobDone(Job As HttpJob) Sub JobDone(Job As HttpJob)
If Job.Success = False Then If reqManager.reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
'ToastMessageShow("Error: " & Job.ErrorMessage, True) 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 Not(Job.Success) Then
LogColor("Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
Else Else
LogColor("JobDone: '" & reqManager.HandleJob(Job).tag & "' - Registros: " & reqManager.HandleJob(Job).Rows.Size, Colors.Green)
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 = "kmt_datos" Then 'query tag If RESULT.Tag = "kmt_datos" Then 'query tag