mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-20 11:39:13 +00:00
VERSION 6.03.30
- Cambios en DBRequestManagerW para evitar un error cuando no hay internet
This commit is contained in:
@@ -643,6 +643,7 @@ Sub Subir_Click
|
||||
Next
|
||||
End If
|
||||
Sleep(1000)
|
||||
Starter.revisandoNotifiaciones = False
|
||||
|
||||
CARGA = "SUBIR"
|
||||
' P1.Visible = True
|
||||
@@ -2289,9 +2290,9 @@ Sub JobDone(Job As HttpJob)
|
||||
LogColor(reqManager.reqsList, Colors.blue)
|
||||
LogColor(reqManager.reqsList.Size, Colors.blue)
|
||||
If CARGA = "SUBIR" Then actualizaProgressBar
|
||||
|
||||
|
||||
'Si ya se procesaron TODAS las peticiones, entonces realizamos validaciones.
|
||||
If reqManager.reqsList.Size = 0 Then
|
||||
If reqManager.reqsList.Size = 0 And Not(Starter.revisandoNotifiaciones) Then
|
||||
If CARGA = "SUBIR" Then revisaHistNotificaciones
|
||||
End If
|
||||
End If
|
||||
@@ -2314,14 +2315,15 @@ Sub JobDone(Job As HttpJob)
|
||||
End Sub
|
||||
|
||||
'Envia el historial de notificaciones despues de haberlas borrado para que no se dupliquen.
|
||||
Sub enviaHistNotificaciones
|
||||
Private hn As Cursor = Starter.skmt.ExecQuery($"select * from hist_notificaciones"$)
|
||||
Sub enviaHistNotificaciones(id As String, codigo As String)
|
||||
Private hn As Cursor = Starter.skmt.ExecQuery($"select * from hist_notificaciones where HN_CODIGO = '${codigo}' and HN_ID = '${id}'"$)
|
||||
If hn.RowCount > 0 Then
|
||||
For i = 0 To hn.RowCount - 1
|
||||
hn.Position = i
|
||||
cmd.Initialize
|
||||
cmd.Name = "insertHistNotificaciones"
|
||||
cmd.Parameters = Array As Object( hn.GetString("HN_CODIGO"), hn.GetString("HN_ID"), hn.GetString("HN_FECHA"))
|
||||
cmd.Parameters = Array As Object(hn.GetString("HN_ID"), hn.GetString("HN_CODIGO"), hn.GetString("HN_FECHA"))
|
||||
Log($"Enviamos notificacion: id: ${hn.GetString("HN_ID")}, codigo: ${hn.GetString("HN_CODIGO")}, fecha: ${hn.GetString("HN_FECHA")}"$)
|
||||
reqManager.ExecuteCommand(cmd , "insertHistNotificaciones")
|
||||
Next
|
||||
hn.Close
|
||||
@@ -2331,7 +2333,9 @@ End Sub
|
||||
' Revisa que en web haya el numero correcto de notificaciones en el historial
|
||||
Sub revisaHistNotificaciones
|
||||
LogColor("####################### REVISA NOTIS ########", Colors.red)
|
||||
Private cn As Cursor = Starter.skmt.ExecQuery("select count(HN_CODIGO) as cuantos, HN_CODIGO, HN_ID from HIST_NOTIFICACIONES")
|
||||
Starter.revisandoNotifiaciones = True
|
||||
' Private cn As Cursor = Starter.skmt.ExecQuery("select count(HN_CODIGO) as cuantos, HN_CODIGO, HN_ID from HIST_NOTIFICACIONES")
|
||||
Private cn As Cursor = Starter.skmt.ExecQuery($"SELECT HN_ID, HN_CODIGO, HN_FECHA, COUNT(*) As cuantos FROM HIST_NOTIFICACIONES GROUP BY HN_ID"$)
|
||||
If cn.RowCount > 0 Then
|
||||
cn.Position = 0
|
||||
Private CuantasN As Int = cn.GetInt("cuantos")
|
||||
@@ -2344,14 +2348,15 @@ Sub revisaHistNotificaciones
|
||||
Subs.logJobDoneResultados(r.resultado)
|
||||
For Each records() As Object In r.resultado.Rows
|
||||
Dim CuantasN As Int = records(r.resultado.Columns.Get("CUANTOS"))
|
||||
LogColor($"####################### id: ${cn.GetString("HN_ID")}, codigo: ${cn.GetString("HN_CODIGO")}, Cuantas: ${CuantasN} ########"$, Colors.red)
|
||||
If cn.GetInt("cuantos") > CuantasN Then
|
||||
enviaHistNotificaciones
|
||||
enviaHistNotificaciones(cn.GetString("HN_ID"), cn.GetString("HN_CODIGO"))
|
||||
Log($"enviaHistNotificaciones(${cn.GetString("HN_ID")}, ${cn.GetString("HN_CODIGO")})"$)
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
Log(r.ErrorMessage)
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -2579,6 +2584,7 @@ Sub e_ruta_EnterPressed
|
||||
Starter.skmt.ExecNonQuery("delete from HIST_TREND_SPENDING_SEMANAL")
|
||||
Starter.skmt.ExecNonQuery("delete from VERSIONES")
|
||||
Starter.skmt.ExecNonQuery("delete from auditoria")
|
||||
Starter.skmt.ExecNonQuery("delete from HIST_NOTIFICACIONES")
|
||||
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_ENVIOS VALUES (?,0,?)", Array As Object(sTime, "PEDIDO"))
|
||||
Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("NUMERO_PEDIDO"))
|
||||
@@ -3448,8 +3454,8 @@ Sub SUBIR_INFO_PEDIDO
|
||||
PB2.Progress = PB2.Progress + 1
|
||||
contador_env = contador_env + 1
|
||||
Next
|
||||
c.Close
|
||||
End If
|
||||
c.Close
|
||||
d.Position=0
|
||||
cuantos_noventa = D.GetString("CUANTOS_NOVENTA")
|
||||
PB2.Progress = 100
|
||||
@@ -3569,35 +3575,35 @@ Sub enviaPedidoBatch(filtro As String)
|
||||
' BLOQUE DE VALIDACIÓN REMOTA: Revisar si el pedido ya está liquidado o el arqueo cerrado
|
||||
' =========================================================================================
|
||||
' sql.revisaArqueoYLiquidacion_Kelloggs = select NVL(HVD_ESTATUS, 'NO') as liquidado, HVD_DTECIERRE, (select hist_ca_fecha from KELLOGGS.hist_cierre_arqueo where hist_ca_idalmacen = (?) and hist_ca_ruta = (?) and trunc(sysdate) = trunc(hist_ca_fecha)) as arqueo from KELLOGGS.HIST_VENTAS_DETALLE where HVD_ALMACEN = (?) and HVD_RUTA = (?) and trunc(sysdate) = trunc(HVD_FECHA) and HVD_TIPOVENTA = 'VENTA' and rownum <= 1
|
||||
|
||||
|
||||
' 1. Preparamos el comando para consultar el estatus directamente en la base de datos del servidor.
|
||||
cmd.Initialize
|
||||
cmd.Name = "revisaArqueoYLiquidacion_Kelloggs"
|
||||
Private ruta_ As String = Subs.traeRuta
|
||||
cmd.Parameters = Array As Object(ALMACEN, ruta_, ALMACEN, ruta_)
|
||||
|
||||
|
||||
' 2. Disparamos la consulta al servidor de forma asíncrona usando reqManagerW.
|
||||
reqManagerW.ExecuteQuery(Starter.DBReqServer, cmd, Me, "revisaPedidoLiquidado")
|
||||
|
||||
|
||||
' 3. Pausamos la ejecución de este bloque local hasta que el servidor nos responda.
|
||||
Wait For revisaPedidoLiquidado_Completed (rpd As TResultado)
|
||||
|
||||
|
||||
' 4. Evaluamos la respuesta del servidor.
|
||||
If rpd.Success Then
|
||||
Log("SUCCESS - revisaPedidoLiquidado")
|
||||
|
||||
|
||||
' Inicializamos variables asumiendo que el pedido NO está liquidado y NO hay arqueo.
|
||||
Dim liquidado As String = "NO"
|
||||
Dim arqueo As String = "null"
|
||||
|
||||
|
||||
' Leemos los registros devueltos por el servidor para actualizar nuestras variables.
|
||||
For Each records() As Object In rpd.resultado.Rows
|
||||
liquidado = records(rpd.resultado.Columns.Get("LIQUIDADO"))
|
||||
arqueo = records(rpd.resultado.Columns.Get("ARQUEO"))
|
||||
Next
|
||||
|
||||
|
||||
Subs.logJobDoneResultados(rpd.resultado)
|
||||
|
||||
|
||||
' 5. Regla de negocio: Si el estatus es "NO" liquidado y el arqueo es "null" (abierto),
|
||||
' entonces es seguro proceder a modificar/enviar la información.
|
||||
If liquidado = "NO" And arqueo = "null" Then
|
||||
|
||||
Reference in New Issue
Block a user