commit general local oscar

This commit is contained in:
Rakcsle Supertramp
2020-02-10 18:13:33 -07:00
parent 22b0e02311
commit e610d01cd7
18 changed files with 1798 additions and 1336 deletions

View File

@@ -127,6 +127,7 @@ Partial Class GPS_Rastreo
CargaDispositivos()
CargaEventos()
CargaGrupos()
CargaGruposPI()
CreaTmpDTDetalle()
IndiceGV = 0
End If
@@ -144,6 +145,16 @@ Partial Class GPS_Rastreo
RegistraScript("$('#C_GvDispositivos_chkSelectAll').click(function () { $("".ChkAllEvt input"").not(this).prop('checked',$(this).is(':checked')); });", "1")
End Sub
Private Sub CargaGruposPI()
Dim ObjGPS As New ClsGPS
If ObjGPS.PuntoDeInteresGrupoGet(-1, 1) Then
GvGrupos.DataSource = ObjGPS.DtResultados
End If
ObjGPS.Dispose()
GvGrupos.DataBind()
UpAgregarPuntoInteres.Update()
End Sub
Private Sub CargaEventos()
Dim GPS As New ClsGPS
@@ -325,41 +336,33 @@ Partial Class GPS_Rastreo
Mensajes = Mensajes + $"{GVRow.DataKey("NoEconomico").ToString},"
End If
End If
ElseIf Opcion = "All" Then
'Dim CveDispositivo = GVRow.DataKey("CveDispositivo").ToEntero
'Dim RowDispositivo As DataRow = GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimero($"CveDispositivo = {CveDispositivo}")
'Dim json As JObject = GPS.GetPosicionEquipoJson(CveDispositivo, FechaI, FechaF, RowDispositivo("Icono").ToString, RowDispositivo("ColorTrazo").ToString, GVRow.DataKey("NombreVehiculo").ToString, UsuarioActual.TienePermisoProceso(200))
'HdnJSScript.Value = json.ToString()
'DtPosiciones = GPS.DtPosicionesResultados '.AsEnumerable().Take(1000).CopyToDataTable()
'UpDatosMapa.Update()
'RegistraScript($"CargaHistorico(); PreparaDibujadoHistorico();PreparaDibujado(3);")
If ChkTrazarGeocercas.Checked Then
Dim DtGeocercas As DataTable = Nothing
If GPS.GetReferenciaDetalle(-1, -1, GVRow.DataKey("CveDispositivo").ToEntero, UsuarioActual.CveCliente) Then
DtGeocercas = GPS.DtResultados.FiltraParametros("EsParada = False And Tipo='Geocerca' AND Estatus = 1")
End If
'SI TIENE GEOREFERENCIAS LAS MOSTRAMOS
If DtGeocercas IsNot Nothing Then
Dim SbJS As New StringBuilder
SbJS.Append("$('#LnkMostarGeocercas').css('display', 'block'); setTimeout(function(){ ")
For Each Dr As DataRow In DtGeocercas.Rows
Dim CoordsParada = SQLToGmapsJArray(Dr("Coordenadas").ToString, "POLYGON")
SbJS.AppendFormat(" creaPoligonoGeocerca({0},'{1}','{2}'); ", CoordsParada.ToString, Dr("Color").ToString, Dr("GeoReferencia").ToString)
Next
SbJS.Append(" VerGeocercas(); },1000);")
RegistraScript(SbJS.ToString)
End If
Else
RegistraScript("$('#LnkMostarGeocercas').css('display', 'none');")
End If
If ChkTrazarGeocercas.Checked Then
MostrarGeoCercas()
End If
If ChkTrazarGeorutas.Checked Then
MostrarGeoRutas()
End If
If ChkTrazarPuntosInteres.Checked Then
MostrarPuntosDeInteres()
End If
ElseIf Opcion = "All" Then
If ChkTrazarGeocercas.Checked Then
MostrarGeoCercas()
End If
If ChkTrazarGeorutas.Checked Then
MostrarGeoRutas()
End If
If ChkTrazarPuntosInteres.Checked Then
MostrarPuntosDeInteres()
End If
If GPS.GetPosicionEquipo(GVRow.DataKey("CveDispositivo").ToEntero, FechaI, FechaF) Then
If GPS.DtResultados.Rows.Count > 0 Then
@@ -572,7 +575,20 @@ Partial Class GPS_Rastreo
End If
RegistraScript($"CreaMarcador({Coord},'{row("NombreVehiculo")}', '{Info}', '{Icono}');", row("CveDispositivo").ToString)
AddRowPosiciones(Vehiculo, Coord, row("SPD").ToString.ToDouble, Fecha, row("CveDispositivo").ToString.ToEntero, row("TiempoDetenido").ToString.ToDouble)
Next
Next
If ChkTrazarGeocercas.Checked Then
MostrarGeoCercas()
End If
If ChkTrazarGeorutas.Checked Then
MostrarGeoRutas()
End If
If ChkTrazarPuntosInteres.Checked Then
MostrarPuntosDeInteres()
End If
Else
Alert($"No se encontraron resultados")
End If
@@ -619,15 +635,16 @@ Partial Class GPS_Rastreo
Next
If ChkTrazarGeocercas.Checked Then
Dim Dispositivos As String = Equipos.Replace(";", ",").Remove(Equipos.Length - 1, 1)
CargaGeocercas(Dispositivos)
MostrarGeoCercas()
End If
If ChkTrazarGeorutas.Checked Then
MostarGeoRutas()
MostrarGeoRutas()
End If
If ChkTrazarPuntosInteres.Checked Then
MostrarPuntosDeInteres()
End If
RegistraScript("setTimeout(function(){ $('#LnkMostarGeocercas').css('display', 'block'); },1000);")
Else
Alert($"No se encontraron resultados", TipoMensaje.MsgAdvertencia)
End If
@@ -702,29 +719,47 @@ Partial Class GPS_Rastreo
GPS.Dispose()
End Sub
Private Sub CargaGeocercas(Dispositivos As String)
Dim DtGeocercas As DataTable = Nothing
Dim ObjGPSGeo As New ClsGPS
If ObjGPSGeo.GetReferenciaDetalle(-1, -1, -1, UsuarioActual.CveCliente) Then
DtGeocercas = ObjGPSGeo.DtResultados.FiltraParametros("EsParada = False AND Tipo='Geocerca' AND Estatus = 1")
End If
ObjGPSGeo.Dispose()
'SI TIENE GEOREFERENCIAS LAS MOSTRAMOS
If DtGeocercas IsNot Nothing Then
Dim DtParadasDispositivo = DtGeocercas.FiltraParametros($"CveDispositivo IN({Dispositivos})", "", {"Color", "GeoReferencia", "Coordenadas"})
Dim SbJS As New StringBuilder
SbJS.Append("$('#LnkMostarGeocercas').css('display', 'block'); setTimeout(function(){ ")
For Each Dr As DataRow In DtParadasDispositivo.Rows
SbJS.AppendFormat(" creaPoligonoGeocerca({0},'{1}','{2}'); ", SQLToGmapsJArray(Dr("Coordenadas").ToString, "POLYGON"), Dr("Color").ToString, Dr("GeoReferencia").ToString)
Next
SbJS.Append(" VerGeocercas(); },1000);")
RegistraScript(SbJS.ToString)
End If
Try
Dim DtGeocercas As DataTable = Nothing
Dim ObjGPSGeo As New ClsGPS
If ObjGPSGeo.GetReferenciaDetalle(-1, -1, -1, UsuarioActual.CveCliente) Then
DtGeocercas = ObjGPSGeo.DtResultados.FiltraParametros("EsParada = False AND Tipo='Geocerca' AND Estatus = 1")
End If
ObjGPSGeo.Dispose()
'SI TIENE GEOREFERENCIAS LAS MOSTRAMOS
If DtGeocercas IsNot Nothing Then
Dim DtParadasDispositivo = DtGeocercas.FiltraParametros($"CveDispositivo IN({Dispositivos})", DistinctColumns:={"GeoReferencia", "Coordenadas", "Color"})
GvGeoCercas.DataSource = DtParadasDispositivo
GvGeoCercas.DataBind()
End If
Catch ex As Exception
OnError("Ocurrió un error al consultar las geocercas", ex)
End Try
UpGeoCercas.Update()
End Sub
Private Sub MostarGeoRutas()
Private Sub MostrarGeoCercas()
Dim count = 0
RegistraScript($"initGeoRutas();", count.ToString())
Try
RegistraScript($"NuevaConsultaGeoCercas();", count.ToString())
For Each GvRow As GridViewRow In GvGeoCercas.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkGeo").Checked Then
count += 1
RegistraScript(String.Format("creaPoligonoGeocerca({0},'{1}','{2}'); ", SQLToGmapsJArray(GvRow.DataKey("Coordenadas"), "POLYGON"), GvRow.DataKey("Color"), GvRow.DataKey("GeoReferencia")), count.ToString())
End If
End If
Next
RegistraScript("VerGeocercas();", (count + 1).ToString())
Catch ex As Exception
OnError("Ocurrió un error al consultar las geocercas", ex)
End Try
End Sub
Private Sub MostrarGeoRutas()
Dim count = 0
RegistraScript($"NuevaConsultaGeoRutas();", count.ToString())
For Each GvRow As GridViewRow In GvGeorutas.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
@@ -736,6 +771,20 @@ Partial Class GPS_Rastreo
End If
Next
End Sub
Private Sub MostrarPuntosDeInteres()
RegistraScript($"NuevaConsultaPI();", "0")
For Each GvRow As GridViewRow In GVPuntosInteres.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkPI").Checked Then
Dim coords = SQLToGmaps(GvRow.DataKey("Punto"), "POINT")
RegistraScript($"CreaMarcadorPI({coords}, '{GvRow.DataKey("PuntoDeInteres").ToString}')", GvRow.RowIndex.ToString())
End If
End If
Next
End Sub
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
@@ -778,7 +827,6 @@ Partial Class GPS_Rastreo
End If
End If
If chkTrazarLinea.Checked Then
TrazarLineaContinuo = True
CreaDTCoordenadas()
@@ -1144,10 +1192,18 @@ Partial Class GPS_Rastreo
Protected Sub CargaOpcion(opcion As String)
TimmerRefresh.Enabled = False
HdnOpcion.Value = opcion
HdnOpcion.Value = opcion
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
chkTrazarLinea.Checked = False
ChkTrazarGeocercas.Checked = False
ChkTrazarGeorutas.Checked = False
ChkTrazarPuntosInteres.Checked = False
chkTrazarLinea.Visible = False
ChkTrazarGeocercas.Visible = False
DvPaginacion.Visible = False
rowImpresionesKM.Visible = False
If opcion = "All" Then
@@ -1158,6 +1214,7 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = False
dvTrazoGeo.Visible = True
dvTrazoRutas.Visible = True
dvTrazoPI.Visible = True
ChkTrazarGeocercas.Visible = True
dvMinutos.Visible = False
RegistraScript("$('#dvConsulta').modal();TerminaDibujado();")
@@ -1172,6 +1229,7 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
dvMinutos.Visible = False
BtnRastrear.ValidationGroup = "GrpFechas"
RegistraScript("$('#dvConsulta').modal();TerminaDibujado();")
@@ -1184,6 +1242,7 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
dvDispositivos.Visible = True
dvMinutos.Visible = False
GvDispositivos.DataSource = GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario).FiltraParametros("Estatus = 1 AND LimiteVelocidad = 1")
@@ -1201,6 +1260,7 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
dvMinutos.Visible = True
dvEventos.Visible = False
BtnRastrear.ValidationGroup = "GrpFechas"
@@ -1214,6 +1274,7 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
dvMinutos.Visible = False
dvEventos.Visible = False
BtnRastrear.ValidationGroup = "GrpFechas"
@@ -1223,8 +1284,9 @@ Partial Class GPS_Rastreo
dvFechas.Visible = False
dvDispositivos.Visible = True
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoGeo.Visible = True
dvTrazoRutas.Visible = True
dvTrazoPI.Visible = True
dvMinutos.Visible = False
dvEventos.Visible = False
BtnRastrear.ValidationGroup = "xx"
@@ -1236,23 +1298,13 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = True
dvTrazoGeo.Visible = True
dvTrazoRutas.Visible = True
dvTrazoPI.Visible = True
dvEventos.Visible = False
BtnRastrear.ValidationGroup = "xx"
RegistraScript("$('#dvConsulta').modal();TerminaDibujado();")
myModalLabel2.InnerHtml = "Rastreo Continuo"
chkTrazarLinea.Visible = True
ChkTrazarGeocercas.Visible = True
ElseIf opcion = "Watch" Then
dvFechas.Visible = False
dvDispositivos.Visible = True
dvMinutos.Visible = False
dvTrazo.Visible = True
dvTrazoGeo.Visible = True
dvTrazoRutas.Visible = True
dvEventos.Visible = False
BtnRastrear.ValidationGroup = "xx"
RegistraScript("$('#dvConsulta').modal();TerminaDibujado();")
myModalLabel2.InnerHtml = "Rastreo Continuo"
ElseIf opcion = "KM" Then
dvFechas.Visible = True
dvDispositivos.Visible = False
@@ -1260,6 +1312,7 @@ Partial Class GPS_Rastreo
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
dvEventos.Visible = False
BtnRastrear.ValidationGroup = "xx"
RegistraScript("$('#dvConsulta').modal();TerminaDibujado();")
@@ -1267,7 +1320,11 @@ Partial Class GPS_Rastreo
ElseIf opcion = "TPS" Then
dvFechas.Visible = False
dvDispositivos.Visible = True
dvMinutos.Visible = False
dvMinutos.Visible = False
dvTrazo.Visible = False
dvTrazoGeo.Visible = False
dvTrazoRutas.Visible = False
dvTrazoPI.Visible = False
DivFechasGVBarra.Visible = False
GvDispositivos.DataSource = GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario).FiltraParametros("CveModelo = 17")
GvDispositivos.DataBind()
@@ -1275,24 +1332,35 @@ Partial Class GPS_Rastreo
dvEventos.Visible = False
RegistraScript("$('#dvConsulta').modal();TerminaDibujado();")
myModalLabel2.InnerHtml = "Contador de pasajeros"
End If
If Not dvTrazoGeo.Visible Then
RegistraScript("$('#LnkMostarGeocercas').css('display', 'none');")
End If
If dvTrazoRutas.Visible Then
CargaGeoRutas()
Else
RegistraScript("$('#LnkMostarGeoRutas').css('display', 'none');")
End If
If dvTrazoPI.Visible Then
CargaPI()
Else
RegistraScript("$('#LnkMostarPI').css('display', 'none');")
End If
If opcion <> "Speed" AndAlso opcion <> "TPS" AndAlso Filtrado Then
CargaDispositivos()
Filtrado = False
End If
RegistraScript("$(""#h"").modal('hide');
$(""#ShowDiv3"").css(""line-height"", ""20px"");
open = false;
$(""#ShowDiv3"").html('<i class=""fa fa-angle-up"" aria-hidden=""True""></i>');", "HideDiv")
RegistraScript("$(""input[name^='ctl00$C$GvDispositivos']"").not(this).prop('checked', false);$('#C_GvDispositivos_chkSelectAll').click(function () { $(""input[name^='ctl00$C$GvDispositivos']"").not(this).prop('checked', this.checked); });", "chkGV")
UPConsulta.Update()
End Sub
@@ -2158,12 +2226,39 @@ Partial Class GPS_Rastreo
End Using
Return retorno
End Function
#Region "G E O R U T A S"
#Region "G E O R E F E R E N C I A S"
Protected Sub ChkTrazarGeocercas_CheckedChanged(sender As Object, e As EventArgs)
If ChkTrazarGeocercas.Checked Then
Dim CountEquipos As Integer = 0
Dim Equipos As New StringBuilder()
For Each row As GridViewRow In GvDispositivos.Rows
If row.FCCheckBox("chkDis").Checked Then
CountEquipos += 1
Equipos.Append($"{row.DataKey("CveDispositivo")};")
End If
Next
If CountEquipos > 0 Then
Dim Dispositivos As String = Equipos.Replace(";", ",").Remove(Equipos.Length - 1, 1).ToString()
CargaGeocercas(Dispositivos)
RegistraScript("$('#DivGeoCercas').modal('show');")
Else
Alert("No hay equipos seleccionados", TipoMensaje.MsgAdvertencia)
End If
End If
End Sub
Protected Sub ChkTrazarGeorutas_CheckedChanged(sender As Object, e As EventArgs)
If ChkTrazarGeorutas.Checked Then
RegistraScript("$('#DivGeoRutas').modal('show');")
End If
End Sub
Protected Sub ChkTrazarPI_CheckedChanged(sender As Object, e As EventArgs)
If ChkTrazarPuntosInteres.Checked Then
RegistraScript("$('#DivMostrarPI').modal('show');")
End If
End Sub
Private Sub CargaGeoRutas()
Dim ObjGPS As New ClsGPS
@@ -2175,6 +2270,49 @@ Partial Class GPS_Rastreo
UpGeorutas.Update()
End Sub
Private Sub CargaPI()
Dim ObjGPS As New ClsGPS
If ObjGPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GVPuntosInteres.DataSource = ObjGPS.DtResultados
End If
ObjGPS.Dispose()
GVPuntosInteres.DataBind()
UpMostarPI.Update()
End Sub
#End Region
Protected Sub GvGrupos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvGrupos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onClick", $"CargaDatosSeleccionadosPI({e.Row.RowIndex}, '{e.Row.DBCampo("CvePuntoDeInteresGrupo").ToString}');")
End If
End Sub
Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click
Dim HuboError = False
Dim ObjGPS As New ClsGPS
ObjGPS.IniciaTransacSQL()
Try
Dim GEOM As String = $"POINT{GeoCerca.Value}"
If Not ObjGPS.PuntoDeInteresAdd(TxtNombrePI.Text, UsuarioActual.CveCliente, GEOM, True, TxtDescripcion.Text, HdnGrupo.Value.ToEntero) Then
HuboError = True
End If
Catch ex As Exception
HuboError = True
OnError("Ocurrió un error al agregar el punto de interés", ex)
End Try
If HuboError Then
ObjGPS.RollBack()
Else
ObjGPS.Commit()
TxtDescripcion.Text = ""
TxtNombre.Text = ""
Alert("El punto de interés se agregó correctamente", TipoMensaje.MsgInformacion)
RegistraScript("$('#DivAgregarPuntoInteres').modal('hide');DeleteMarkersG();", "1")
End If
UpAgregarPuntoInteres.Update()
End Sub
End Class