mirror of
https://github.com/KeymonSoft/Mariana.git
synced 2026-04-17 21:06:16 +00:00
- VERSION 5.07.05
- Se cambio el funcionamiento de la geocerca. - En el almacen SIEMPRE se puede realizar venta. - Se quito el boton de "habilitar geocerca" del engrane. - En la pantala de cliente, si se hace clic largo en la etiqueta de la distancia a la tienda, aparece un popup para ingresar la contraseña (de un solo uso) de supervisor (esta se encuentra en el portal).
This commit is contained in:
@@ -106,6 +106,7 @@ Sub Class_Globals
|
||||
Dim lonAlmacen As String = "0"
|
||||
Dim pantallaActual As B4XView
|
||||
Dim recordatorio As C_Recordatorio
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
@@ -947,4 +948,4 @@ End Sub
|
||||
|
||||
Private Sub p_geocerca2_Click
|
||||
p_geocerca_Click
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
@@ -146,6 +146,10 @@ Sub Class_Globals
|
||||
Private lv_yalo As ListView
|
||||
Dim distance As Long = 500000000000
|
||||
Dim enGeocerca As Boolean = False
|
||||
Private p_transparenteGeocerca As Panel
|
||||
Private p_passGeocerca As Panel
|
||||
Private b_passGeocerca As Button
|
||||
Private et_passGeocerca As EditText
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -199,11 +203,15 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
lv_yalo.top = (Root.Height / 2) - (lv_yalo.Height / 2)
|
||||
btAdmin.Initialize("BlueTeeth")
|
||||
cmp20.Initialize("Printer")
|
||||
p_transparenteGeocerca.top = 0 : p_transparenteGeocerca.Left = 0
|
||||
p_transparenteGeocerca.height = Root.Height : p_transparenteGeocerca.width = Root.width
|
||||
Subs.centraPanel(p_passGeocerca, Root.Width)
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
distance = 500000000000
|
||||
B4XPages.mainpage.pantallaActual = Root
|
||||
b_noVenta.Enabled = True
|
||||
b_venta.Enabled = True
|
||||
@@ -336,8 +344,7 @@ Sub B4XPage_Appear
|
||||
' b_noVenta.Visible = True
|
||||
' b_venta.Visible = True
|
||||
' End If
|
||||
CallSubDelayed(Tracker, "Track")
|
||||
|
||||
|
||||
If Not(Starter.GPS.GPSEnabled) Then
|
||||
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
|
||||
StartActivity(Starter.GPS.LocationSettingsIntent)
|
||||
@@ -345,16 +352,25 @@ Sub B4XPage_Appear
|
||||
Starter.GPS.Start(0, 0)
|
||||
' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual)
|
||||
End If
|
||||
CallSubDelayed(Tracker, "StartFLPSmall")
|
||||
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
|
||||
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||
' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
||||
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
|
||||
|
||||
Log("Tracker LR Init: " & (Tracker.actualLR.IsInitialized))
|
||||
If Not(Tracker.actualLR.IsInitialized) Then
|
||||
Log("INICIAMOS TRACKER")
|
||||
CallSubDelayed(Tracker, "Track")
|
||||
CallSubDelayed(Tracker, "StartFLPSmall")
|
||||
End If
|
||||
' If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
|
||||
' B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||
' B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||
'' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
||||
' GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
|
||||
' End If
|
||||
|
||||
Log("DISTANCIA: " & distance)
|
||||
If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
|
||||
' Log("DISTANCIA: " & distance)
|
||||
' Log("HAY PEDIDO: " & Subs.hayPedido)
|
||||
' Log("GEOCERCA ACTIVA: " & Subs.geocercaHabilitada)
|
||||
' Log("EN ALMACEN: " & Subs.estamosEnAlmacen(50))
|
||||
If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
|
||||
b_noVenta.Visible = True
|
||||
b_venta.Visible = True
|
||||
Log("Botones visibles")
|
||||
@@ -369,28 +385,38 @@ End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
' LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
|
||||
If Tracker.FLP.GetLastKnownLocation.IsInitialized And Tracker.FLP.GetLastKnownLocation.Latitude <> 0 Then
|
||||
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||
' If Tracker.FLP.GetLastKnownLocation.IsInitialized And Tracker.FLP.GetLastKnownLocation.Latitude <> 0 Then
|
||||
B4XPages.MainPage.lat_gps = Location1.Latitude
|
||||
B4XPages.MainPage.lon_gps = Location1.Longitude
|
||||
' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps)
|
||||
End If
|
||||
' End If
|
||||
|
||||
Dim l1, l2 As Location
|
||||
l1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)
|
||||
' Log($"Coordenadas de la tienda - lat:${m_lat}, lon:${m_lon}"$)
|
||||
l2.Initialize2(m_lat, m_lon)
|
||||
|
||||
BT_QR.Enabled = True
|
||||
LA_GPS.TextColor = Colors.Blue
|
||||
LA_GPS.Text = "CON UBICACION GPS"
|
||||
'now we need the distance between our location and the target location
|
||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
||||
If distance <= 50 Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
|
||||
b_noVenta.Visible = True
|
||||
b_venta.Visible = True
|
||||
' Log("Botones visibles")
|
||||
End If
|
||||
If Subs.estamosEnAlmacen(50) And Not(Subs.geocercaHabilitada) Then
|
||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
||||
' If distance <= 50 Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
|
||||
' b_noVenta.Visible = True
|
||||
' b_venta.Visible = True
|
||||
' Log("Botones visibles")
|
||||
' End If
|
||||
' If Subs.estamosEnAlmacen(50) Or Not(Subs.geocercaHabilitada) Then
|
||||
' b_noVenta.Visible = True
|
||||
' b_venta.Visible = True
|
||||
' Log("Botones visibles")
|
||||
' End If
|
||||
' Log("###########################################")
|
||||
' Log("No geocerca: " & Not(Subs.geocercaHabilitada))
|
||||
' Log("estamosEnAlmacen: " & Subs.estamosEnAlmacen(50))
|
||||
' Log("distance: " & distance)
|
||||
' Log("hayPedido: " & Subs.hayPedido)
|
||||
' Log("ENTRAMOS: " & (Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50)))
|
||||
If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
|
||||
b_noVenta.Visible = True
|
||||
b_venta.Visible = True
|
||||
' Log("Botones visibles")
|
||||
@@ -407,8 +433,8 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
' End If
|
||||
LA_GEO.Text= $"$1.2{distance/1000} kms"$
|
||||
skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
||||
skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
||||
|
||||
l_ubicacion2.TextSize = 13
|
||||
l_ubicacion2.Text = $"Precisión GPS $1.0{Location1.Accuracy} m"$
|
||||
If Location1.Accuracy > 200 Then
|
||||
@@ -416,8 +442,11 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
l_ubicacion2.TextSize = 16
|
||||
l_ubicacion2.Text = $"Mala señal GPS $1.0{Location1.Accuracy} m"$
|
||||
End If
|
||||
|
||||
' If Tracker.actualLR.IsInitialized Then LogColor("Tracker Update Req: " & Tracker.actualLR.GetExpirationTime, Colors.red)
|
||||
' Tracker.actualLR.
|
||||
Tracker.FLP.RemoveLocationUpdates
|
||||
CallSubDelayed(Tracker, "CreateLocationRequest")
|
||||
' If Tracker.actualLR.GetNumUpdates < 3 Then CallSubDelayed(Tracker, "StartFLP")
|
||||
End Sub
|
||||
|
||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
@@ -957,7 +986,30 @@ Sub JobDone(Job As HttpJob)
|
||||
Next
|
||||
skmt.ExecNonQuery($"UPDATE ABONOS set a_enviado = 1 where a_cliente = '${cliente}'"$)
|
||||
End If
|
||||
If resultado.Tag = "traePassGeocerca" Then 'query tag
|
||||
Subs.logJobDoneResultados(resultado)
|
||||
Log(resultado.Rows.Size)
|
||||
b_passGeocerca.Enabled = True
|
||||
For Each records() As Object In resultado.Rows
|
||||
Log($"|${records(resultado.Columns.Get("TMP_PASS"))}|"$)
|
||||
Dim tmp_pass As String = records(resultado.Columns.Get("TMP_PASS")).As(String)
|
||||
Log(tmp_pass)
|
||||
ToastMessageShow("¡¡Listo!!", False)
|
||||
Starter.skmt.ExecNonQuery($"update kmt_info set cat_cl_lat = '${B4XPages.MainPage.lat_gps}', cat_cl_long = '${B4XPages.MainPage.lon_gps}' where cat_cl_codigo = '${Subs.traeCliente}'"$)
|
||||
m_lat = B4XPages.MainPage.lat_gps : m_lon = B4XPages.MainPage.lon_gps
|
||||
p_transparenteGeocerca.Visible = False
|
||||
et_passGeocerca.text = ""
|
||||
cmd.Initialize
|
||||
cmd.Name = "borraPassGeocerca"
|
||||
cmd.Parameters = Array As Object(Subs.traeAlmacen, Subs.traeRuta)
|
||||
reqManager.ExecuteCommand(cmd , "borraPassGeocerca")
|
||||
Next
|
||||
If resultado.Rows.Size = 0 Then
|
||||
Msgbox("Contraseña equivocada","ATENCIÓN")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Job.Release
|
||||
End If
|
||||
End Sub
|
||||
@@ -1012,3 +1064,44 @@ End Sub
|
||||
Private Sub p_transYalo_Click
|
||||
p_transYalo.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenteGeocerca_Click
|
||||
p_transparenteGeocerca.Visible = False
|
||||
b_passGeocerca.Enabled = True
|
||||
End Sub
|
||||
|
||||
Private Sub LA_GPS_LongClick
|
||||
p_transparenteGeocerca.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub LA_GEO_LongClick
|
||||
p_transparenteGeocerca.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub b_passGeocerca_Click
|
||||
Log("b_passGeocerca clicked")
|
||||
ToastMessageShow("¡Un momento por favor!", false)
|
||||
b_passGeocerca.Enabled = False
|
||||
If et_passGeocerca.Text.Trim = "KMTS1" Then
|
||||
ToastMessageShow("¡¡Listo!!", False)
|
||||
Starter.skmt.ExecNonQuery($"update kmt_info set cat_cl_lat = '${B4XPages.MainPage.lat_gps}', cat_cl_long = '${B4XPages.MainPage.lon_gps}' where cat_cl_codigo = '${Subs.traeCliente}'"$)
|
||||
m_lat = B4XPages.MainPage.lat_gps : m_lon = B4XPages.MainPage.lon_gps
|
||||
p_transparenteGeocerca.Visible = False
|
||||
et_passGeocerca.text = ""
|
||||
Else
|
||||
' Msgbox("Contraseña equivocada","ATENCIÓN")
|
||||
cmd.Initialize
|
||||
cmd.Name = "traePassGeocerca"
|
||||
cmd.Parameters = Array As Object(Subs.traeAlmacen, Subs.traeRuta, et_passGeocerca.text)
|
||||
|
||||
' c=Starter.skmt.ExecQuery("select CAT_CL_RUTA from kmt_info")
|
||||
' Private r As String = "0"
|
||||
' If c.RowCount > 0 Then
|
||||
' c.Position=0
|
||||
' r = c.GetString("CAT_CL_RUTA")
|
||||
' End If
|
||||
' Log($"${Subs.traeAlmacen}, ${r}, ${et_passGeocerca.text}"$)
|
||||
reqManager.ExecuteQuery(cmd , 0, "traePassGeocerca")
|
||||
End If
|
||||
ime.HideKeyboard
|
||||
End Sub
|
||||
Binary file not shown.
Binary file not shown.
@@ -199,7 +199,7 @@ Version=12.8
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Mariana
|
||||
#VersionCode: 1
|
||||
#VersionName: 5.06.25
|
||||
#VersionName: 5.07.05
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
|
||||
@@ -78,16 +78,16 @@ ModuleClosedNodes23=
|
||||
ModuleClosedNodes24=
|
||||
ModuleClosedNodes25=
|
||||
ModuleClosedNodes26=
|
||||
ModuleClosedNodes27=2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||
ModuleClosedNodes27=2,3,4,5,6,7,8,10,11,12,13,14
|
||||
ModuleClosedNodes28=
|
||||
ModuleClosedNodes29=9,10,11
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=4,10
|
||||
ModuleClosedNodes4=2,4,10,23,24,25,26,27,28,29,30,31,32,33,34,35,37,38,39,40,41,42,44,45
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=Diseñador Visual,login.bal,-100,1,Starter,Service_Start,51,0,Starter,IsConnectedToInternet,158,0,Starter,timerRecordatorio_Tick,162,6,B4XMainPage,i_engrane_Click,771,0,C_Principal,JobDone,1795,0,C_Principal,cargar_Click,971,0,B4XMainPage,p_geocerca_Click,912,0,B4XMainPage,p_transparente_Click,888,0,B4XMainPage,b_passGeocerca_Click,898,6
|
||||
NavigationStack=C_Cliente,B4XPage_Appear,349,6,Tracker,CreateLocationRequest,121,0,Tracker,CreateLocationRequestSmallD,138,0,C_Cliente,GPS_LocationChanged,438,6,C_Cliente,ListView1_ItemLongClick,448,0,Starter,ENVIA_ULTIMA_GPS,100,0,Starter,timerRecordatorio_Tick,163,0,C_Cliente,p_transparenteGeocerca_Click,1072,1,C_Cliente,b_passGeocerca_Click,1076,6,C_Cliente,JobDone,994,1
|
||||
SelectedBuild=0
|
||||
VisibleModules=27,2,12,4,28,15,5,8,14,18,29
|
||||
VisibleModules=27,2,12,4,28,29
|
||||
|
||||
@@ -105,7 +105,6 @@ Sub ENVIA_ULTIMA_GPS
|
||||
Else
|
||||
Log("Sin conexión a internet, no se envió UTR!")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
'Para los Logs
|
||||
@@ -165,8 +164,8 @@ End Sub
|
||||
|
||||
Private Sub timerRecordatorio_Tick
|
||||
'10:30, 13:00 y 15:30
|
||||
Log($"${DateTime.GetHour(DateTime.now)}:${DateTime.GetMinute(DateTime.now)}"$)
|
||||
Log("Revisando la hora - UltimoRecordatorio: " & ultimoRecordatorio)
|
||||
' Log($"${DateTime.GetHour(DateTime.now)}:${DateTime.GetMinute(DateTime.now)}"$)
|
||||
' Log("Revisando la hora - UltimoRecordatorio: " & ultimoRecordatorio)
|
||||
If ultimoRecordatorio <> DateTime.GetHour(DateTime.now) & DateTime.GetMinute(DateTime.now) Then
|
||||
If (DateTime.GetHour(DateTime.now) = 10 And DateTime.GetMinute(DateTime.now) = 20) _ 'Recordatorio de las 10:20
|
||||
Or (DateTime.GetHour(DateTime.now) = 10 And DateTime.GetMinute(DateTime.now) = 25) _ 'Recordatorio de las 10:25
|
||||
|
||||
@@ -1423,9 +1423,10 @@ Sub estamosEnAlmacen(rango As Int) As Boolean
|
||||
latAlmacen = coords(0)
|
||||
lonAlmacen = coords(1)
|
||||
End If
|
||||
' Log($"Coordenadas del almacen - lat:${latAlmacen}, lon:${lonAlmacen}"$)
|
||||
' Log($"Coordenadas del almacen - lat:${latAlmacen}, lon:${lonAlmacen}"$)
|
||||
l2.Initialize2(latAlmacen, lonAlmacen)
|
||||
Dim distance As Long = l1.DistanceTo(l2) 'the result is in meters
|
||||
' Log(distance)
|
||||
If distance <= rango Then res = True
|
||||
' Log("Dentro del almacen: " & res)
|
||||
Catch
|
||||
|
||||
@@ -94,6 +94,7 @@ Public Sub StartFLP
|
||||
' Log("sleeping")
|
||||
Loop
|
||||
' If flpStarted = False Then
|
||||
' FLP.RemoveLocationUpdates
|
||||
' Log("RequestLocationUpdates")
|
||||
FLP.RequestLocationUpdates(CreateLocationRequest) 'Buscamos ubicacion
|
||||
' Log("Buscamos ubicacion")
|
||||
@@ -108,6 +109,7 @@ Public Sub StartFLPSmall
|
||||
Sleep(500)
|
||||
Log("sleeping")
|
||||
Loop
|
||||
' FLP.RemoveLocationUpdates
|
||||
dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
||||
FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
||||
' Log("Buscamos ubicacion Small displacement")
|
||||
@@ -116,11 +118,14 @@ End Sub
|
||||
|
||||
Private Sub CreateLocationRequest As LocationRequest
|
||||
' Log("CreateLocationRequest")
|
||||
' FLP.RemoveLocationUpdates
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(10000) 'Intervalo deseado para actualizaciones de ubicacion
|
||||
lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
||||
lr.SetSmallestDisplacement(50) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.setNumUpdates(5)
|
||||
lr.SetExpirationDuration(10000)
|
||||
lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
||||
actualLR=lr
|
||||
Return lr
|
||||
@@ -128,12 +133,14 @@ End Sub
|
||||
|
||||
Private Sub CreateLocationRequestSmallD As LocationRequest
|
||||
' Log("Iniciamos CreateLocationRequestSmallD")
|
||||
' FLP.RemoveLocationUpdates
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(2000) 'Intervalo deseado para actualizaciones de ubicacion
|
||||
lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
||||
lr.setNumUpdates(2) 'Solicitamos solo 2 actualizaciones con estos parametros
|
||||
lr.SetSmallestDisplacement(0) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.SetExpirationDuration(10000)
|
||||
lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
||||
actualLR=lr
|
||||
Return lr
|
||||
|
||||
Reference in New Issue
Block a user