mirror of
https://github.com/KeymonSoft/Intmex_Reparto_Vieja.git
synced 2026-04-17 21:06:13 +00:00
16/12/23 - Se agregó validacion para que si las coordenadas estan en blanco no mande error.
This commit is contained in:
@@ -141,8 +141,12 @@ Sub MapFragment1_Ready
|
|||||||
rutaAnt = ""
|
rutaAnt = ""
|
||||||
For i = 0 To c.RowCount -1
|
For i = 0 To c.RowCount -1
|
||||||
c.Position = i
|
c.Position = i
|
||||||
LatitudRu = c.GetString("CAT_CL_LAT")
|
' If c.GetString("CAT_CL_LAT") <> "" Then Log("full") Else Log("empty")
|
||||||
LongitudRU = c.GetString("CAT_CL_LONG")
|
' Log($"|${c.GetString("CAT_CL_LAT")}|"$)
|
||||||
|
LatitudRu = 0
|
||||||
|
If c.GetString("CAT_CL_LAT").Length > 3 Then LatitudRu = c.GetString("CAT_CL_LAT")
|
||||||
|
Longitud = 0
|
||||||
|
If c.GetString("CAT_CL_LONG").Length > 3 Then LongitudRU = c.GetString("CAT_CL_LONG")
|
||||||
CODIGO=c.GetString("CAT_CL_CODIGO")
|
CODIGO=c.GetString("CAT_CL_CODIGO")
|
||||||
Tienda= c.GetString("CAT_CL_NOMBRE")
|
Tienda= c.GetString("CAT_CL_NOMBRE")
|
||||||
ruta = c.GetString("CAT_CL_RUTA")
|
ruta = c.GetString("CAT_CL_RUTA")
|
||||||
|
|||||||
14
colonia.bas
14
colonia.bas
@@ -170,7 +170,7 @@ Sub ListView1_ItemClick (Position As Int, Value As Object)
|
|||||||
lrt = Value
|
lrt = Value
|
||||||
laRuta = lrt.SubString(6) 'Quitamos el texto "Ruta: " para obtener el numero de la ruta.
|
laRuta = lrt.SubString(6) 'Quitamos el texto "Ruta: " para obtener el numero de la ruta.
|
||||||
' Log($"Original: ${Value} - Mod: |${lrt.SubString(6)}| - laRuta: ${laRuta}"$)
|
' Log($"Original: ${Value} - Mod: |${lrt.SubString(6)}| - laRuta: ${laRuta}"$)
|
||||||
c2=Starter.skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO, CAT_CL_LAT, CAT_CL_LONG from kmt_info where CAT_CL_RUTA = ? and gestion = 0 order by CAT_CL_NOMBRE ", Array As String(laRuta))
|
c2=Starter.skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO, CAT_CL_LAT, CAT_CL_LONG from kmt_info where CAT_CL_RUTA = ? and gestion = 0 order by CAT_CL_NOMBRE ", Array As String(laRuta))
|
||||||
Private thisLoc As Location
|
Private thisLoc As Location
|
||||||
Private label1 As Label
|
Private label1 As Label
|
||||||
Private label2 As Label
|
Private label2 As Label
|
||||||
@@ -191,8 +191,10 @@ Sub ListView1_ItemClick (Position As Int, Value As Object)
|
|||||||
If c2.RowCount>0 Then
|
If c2.RowCount>0 Then
|
||||||
For i=0 To c2.RowCount -1 'Generamos mapa de clientes
|
For i=0 To c2.RowCount -1 'Generamos mapa de clientes
|
||||||
c2.Position=i
|
c2.Position=i
|
||||||
thisLoc.Latitude = c2.GetString("CAT_CL_LAT")
|
thisLoc.Latitude = 0
|
||||||
thisLoc.Longitude = c2.GetString("CAT_CL_LONG")
|
thisLoc.Longitude = 0
|
||||||
|
If c2.GetString("CAT_CL_LAT").Length > 3 Then thisLoc.Latitude = c2.GetString("CAT_CL_LAT")
|
||||||
|
If c2.GetString("CAT_CL_LONG").Length > 3 Then thisLoc.Longitude = c2.GetString("CAT_CL_LONG")
|
||||||
Private distancia As Int = Tracker.UUGCoords.DistanceTo(thisLoc) 'Calculamos la distancia de la posicion ACTUAL a la tienda.
|
Private distancia As Int = Tracker.UUGCoords.DistanceTo(thisLoc) 'Calculamos la distancia de la posicion ACTUAL a la tienda.
|
||||||
Private esteCliente As Map = CreateMap("distancia": distancia, "ubicacion": thisLoc.Longitude&","&thisLoc.Latitude, "codigo": c2.GetString("CAT_CL_CODIGO"), "nomDirDist": $"${c2.GetString("CAT_CL_NOMBRE")} CALLE: ${c2.GetString("CAT_CL_CALLE")} ${CRLF}Distancia: $1.1{(distancia/1000)} kms"$)
|
Private esteCliente As Map = CreateMap("distancia": distancia, "ubicacion": thisLoc.Longitude&","&thisLoc.Latitude, "codigo": c2.GetString("CAT_CL_CODIGO"), "nomDirDist": $"${c2.GetString("CAT_CL_NOMBRE")} CALLE: ${c2.GetString("CAT_CL_CALLE")} ${CRLF}Distancia: $1.1{(distancia/1000)} kms"$)
|
||||||
distOrderedMap.Put(distancia, esteCliente)
|
distOrderedMap.Put(distancia, esteCliente)
|
||||||
@@ -566,8 +568,10 @@ Sub traeTodosAVisitar As B4XOrderedMap 'ignore
|
|||||||
For j=0 To c2.RowCount -1 'Generamos lista de clientes
|
For j=0 To c2.RowCount -1 'Generamos lista de clientes
|
||||||
c2.Position=j
|
c2.Position=j
|
||||||
' Log($"Renglones clientes: ${c2.RowCount} - j=${j} - Ruta: ${c2.GetString("CAT_CL_CODIGO")}"$)
|
' Log($"Renglones clientes: ${c2.RowCount} - j=${j} - Ruta: ${c2.GetString("CAT_CL_CODIGO")}"$)
|
||||||
thisLoc.Latitude = c2.GetString("CAT_CL_LAT")
|
thisLoc.Latitude = 0
|
||||||
thisLoc.Longitude = c2.GetString("CAT_CL_LONG")
|
thisLoc.Longitude = 0
|
||||||
|
If c2.GetString("CAT_CL_LAT").Length > 3 Then thisLoc.Latitude = c2.GetString("CAT_CL_LAT")
|
||||||
|
If c2.GetString("CAT_CL_LONG").Length > 3 Then thisLoc.Longitude = c2.GetString("CAT_CL_LONG")
|
||||||
If Not(thisLoc.Latitude = 0.0) And Not(thisLoc.Latitude = 0) Then 'Este IF es para que si las coordenadas no son válidas, entonces no las agregue al mapeo, porque el API de OSRM nos manda error.
|
If Not(thisLoc.Latitude = 0.0) And Not(thisLoc.Latitude = 0) Then 'Este IF es para que si las coordenadas no son válidas, entonces no las agregue al mapeo, porque el API de OSRM nos manda error.
|
||||||
Private distancia As Int = ubicacionInicial.DistanceTo(thisLoc) 'Calculamos la distancia del cedis a la tienda.
|
Private distancia As Int = ubicacionInicial.DistanceTo(thisLoc) 'Calculamos la distancia del cedis a la tienda.
|
||||||
If clientesMapaO.ContainsKey(distancia) Then distancia = distancia + 1 'Si por alguna extraña razon hay dos tiendas a la misma distancia del CEDIS, le sumamos 1 para que sea diferente.
|
If clientesMapaO.ContainsKey(distancia) Then distancia = distancia + 1 'Si por alguna extraña razon hay dos tiendas a la misma distancia del CEDIS, le sumamos 1 para que sea diferente.
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ ModuleClosedNodes6=
|
|||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=2,7,11
|
ModuleClosedNodes8=2,7,11
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=fila,gest_Click,263,0,nopago,GUARDA_Click,112,2,seleccion,Globals,83,0,Starter,ENVIA_ULTIMA_GPS,110,0,Main,Process_Globals,28,0,seleccion,Activity_Resume,185,3,seleccion,Subir_Click,464,6,seleccion,cargar_Click,483,0,Subs,revisaBD,191,0,Main,Activity_Create,77,0
|
NavigationStack=seleccion,Globals,83,0,Starter,ENVIA_ULTIMA_GPS,110,0,Main,Process_Globals,28,0,seleccion,Activity_Resume,185,3,seleccion,Subir_Click,464,6,seleccion,cargar_Click,483,0,Subs,revisaBD,191,0,Main,Activity_Create,77,0,MAPA_RUTAS,MapFragment1_Ready,140,6,colonia,ListView1_ItemClick,189,1,colonia,traeTodosAVisitar,565,4
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=19,23,20,18,4,5,8,15,6,9
|
VisibleModules=19,23,20,18,4,5,8,15,6,9,13
|
||||||
|
|||||||
Reference in New Issue
Block a user