mirror of
https://github.com/KeymonSoft/Durakelo.git
synced 2026-04-17 19:36:12 +00:00
4/11/23 - Cambios en el JobDone de Principal y en DBRequestManager.
This commit is contained in:
@@ -841,12 +841,15 @@ Sub cargar_Click
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
|
||||
reqManager.reqsList.Initialize 'inicializamos lista de requests.
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name ="insert_drop2_DUR"
|
||||
'cmd.Name = "UPDATE_DUR_ACTUALR2_GPS"
|
||||
cmd.Parameters = Array As Object(usuario, e_ruta.Text,fecha, l_porvisitar.Text,l_drop.Text,l_efectiva.Text,l_cuantosc.Text,l_cuantosn.Text, L_MONTOD.Text,"CARGO", ALMACEN, L_VENTA.Text, L_PREVENTA.Text, L_ABORDO.Text, l_cambios.TEXT)
|
||||
reqManager.ExecuteQuery(cmd , 0, "inst_noventa")
|
||||
' reqManager.ExecuteQuery(cmd , 0, "inst_noventa") xxxxxxxxxxxxxxx
|
||||
'sql.UPDATE_DUR_ACTUALR2_GPS=UPDATE DURAKELO.CAT_RUTAS_REPARTO SET CAT_RR_MONTO_ACT = (?),CAT_RR_MRECH_ACT =(?),CAT_RR_VISIT_ACT =(?), CAT_RR_DEV_ACT =(?), CAT_RR_LAT_ACT =(?), CAT_RR_LONG_ACT =(?), CAT_RR_BAT_ACT =(?), CAT_RR_TT = (?), CAT_RR_MONTO = (?), CAT_RR_FECHA_ACT = SYSDATE WHERE CAT_RR_IDALMACEN = (?) And CAT_RR_RUTA = (?)
|
||||
|
||||
'cmd.Initialize
|
||||
@@ -871,17 +874,17 @@ Sub cargar_Click
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cat_paquetes_abordo_DUR"
|
||||
cmd.Parameters = Array As Object(ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprodpa")
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprodpa") 'xxxxxxxxxxxxxx
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cat_paquetes_DUR"
|
||||
cmd.Parameters = Array As Object(ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprodp")
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprodp") 'xxxxxxxxxxxxxxxxx
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cat_paquetess_DUR"
|
||||
cmd.Parameters = Array As Object(ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprodps")
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprodps") 'xxxxxxxxxxxxxxxx
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cat_detallepa_DUR"
|
||||
@@ -906,7 +909,7 @@ Sub cargar_Click
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_hist_cliente_promos_DUR"
|
||||
cmd.Parameters = Array As Object(e_ruta.text, ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "hist_cliente_promos")
|
||||
reqManager.ExecuteQuery(cmd , 0, "hist_cliente_promos") 'xxxxxxxxxxxxxxx
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_promo_comp_DUR"
|
||||
@@ -918,7 +921,7 @@ Sub cargar_Click
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_verificacion_DUR"
|
||||
cmd.Parameters = Array As Object(e_ruta.text, ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "cat_verificacion")
|
||||
reqManager.ExecuteQuery(cmd , 0, "cat_verificacion") 'xxxxxxxxxxxxxxx
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_fecha"
|
||||
@@ -1014,10 +1017,15 @@ Sub cargar_Click
|
||||
ToastMessageShow("Se Actualizaran los datos, Este proceso podria tardar hasta un minuto, gracias" , True)
|
||||
End Sub
|
||||
Sub JobDone(Job As HttpJob)
|
||||
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)
|
||||
End If
|
||||
If Job.Success = False Then
|
||||
'If Job.ErrorMessage <> "STREAM" Then
|
||||
' ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
||||
'End If
|
||||
LogColor("Error: " & Job.tag & " : " & Job.ErrorMessage, Colors.red)
|
||||
If Job.ErrorMessage = "STREAM" Then
|
||||
If CARGA = "SUBIR" Then
|
||||
PB2.Progress = PB2.Progress + PORCENTAJE
|
||||
@@ -1038,6 +1046,16 @@ Sub JobDone(Job As HttpJob)
|
||||
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)
|
||||
End If
|
||||
LogColor(">>>>>> " & reqManager.reqsList.Size & " - " & reqManager.reqsList, Colors.red)
|
||||
End If
|
||||
|
||||
|
||||
If RESULT.Tag = "kmt_datos" Then 'query tag
|
||||
skmt.BeginTransaction
|
||||
Try
|
||||
|
||||
@@ -618,7 +618,6 @@ Sub b_prodMas_Click
|
||||
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
|
||||
' LogColor($"focus changed=${HasFocus}"$, Colors.Magenta)
|
||||
etCantHasFocus = HasFocus
|
||||
|
||||
@@ -4,9 +4,7 @@ ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
'Necesita la libreria RandomAccessFile, ByteConverter
|
||||
|
||||
'Class module
|
||||
''Class module
|
||||
Sub Class_Globals
|
||||
Private mTarget As Object
|
||||
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
||||
@@ -17,7 +15,8 @@ Sub Class_Globals
|
||||
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
||||
Private VERSION As Float = 0.9
|
||||
Private tempArray(1) As Object
|
||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211027
|
||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211109
|
||||
Dim reqsList As List
|
||||
End Sub
|
||||
|
||||
'Target - The module that handles JobDone (usually Me).
|
||||
@@ -25,6 +24,7 @@ End Sub
|
||||
Public Sub Initialize (Target As Object, ConnectorLink As String)
|
||||
mTarget = Target
|
||||
link = ConnectorLink
|
||||
reqsList.Initialize
|
||||
End Sub
|
||||
|
||||
'Sends a query request.
|
||||
@@ -35,7 +35,8 @@ Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
|
||||
If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||
|
||||
WriteObject(Command.Name, out2)
|
||||
WriteInt(Limit, out2)
|
||||
WriteList(Command.Parameters, out2)
|
||||
@@ -61,6 +62,7 @@ End Sub
|
||||
|
||||
'Similar to ExecuteBatch. Sends a single command.
|
||||
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
|
||||
If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||
ExecuteBatch(Array As DBCommand(Command), Tag)
|
||||
End Sub
|
||||
|
||||
@@ -188,7 +190,7 @@ End Sub
|
||||
|
||||
'Handles the Job result and returns a 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 cs As CompressedStreams
|
||||
In = cs.WrapInputStream(In, "gzip")
|
||||
@@ -199,8 +201,8 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
table.Columns.Initialize
|
||||
table.rows.Initialize
|
||||
table.Tag = Job.Tag
|
||||
If jobTagAnterior <> Job.Tag Then LogColor("HandleJob: '"&Job.Tag&"'", Colors.Blue) 'Mod por CHV - 211023
|
||||
jobTagAnterior = Job.Tag 'Mod por CHV - 211023
|
||||
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
|
||||
Dim numberOfColumns As Int = ReadInt(In)
|
||||
For i = 0 To numberOfColumns - 1
|
||||
@@ -222,7 +224,7 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
Next
|
||||
End If
|
||||
In.Close
|
||||
' Log("HandleJob: " & (DateTime.Now - start))
|
||||
' Log("HandleJob: " & (DateTime.Now - start))'Comentado por CHV - 211112
|
||||
Return table
|
||||
End Sub
|
||||
'Reads a file and returns the file as a bytes array.
|
||||
@@ -234,7 +236,6 @@ Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
|
||||
'Converts an image to a bytes array (for BLOB fields).
|
||||
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||
Dim out As OutputStream
|
||||
@@ -243,7 +244,6 @@ Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
|
||||
'Converts a bytes array to an image (for BLOB fields).
|
||||
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||
Dim In As InputStream
|
||||
@@ -252,7 +252,6 @@ Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||
bmp.Initialize2(In)
|
||||
Return bmp
|
||||
End Sub
|
||||
|
||||
'Prints the table to the logs.
|
||||
Public Sub PrintTable(Table As DBResult)
|
||||
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
||||
|
||||
@@ -62,8 +62,8 @@ ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=1
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=1
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Productos,cuentaProds,703,0,C_Cliente,Guardar_Click,337,0,Visual Designer,nota.bal,-100,3,C_Cliente,Tels_Click,313,0,C_Cliente,Tar_Click,324,0,B4XMainPage,JobDone,403,0,B4XMainPage,B4XPage_CloseRequest,418,0,C_Principal,B4XPage_CloseRequest,1885,0,C_Cliente,B4XPage_CloseRequest,320,6,C_Productos,et_pCant_TextChanged,648,0,C_Productos,et_pCant_FocusChanged,629,1
|
||||
NavigationStack=Visual Designer,productos.bal,-100,2,C_Productos,et_pCant_FocusChanged,631,1,C_Productos,b_prodMas_Click,613,0,DBRequestManager,Initialize,23,0,DBRequestManager,WriteObject,113,0,DBRequestManager,Class_Globals,12,0,C_Principal,Class_Globals,0,0,DBRequestManager,ExecuteQuery,28,0,C_Principal,cargar_Click,1011,6,C_Principal,JobDone,1021,6
|
||||
SelectedBuild=0
|
||||
VisibleModules=19,1,8,16,6,3,7,9,20,10,21
|
||||
VisibleModules=19,1,8,16,6,3,7,9,20,10
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user