Notificaciones de Trayectos P1
This commit is contained in:
@@ -4714,11 +4714,11 @@ Public Class ClsGPS
|
||||
OnError("Ocurrió un error al eliminar los costos del kilometro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "T R A Y E C T O S"
|
||||
Public Function AddTrayecto(Trayecto As String, Fecha As DateTime, Folio As String, CveDispositivo As Integer, CveCliente As Integer) As Integer
|
||||
Public Function AddTrayecto(Trayecto As String, Fecha As DateTime, Folio As String, CveDispositivo As Integer, CveCliente As Integer, Optional EnviarNotificacion As Boolean = False, Optional CorreosNotificacion As String = "", Optional Intervalo As Integer = 0, Optional EnviarLiga As Boolean = False) As Integer
|
||||
Dim retorno As Integer = 0
|
||||
DataAdapter("PA_GPS_TrayectosAdd", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -4727,6 +4727,10 @@ Public Class ClsGPS
|
||||
.Add("@Folio", SqlDbType.VarChar).Value = Folio
|
||||
.Add("@CveDispositivo", SqlDbType.Int).Value = CveDispositivo
|
||||
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
.Add("@EnviarNotificacion", SqlDbType.Bit).Value = EnviarNotificacion
|
||||
.Add("@CorreosNotificacion", SqlDbType.VarChar).Value = CorreosNotificacion
|
||||
.Add("@Intervalo", SqlDbType.Int).Value = Intervalo
|
||||
.Add("@EnviarLiga", SqlDbType.Bit).Value = EnviarLiga
|
||||
.Add("@CveTrayecto", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
End With
|
||||
|
||||
|
||||
@@ -316,67 +316,7 @@
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<%-- <asp:UpdatePanel ID="UpBodyTipoEquipo" UpdateMode="Conditional" runat="server">
|
||||
<ContentTemplate>
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 15px;">
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnApagarMotor" CssClass="btn btn-danger" Text="Apagar Motor" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" style="padding-right: 0px">
|
||||
<asp:TextBox ID="TxtTelefonoPanico" runat="server" Style="width: 150px; height: 100%; float: right;" Type="number" MaxLength="10" />
|
||||
<asp:RequiredFieldValidator ID="RFVTelefonoPanico" runat="server" ControlToValidate="TxtTelefonoPanico" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Telefono''</b> es necesario, por favor ingréselo." ValidationGroup="GrpBotonPanico"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCETelefonoPanico" runat="server" HighlightCssClass="vco" TargetControlID="RFVTelefonoPanico" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnTelefonoPanico" CssClass="btn btn-danger" Text="Telefono Panico" ValidationGroup="GrpBotonPanico" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 15px;">
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnEncenderMotor" CssClass="btn btn-success" Text="Encender Motor" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" style="padding-right: 0px">
|
||||
<asp:DropDownList CssClass="form-control input-sm" Style="float: right; height: 100%;" ID="DdlTipoBateria" runat="server" Width="150px">
|
||||
<asp:ListItem Value="0" Text="ST Solo en Movimiento"></asp:ListItem>
|
||||
<asp:ListItem Value="1" Text="Intervalos de Tiempo" Selected="True"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnAhorroBateria" CssClass="btn btn-success" Text="Ahorro Bateria" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 15px;">
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnProbarEncendido" CssClass="btn btn-primary" Text="Abrir Compuerta" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnInfoDispositivo" CssClass="btn btn-primary" Text="Cerrar Compuerta" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<asp:LinkButton runat="server" Style="width: 150px; text-align: center" ID="BtnReinicio" CssClass="btn btn-primary" Text="Reiniciar" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>--%>
|
||||
</div>
|
||||
<%--<div class="modal-footer">
|
||||
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton ID="BtnBuscarEquipoC" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='fa fa-search '></i> Buscar</asp:LinkButton>
|
||||
<button id="btnCancelar" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>--%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
@@ -1063,6 +1003,7 @@
|
||||
CalculaDireccionHistorica(coord, j, ejecutar)
|
||||
}
|
||||
}
|
||||
|
||||
function CalculaDireccionHistorica(coord, j, ejecutar) {
|
||||
setTimeout(function () {
|
||||
var url = '<%= ClsPaginas.UrlDirecciones%>' + 'nominatim/reverse.php?format=jsonv2&lat=' + coord.lat + '&lon=' + coord.lng;
|
||||
@@ -1077,7 +1018,8 @@
|
||||
}
|
||||
});
|
||||
}, timeout + (j));
|
||||
}
|
||||
}
|
||||
|
||||
function CalculaRutaHistorica(coordenadasRuta, lastCoord) {
|
||||
if (coordenadasRuta.length > 0) {
|
||||
var flag = 1;
|
||||
|
||||
679
GPS/RastreoTrayectos.aspx
Normal file
679
GPS/RastreoTrayectos.aspx
Normal file
@@ -0,0 +1,679 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="RastreoTrayectos.aspx.vb" Inherits="GPS_RastreoTrayectos" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style type="text/css">
|
||||
.ADScroller-body {
|
||||
max-height: 400px;
|
||||
}
|
||||
|
||||
.dataTables_scrollHeadInner > table {
|
||||
background: lightgray;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.dataTable th.focus, table.dataTable td.focus {
|
||||
outline: 3px solid #3366ff00;
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
.CustomSpinner {
|
||||
position: fixed;
|
||||
background-image: url(/Imagenes/Loading.gif);
|
||||
background-repeat: no-repeat, repeat;
|
||||
background-size: contain;
|
||||
top: 60px;
|
||||
right: 25px;
|
||||
z-index: 500000;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
}
|
||||
/*.page-head {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-breadcrumb .breadcrumb {
|
||||
display: none;
|
||||
}
|
||||
#barradenavegacion {
|
||||
display:none;
|
||||
}*/
|
||||
|
||||
#showdiv1 {
|
||||
left: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
#ShowDiv3:hover {
|
||||
line-height: 34px !important;
|
||||
-webkit-transition: line-height ease 1s;
|
||||
-moz-transition: line-height ease 1s;
|
||||
-o-transition: line-height ease 1s;
|
||||
transition: line-height ease 1s;
|
||||
}
|
||||
|
||||
#map {
|
||||
position: fixed !important;
|
||||
}
|
||||
|
||||
.pac-container.pac-logo {
|
||||
z-index: 100000;
|
||||
}
|
||||
|
||||
#iw-container {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#iw-container .iw-title {
|
||||
font-family: 'Open Sans Condensed', sans-serif;
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
padding: 10px;
|
||||
background-color: #48b5e9;
|
||||
color: white;
|
||||
margin: 0;
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
|
||||
#iw-container .iw-content {
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
font-weight: 400;
|
||||
margin-right: 1px;
|
||||
padding: 15px 5px 20px 15px;
|
||||
max-height: 140px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.iw-content img {
|
||||
float: right;
|
||||
margin: 0 5px 5px 10px;
|
||||
}
|
||||
|
||||
.iw-subTitle {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.iw-bottom-gradient {
|
||||
position: absolute;
|
||||
width: 326px;
|
||||
height: 25px;
|
||||
bottom: 10px;
|
||||
right: 18px;
|
||||
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
||||
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
||||
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
||||
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
|
||||
}
|
||||
|
||||
.modal.fade:not(.in).left .modal-dialog {
|
||||
-webkit-transform: translate3d(-25%, 0, 0);
|
||||
transform: translate3d(-25%, 0, 0);
|
||||
}
|
||||
|
||||
.modal.fade:not(.in).right .modal-dialog {
|
||||
-webkit-transform: translate3d(25%, 0, 0);
|
||||
transform: translate3d(25%, 0, 0);
|
||||
}
|
||||
|
||||
.modal.fade:not(.in).bottom .modal-dialog {
|
||||
-webkit-transform: translate3d(0, 25%, 0);
|
||||
transform: translate3d(0, 25%, 0);
|
||||
}
|
||||
|
||||
/* Alternative Angles */
|
||||
.modal.fade:not(.in).top-left .modal-dialog {
|
||||
-webkit-transform: translate3d(-25%, -25%, 0);
|
||||
transform: translate3d(-25%, -25%, 0);
|
||||
}
|
||||
|
||||
.modal.fade:not(.in).top-right .modal-dialog {
|
||||
-webkit-transform: translate3d(25%, -25%, 0);
|
||||
transform: translate3d(25%, -25%, 0);
|
||||
}
|
||||
|
||||
.modal.fade:not(.in).bottom-left .modal-dialog {
|
||||
-webkit-transform: translate3d(-25%, 25%, 0);
|
||||
transform: translate3d(-25%, 25%, 0);
|
||||
}
|
||||
|
||||
.modal.fade:not(.in).bottom-right .modal-dialog {
|
||||
-webkit-transform: translate3d(25%, 25%, 0);
|
||||
transform: translate3d(25%, 25%, 0);
|
||||
}
|
||||
|
||||
.minicolors {
|
||||
position: relative;
|
||||
MARGIN-TOP: 10PX;
|
||||
WIDTH: 20%;
|
||||
}
|
||||
|
||||
table.dataTable,
|
||||
table.dataTable th,
|
||||
table.dataTable td {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.dataTables_scrollBody > .dataTable > thead {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
tr td:nth-child(4) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.form-horizontal .control-label {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UpFiltros" runat="server" UpdateMode="conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Timer runat="server" ID="TimmerRefresh" Enabled="false" Interval="30000" OnTick="TimmerRefresh_Tick"></asp:Timer>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<div id="map"></div>
|
||||
<div class="modal fade bottom in" style="bottom: unset; z-index: 539" id="h">
|
||||
<div class="modal-dialog" style="position: fixed; bottom: 0; margin: 0px,0px,0px,0px; width: 100%; padding: 0px, 0px, 0px, 0px; border-style: solid; border-color: rgb(68, 77, 88); z-index: 539;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" style="padding: 5px;">
|
||||
<asp:UpdatePanel runat="server" ID="UPGV" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div id="DvPaginacion" runat="server" class="row" visible="false">
|
||||
<div class="col-md-11">
|
||||
<asp:Label ID="LblRegistros" runat="server" Style="display: inline-block;"></asp:Label>
|
||||
</div>
|
||||
<div class="col-md-1" style="display: inline-block; position: relative">
|
||||
<asp:HiddenField ID="HdnIndexPage" runat="server" ClientIDMode="Static" Value="0" />
|
||||
<asp:LinkButton ID="btnPagePrev" runat="server" Style="vertical-align: top;" Text="<i class='fa fa-angle-left' style='font-size:24px' aria-hidden='true'></i> Anterior" OnClick="btnPagePrev_Click" Enabled="false" />
|
||||
<asp:LinkButton ID="btnPageNext" runat="server" Style="vertical-align: top;" Text="Siguiente <i class='fa fa-angle-right' aria-hidden='true' style='font-size:24px'></i>" OnClick="btnPageNext_Click" />
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvBarra" runat="server" GridLines="None" PageSize="1000" AllowPaging="true" AllowCustomPaging="true" DataKeyNames="Vehiculo, Posicion,Fecha,Velocidad, CveDispositivo" CssClass="table table-striped table-advance table-hover Widthall ADScrollPaginator2" data-sort="true" data-height="150px;" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="15%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:BoundField DataField="Fecha" ItemStyle-Width="15%" HeaderText="Fecha Reporte" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:TemplateField ItemStyle-Width="30%" HeaderText="Dirección" ItemStyle-HorizontalAlign="center">
|
||||
<ItemTemplate>
|
||||
<asp:Literal runat="server" Text="Haga click para ver Dirección" ID="ltlDireccion"></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="TiempoDetenido" ItemStyle-Width="25%" DataFormatString="{0} Minutos" HeaderText="Tiempo Detenido" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:BoundField DataField="Evento" ItemStyle-Width="25%" HeaderText="Eventos" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:BoundField DataField="Velocidad" ItemStyle-Width="10%" DataFormatString="{0:N2} KM/H" HeaderText="Velocidad" ItemStyle-HorizontalAlign="center" />
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:HiddenField ID="HdnDireccionRow" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<PagerSettings Mode="NextPrevious" Visible="true" Position="Top" />
|
||||
</asp:GridView>
|
||||
<asp:HiddenField ID="HdnIndexGvBarra" runat="server" ClientIDMode="Static" Value="-1" />
|
||||
<asp:HiddenField ID="HdnTextFilter" runat="server" ClientIDMode="Static" Value="" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAF7s8wwhzCVXDUYopc9mXxqaWB33cDro4&libraries=places"></script>
|
||||
<script src="../Metronic/assets/global/plugins/datatables2/datatables.min.js"></script>
|
||||
<script src="../Metronic/assets/global/plugins/datatables2/extensions/Scroller/js/dataTables.scroller.js"></script>
|
||||
<script src="../Metronic/assets/global/plugins/datatables2/extensions/KeyTable/js/dataTables.keyTable.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
initMap();
|
||||
});
|
||||
var image = '/Imagenes/rsz_11rsz_car.png';
|
||||
var geocoder;
|
||||
var map;
|
||||
var directionsService;
|
||||
var directionsDisplay;
|
||||
var polylinesRoute = [];
|
||||
var directionsDisplayArray = [];
|
||||
|
||||
var lastOpenedInfoWindow;
|
||||
|
||||
var retorno;
|
||||
function initMap() {
|
||||
map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: { lat: 24.6345, lng: -102.5528 },
|
||||
zoom: 6
|
||||
});
|
||||
|
||||
var ShowDiv1 = document.createElement('div');
|
||||
var ShowDivControl = new ShowDiv(ShowDiv1, map);
|
||||
|
||||
|
||||
ShowDiv1.index = 1;
|
||||
ShowDiv1.id = "showdiv1"
|
||||
|
||||
map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1);
|
||||
|
||||
geocoder = new google.maps.Geocoder();
|
||||
|
||||
google.maps.event.addListener(map, "click", function (event) {
|
||||
closeLastOpenedInfoWindow();
|
||||
});
|
||||
|
||||
directionsService = new google.maps.DirectionsService;
|
||||
directionsDisplay = new google.maps.DirectionsRenderer;
|
||||
directionsDisplay.setOptions({ suppressMarkers: true });
|
||||
directionsDisplay.setMap(map);
|
||||
}
|
||||
|
||||
var polylines = [];
|
||||
var coordspoly = [];
|
||||
var geoRutasHistoricas = [];
|
||||
function creaPolyline(coords, color, info, lastcoord, nomequipo, Imagen, valueEquipo, Continuo) {
|
||||
var lineSymbol = {
|
||||
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
|
||||
strokeWeight: 1,
|
||||
strokeOpacity: 1,
|
||||
scale: 3,
|
||||
fillOpacity: 0.6
|
||||
};
|
||||
var polyline = new google.maps.Polyline({
|
||||
path: coords,
|
||||
strokeColor: color,
|
||||
strokeOpacity: 0.6,
|
||||
strokeWeight: 6,
|
||||
fillOpacity: 0.35,
|
||||
icons: [{
|
||||
icon: lineSymbol,
|
||||
offset: '0',
|
||||
repeat: '80px'
|
||||
}]
|
||||
});
|
||||
polyline.setMap(map);
|
||||
polylines.push(polyline);
|
||||
if (coordspoly.length <= 0 && typeof (Continuo) === "undefined") {
|
||||
FitBoundsToCoords(coords);
|
||||
} else {
|
||||
coordspoly.push(coords[coords.length - 1]);
|
||||
}
|
||||
if (lastcoord != "") {
|
||||
var geo = {
|
||||
NombreEquipo: nomequipo,
|
||||
ValueEquipo: valueEquipo,
|
||||
UltimaPos: lastcoord,
|
||||
Cordenadas: coords
|
||||
};
|
||||
geoRutasHistoricas.push(geo);
|
||||
CreaMarcador(lastcoord, nomequipo, info, Imagen);
|
||||
ConsultaDireccionesRutasHistoricas(geo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function closeLastOpenedInfoWindow() {
|
||||
if (lastOpenedInfoWindow) {
|
||||
lastOpenedInfoWindow.close();
|
||||
}
|
||||
}
|
||||
function fitBoundsToVisibleMarkers() {
|
||||
var bounds = new google.maps.LatLngBounds();
|
||||
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
if (markers[i].getVisible()) {
|
||||
bounds.extend(markers[i].getPosition());
|
||||
}
|
||||
}
|
||||
|
||||
map.fitBounds(bounds);
|
||||
|
||||
}
|
||||
function ShowDiv(controlDiv, map) {
|
||||
// Set CSS for the control border.
|
||||
var controlUI = document.createElement('div');
|
||||
controlUI.style.backgroundColor = '#444d58';
|
||||
controlUI.style.border = '2px solid #444d58';
|
||||
controlUI.style.borderRadius = '3px';
|
||||
controlUI.style.width = '100%'
|
||||
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
|
||||
controlUI.style.cursor = 'pointer';
|
||||
controlUI.style.marginRight = '5px';
|
||||
controlUI.style.marginTop = '5px';
|
||||
controlUI.style.marginBottom = '0px';
|
||||
controlUI.style.textAlign = 'center';
|
||||
// controlUI.title = 'Click para borrar el último punto dibujado';
|
||||
controlDiv.appendChild(controlUI);
|
||||
|
||||
// Set CSS for the control interior.
|
||||
var controlText = document.createElement('div');
|
||||
controlText.style.color = '#ebebeb';
|
||||
controlText.id = "ShowDiv3"
|
||||
controlText.style.fontFamily = ' "Open Sans", sans-serif; ';
|
||||
controlText.style.fontSize = '14px';
|
||||
controlText.style.lineHeight = '20px';
|
||||
controlText.style.paddingLeft = '5px';
|
||||
controlText.style.paddingRight = '5px';
|
||||
controlText.innerHTML = '<i class="fa fa-angle-up" aria-hidden="true"></i>';
|
||||
controlUI.appendChild(controlText);
|
||||
|
||||
// Setup the click event listeners: simply set the map to Chicago.
|
||||
controlUI.addEventListener('click', function () {
|
||||
FNShowDiv();
|
||||
});
|
||||
}
|
||||
function FNShowDiv() {
|
||||
if (open === false) {
|
||||
//$("#ChkSeguimiento").appendTo("#DivSeguimiento");
|
||||
//$("#ChkSeguimiento").appendTo("#DivSeguimiento");
|
||||
$("#h").modal()
|
||||
$("#ShowDiv3").css("line-height", "34px")
|
||||
open = true
|
||||
$("#ShowDiv3").html('<i class="fa fa-angle-down" aria-hidden="true"></i>')
|
||||
setTimeout(function () {
|
||||
$('.table.ADScrollPaginator2').DataTable().draw();
|
||||
}, 150);
|
||||
if ($("#HdnOpcion").val() === 'All' || $("#HdnOpcion").val() === 'Idle' || $("#HdnOpcion").val() === 'Ralenti') {
|
||||
$('#btnPlay').css('display', '');
|
||||
$('#btnPrintExcel').css('display', '');
|
||||
$('#btnPrintPDF').css('display', '');
|
||||
$("#btnPlay").click(function () {
|
||||
pause = !pause;
|
||||
if (pause) {
|
||||
stopTimeout();
|
||||
} else {
|
||||
if (startPlay) {
|
||||
startPlay = false;
|
||||
Play();
|
||||
} else {
|
||||
Play();
|
||||
}
|
||||
}
|
||||
if ($('#btnPlay > i').hasClass("fa-pause")) {
|
||||
$('#btnPlay > i').removeClass("fa-pause").addClass("fa-play");
|
||||
} else if ($('#btnPlay > i').hasClass("fa-play")) {
|
||||
$('#btnPlay > i').removeClass("fa-play").addClass("fa-pause");
|
||||
}
|
||||
|
||||
});
|
||||
$("#btnPrintExcel").click(function () {
|
||||
var s;
|
||||
for (var i = 0; i < $("#C_GvBarra").DataTable().rows().nodes().length; i++) {
|
||||
s = s + $("#C_GvBarra").DataTable().row(i).node().cells[2].title.trim() + ';';
|
||||
}
|
||||
$("#HdnDirecciones").val(s);
|
||||
doScaledCLick("#C_BtnImprimirEX")
|
||||
});
|
||||
$("#btnPrintPDF").click(function () {
|
||||
var s = "";
|
||||
for (var i = 0; i < $("#C_GvBarra").DataTable().rows().nodes().length; i++) {
|
||||
s = s + $("#C_GvBarra").DataTable().row(i).node().cells[2].title.trim() + ';';
|
||||
}
|
||||
$("#HdnDirecciones").val(s);
|
||||
doScaledCLick("#C_btnImprimir")
|
||||
});
|
||||
} else if ($("#HdnOpcion").val() === 'Speed') {
|
||||
|
||||
$('#btnPrintExcel').css('display', '');
|
||||
$('#btnPrintPDF').css('display', '');
|
||||
|
||||
$("#btnPrintExcel").click(function () {
|
||||
var s;
|
||||
for (var i = 0; i < $("#C_GvBarra").DataTable().rows().nodes().length; i++) {
|
||||
s = s + $("#C_GvBarra").DataTable().row(i).node().cells[2].title.trim() + ';';
|
||||
}
|
||||
$("#HdnDirecciones").val(s);
|
||||
doScaledCLick("#C_BtnImprimirEX")
|
||||
});
|
||||
$("#btnPrintPDF").click(function () {
|
||||
var s = "";
|
||||
for (var i = 0; i < $("#C_GvBarra").DataTable().rows().nodes().length; i++) {
|
||||
s = s + $("#C_GvBarra").DataTable().row(i).node().cells[2].title.trim() + ';';
|
||||
}
|
||||
$("#HdnDirecciones").val(s);
|
||||
doScaledCLick("#C_btnImprimir")
|
||||
});
|
||||
} else if ($("#HdnOpcion").val() === 'Last') {
|
||||
$('#btnPrintExcel').css('display', '');
|
||||
$("#btnPrintExcel").click(function () {
|
||||
var s;
|
||||
for (var i = 0; i < $("#C_GvBarra").DataTable().rows().nodes().length; i++) {
|
||||
s = s + $("#C_GvBarra").DataTable().row(i).node().cells[2].title.trim() + ';';
|
||||
}
|
||||
$("#HdnDirecciones").val(s);
|
||||
doScaledCLick("#C_BtnImprimirEX");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$("#h").modal('hide')
|
||||
$("#ShowDiv3").css("line-height", "20px")
|
||||
open = false
|
||||
$("#ShowDiv3").html('<i class="fa fa-angle-up" aria-hidden="true"></i>')
|
||||
}
|
||||
}
|
||||
function GvBarraPaginator() {
|
||||
$('.table.PaginarGV').each(function () {
|
||||
var Tthis = $(this);
|
||||
if (!$.fn.DataTable.isDataTable(Tthis) && Tthis.find("th").length > 0) {
|
||||
Tthis.prepend(("<thead></thead>"));
|
||||
Tthis.find('thead').append($("#C_GvBarra").find("tr:first"));
|
||||
var table = Tthis.DataTable({
|
||||
deferRender: true,
|
||||
deferLoading: 100,
|
||||
scrollY: 130,
|
||||
scrollCollapse: true,
|
||||
scroller: {
|
||||
displayBuffer: 20
|
||||
},
|
||||
ordering: true
|
||||
});
|
||||
var tkeys = new $.fn.dataTable.KeyTable(table, {
|
||||
// options
|
||||
});
|
||||
var parent = Tthis.parent().parent().parent();
|
||||
$('.dataTables_scrollHeadInner > .table.ADScrollPaginator2').find('th').addClass('importantth');
|
||||
parent.find(".dataTables_paginate").css("display", "none");
|
||||
parent.find(".dataTables_length").css("display", "none");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
GvBarraPaginator();
|
||||
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
|
||||
function EndRequestHandler(sender, args) {
|
||||
$("#C_GvBarra_filter > div > input").on("keypress", function (e) {
|
||||
HdnTextFilter.value = $(this).val() + String.fromCharCode(e.which);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var markers = [];
|
||||
|
||||
function CreaMarcador(coords, nomEquipo, ContentString, imagen) {
|
||||
if (typeof imagen === 'undefined') { imagen = image; }
|
||||
var markerIcon = {
|
||||
url: imagen,
|
||||
labelOrigin: new google.maps.Point(26, 43)
|
||||
};
|
||||
var marker = new google.maps.Marker({
|
||||
position: coords,
|
||||
title: nomEquipo,
|
||||
map: map,
|
||||
icon: markerIcon
|
||||
});
|
||||
|
||||
var infowindow = new google.maps.InfoWindow({
|
||||
content: ContentString
|
||||
});
|
||||
marker.addListener('click', function () {
|
||||
closeLastOpenedInfoWindow();
|
||||
GetDirecciones(coords, infowindow, marker)
|
||||
infowindow.open(map, marker);
|
||||
lastOpenedInfoWindow = infowindow;
|
||||
});
|
||||
marker.Nombre = nomEquipo
|
||||
markers.push(marker);
|
||||
|
||||
if (markers.length > 1 && coordspoly.length < 1) {
|
||||
fitBoundsToVisibleMarkers()
|
||||
} else if (markers.length === 1 && coordspoly.length < 1) {
|
||||
map.setZoom(15);
|
||||
map.setCenter(coords);
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteMarkers() {
|
||||
for (var i = 0; i < markers.length; i++) {
|
||||
markers[i].setMap(null);
|
||||
}
|
||||
markers = [];
|
||||
for (var i = 0; i < polylines.length; i++) {
|
||||
polylines[i].setMap(null);
|
||||
}
|
||||
polylines = [];
|
||||
coordspoly = [];
|
||||
}
|
||||
|
||||
var timeout = 1500;
|
||||
|
||||
function GetDireccionesGV(posicion, indice, multiplicador) {
|
||||
setTimeout(function () {
|
||||
|
||||
var columnaSeleccionada = 2 + indice;
|
||||
var tr = $("#C_GvBarra").DataTable().row(indice).node();
|
||||
var lat = posicion.lat;
|
||||
var lng = posicion.lng;
|
||||
var largo;
|
||||
var url = '<%= ClsPaginas.UrlDirecciones%>' + 'nominatim/reverse.php?format=jsonv2&lat=' + lat + '&lon=' + lng;
|
||||
|
||||
if ($("#HdnOpcion").val() === 'All' || $("#HdnOpcion").val() === 'TPS') { largo = 37 } else { largo = 74 }
|
||||
if ($())
|
||||
$.getJSON(url, function (data) {
|
||||
if (typeof (data.error) === 'undefined') {
|
||||
if (multiplicador > 0) {
|
||||
if (typeof (markers[indice]) !== 'undefined') {
|
||||
markers[indice].formatted_addressrow = data.display_name
|
||||
}
|
||||
}
|
||||
if (data.display_name.length > largo) {
|
||||
tr.cells[2].innerHTML = data.display_name.substring(0, largo) + '...';
|
||||
} else {
|
||||
tr.cells[2].innerHTML = data.display_name;
|
||||
}
|
||||
tr.cells[2].title = data.display_name;
|
||||
$("#C_GvBarra_HdnDireccionRow_" + indice).val(data.display_name);
|
||||
} else {
|
||||
tr.cells[2].innerHTML = "No se encontró la dirección";
|
||||
$("#C_GvBarra_HdnDireccionRow_" + indice).val("No se encontró la dirección;");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}, timeout + (indice));
|
||||
}
|
||||
var countdown = 1;
|
||||
var countup = 1;
|
||||
var pixels = 0;
|
||||
|
||||
function GetDireccionesGVClick(posicion, indice) {
|
||||
if (typeof (markers[indice].formatted_addressrow) === 'undefined') {
|
||||
setTimeout(function () {
|
||||
var columnaSeleccionada = 2 + indice;
|
||||
var tr = $("#C_GvBarra").DataTable().row(indice).node()
|
||||
geocoder.geocode({ 'location': posicion }, function (results, status) {
|
||||
if (status === 'OK') {
|
||||
if (results[0]) {
|
||||
if (typeof (markers[indice]) !== 'undefined') {
|
||||
|
||||
markers[indice].formatted_addressrow = results[0].formatted_address
|
||||
if (typeof (tr) !== 'undefined') {
|
||||
tr.cells[2].innerHTML = results[0].formatted_address;
|
||||
}
|
||||
} else {
|
||||
console.log("Ocurrio un error al obtener la direccion del punto: " + posicion + "en el indice: " + indice)
|
||||
}
|
||||
} else {
|
||||
markers[indice].formatted_addressrow = "Direccion no encontrada"
|
||||
tr.cells[2].innerHTML = "Direccion no encontrada;"
|
||||
}
|
||||
} else {
|
||||
markers[indice].formatted_addressrow = "Cargando..."
|
||||
tr.cells[2].innerHTML = "Cargando..."
|
||||
}
|
||||
});
|
||||
}, timeout);
|
||||
}
|
||||
}
|
||||
function GetDirecciones(posicion, infowindow, marker, indice) {
|
||||
var lat = posicion.lat
|
||||
var lng = posicion.lng
|
||||
var url = '<%= ClsPaginas.UrlDirecciones%>' + 'nominatim/reverse.php?format=jsonv2&lat=' + lat + '&lon=' + lng;
|
||||
|
||||
$.getJSON(url, function (data) {
|
||||
if (typeof (data.error) === 'undefined') {
|
||||
marker.formatted_address = data.display_name;
|
||||
var contenido = infowindow.getContent();
|
||||
if (contenido.indexOf("direccion") >= 0) {
|
||||
var html = $($.parseHTML(contenido));
|
||||
var dir = html.filter(".direccion");;
|
||||
dir.text("Dirección: " + data.display_name);
|
||||
var htmlstring = "";
|
||||
for (var i = 0; i < html.length; i++) {
|
||||
htmlstring = htmlstring.concat(html[i].outerHTML);
|
||||
}
|
||||
infowindow.setContent(htmlstring);
|
||||
} else {
|
||||
infowindow.setContent(contenido + "<div class='direccion' style='margin-left:5px'>" + "Dirección: " + data.display_name + "</div>");
|
||||
}
|
||||
if (indice > -1) {
|
||||
if (data.display_name.length > 74) {
|
||||
if (typeof (tr) !== 'undefined') {
|
||||
tr.cells[2].innerHTML = data.display_name.substring(0, 74) + '...'
|
||||
}
|
||||
} else {
|
||||
if (typeof (tr) !== 'undefined') {
|
||||
tr.cells[2].innerHTML = data.display_name
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
marker.formatted_address = "Dirección no encontrada";
|
||||
if (contenido.indexOf("direccion") >= 0) {
|
||||
var html = $($.parseHTML(contenido));
|
||||
var dir = html.filter(".direccion");;
|
||||
dir.text("Dirección no encontrada");
|
||||
var htmlstring = "";
|
||||
for (var i = 0; i < html.length; i++) {
|
||||
htmlstring = htmlstring.concat(html[i].outerHTML);
|
||||
}
|
||||
infowindow.setContent(htmlstring);
|
||||
} else {
|
||||
infowindow.setContent(infowindow.getContent() + "<div style='margin-left:5px'> Dirección: No Encontrada </div>");
|
||||
}
|
||||
|
||||
if (indice) {
|
||||
var col = indice + 1
|
||||
var tr = $('#C_GvBarra tr').filter(':nth-child(' + col + ')')
|
||||
tr.find("td").filter(':nth-child(3)').html(results[0].formatted_address);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
343
GPS/RastreoTrayectos.aspx.vb
Normal file
343
GPS/RastreoTrayectos.aspx.vb
Normal file
@@ -0,0 +1,343 @@
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Net
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports System.Linq
|
||||
|
||||
Partial Class GPS_RastreoTrayectos
|
||||
Inherits Page
|
||||
|
||||
#Region "P R O P I E D A D E S"
|
||||
Private Property TrazarLineaContinuo As Boolean
|
||||
Get
|
||||
Return CType(ViewState("TrazarLineaContinuo"), Boolean)
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("TrazarLineaContinuo") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveTrayecto As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("CveTrayecto"), -1, ViewState("CveTrayecto").ToString().ToEntero()).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveTrayecto") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveDispositivo As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("CveDispositivo"), -1, ViewState("CveDispositivo").ToString().ToEntero()).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveDispositivo") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveCliente As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("CveCliente"), -1, ViewState("CveCliente").ToString().ToEntero()).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCliente") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtCoordenadasContinuas As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtCoordenadasContinuas"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtCoordenadasContinuas") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtPosiciones As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtPosiciones"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtPosiciones") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property GlobalDTDispositivos(CveCliente As Integer) As DataTable
|
||||
Get
|
||||
Dim Str As StringBuilder = New StringBuilder()
|
||||
|
||||
If CveCliente <> -1 Then Str.AppendFormat(" {0} CveCliente = {1}", If(Str.Length > 0, "AND", ""), CveCliente)
|
||||
|
||||
|
||||
If CveCliente <> -1 Then
|
||||
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTDispositivos"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows)
|
||||
GlobalDTDispositivos = Dv.ToTable
|
||||
Dv.Dispose()
|
||||
Else
|
||||
GlobalDTDispositivos = DirectCast(HttpContext.Current.Application("GlobalDTDispositivos"), DataTable)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
HttpContext.Current.Application("GlobalDTDispositivos") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
RegistraScript("$('#SideNav').click();initMap();")
|
||||
Me.CveTrayecto = 97
|
||||
|
||||
CreaDTPosiciones()
|
||||
CargaDatos()
|
||||
RastrearEquipos()
|
||||
CargaTabla()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CreaDTPosiciones()
|
||||
DtPosiciones = Nothing
|
||||
|
||||
Dim dt As New DataTable
|
||||
dt.Columns.Add("CveDispositivo", Type.GetType("System.Int32"))
|
||||
dt.Columns.Add("Vehiculo", Type.GetType("System.String"))
|
||||
dt.Columns.Add("Fecha", Type.GetType("System.String"))
|
||||
dt.Columns.Add("Evento", Type.GetType("System.String"))
|
||||
dt.Columns.Add("TiempoDetenido", Type.GetType("System.Double"))
|
||||
dt.Columns.Add("Velocidad", Type.GetType("System.Double"))
|
||||
dt.Columns.Add("Posicion", Type.GetType("System.String"))
|
||||
dt.Columns.Add("KMRecorridos", Type.GetType("System.Double"))
|
||||
dt.Columns.Add("Icono", Type.GetType("System.String"))
|
||||
|
||||
DtPosiciones = dt
|
||||
End Sub
|
||||
Private Sub CreaDTCoordenadas()
|
||||
|
||||
Dim dt As New DataTable
|
||||
dt.Columns.Add("CveDispositivo", Type.GetType("System.Int32"))
|
||||
dt.Columns.Add("Coord", Type.GetType("System.String"))
|
||||
|
||||
DtCoordenadasContinuas = dt
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
Dim Row As DataRow = ObjGPS.DtResultados.Rows(0)
|
||||
Me.CveDispositivo = Row("CveDispositivo").ToString().ToEntero()
|
||||
Me.CveCliente = Row("CveCliente").ToString().ToEntero()
|
||||
End If
|
||||
End Using
|
||||
TrazarLineaContinuo = True
|
||||
CreaDTCoordenadas()
|
||||
End Sub
|
||||
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
|
||||
DtPosiciones.Rows.Clear()
|
||||
RegistraScript("DeleteMarkers();")
|
||||
Dim LastCoord As String = ""
|
||||
Dim TmpDT As New DataTable
|
||||
Dim Info = ""
|
||||
Dim Direccion = ""
|
||||
Dim SBBody As New StringBuilder
|
||||
Dim Icono As String = "/Imagenes/rsz_11rsz_car.png"
|
||||
Dim Fecha, Vehiculo As String
|
||||
|
||||
Dim ObjGPS As New ClsGPS
|
||||
Try
|
||||
Dim RowVehiculo As DataRow = GlobalDTDispositivos(CveCliente).FiltroPrimero($"CveDispositivo = {CveDispositivo}")
|
||||
|
||||
If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha) Then
|
||||
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
Dim Coord As String = SQLToGmaps(ObjGPS.DtResultados.Rows(0)("Posicion").ToString, "POINT")
|
||||
Fecha = ObjGPS.DtResultados.Rows(0)("FechaTrama").ToString
|
||||
Vehiculo = ObjGPS.DtResultados.Rows(0)("Vehiculo").ToString
|
||||
Info = InfoWindowCombustible($" Vehículo: {Vehiculo}", "-1", CveDispositivo, ObjGPS.DtResultados.Rows(0), False)
|
||||
|
||||
If ObjGPS.DtResultados.Rows(0)("SPD").ToString.ToDouble > 1 Then
|
||||
Icono = $"/Imagenes/{RowVehiculo("Icono")}green.png"
|
||||
Else
|
||||
Icono = $"/Imagenes/{RowVehiculo("Icono")}.png"
|
||||
End If
|
||||
|
||||
AddRowCoordenadasContinuas(Coord, CveDispositivo)
|
||||
|
||||
Dim POLYPATH As String = "["
|
||||
|
||||
For Each RCC As DataRow In DtCoordenadasContinuas.FiltraParametros($"CveDispositivo = {CveDispositivo}", DistinctColumns:={"CveDispositivo", "Coord"}).Rows
|
||||
POLYPATH = $"{POLYPATH}{RCC("Coord").ToString},"
|
||||
Next
|
||||
POLYPATH = $"{POLYPATH.Substring(0, POLYPATH.Length - 1)}]"
|
||||
RegistraScript($"creaPolyline({POLYPATH}, '{RowVehiculo("ColorTrazo")}', '{Info}', {Coord}, '{RowVehiculo("NombreVehiculo")}', '{Icono}',{CveDispositivo}, 1)", $"{CveDispositivo}{DtCoordenadasContinuas.Rows.Count}")
|
||||
|
||||
RegistraScript($"setTimeout(function(){{ CreaMarcador({Coord},'{RowVehiculo("NombreVehiculo").ToString()}', '{Info}', '{Icono}');}}, 1000);", CveDispositivo.ToString())
|
||||
AddRowPosiciones(Vehiculo, Coord, ObjGPS.DtResultados.Rows(0)("SPD").ToString.ToDouble, Fecha, CveDispositivo, ObjGPS.DtResultados(0)("TiempoDetenido").ToString.ToDouble)
|
||||
End If
|
||||
End If
|
||||
|
||||
TimmerRefresh.Enabled = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al rastrear equipo", ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub RastrearEquipos()
|
||||
Dim LastCoord As String = ""
|
||||
Dim TmpDT As New DataTable
|
||||
Dim Info = ""
|
||||
Dim Direccion = ""
|
||||
Dim SBBody As New StringBuilder
|
||||
Dim Icono As String = "/Imagenes/rsz_11rsz_car.png"
|
||||
Dim Fecha, Vehiculo As String
|
||||
|
||||
Dim ObjGPS As New ClsGPS
|
||||
Try
|
||||
Dim RowVehiculo As DataRow = GlobalDTDispositivos(CveCliente).FiltroPrimero($"CveDispositivo = {CveDispositivo}")
|
||||
|
||||
If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha) Then
|
||||
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
Dim Coord As String = SQLToGmaps(ObjGPS.DtResultados.Rows(0)("Posicion").ToString, "POINT")
|
||||
Fecha = ObjGPS.DtResultados.Rows(0)("FechaTrama").ToString
|
||||
Vehiculo = ObjGPS.DtResultados.Rows(0)("Vehiculo").ToString
|
||||
Info = InfoWindowCombustible($" Vehículo: {Vehiculo}", "-1", CveDispositivo, ObjGPS.DtResultados.Rows(0), False)
|
||||
|
||||
If ObjGPS.DtResultados.Rows(0)("SPD").ToString.ToDouble > 1 Then
|
||||
Icono = $"/Imagenes/{RowVehiculo("Icono")}green.png"
|
||||
Else
|
||||
Icono = $"/Imagenes/{RowVehiculo("Icono")}.png"
|
||||
End If
|
||||
|
||||
AddRowCoordenadasContinuas(Coord, CveDispositivo)
|
||||
|
||||
RegistraScript($"setTimeout(function(){{ CreaMarcador({Coord},'{RowVehiculo("NombreVehiculo").ToString()}', '{Info}', '{Icono}');}}, 1000);", CveDispositivo.ToString())
|
||||
AddRowPosiciones(Vehiculo, Coord, ObjGPS.DtResultados.Rows(0)("SPD").ToString.ToDouble, Fecha, CveDispositivo, ObjGPS.DtResultados(0)("TiempoDetenido").ToString.ToDouble)
|
||||
End If
|
||||
End If
|
||||
|
||||
TimmerRefresh.Enabled = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al rastrear equipo", ex)
|
||||
End Try
|
||||
ObjGPS.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaTabla()
|
||||
If DtPosiciones IsNot Nothing Then
|
||||
GvBarra.DataSource = DtPosiciones
|
||||
GvBarra.DataBind()
|
||||
End If
|
||||
|
||||
If GvBarra.HeaderRow IsNot Nothing Then
|
||||
GvBarra.HeaderRow.Cells(3).Style.Add("display", "")
|
||||
GvBarra.HeaderRow.Cells(4).Style.Add("display", "none !important")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub AddRowCoordenadasContinuas(Coord As String, CveDispositivo As Integer)
|
||||
Dim dr As DataRow = DtCoordenadasContinuas.NewRow()
|
||||
dr("CveDispositivo") = CveDispositivo
|
||||
dr("Coord") = Coord
|
||||
DtCoordenadasContinuas.Rows.Add(dr)
|
||||
End Sub
|
||||
Private Sub AddRowPosiciones(Vehiculo As String, Posicion As String, Velocidad As Double, Fecha As String, CveDispositivo As Integer, Optional TiempoDetenido As Double = 0, Optional Evento As String = "", Optional KMRecorridos As Double = 0, Optional Icono As String = "/Imagenes/rsz_11rsz_car.png")
|
||||
Dim dr As DataRow = DtPosiciones.NewRow()
|
||||
dr("Vehiculo") = Vehiculo
|
||||
dr("Fecha") = Fecha
|
||||
dr("TiempoDetenido") = TiempoDetenido
|
||||
dr("Velocidad") = Velocidad
|
||||
dr("Posicion") = Posicion
|
||||
dr("CveDispositivo") = CveDispositivo
|
||||
dr("Evento") = Evento
|
||||
dr("KMRecorridos") = KMRecorridos
|
||||
dr("Icono") = Icono
|
||||
|
||||
DtPosiciones.Rows.Add(dr)
|
||||
End Sub
|
||||
Public Function InfoWindowCombustible(Header As String, ExtraBody As String, CveDispositivo As Integer, row As DataRow, Optional PermisoComandos As Boolean = True) As String
|
||||
Dim SBuilder As New StringBuilder
|
||||
SBuilder.Clear()
|
||||
SBuilder.Append($"<div>")
|
||||
SBuilder.Append($"<div><h5><a target=\'_blank\' href=\'\'><b>{Header}</b></a></h5></div>")
|
||||
SBuilder.Append($"<div><table>")
|
||||
Try
|
||||
SBuilder.Append($"<tr><td>Fecha : {row("FechaTrama")} </td></tr>")
|
||||
SBuilder.Append($"<tr><td>Conductor : {row("Conductor").ToString}</td></tr>")
|
||||
If row.Table.Columns.Contains("Combustible") Then
|
||||
SBuilder.Append($"<tr><td>Combustible : {IfNull(row("Combustible"), "NO DISPONIBLE", $"{row("Combustible").ToString.FormatoNumero} lts").ToString}</td></tr>")
|
||||
End If
|
||||
If row("SPD").ToString <> "-1" Then
|
||||
SBuilder.Append($"<tr><td>Velocidad : {row("SPD").ToString} KM/H </td></tr>")
|
||||
End If
|
||||
If ExtraBody <> "" AndAlso ExtraBody <> "-1" Then
|
||||
SBuilder.Append(ExtraBody)
|
||||
End If
|
||||
SBuilder.AppendFormat("<tr><td><a target=\'_blank\' href=\'https://www.google.com/maps/search/{0},{1}/\'>Ver en google maps</a></td></tr>", row("Lat").ToString, row("Lng").ToString)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al consultar", ex)
|
||||
End Try
|
||||
SBuilder.Append($"</table></div><div></div></div>")
|
||||
Return SBuilder.ToString
|
||||
End Function
|
||||
Protected Sub btnPagePrev_Click(sender As Object, e As EventArgs)
|
||||
Dim TotalRegistros As Integer = DtPosiciones.Rows.Count
|
||||
Dim TotalRowsPage As Integer = GvBarra.PageSize
|
||||
Dim PrevIndex As Integer = HdnIndexPage.Value.ToEntero - 1
|
||||
Dim CurrentIndex As Integer = PrevIndex + 1
|
||||
|
||||
Dim PrevIndexDT As Integer = (TotalRowsPage) * PrevIndex
|
||||
Dim CurrentIndexDT As Integer = (TotalRowsPage) * CurrentIndex
|
||||
|
||||
HdnIndexPage.Value = PrevIndex.ToString
|
||||
|
||||
If Not btnPageNext.Enabled Then
|
||||
btnPageNext.Enabled = True
|
||||
End If
|
||||
|
||||
If PrevIndexDT <= 0 Then
|
||||
btnPagePrev.Enabled = False
|
||||
GvBarra.DataSource = DtPosiciones.FiltraPorIndices(0, CurrentIndexDT)
|
||||
LblRegistros.Text = $"Distribución de datos desde 0 hasta {CurrentIndexDT.ToString.FormatoNumero(0)}. Total de registros: {DtPosiciones.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
Else
|
||||
LblRegistros.Text = $"Distribución de datos desde {PrevIndexDT.ToString.FormatoNumero(0)} hasta {CurrentIndexDT.ToString.FormatoNumero(0)}. Total de registros: {DtPosiciones.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
GvBarra.DataSource = DtPosiciones.FiltraPorIndices(PrevIndexDT, CurrentIndexDT)
|
||||
End If
|
||||
|
||||
GvBarra.DataBind()
|
||||
UPGV.Update()
|
||||
|
||||
RegistraScript("setTimeout(function(){OpcionesHistorico();},500);")
|
||||
End Sub
|
||||
Protected Sub btnPageNext_Click(sender As Object, e As EventArgs)
|
||||
Dim TotalRegistros As Integer = DtPosiciones.Rows.Count
|
||||
Dim TotalRowsPage As Integer = GvBarra.PageSize
|
||||
Dim Index As Integer = HdnIndexPage.Value.ToEntero + 1
|
||||
Dim NextIndex As Integer = Index + 1
|
||||
|
||||
Dim CurrentIndexDT As Integer = (TotalRowsPage) * Index
|
||||
Dim NextIndexDT As Integer = (TotalRowsPage) * NextIndex
|
||||
|
||||
HdnIndexPage.Value = Index.ToString
|
||||
|
||||
If Not btnPagePrev.Enabled Then
|
||||
btnPagePrev.Enabled = True
|
||||
End If
|
||||
|
||||
If NextIndexDT >= TotalRegistros Then
|
||||
btnPageNext.Enabled = False
|
||||
GvBarra.DataSource = DtPosiciones.FiltraPorIndices(CurrentIndexDT, TotalRegistros - 1)
|
||||
LblRegistros.Text = $"Distribución de datos desde {CurrentIndexDT.ToString.FormatoNumero(0)} hasta {DtPosiciones.Rows.Count.ToString.FormatoNumero(0)}. Total de registros: {DtPosiciones.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
Else
|
||||
GvBarra.DataSource = DtPosiciones.FiltraPorIndices(CurrentIndexDT, NextIndexDT)
|
||||
LblRegistros.Text = $"Distribución de datos desde {CurrentIndexDT.ToString.FormatoNumero(0)} hasta {NextIndexDT.ToString.FormatoNumero(0)}. Total de registros: {DtPosiciones.Rows.Count.ToString.FormatoNumero(0)}"
|
||||
End If
|
||||
|
||||
GvBarra.DataBind()
|
||||
UPGV.Update()
|
||||
|
||||
RegistraScript("setTimeout(function(){OpcionesHistorico();},500);")
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub RegistraScript(Script As String, Optional valuetick As String = "")
|
||||
Dim Rdm As Random = New Random()
|
||||
ScriptManager.RegisterStartupScript(Page, Me.GetType(), String.Format("{0}{1}{2}", (DateTime.Now.Ticks + 1), Rdm.Next(), valuetick), String.Format("<script type='text/javascript' language='javascript'>{0}</script>", Script), False)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
1442
GPS/Trayectos.aspx
1442
GPS/Trayectos.aspx
File diff suppressed because it is too large
Load Diff
@@ -183,7 +183,9 @@ Partial Class GPS_Trayectos
|
||||
ObjGPS.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
Dim CveTrayecto As Integer = ObjGPS.AddTrayecto(Nombre, DateTime.Now, "", CveDispositivo, UsuarioActual.CveCliente)
|
||||
Dim CveTrayecto As Integer = ObjGPS.AddTrayecto(Nombre, DateTime.Now, "", CveDispositivo, UsuarioActual.CveCliente, EnviarNotificacion:=ChkNotificacion.Checked,
|
||||
CorreosNotificacion:=TxtCorreoNot.Text, Intervalo:=If(ChkNotificacion.Checked, 0, DdlIntervalo.SelectedValue.ToEntero()),
|
||||
EnviarLiga:=ChkEnviarLiga.Checked)
|
||||
|
||||
If CveTrayecto > 0 Then
|
||||
For Each Row As GridViewRow In GvEstatus.Rows
|
||||
@@ -401,6 +403,115 @@ Partial Class GPS_Trayectos
|
||||
ObjGPS.Dispose()
|
||||
End If
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
End Function
|
||||
|
||||
Protected Sub ChkNotificacion_CheckedChanged(sender As Object, e As EventArgs)
|
||||
DivNotificaciones.Visible = ChkNotificacion.Checked
|
||||
UpAgregar.Update()
|
||||
End Sub
|
||||
Protected Sub LnkEnviar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero()
|
||||
Dim EnviarLiga As Boolean = CBool(GvRow.DataKey("EnviarLiga"))
|
||||
If CveTrayecto > 0 Then
|
||||
Dim DtInfoTrayecto As DataTable = Nothing
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
|
||||
DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy()
|
||||
End If
|
||||
End Using
|
||||
If DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then
|
||||
Dim Row As DataRow = DtInfoTrayecto.Rows(0)
|
||||
GeneraCorreo(CveTrayecto, EnviarLiga, Row)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String
|
||||
Dim strBody As New StringBuilder
|
||||
Try
|
||||
strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
||||
strBody.Append("<head> ")
|
||||
strBody.Append(" <style type=""text/css""> ")
|
||||
strBody.Append(" body ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" margin:0px; ")
|
||||
strBody.Append(" padding:0px 0px 0px 0px; ")
|
||||
strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
||||
strBody.Append(" font-size: 10px; ")
|
||||
strBody.Append(" background-color:#F0F0F0; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" a.Texto ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" font-size:11px; ")
|
||||
strBody.Append(" background-color:#F7F6F3; ")
|
||||
strBody.Append(" text-decoration:none; ")
|
||||
strBody.Append(" font-weight:bold; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .Texto ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .TextoAlterno ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
||||
strBody.Append(" vertical-align:middle; height:20px;")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .BarraIdentidad ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" color:#FFFFFF; ")
|
||||
strBody.Append(" background:#F0F0F0; ")
|
||||
strBody.Append(" font-weight:bold; ")
|
||||
strBody.Append(" font-size:19px; ")
|
||||
strBody.Append(" font-style:oblique; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .Titulos ")
|
||||
strBody.Append(" { ")
|
||||
strBody.Append(" background-color: Gray;")
|
||||
strBody.Append(" color:White; ")
|
||||
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
||||
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
||||
strBody.Append(" text-decoration:none; ")
|
||||
strBody.Append(" } ")
|
||||
strBody.Append(" .Verde {color: #00CC00;} ")
|
||||
strBody.Append(" .Negro {color: #000000;} ")
|
||||
strBody.Append(" .Rojo {color: #FF0000;} ")
|
||||
strBody.Append(" </style> ")
|
||||
strBody.Append("</head> ")
|
||||
strBody.Append("<body> ")
|
||||
strBody.Append(" <h5> ")
|
||||
strBody.Append(" ")
|
||||
strBody.Append(" </h5> ")
|
||||
strBody.Append(" <div id=""C_divOC"" > <fieldset> <legend><b> Datos del Trayecto</b></legend> ")
|
||||
strBody.Append(" <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""550px""> ")
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td> Trayecto:</td><td colspan=""3""><b>{0}</b></td> ", Row("Trayecto"))
|
||||
strBody.Append(" </tr> ")
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td> Vehículo:</td><td colspan=""3""><b>{0}</b></td> ", Row("Vehiculo"))
|
||||
strBody.Append(" </tr> ")
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td>Estatus:</td><td colspan='3'><b>{0}</b></td> ", Row("Estatus"))
|
||||
strBody.Append(" </tr> ")
|
||||
If EnviarLiga Then
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td>Rastrea Equipo:</td><td colspan='3'><b>{0}</b></td> ", String.Format("http://gps.signalsgps.com/GPS/RastreoTrayectos.aspx?P={0}", Encripta($"CveTrayecto={CveTrayecto}")))
|
||||
strBody.Append(" </tr> ")
|
||||
End If
|
||||
strBody.Append(" <tr > ")
|
||||
strBody.AppendFormat(" <td>Posición:</td><td colspan='3'><img src=""{0}""></td> ", Row("LigaImagen"))
|
||||
strBody.Append(" </tr> ")
|
||||
strBody.Append(" </table> ")
|
||||
strBody.Append(" </fieldset> ")
|
||||
strBody.Append(" <h5> ")
|
||||
strBody.Append(" ")
|
||||
strBody.Append(" </h5> ")
|
||||
strBody.Append(" </div> ")
|
||||
strBody.Append("</body></html>")
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrio un error al general el correo.", ex)
|
||||
End Try
|
||||
Return strBody.ToString()
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -843,7 +843,7 @@
|
||||
var request = {
|
||||
Metodo: "UpdateNotificacion",
|
||||
Params: {
|
||||
Cve: <%= UsuarioActual.CveUsuario %>,
|
||||
Cve: <%= If(UsuarioActual IsNot Nothing, UsuarioActual.CveUsuario, -1) %>,
|
||||
CveBitacora: -1
|
||||
}
|
||||
}
|
||||
@@ -864,8 +864,6 @@
|
||||
|
||||
setTimeout(startTimer, 60000); // callback
|
||||
}
|
||||
startTimer();
|
||||
|
||||
|
||||
//
|
||||
function ShowToast(text, header, type, footer, sound,persistencia,coords) {
|
||||
@@ -919,7 +917,7 @@
|
||||
var request = {
|
||||
Metodo: "UpdateNotificacion",
|
||||
Params: {
|
||||
Cve: <%= UsuarioActual.CveUsuario %>,
|
||||
Cve: <%= If(UsuarioActual IsNot Nothing, UsuarioActual.CveUsuario, -1) %>,
|
||||
CveBitacora: CveNotificacionBitacora
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,19 +127,22 @@ Partial Class SiteGPS
|
||||
End If
|
||||
|
||||
End If
|
||||
CargarNotificaciones()
|
||||
CargarNotificaciones()
|
||||
|
||||
RegistraScript($"IniciarNotificaciones();startTimer();")
|
||||
Else
|
||||
|
||||
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
||||
If thisURL.Equals("WizardRegistro.aspx") OrElse thisURL.Equals("Registro.aspx") Then
|
||||
LitTit.Text = "<span style='color:white; font-size:x-large'>AD</span> <span style='color: #32A1CF; font-size:x-large'> Soluciones en TI</span> "
|
||||
|
||||
ElseIf thisURL.Equals("RastreoTrayectos.aspx") Then
|
||||
LitTit.Text = "<span style='color:white; font-size:x-large'>Rastreo</span> <span style='color: #32A1CF; font-size:x-large'> Trayectos</span> "
|
||||
End If
|
||||
'Response.Redirect("/PortalGPS/LoginPortal.aspx")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
RegistraScript($"IniciarNotificaciones();")
|
||||
|
||||
Else
|
||||
'VALIDACION DE SEGURIDAD, EN LA QUE SE VALIDA QUE LA EMPRESA EN LA QUE SE GENERO LA PAGINA SEA LA MISMA A LA DE LA SESION,
|
||||
|
||||
Reference in New Issue
Block a user