22/9/23 - Cambios en Nota y nuevo servicio "NotificationService"

- Se modifico "Nota" para que cuando ya este guardado el pedido, ya no se puedan borrar los productos individuales.
- Se agregó el servicio "NotificationService" para interceptar notificaciones y por medio de un mensaje de WhatsApp (#NS http://10.0.0.205:1782), cambiar el servidor de DBReq.
- Se estandarizó el DBreqServer en Starter.DBReqServer.
This commit is contained in:
2023-09-22 04:28:31 -06:00
parent 9059bda2f4
commit 3b3f808653
18 changed files with 668 additions and 621 deletions

View File

@@ -13,16 +13,17 @@ Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public gps As GPS
Dim skmt As SQL
Dim ph As Phone
Public rp As RuntimePermissions
Dim s As C_Subs
Public FLP As FusedLocationProvider
' Private flpStarted As Boolean
Dim reqManager As DBRequestManager
' Dim server As String = "http://11.0.0.253:1782"
Dim server As String = "http://187.189.244.154:1782"
' Dim server As String = "http://10.0.0.205:1782"
' Dim server As String = "http://11.0.0.231:1782"
' Dim DBReqServer As String = "http://11.0.0.253:1782"
Dim DBReqServer As String = "http://187.189.244.154:1782"
' Dim DBReqServer As String = "http://10.0.0.205:1782"
' Dim DBReqServer As String = "http://11.0.0.231:1782"
Dim Timer1 As Timer
Dim Interval As Int = 300
Dim ruta As String = File.DirInternal
@@ -40,6 +41,7 @@ Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.
s.Initialize(Me, "Subs") 'Inicializamos la clase Subs
skmt = s.inicializaBD(File.DirInternal, "kmt.db")
gps.Initialize("GPS")
Timer1.Initialize("Timer1", Interval * 1000)
Timer1.Enabled = True
@@ -54,7 +56,9 @@ End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
Subs.revisaBD
reqManager.Initialize(Me, server)
If s.traeDBReqServerDeBD(skmt) <> "N/A" Then DBReqServer = s.traeDBReqServerDeBD(skmt)
reqManager.Initialize(Me, DBReqServer)
' StartService(NotificationService)
End Sub
Private Sub Timer1_Tick
@@ -78,9 +82,7 @@ Sub ENVIA_ULTIMA_GPS
If IsConnectedToInternet Or 1 = 1 Then
Dim logger As Boolean = True
If logger Then LogColor("Iniciamos ENVIA_ULTIMA_GPS", Colors.Magenta)
Dim skmt As SQL
Dim cmd As DBCommand
skmt.Initialize(ruta,"kmt.db", False)
' cmd.Initialize
' cmd.Name = "select_fechat"
' B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "fechat")
@@ -122,9 +124,13 @@ Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub reinicializaReqManager
reqManager.Initialize(Me, server)
If logger Then Log(server)
'Inicializa el reqServer con la dirección dada y lo guarda en CAT_VARIABLES.
Sub reinicializaReqManager(srv As String)
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)
End Sub
Sub JobDone(Job As HttpJob)