Precio minimo anterior en actualizar precios y evitar cerrar ventana en shipments
This commit is contained in:
@@ -1,254 +0,0 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Partial Class GPS_PruebaMaster
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "P R O P I E D A D E S"
|
||||
Public Property Offset() As Integer
|
||||
Get
|
||||
Return DirectCast(IfNull(ViewState("Offset"), 0), Integer)
|
||||
End Get
|
||||
Set(ByVal value As Integer)
|
||||
ViewState("Offset") = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property FechaCliente() As DateTime
|
||||
Get
|
||||
Return DateTime.UtcNow.AddMinutes(10).AddMinutes(Offset)
|
||||
End Get
|
||||
End Property
|
||||
Private Property DTEquipos As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DTEquipos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTEquipos") = 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
|
||||
If UsuarioActual.Contraseña = (ContraseñaPredeterminadaEncriptada) OrElse UsuarioActual.ActCambiarContraseña Then
|
||||
Response.Redirect("/Sistemas/CatContrasenia.aspx")
|
||||
Else
|
||||
CargaDispositivos()
|
||||
CargaZonasHorarias()
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaZonasHorarias()
|
||||
Using ObjGPS As New ClsGPS
|
||||
Dim CveZonaHoraria As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveZonaHoraria", $"CveCliente = {UsuarioActual.CveCliente}").ToEntero()
|
||||
If ObjGPS.GetZonasHorarias() Then
|
||||
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
Offset = ObjGPS.DtResultados.FiltroPrimeroValor("UTCOffset", $"CveZonaHoraria = {CveZonaHoraria}").ToEntero()
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDispositivos()
|
||||
DTEquipos = GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario).FiltraParametros("Estatus = 1")
|
||||
End Sub
|
||||
|
||||
Private Function SQLToGmaps(CoordsSQL As String, Tipo As String) As String
|
||||
Dim CoordsPoligono As String = CoordsSQL.Replace($"{Tipo}", "").Replace(")", "").Replace("(", "")
|
||||
Dim CoordsPuntos() As String = CoordsPoligono.Split(","c)
|
||||
Dim Var As String = ""
|
||||
For Each coordenada As String In CoordsPuntos
|
||||
If coordenada Is CoordsPuntos.Last Then
|
||||
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
||||
Var = $"{Var}{{lat: {latlng(1)}, lng: {latlng(0)} }}"
|
||||
Else
|
||||
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
||||
Var = $"{Var}{{lat: {latlng(1)}, lng: {latlng(0)} }},"
|
||||
End If
|
||||
Next
|
||||
Return Var
|
||||
End Function
|
||||
|
||||
Protected Sub BtnCargar_Click(sender As Object, e As EventArgs) Handles BtnCargar.Click
|
||||
Dim SBBody As New StringBuilder
|
||||
Dim Info As String
|
||||
Dim GPS As New ClsGPS
|
||||
Dim Icono As String = ""
|
||||
Dim SB = New StringBuilder()
|
||||
For Each row As DataRow In DTEquipos.Rows
|
||||
SB.Append($"{row("CveDispositivo")};")
|
||||
Next
|
||||
|
||||
If GPS.UltimaPosicionEquipoGet(SB.ToString, UsuarioActual.CveCliente) Then
|
||||
If GPS.DtResultados.Rows.Count > 0 Then
|
||||
For Each row As DataRow In GPS.DtResultados.Rows
|
||||
Dim Coord As String '= SQLToGmaps(row("Posicion").ToString, "POINT")
|
||||
|
||||
Try
|
||||
Coord= SQLToGmaps(row("Posicion").ToString, "POINT")
|
||||
|
||||
Catch ex As Exception
|
||||
GuardaLog($"{SB.ToString} {UsuarioActual.CveCliente}{ex.ToString()}")
|
||||
End Tryy
|
||||
Info = InfoWindowCombustible($"Vehículo: {row("Vehiculo").ToString}", "-1", row("CveDispositivo").ToString.ToEntero, row)
|
||||
Dim Fecha = row("FechaTrama").ToString
|
||||
Dim Diferencia As Long = DateDiff(DateInterval.Minute, Fecha.ToDateTime(), FechaCliente)
|
||||
|
||||
If Diferencia >= 30 AndAlso Diferencia < 120 Then
|
||||
Icono = $"/Imagenes/rsz_11rsz_car_disconnected.png"
|
||||
ElseIf Diferencia >= 120 Then
|
||||
Icono = $"/Imagenes/rsz_11rsz_car_disable.png"
|
||||
Else
|
||||
If row("SPD").ToString.ToDouble > 1 Then
|
||||
Icono = $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {row("CveDispositivo").ToString}")}green.png"
|
||||
Else
|
||||
Icono = $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {row("CveDispositivo").ToString}")}.png"
|
||||
End If
|
||||
End If
|
||||
|
||||
SBBody.Append($"</table></div><div></div></div>")
|
||||
RegistraScript($"CreaMarcador({Coord},'{row("Vehiculo").ToString}', '{Info}', '{Icono}');", row("CveDispositivo").ToString)
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
RegistraScript("fitBoundsToVisibleMarkers();", "2")
|
||||
GPS.Dispose()
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "Herramientas - GPS"
|
||||
|
||||
Protected Sub BtnCargaComandos_Click(sender As Object, e As EventArgs) Handles BtnCargaComandos.Click
|
||||
CargaComandos()
|
||||
End Sub
|
||||
Private Sub CargaComandos()
|
||||
'Dim ObjGps As New ClsGPS
|
||||
'If ObjGps.GetComandosModeloDispositivo(HdnCveDipositivo.Value.ToEntero) AndAlso ObjGps.DtResultados.Rows.Count > 0 Then
|
||||
' GvComandos.DataSource = ObjGps.DtResultados.FiltraParametros("CveComando IN (6, 7, 32, 36, 8, 9)")
|
||||
' GvComandos.DataBind()
|
||||
' UpBodyTipoEquipo.Update()
|
||||
'End If
|
||||
|
||||
'ObjGps.Dispose()
|
||||
|
||||
Dim ObjGps As New ClsGPS
|
||||
If ObjGps.GetComandosModeloDispositivoUsuarios(HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, 1) Then
|
||||
GvComandos.DataSource = ObjGps.DtResultados
|
||||
End If
|
||||
ObjGps.Dispose()
|
||||
GvComandos.DataBind()
|
||||
|
||||
UpBodyTipoEquipo.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub GvComandos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvComandos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
'Select Case e.Row.DBCampo("CveComando").ToEntero
|
||||
' Case 6
|
||||
' e.Row.Cells(1).Text = "Apagar Motor"
|
||||
' Case 7
|
||||
' e.Row.Cells(1).Text = "Encender Motor"
|
||||
' Case 32
|
||||
' e.Row.Cells(1).Text = "Reiniciar Dispositivo"
|
||||
' Case 36
|
||||
' e.Row.Cells(1).Text = "Telefono de Pánico"
|
||||
' Case 8
|
||||
' e.Row.Cells(1).Text = "Abrir Compuerta"
|
||||
' Case 9
|
||||
' e.Row.Cells(1).Text = "Cerrar Compuerta"
|
||||
'End Select
|
||||
|
||||
If e.Row.DataKey("RequiereValor").ToEntero = 1 Then
|
||||
e.Row.FCTextBox("TxtValor").Visible = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GvComandos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvComandos.RowCommand
|
||||
If (e.CommandName = "EnviarComando") Then
|
||||
|
||||
Dim ObjHerramientas As New ClsGPSHerramientas
|
||||
|
||||
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
|
||||
Dim row As GridViewRow = GvComandos.Rows(index)
|
||||
|
||||
ObjHerramientas.EjecutarComandoGPRS(row.DataKey("CveComando").ToEntero, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, row.FCTextBox("TxtValor").Text)
|
||||
|
||||
ObjHerramientas.Dispose()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Private Sub BtnApagarMotor_Click(sender As Object, e As EventArgs) Handles BtnApagarMotor.Click
|
||||
' 'Comando 6
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(6, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, "")
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
|
||||
'Private Sub BtnEncenderMotor_Click(sender As Object, e As EventArgs) Handles BtnEncenderMotor.Click
|
||||
' 'Comando 7
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(7, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, "")
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
|
||||
'Private Sub BtnReinicio_Click(sender As Object, e As EventArgs) Handles BtnReinicio.Click
|
||||
' 'Comando 32
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(32, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, "")
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
|
||||
'Private Sub BtnTelefonoPanico_Click(sender As Object, e As EventArgs) Handles BtnTelefonoPanico.Click
|
||||
' 'Comando 36
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(36, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, TxtTelefonoPanico.Text.Trim)
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
|
||||
'Private Sub BtnProbarEncendido_Click(sender As Object, e As EventArgs) Handles BtnProbarEncendido.Click
|
||||
' 'Comando 8 'Abrir Compuerta
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(8, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, "")
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
|
||||
'Private Sub BtnInfoDispositivo_Click(sender As Object, e As EventArgs) Handles BtnInfoDispositivo.Click
|
||||
' 'Comando 9 'Cerrar Compuerta
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(9, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, "")
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
|
||||
'Private Sub BtnAhorroBateria_Click(sender As Object, e As EventArgs) Handles BtnAhorroBateria.Click
|
||||
' 'Comando 40
|
||||
' Dim ObjGPSHerramientas As New ClsGPSHerramientas
|
||||
' ObjGPSHerramientas.EjecutarComandoGPRS(40, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, DdlTipoBateria.SelectedValue)
|
||||
' ObjGPSHerramientas.Dispose()
|
||||
'End Sub
|
||||
#End Region
|
||||
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=\'/GPS/Vehiculos.aspx?CveDispositivo={CveDispositivo}\'><b>{Header}</b></a></h5></div>")
|
||||
SBuilder.Append($"<div><table>")
|
||||
SBuilder.Append($"<tr><td>Fecha : {row("FechaTrama")} </td></tr>")
|
||||
SBuilder.Append($"<tr><td>Conductor : {row("Conductor").ToString}</td></tr>")
|
||||
SBuilder.Append($"<tr><td>Combustible : {IfNull(row("Combustible"), "NO DISPONIBLE", $"{row("Combustible").ToString.FormatoNumero} lts").ToString}</td></tr>")
|
||||
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
|
||||
If PermisoComandos Then
|
||||
SBuilder.Append($"<tr><td><a href=""javascript:;"" onclick=""CargaComandos(\'{row("Vehiculo").ToString}\',{CveDispositivo});"">Comandos</a></td></tr>")
|
||||
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)
|
||||
SBuilder.Append($"</table></div><div></div></div>")
|
||||
Return SBuilder.ToString
|
||||
End Function
|
||||
End Class
|
||||
1127
GPS/Shipments.aspx
1127
GPS/Shipments.aspx
File diff suppressed because it is too large
Load Diff
@@ -154,34 +154,41 @@ public partial class GPS_Shipments : ClsPaginas
|
||||
}
|
||||
protected void LnkAddStop_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DtStops != null)
|
||||
{
|
||||
var Row = DtStops.NewRow();
|
||||
Row["StopSequence"] = DtStops.Rows.Count + 1;
|
||||
Row["Name"] = TxtLocName.Text.Trim();
|
||||
Row["LocationID"] = TxtLocID.Text.Trim();
|
||||
Row["StopType"] = DdlStopType.SelectedValue;
|
||||
Row["StopRole"] = DdlStopRole.SelectedValue;
|
||||
Row["EarlyArrivalTime"] = TxtFechaStopI.Text.ToDateTime();
|
||||
Row["LateArrivalTime"] = TxtFechaStopF.Text.ToDateTime();
|
||||
|
||||
Row["Address"] = TxtAddress.Text.Trim();
|
||||
Row["City"] = TxtCity.Text.Trim();
|
||||
Row["State"] = TxtState.Text.Trim();
|
||||
Row["PostalCode"] = TxtPostalCode.Text.Trim();
|
||||
Row["Country"] = TxtContry.Text.Trim();
|
||||
|
||||
var latlon = TxtLatLong.Text.Trim().Split(',');
|
||||
|
||||
Row["Lat"] = latlon[0];
|
||||
Row["Lon"] = latlon[1];
|
||||
|
||||
DtStops.Rows.Add(Row);
|
||||
try
|
||||
{
|
||||
if (DtStops != null)
|
||||
{
|
||||
var Row = DtStops.NewRow();
|
||||
Row["StopSequence"] = DtStops.Rows.Count + 1;
|
||||
Row["Name"] = TxtLocName.Text.Trim();
|
||||
Row["LocationID"] = TxtLocID.Text.Trim();
|
||||
Row["StopType"] = DdlStopType.SelectedValue;
|
||||
Row["StopRole"] = DdlStopRole.SelectedValue;
|
||||
Row["EarlyArrivalTime"] = TxtFechaStopI.Text.ToDateTime();
|
||||
Row["LateArrivalTime"] = TxtFechaStopF.Text.ToDateTime();
|
||||
|
||||
Row["Address"] = TxtAddress.Text.Trim();
|
||||
Row["City"] = TxtCity.Text.Trim();
|
||||
Row["State"] = TxtState.Text.Trim();
|
||||
Row["PostalCode"] = TxtPostalCode.Text.Trim();
|
||||
Row["Country"] = TxtContry.Text.Trim();
|
||||
|
||||
var latlon = TxtLatLong.Text.Trim().Split(',');
|
||||
|
||||
Row["Lat"] = latlon[0];
|
||||
Row["Lon"] = latlon[1];
|
||||
|
||||
DtStops.Rows.Add(Row);
|
||||
}
|
||||
GvStops.DataSource = DtStops;
|
||||
GvStops.DataBind();
|
||||
|
||||
UpShipment.Update();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnError("Ocurrió un error al registrar la parada (stop)", ex);
|
||||
}
|
||||
GvStops.DataSource = DtStops;
|
||||
GvStops.DataBind();
|
||||
|
||||
UpShipment.Update();
|
||||
|
||||
this.RegistraScript("$('#DivStop').modal('hide');");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user