mirror of
https://github.com/KeymonSoft/Android_Danvit.git
synced 2026-04-17 19:37:08 +00:00
VERSION 6.04.07
- Cambios en la clase DBRequestManager para que mande mas logs - Se agtego un parametro al query hist_comp_promos
This commit is contained in:
@@ -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,12 @@ 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, timesList As List
|
||||||
|
Dim inicioRequest As Long 'ignore
|
||||||
|
Dim inicioJobDone As Long 'ignore
|
||||||
|
Dim inicioRequestMap, inicioJobDoneMap As Map
|
||||||
|
Private logger As Boolean = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Target - The module that handles JobDone (usually Me).
|
'Target - The module that handles JobDone (usually Me).
|
||||||
@@ -31,8 +37,10 @@ End Sub
|
|||||||
Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
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)
|
||||||
|
' If timesList.IsInitialized Then timesList.Add(DateTime.now)
|
||||||
|
|
||||||
WriteObject(Command.Name, out2)
|
WriteObject(Command.Name, out2)
|
||||||
WriteInt(Limit, out2)
|
WriteInt(Limit, out2)
|
||||||
WriteList(Command.Parameters, out2)
|
WriteList(Command.Parameters, out2)
|
||||||
@@ -40,13 +48,30 @@ 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.
|
||||||
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
|
Public Sub ExecuteBatch(ListOfCommands As List, 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)
|
||||||
WriteInt(ListOfCommands.Size, out2)
|
WriteInt(ListOfCommands.Size, out2)
|
||||||
For Each Command As DBCommand In ListOfCommands
|
For Each Command As DBCommand In ListOfCommands
|
||||||
WriteObject(Command.Name, out2)
|
WriteObject(Command.Name, out2)
|
||||||
@@ -58,10 +83,15 @@ 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)
|
||||||
|
' If timesList.IsInitialized Then timesList.Add(DateTime.now)
|
||||||
ExecuteBatch(Array As DBCommand(Command), Tag)
|
ExecuteBatch(Array As DBCommand(Command), Tag)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub StartJob(j As HttpJob, MemoryStream As OutputStream, Tag As Object) As OutputStream
|
Private Sub StartJob(j As HttpJob, MemoryStream As OutputStream, Tag As Object) As OutputStream
|
||||||
|
' inicioRequest = DateTime.now
|
||||||
|
If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||||
|
If timesList.IsInitialized Then timesList.Add(DateTime.now)
|
||||||
j.Initialize("DBRequest", mTarget)
|
j.Initialize("DBRequest", mTarget)
|
||||||
j.Tag = Tag
|
j.Tag = Tag
|
||||||
MemoryStream.InitializeToBytesArray(0)
|
MemoryStream.InitializeToBytesArray(0)
|
||||||
@@ -112,7 +142,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 +215,13 @@ 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
|
If jobTagAnterior <> Job.Tag Then
|
||||||
|
' inicioJobDone = DateTime.Now 'ignore
|
||||||
|
If inicioJobDoneMap.IsInitialized Then inicioJobDoneMap.Put(Job.Tag, DateTime.Now)
|
||||||
|
' tiempos.Put(Job.taskId, CreateMap("inicioJobDone":inicioJobDone))
|
||||||
|
' Log(tiempos)
|
||||||
|
' Log("############# " & Job.taskId)
|
||||||
|
End If
|
||||||
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")
|
||||||
@@ -217,9 +253,14 @@ 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
|
||||||
|
If jobTagAnterior <> table.Tag Then
|
||||||
|
LogColor("HandleJob: '"&table.Tag&"'" & " - Registros: " & table.Rows.Size, Colors.RGB(115, 0, 140)) 'Mod por CHV - 211109
|
||||||
|
End If
|
||||||
|
jobTagAnterior = table.Tag 'Mod por CHV - 211109
|
||||||
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.
|
||||||
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||||
Dim out As OutputStream
|
Dim out As OutputStream
|
||||||
@@ -229,6 +270,7 @@ Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
|||||||
out.Close
|
out.Close
|
||||||
Return out.ToBytesArray
|
Return out.ToBytesArray
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Converts an image to a bytes array (for BLOB fields).
|
'Converts an image to a bytes array (for BLOB fields).
|
||||||
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||||
Dim out As OutputStream
|
Dim out As OutputStream
|
||||||
@@ -237,6 +279,7 @@ Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
|||||||
out.Close
|
out.Close
|
||||||
Return out.ToBytesArray
|
Return out.ToBytesArray
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Converts a bytes array to an image (for BLOB fields).
|
'Converts a bytes array to an image (for BLOB fields).
|
||||||
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||||
Dim In As InputStream
|
Dim In As InputStream
|
||||||
@@ -245,6 +288,7 @@ Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
|||||||
bmp.Initialize2(In)
|
bmp.Initialize2(In)
|
||||||
Return bmp
|
Return bmp
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Prints the table to the logs.
|
'Prints the table to the logs.
|
||||||
Public Sub PrintTable(Table As DBResult)
|
Public Sub PrintTable(Table As DBResult)
|
||||||
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
||||||
@@ -260,8 +304,60 @@ Public Sub PrintTable(Table As DBResult)
|
|||||||
For Each record As Object In row
|
For Each record As Object In row
|
||||||
sb.Append(record).Append(TAB)
|
sb.Append(record).Append(TAB)
|
||||||
Next
|
Next
|
||||||
ToastMessageShow(sb.ToString, True)
|
Log(sb.ToString)
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub requestTimes(tag As String) As Map 'ignore
|
||||||
|
Private times As Map
|
||||||
|
times.Initialize
|
||||||
|
' Log("###### " & tag)
|
||||||
|
' Log(reqsList.IsInitialized)
|
||||||
|
If reqsList.IsInitialized Then
|
||||||
|
' Log(reqsList)
|
||||||
|
' Private pos As Int = reqsList.IndexOf(tag)
|
||||||
|
If inicioRequestMap.ContainsKey(tag) Then
|
||||||
|
inicioRequest = inicioRequestMap.Get(tag)
|
||||||
|
' Log(">>>>>>> From inicioRequestMap")
|
||||||
|
End If
|
||||||
|
If inicioJobDoneMap.ContainsKey(tag) Then
|
||||||
|
inicioJobDone = inicioJobDoneMap.Get(tag)
|
||||||
|
' Log(">>>>>>> From inicioJobDoneMap")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
' Log($"${inicioJobDone} - ${inicioRequest}"$)
|
||||||
|
Private requestTime As String = NumberFormat2(((inicioJobDone - inicioRequest) / 1000),1,5,0,False)
|
||||||
|
Private JobDoneTime As String = NumberFormat2(((DateTime.Now - inicioJobDone) / 1000),1,5,0,False)
|
||||||
|
times.Put("request", tag)
|
||||||
|
times.Put("requestTime", requestTime)
|
||||||
|
times.Put("jobDoneTime", JobDoneTime)
|
||||||
|
times.Put("totalTime", NumberFormat2((JobDoneTime + requestTime),1,5,0,False))
|
||||||
|
Return times
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Initializes request tracking
|
||||||
|
Sub trackInit 'ignore
|
||||||
|
If logger Then Log(">>>>>>>>> TRACKINIT ")
|
||||||
|
reqsList.Initialize
|
||||||
|
timesList.Initialize
|
||||||
|
inicioRequestMap.Initialize
|
||||||
|
inicioJobDoneMap.Initialize
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Sub trackNext(job As HttpJob)
|
||||||
|
If reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||||
|
Private quitamos As String = ""
|
||||||
|
If reqsList.IndexOf(job.tag) <> -1 Then
|
||||||
|
Private pos As Int = reqsList.IndexOf(job.tag)
|
||||||
|
If pos <> -1 Then
|
||||||
|
inicioRequestMap.Put(job.Tag, timesList.Get(pos))
|
||||||
|
reqsList.RemoveAt(pos)
|
||||||
|
timesList.RemoveAt(pos)
|
||||||
|
End If
|
||||||
|
quitamos = $"Quitamos ${job.tag} - "$
|
||||||
|
End If
|
||||||
|
If logger Then LogColor(">>>>>> Requests: " & reqsList.Size & " - " & quitamos & reqsList, Colors.Blue)
|
||||||
|
If logger Then LogColor(">>>>>> inicioRequestMap:" & inicioRequestMap.Size & " - " & inicioRequestMap, Colors.Magenta)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
@@ -148,7 +148,7 @@ Version=12.8
|
|||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Danvit-V
|
#ApplicationLabel: Danvit-V
|
||||||
#VersionCode: 1
|
#VersionCode: 1
|
||||||
#VersionName: 5.12.06
|
#VersionName: 6.04.07
|
||||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ ModuleClosedNodes14=
|
|||||||
ModuleClosedNodes15=
|
ModuleClosedNodes15=
|
||||||
ModuleClosedNodes16=
|
ModuleClosedNodes16=
|
||||||
ModuleClosedNodes17=
|
ModuleClosedNodes17=
|
||||||
ModuleClosedNodes18=3
|
ModuleClosedNodes18=
|
||||||
ModuleClosedNodes19=
|
ModuleClosedNodes19=
|
||||||
ModuleClosedNodes2=
|
ModuleClosedNodes2=
|
||||||
ModuleClosedNodes20=
|
ModuleClosedNodes20=
|
||||||
@@ -64,6 +64,6 @@ ModuleClosedNodes6=
|
|||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=
|
ModuleClosedNodes8=
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=fila,Activity_Resume,214,6,MAPA_RUTAS,Globals,17,0,Main,Process_Globals,17,0,Main,Entrar_Click,195,0,seleccion,Activity_Resume,320,3,seleccion,connecta_Click,1913,0,pedidos,Activity_Create,79,0,seleccion,Activity_Create,217,0,seleccion,Process_Globals,17,0,Main,Activity_Resume,149,3
|
NavigationStack=seleccion,Activity_Create,221,0,seleccion,Activity_Resume,316,3,DBRequestManager,Class_Globals,14,0,DBRequestManager,WriteObject,138,0,seleccion,Activity_KeyPress,1860,0,Diseñador Visual,seleccion.bal,-100,1,seleccion,cargar_Click,1033,6,seleccion,JobDone,1272,6,seleccion,B_COMM_Click,2635,0,seleccion,e_ruta_TextChanged,2619,0,fila,GPS_LocationChanged,413,0
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=19,2,4,5,7,8,9,12,18,16
|
VisibleModules=19,18,2,4,5,7,8,9,12,16,6
|
||||||
|
|||||||
7
fila.bas
7
fila.bas
@@ -406,19 +406,18 @@ lon_gps=Location1.Longitude
|
|||||||
BT_QR.Enabled = True
|
BT_QR.Enabled = True
|
||||||
LA_GPS.TextColor = Colors.Blue
|
LA_GPS.TextColor = Colors.Blue
|
||||||
LA_GPS.Text = "CON UBICACION GPS"
|
LA_GPS.Text = "CON UBICACION GPS"
|
||||||
|
|
||||||
|
|
||||||
Dim l1, l2 As Location
|
Dim l1, l2 As Location
|
||||||
l1.Initialize2(lat_gps, lon_gps)
|
l1.Initialize2(lat_gps, lon_gps)
|
||||||
l2.Initialize2(m_lat, m_lon)
|
l2.Initialize2(m_lat, m_lon)
|
||||||
|
|
||||||
'now we need the distance between our location and the target location
|
'now we need the distance between our location and the target location
|
||||||
|
|
||||||
Dim distance As Long
|
Dim distance As Long
|
||||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
distance = l1.DistanceTo(l2) 'the result is in meter
|
||||||
|
|
||||||
gest.Visible = True
|
gest.Visible = True
|
||||||
|
|
||||||
If distance < 20 Then
|
If distance < 20 Then
|
||||||
LA_GEO.TextColor = Colors.Blue
|
LA_GEO.TextColor = Colors.Blue
|
||||||
Else
|
Else
|
||||||
|
|||||||
1621
seleccion.bas
1621
seleccion.bas
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user