mirror of
https://github.com/KeymonSoft/Guna_Reparto_Imp.git
synced 2026-04-19 21:59:31 +00:00
- VERSION 5.03.08
- Se agregó codigo para la confirmacion de pagares mediante WhatsApp en Cliente. - Se agregaron 270 segundos (4.5 minutos) al tiempo calculado en el ruteo de Clientes. - Se hicieorn mas pequeños los números de los globitos en MAPAS_RUTAS, de 20 a 15. - Se puso un toastMessage cuando las coordenadas del CEDIS están en CERO.
This commit is contained in:
@@ -31,6 +31,7 @@ Sub Class_Globals
|
||||
Private b_limpiarRuta As Button
|
||||
Dim rutaGenerada As Boolean = False
|
||||
Dim rutaacambiar As String
|
||||
Dim mostrarProgressDialog As Boolean
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -100,7 +101,7 @@ Sub B4XPage_Appear
|
||||
Subs.centraEtiqueta(l_rutaInfo, Root.Width)
|
||||
Subs.centraListView(ListView1, p_colonia.Width)
|
||||
ListView1.Height = p_colonia.Height * 0.70
|
||||
Subs.centraEtiqueta(lfila, Root.Width)
|
||||
Subs.centraEtiqueta(lfila, Root.Width + (b_getRutaInfo.Width / 2))
|
||||
b_getRutaInfo.Visible = True
|
||||
b_getRutaInfo.BringToFront
|
||||
If Starter.cedisLocation.Latitude = "0" Then
|
||||
@@ -113,9 +114,12 @@ Sub B4XPage_Appear
|
||||
End If
|
||||
End If
|
||||
Log(Starter.cedisLocation)
|
||||
If mostrarProgressDialog = True Then
|
||||
ProgressDialogShow2("Calculando distancia y tiempo, un momento por favor.", False)
|
||||
mostrarProgressDialog = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
' BACK key pressed
|
||||
'Return True to close, False to cancel
|
||||
@@ -244,7 +248,7 @@ End Sub
|
||||
|
||||
Sub BUSCA_TextChanged (Old As String, New As String)
|
||||
q_buscar = "%" & busca.Text & "%"
|
||||
c2=Starter.skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where CAT_CL_NOMBRE like ? and gestion = 0 AND CAT_CL_RUTA <> 1000 order by CAT_CL_CODIGO ", Array As String(q_buscar))
|
||||
c2=Starter.skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where CAT_CL_NOMBRE like ? and gestion = 0 AND CAT_CL_RUTA <> 1000 order by CAT_CL_CODIGO ", Array As String(q_buscar))
|
||||
ListView1.Clear
|
||||
lfila.text = "Nombre y Calle"
|
||||
Subs.SetDivider(ListView1, Colors.Blue, 2)
|
||||
@@ -278,6 +282,7 @@ Sub distanciaEntreCoords(id As String, coords1 As String, coords2 As String) As
|
||||
Dim j As HttpJob
|
||||
j.Initialize("", Me)
|
||||
j.Download("https://router.project-osrm.org/route/v1/driving/"&coords1&";"&coords2&"?overview=false")
|
||||
Log(("https://router.project-osrm.org/route/v1/driving/"&coords1&";"&coords2&"?overview=false"))
|
||||
Wait For (j) JobDone(j As HttpJob)
|
||||
If j.Success Then
|
||||
Dim jp As JSONParser
|
||||
@@ -646,7 +651,7 @@ Sub caculaRutaGPS(coords As List, agregarActual As Boolean)
|
||||
For i = 0 To coords.Size - 1
|
||||
Private ti As Map = coords.Get(i)
|
||||
Starter.skmt.ExecNonQuery($"update kmt_info set SECUENCIA = ${ti.Get("pos")} where CAT_CL_CODIGO = '${ti.Get("id").As(String).SubString(1)}'"$) ' Ponemos la secuencia con el orden del ruteo para poder verla en el mapa.
|
||||
Starter.skmt.ExecNonQuery($"insert into waypoints (codigo, indice) values ('${ti.Get("id").As(String).SubString(1)}', '${ti.Get("pos")}')"$)
|
||||
Starter.skmt.ExecNonQuery($"insert into waypoints (codigo, indice) values ('${ti.Get("id").As(String).SubString(1)}', '${ti.Get("pos")}')"$)
|
||||
Next
|
||||
c = Starter.skmt.ExecQuery("select codigo, indice, CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_NOEXT, CAT_CL_LAT, CAT_CL_LONG from waypoints inner join kmt_info on waypoints.codigo = kmt_info.CAT_CL_CODIGO where gestion = 0 AND CAT_CL_RUTA <> 1000 order by indice")
|
||||
If c.RowCount > 0 Then 'Ya hay waypoints en la base de datos.
|
||||
@@ -674,6 +679,9 @@ Sub caculaRutaGPS(coords As List, agregarActual As Boolean)
|
||||
Private pri As String = $"${primerLon},${primerLat}"$
|
||||
Private ult As String = $"${ultimaLon},${ultimaLat}"$
|
||||
Private ced As String = Starter.cedisLocation.Longitude & "," & Starter.cedisLocation.Latitude
|
||||
If Starter.cedisLocation.Longitude = 0 Or Starter.cedisLocation.Latitude = 0 Then
|
||||
ToastMessageShow("Las coordenadas del CEDIS NO deben estar en CERO", True)
|
||||
End If
|
||||
Private ubiActual As String = Starter.inicioLon & "," & Starter.inicioLat
|
||||
Wait For(distanciaEntreCoords("aaaa", pri, ubiActual)) Complete (r As List)
|
||||
Log("DistToPrimero: " & r)
|
||||
@@ -681,12 +689,13 @@ Sub caculaRutaGPS(coords As List, agregarActual As Boolean)
|
||||
Wait For(distanciaEntreCoords("aaaa", ult, ced)) Complete (r As List)
|
||||
Log("DistToUltimo: " & r)
|
||||
Private DistToUltimo As String = NumberFormat2((r.Get(1)/1000), 1, 2, 0, True)
|
||||
duration = duration + (270 * puntos) ' Agregamoms 4.5 minutos por parada/tienda - 270 segundos = 4.5 minutos
|
||||
Log($"Distancia total: $1.1{distance/1000} kms, tiempo aprox: $1.1{duration/60} mins. ($1.1{duration/60/60} hrs)"$)
|
||||
l_rutaInfo.Text = $"Actual a primer tienda: ${distToPrimero} kms
|
||||
Distancia: $1.1{distance/1000} kms, tiempo aprox: 5.8 hrs${CRLF}Visitas restantes: ${puntos + 1}
|
||||
Última tienda a CEDIS: 1.2 kms"$
|
||||
Distancia: $1.1{distance/1000} kms, tiempo aprox: $1.1{duration/60/60} hrs${CRLF}Visitas restantes: ${puntos + 1}
|
||||
Última tienda a CEDIS: ${DistToUltimo} kms"$
|
||||
' Distancia: $1.1{distance/1000} kms, tiempo aprox: $1.1{duration/60/60} hrs${CRLF}Visitas restantes: ${puntos - 1}
|
||||
' Última tienda a CEDIS: ${DistToUltimo} kms"$
|
||||
Log($"Última tienda a CEDIS: ${DistToUltimo} kms"$)
|
||||
l_rutaInfo.Width = Root.Width * 0.9
|
||||
Subs.centraEtiqueta(l_rutaInfo, Root.Width)
|
||||
l_rutaInfo.Visible = True
|
||||
|
||||
Reference in New Issue
Block a user