Se agregaron las condicionales pertinentes.

This commit is contained in:
IsR0d
2024-06-06 10:25:13 -06:00
parent 345878eec6
commit 55324275a7
3 changed files with 89 additions and 32 deletions

View File

@@ -16,6 +16,7 @@ Sub Class_Globals
Private et_placas As EditText
Private et_operador As EditText
Private et_rutaReparto As EditText
' et_rutaReparto.InputType=et_rutaReparto.INPUT_TYPE_NUMBERS
Private b_guardar As Button
Private ImageView1 As ImageView
Private ImageView1 As ImageView
@@ -45,6 +46,9 @@ Sub Class_Globals
Dim PLACA_OK As String
Dim CARTAPORTE_OK As String
Dim c As Cursor
Dim count As Int = 0
Dim count2 As Int = 0
Dim ime As IME
End Sub
'You can add more parameters here.
@@ -68,7 +72,6 @@ Private Sub B4XPage_Created (Root1 As B4XView)
B4XPages.SetTitle(Me, "Barcode Example")
CreateDetector (Array("AZTEC", "CODE_128", "CODE_39", "CODE_93", "CODABAR", "DATA_MATRIX", "EAN_13", "EAN_8", "ITF", "PDF417", "QR_CODE", "UPC_A", "UPC_E"))
'Termina camara
End Sub
Sub B4XPage_Appear
@@ -98,6 +101,7 @@ Sub JobDone(Job As HttpJob)
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
If result.Tag = "PLACA_OK" Then 'query tag
count = count+1
PLACA_OK = 0
For Each records() As Object In result.Rows
For Each k As String In result.Columns.Keys
@@ -105,15 +109,16 @@ Sub JobDone(Job As HttpJob)
PLACA_OK= records(result.Columns.Get("INFO_OK"))
Next
Next
' MsgboxAsync("Favo de revisar la placa, el operador y la descarga de la carta porte", "AVISO")
If PLACA_OK = "OK" Then
count2 = count2+1
End If
End If
End If
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
If result.Tag = "CheckList_OK" Then 'query tag
count = count+1
CHECK_LIST = 0
For Each records() As Object In result.Rows
For Each k As String In result.Columns.Keys
@@ -121,15 +126,16 @@ Sub JobDone(Job As HttpJob)
CHECK_LIST= records(result.Columns.Get("'OK'"))
Next
Next
' MsgboxAsync("Favo de revisar la placa, el operador y la descarga de la carta porte", "AVISO")
If CHECK_LIST = "OK" Then
count2 = count2+1
End If
End If
End If
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
If result.Tag = "Operador_OK" Then 'query tag
count = count+1
OPERADOR_OK = 0
For Each records() As Object In result.Rows
For Each k As String In result.Columns.Keys
@@ -137,41 +143,91 @@ Sub JobDone(Job As HttpJob)
OPERADOR_OK = records(result.Columns.Get("INFO_OK"))
Next
Next
' MsgboxAsync("Favo de revisar la placa, el operador y la descarga de la carta porte", "AVISO")
If OPERADOR_OK = "OK" Then
count2 = count2+1
End If
End If
End If
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
If result.Tag = "CartaPorte_OK" Then 'query tag
count = count+1
CARTAPORTE_OK = 0
For Each records() As Object In result.Rows
For Each k As String In result.Columns.Keys
Log(k & ": " & records(result.Columns.Get(k)))
Log(k & ": |" & records(result.Columns.Get(k))&"|")
CARTAPORTE_OK= records(result.Columns.Get("INFO_OK"))
Next
Next
' MsgboxAsync("Favo de revisar la placa, el operador y la descarga de la carta porte", "AVISO")
If CARTAPORTE_OK = "OK" Then
count2 = count2+1
End If
End If
End If
Job.Release
If PLACA_OK = "OK" And OPERADOR_OK = "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK = "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Green
Else If PLACA_OK <> "OK" Or OPERADOR_OK <> "OK" Or CARTAPORTE_OK <> "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Red
Else If PLACA_OK = "OK" And OPERADOR_OK = "OK" And CHECK_LIST <> "OK" And CARTAPORTE_OK = "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Yellow
Log($"placa:${PLACA_OK}, operador:${OPERADOR_OK}, checklist:${CHECK_LIST}, cp:${CARTAPORTE_OK}"$)
Log(count)
Log(count2)
' If count = 4 Then
' If PLACA_OK = "OK" And OPERADOR_OK = "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK = "OK" Then
' P_Color.Visible = True
' P_Color.Color = Colors.Green
' Else If PLACA_OK = "OK" And OPERADOR_OK = "OK" And CHECK_LIST <> "OK" And CARTAPORTE_OK = "OK" Then
' P_Color.Visible = True
' P_Color.Color = Colors.Yellow
' MsgboxAsync("Favor de revisar El Check List", "AVISO")
' Else If PLACA_OK <> "OK" Or OPERADOR_OK <> "OK" Or CHECK_LIST <> "OK" Or CARTAPORTE_OK <> "OK" Then
' If PLACA_OK <> "OK" And OPERADOR_OK <> "OK" And CHECK_LIST <> "OK" And CARTAPORTE_OK = "OK" Then
' P_Color.Visible = True
' P_Color.Color = Colors.Red
' MsgboxAsync("Revisa La Placa", "AVISO")
' Else If PLACA_OK = "OK" And OPERADOR_OK <> "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK = "OK" Then
' P_Color.Visible = True
' P_Color.Color = Colors.Red
' MsgboxAsync("Revisa El Operador", "AVISO")
' End If
' If PLACA_OK <> "OK" And OPERADOR_OK <> "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK <> "OK" Then
' P_Color.Visible = True
' P_Color.Color = Colors.Red
' MsgboxAsync("No hay Carta Porte para esa Ruta", "AVISO")
' End If
' End If
' End If
'--------------------------------------
If count = 4 Then
If count2 = 4 Then
P_Color.Visible = True
P_Color.Color = Colors.Green
Else If PLACA_OK = "OK" And OPERADOR_OK = "OK" And CHECK_LIST <> "OK" And CARTAPORTE_OK = "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Yellow
MsgboxAsync("Favor de revisar el CheckList", "AVISO")
Else If count2 < 4 Then
P_Color.Visible = True
P_Color.Color = Colors.Red
If PLACA_OK <> "OK" And OPERADOR_OK <> "OK" And CHECK_LIST <> "OK" And CARTAPORTE_OK = "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Red
MsgboxAsync("Revisa La Placa", "AVISO")
Else If PLACA_OK = "OK" And OPERADOR_OK <> "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK = "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Red
MsgboxAsync("Revisa El Operador", "AVISO")
Else if PLACA_OK <> "OK" And OPERADOR_OK <> "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK <> "OK" And count2 = 1 Then
P_Color.Visible = True
P_Color.Color = Colors.Red
MsgboxAsync("No hay Carta Porte para esa Ruta", "AVISO")
End If
End If
If PLACA_OK = "OK" And OPERADOR_OK = "OK" And CHECK_LIST = "OK" And CARTAPORTE_OK <> "OK" Then
P_Color.Visible = True
P_Color.Color = Colors.Red
MsgboxAsync("No se encuentra Carta Porte", "AVISO")
End If
End If
Job.Release
End If
End Sub
@@ -317,7 +373,9 @@ End Sub
'fin camara
Private Sub b_guardar_Click
count = 0
count2 = 0
ime.HideKeyboard
Starter.skmt.ExecNonQuery($"insert into CONTROL_KMS (PLACAS, OPERADOR, RUTA, KMS_INICIAL, KMS_FINAL) values ('${et_placas.text}', '${et_operador.text}', '${et_rutaReparto.text}', '${et_kmsInicial.text}', '${et_kmsFinal.text}')"$)
Dim ValDato As List
@@ -345,7 +403,6 @@ Private Sub b_guardar_Click
MsgboxAsync(MS, "AVISO")
Else
c = Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
Log(c.RowCount)
c.Position = 0
Dim ALM_ENV = c.GetString ("ID_ALMACEN")
c.Close
@@ -353,7 +410,7 @@ Private Sub b_guardar_Click
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_placa_GUNA"
cmd.Parameters = Array As Object(et_placas.Text ,et_rutaReparto.Text, ALM_ENV)
cmd.Parameters = Array As Object(et_placas.Text, et_rutaReparto.Text, ALM_ENV)
Log(et_placas.Text & " ," & et_rutaReparto.Text & " ," & ALM_ENV)
reqManager.ExecuteQuery(cmd , 0, "PLACA_OK")
@@ -361,21 +418,21 @@ Private Sub b_guardar_Click
cmd.Initialize
cmd.Name = "select_Operador_GUNA"
cmd.Parameters = Array As Object(et_placas.Text, et_operador.Text, et_rutaReparto.Text, ALM_ENV)
Log(et_placas.Text & " ," & et_rutaReparto.Text & " ," & ALM_ENV)
Log(et_placas.Text & " ," & et_operador.Text & " ," & et_rutaReparto.Text & " ," & ALM_ENV)
reqManager.ExecuteQuery(cmd , 0, "Operador_OK")
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_CheckList_GUNA"
cmd.Parameters = Array As Object(et_placas.Text)
Log(et_placas.Text & " ," & et_rutaReparto.Text & " ," & ALM_ENV)
Log(et_placas.Text)
reqManager.ExecuteQuery(cmd , 0, "CheckList_OK")
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_CartaPorte_GUNA"
cmd.Parameters = Array As Object(et_rutaReparto.Text, ALM_ENV)
Log(et_placas.Text & " ," & et_rutaReparto.Text & " ," & ALM_ENV)
Log(et_rutaReparto.Text & " ," & ALM_ENV)
reqManager.ExecuteQuery(cmd , 0, "CartaPorte_OK")
End If

Binary file not shown.

View File

@@ -28,6 +28,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=B4XMainPage,Entrar_Click,131,0,C_Clientes,traeTodosAVisitar,535,0,B4XMainPage,Class_Globals,23,0,C_Principal,JoinStrings,327,0,C_Principal,Class_Globals,28,4,C_Principal,B4XPage_Appear,68,3,Diseñador Visual,principal.bal,-100,6,C_Principal,b_guardar_Click,308,6,C_Principal,JobDone,103,6,B4XMainPage,JobDone,163,2
NavigationStack=DBRequestManager,WriteObject,116,0,DBRequestManager,ReadObject,122,0,C_Principal,FoundBarcode,243,3,C_Principal,b_escanOperador_Click,537,0,B4XMainPage,Initialize,68,0,C_Principal,Class_Globals,44,6,C_Principal,B4XPage_Created,67,2,Diseñador Visual,principal.bal,-100,6,C_Principal,b_guardar_Click,409,2,C_Principal,JobDone,216,6
SelectedBuild=0
VisibleModules=2,8,4,9,6,7,3