mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-20 19:49:12 +00:00
cambio db a skmt y bitacora
This commit is contained in:
@@ -15,7 +15,7 @@ Sub Process_Globals
|
||||
Public rp As RuntimePermissions
|
||||
Dim s As C_Subs
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim db, errorLog As SQL
|
||||
Dim skmt, errorLog As SQL
|
||||
Dim ruta As String
|
||||
Public BluetoothState As Boolean
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
@@ -65,9 +65,9 @@ Sub Service_Create
|
||||
GPS.Initialize("GPS")
|
||||
ubicacionActual.Initialize
|
||||
pe.Initialize("pe") 'Para obtener la bateria
|
||||
db = s.dbInit 'Inicializamos BD.
|
||||
skmt = s.dbInit 'Inicializamos BD.
|
||||
DBReqServer = "http://keymon.lat:1782"
|
||||
Private c As Cursor = db.ExecQuery($"select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'SERVER'"$)
|
||||
Private c As Cursor = skmt.ExecQuery($"select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'SERVER'"$)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
DBReqServer = c.GetString("CAT_VA_VALOR")
|
||||
@@ -140,17 +140,17 @@ End Sub
|
||||
|
||||
Sub ENVIA_ULTIMA_GPS
|
||||
If Logger Then Log("Iniciamos ENVIA_ULTIMA_GPS")
|
||||
If Not(db.IsInitialized) Then db.Initialize(ruta,"kmt.db", True)
|
||||
If Not(skmt.IsInitialized) Then skmt.Initialize(ruta,"kmt.db", True)
|
||||
DateTime.TimeFormat = "HHmmss"
|
||||
ultimaActualizacionGPS = DateTime.Time(DateTime.Now)
|
||||
Private s1 As Cursor = db.ExecQuery2("select CAT_VA_VALOR as semana from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SEMANA")) 'Traemos la semana.
|
||||
Private s1 As Cursor = skmt.ExecQuery2("select CAT_VA_VALOR as semana from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SEMANA")) 'Traemos la semana.
|
||||
If s1.RowCount> 0 Then
|
||||
s1.Position=0
|
||||
Private laSemana As String = s1.GetString("semana")
|
||||
Else
|
||||
Private laSemana As String = ""
|
||||
End If
|
||||
Private cpv As Cursor = db.ExecQuery2("select count(*) as CUANTOS from kmt_info where CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?) and cat_cl_codigo <> 0 AND CAT_CL_TIPO_RUTA IN (?,?) ORDER BY CAT_CL_NUM_SERIEFISICO", Array As String("DIA_VISITA", laSemana, "SEMANAL"))'Traemos los clientes a visitar hoy.
|
||||
Private cpv As Cursor = skmt.ExecQuery2("select count(*) as CUANTOS from kmt_info where CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?) and cat_cl_codigo <> 0 AND CAT_CL_TIPO_RUTA IN (?,?) ORDER BY CAT_CL_NUM_SERIEFISICO", Array As String("DIA_VISITA", laSemana, "SEMANAL"))'Traemos los clientes a visitar hoy.
|
||||
cpv.Position=0
|
||||
Private clientesVisitaHoy As String = cpv.GetString("CUANTOS")
|
||||
If lat_gps = 0 Or lat_gps = Null Then 'Si latitud es CERO o NULL traemos las ultimas coordenadas de la base de datos.
|
||||
@@ -165,7 +165,7 @@ Sub ENVIA_ULTIMA_GPS
|
||||
Subs.dameClientesFueraDeFrecuencia
|
||||
Private h As Cursor
|
||||
For Each i As String In Array As String ("RTEC", "PING", "SALTY SNACKS")
|
||||
h=db.ExecQuery2("Select sum(PE_COSTO_TOT) As MONTO_DIA from pedido where PE_CLIENTE <> 0 and pe_proid in (Select CAT_GP_ID from cat_gunaprod2 where CAT_GP_TIPO = ? )", Array As String(i))
|
||||
h=skmt.ExecQuery2("Select sum(PE_COSTO_TOT) As MONTO_DIA from pedido where PE_CLIENTE <> 0 and pe_proid in (Select CAT_GP_ID from cat_gunaprod2 where CAT_GP_TIPO = ? )", Array As String(i))
|
||||
Private x As String = 0
|
||||
If h.RowCount > 0 Then
|
||||
h.Position = 0
|
||||
@@ -186,7 +186,7 @@ Sub ENVIA_ULTIMA_GPS
|
||||
reqManager.ExecuteCommand(cmd,"updateKell_UTR")
|
||||
' If Logger Then Log(reqManager)
|
||||
' If Logger Then Log("++ ++ ++ Envia_Ultima GPS - Inst_visitas - server: "& server)
|
||||
db.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ? WHERE CAT_VA_DESCRIPCION = ?" , Array As String(DateTime.Time(DateTime.Now),"HoraIngreso"))
|
||||
skmt.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ? WHERE CAT_VA_DESCRIPCION = ?" , Array As String(DateTime.Time(DateTime.Now),"HoraIngreso"))
|
||||
'Reiniciamos el timer para cuando llamamos el Sub desde otra actividad
|
||||
Timer1.Enabled = False
|
||||
Timer1.Interval = Interval * 1000
|
||||
@@ -225,13 +225,13 @@ End Sub
|
||||
Sub revisaBD 'ignore
|
||||
If Logger Then Log("revisaBD")
|
||||
If Not(File.Exists(ruta, "kmt.db")) Then File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
If Not(db.IsInitialized) Then db.Initialize(ruta, "kmt.db", True)
|
||||
If Not(skmt.IsInitialized) Then skmt.Initialize(ruta, "kmt.db", True)
|
||||
End Sub
|
||||
|
||||
'Inicializa el reqServer con la dirección dada y lo guarda en CAT_VARIABLES.
|
||||
Sub reinicializaReqManager(srv As String)
|
||||
db.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("SERVER"))
|
||||
db.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("SERVER", srv))
|
||||
skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("SERVER"))
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("SERVER", srv))
|
||||
DBReqServer = srv
|
||||
reqManager.Initialize(Me, srv)
|
||||
' LogColor(srv, Colors.red)
|
||||
|
||||
Reference in New Issue
Block a user