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:
14
colonia.bas
14
colonia.bas
@@ -170,7 +170,7 @@ Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
lrt = Value
|
||||
laRuta = lrt.SubString(6) 'Quitamos el texto "Ruta: " para obtener el numero de la ruta.
|
||||
' 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 label1 As Label
|
||||
Private label2 As Label
|
||||
@@ -191,8 +191,10 @@ Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1 'Generamos mapa de clientes
|
||||
c2.Position=i
|
||||
thisLoc.Latitude = c2.GetString("CAT_CL_LAT")
|
||||
thisLoc.Longitude = c2.GetString("CAT_CL_LONG")
|
||||
thisLoc.Latitude = 0
|
||||
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 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)
|
||||
@@ -566,8 +568,10 @@ Sub traeTodosAVisitar As B4XOrderedMap 'ignore
|
||||
For j=0 To c2.RowCount -1 'Generamos lista de clientes
|
||||
c2.Position=j
|
||||
' Log($"Renglones clientes: ${c2.RowCount} - j=${j} - Ruta: ${c2.GetString("CAT_CL_CODIGO")}"$)
|
||||
thisLoc.Latitude = c2.GetString("CAT_CL_LAT")
|
||||
thisLoc.Longitude = c2.GetString("CAT_CL_LONG")
|
||||
thisLoc.Latitude = 0
|
||||
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.
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user