GPS. Puntos de recoleecion en rutas
This commit is contained in:
@@ -1150,6 +1150,54 @@ Public Class WSGPSApp
|
||||
|
||||
End Function
|
||||
|
||||
<WebMethod>
|
||||
Public Function GetRutas(CveCliente As Integer, CveRuta As Integer, MostrarPuntos As Boolean) As String
|
||||
Dim DtRutas As DataTable = Nothing
|
||||
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetRutas(CveRuta, CveCliente) Then
|
||||
DtRutas = ObjGPS.DtResultados.Copy()
|
||||
End If
|
||||
End Using
|
||||
|
||||
Dim Rutas As New List(Of Object)
|
||||
If DtRutas IsNot Nothing Then
|
||||
For Each Row As DataRow In DtRutas.Rows
|
||||
Dim Coordenadas As List(Of MWSGeolocation2) = Nothing
|
||||
If MostrarPuntos Then
|
||||
Coordenadas = SQLToGmapsPolyline(Row("Poligono").ToString())
|
||||
End If
|
||||
|
||||
Rutas.Add(New With {
|
||||
.CveRuta = Row("CveRuta").ToString().ToEntero(),
|
||||
.Ruta = Row("Ruta").ToString(),
|
||||
.Folio = Row("Folio").ToString(),
|
||||
.Fecha = Row("FechaIng").ToString(),
|
||||
.CveDispositivo = Row("CveDispositivo").ToString().ToEntero(),
|
||||
.CveUsuarioIngreso = Row("CveUsuarioIngreso").ToString().ToEntero(),
|
||||
.Coordenadas = Coordenadas
|
||||
})
|
||||
Next
|
||||
End If
|
||||
|
||||
Return JsonConvert.SerializeObject(Rutas)
|
||||
|
||||
End Function
|
||||
|
||||
<WebMethod>
|
||||
Public Function GetRutaPuntosRecoleecion(CveRuta As Integer) As String
|
||||
Dim Retorno As String = "[]"
|
||||
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetRutasPuntosRecoleecion(CveRuta) Then
|
||||
Retorno = ObjGPS.DtResultados.DataTableToJSONIPP()
|
||||
End If
|
||||
End Using
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
#Region "F U N C I O N E S"
|
||||
Private Function CargarEventos(CveCliente As Integer, FechaI As DateTime, FechaF As DateTime) As MWSDashboard2
|
||||
Dim ObjGPS As New ClsGPS
|
||||
@@ -1225,6 +1273,28 @@ Public Class WSGPSApp
|
||||
Next
|
||||
Return Var
|
||||
End Function
|
||||
Private Function SQLToGmapsPolyline(CoordsSQL As String) As List(Of MWSGeolocation2)
|
||||
Dim CoordsPoligono As String = CoordsSQL.Replace($"LINESTRING", "").Replace(")", "").Replace("(", "")
|
||||
Dim CoordsPuntos() As String = CoordsPoligono.Split(","c)
|
||||
|
||||
Dim puntos As New List(Of MWSGeolocation2)
|
||||
For Each coordenada As String In CoordsPuntos
|
||||
Dim Var As New MWSGeolocation2
|
||||
If coordenada Is CoordsPuntos.Last Then
|
||||
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
||||
Var.Latitud = latlng(1).ToDouble()
|
||||
Var.Longitud = latlng(0).ToDouble()
|
||||
Else
|
||||
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
||||
Var.Latitud = latlng(1).ToDouble()
|
||||
Var.Longitud = latlng(0).ToDouble()
|
||||
End If
|
||||
|
||||
puntos.Add(Var)
|
||||
Next
|
||||
|
||||
Return puntos
|
||||
End Function
|
||||
Private Function GetJson(ByVal dt As DataTable) As String
|
||||
Dim serializer As New System.Web.Script.Serialization.JavaScriptSerializer()
|
||||
Dim rows As New List(Of Dictionary(Of String, Object))()
|
||||
|
||||
Reference in New Issue
Block a user