- Se agregó un TRY/CATCH en generaMatrizRuteoTiempos, porque a veces en modo Release manda error.

This commit is contained in:
2024-05-03 00:17:35 -06:00
parent 769eeec5b4
commit 433fc32b9a
3 changed files with 26 additions and 22 deletions

View File

@@ -273,7 +273,7 @@ Sub generaMatrizOSRM(ruta As String) As ResumableSub 'ignore
lasCols = $"${lasCols},'${c.GetString("Id")}'"$
End If
Loop
Log(">>>>>>>>>>>> " & lasCols & CRLF & lasCoords)
' Log(">>>>>>>>>>>> " & lasCols & CRLF & lasCoords)
Dim j As HttpJob
j.Initialize("", Me)
j.Download($"http://router.project-osrm.org/table/v1/driving/${lasCoords}"$)
@@ -286,13 +286,13 @@ Sub generaMatrizOSRM(ruta As String) As ResumableSub 'ignore
' StopMessageLoop
Private durs As String = j0.SubString2(j0.IndexOf($""durations""$)+12, j0.IndexOf($""sources""$)).Replace("[","")
Private dur1() As String = Regex.Split("]", durs)
Log(durs)
' Log(durs)
For i = 0 To dur1.Length - 1
Private estosVals As String = dur1(i)
If estosVals.StartsWith(",") Then estosVals = $"${estosVals.SubString(1)}"$
If estosVals.Length > 0 Then
estosVals = $"'${listLasCols.get(i)}',${estosVals}"$
Log(estosVals)
' Log(estosVals)
' Log($"insert into ${ruta}_matrizOSRM (${lasCols}) values (${estosVals})"$)
db.ExecNonQuery($"insert into ${ruta}_matrizOSRM (${lasCols}) values (${estosVals})"$)
End If
@@ -419,15 +419,15 @@ Sub tiempos(ruta As String) As ResumableSub 'ignore
j.Download($"http://router.project-osrm.org/route/v1/driving/${estasCoords}"$)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log("RESPONSE:")
Log(j.GetString)
' Log("RESPONSE:")
' Log(j.GetString)
Private j0 As String = j.GetString
End If
j.Release
' StopMessageLoop
Private js As JSONParser
js.Initialize(j0)
Log(j0)
' Log(j0)
' Log("*****************************************")
' Log(js)
'' For Each colroot As Map In js
@@ -437,11 +437,11 @@ Sub tiempos(ruta As String) As ResumableSub 'ignore
ts.Put(ruta, CreateMap("code":"KO", "duration":0, "distance":0, "puntos":0))
Try
Private m As Map = js.NextObject
Log(m)
' Log(m)
Private estatus As String = m.Get("code")
Private rutas As Map = m.Get("routes").as(List).Get(0)
Private waypoints As List = m.Get("waypoints")
Log("Response: " & estatus)
' Log("Response: " & estatus)
' Log("Duration: " & rutas.Get("duration"))
' Log("Distance: " & rutas.Get("distance"))
' Log("Legs: " & rutas.Get("legs").As(List).Size)
@@ -494,7 +494,7 @@ Sub ruteoNearestInsertion(ruta As String, matriz As String) 'ignore
If final = "" Then 'Si no esta especificado un destino final, se toman las coordenadas del punto mas cercano al punto de inicio.
Private a As ResultSet = db.ExecQuery($"Select idt, ${punteoLista.Get(0)} as laCol, nombre, lat, lon from ${ruta}_matriz${matriz} join ${ruta}_puntos on idT = id where idT <> '${punteoLista.Get(0)}' order by ${punteoLista.Get(0)} asc limit 1"$)
Log($"Select idt, ${punteoLista.Get(0)} as laCol, nombre, lat, lon from ${ruta}_matriz${matriz} join ${ruta}_puntos on idT = id where idT <> '${punteoLista.Get(0)}' order by ${punteoLista.Get(0)} asc limit 1"$)
' Log($"Select idt, ${punteoLista.Get(0)} as laCol, nombre, lat, lon from ${ruta}_matriz${matriz} join ${ruta}_puntos on idT = id where idT <> '${punteoLista.Get(0)}' order by ${punteoLista.Get(0)} asc limit 1"$)
' Log(a.GetString("idt"))
Do While a.NextRow
If punteoLista.IndexOf(a.GetString("idt")) = -1 Then