diff --git a/App_Code/ClsGPS.vb b/App_Code/ClsGPS.vb index 9bffc2e1f..6e1ee8d05 100644 --- a/App_Code/ClsGPS.vb +++ b/App_Code/ClsGPS.vb @@ -8,9 +8,9 @@ Imports System.IO Imports Newtonsoft.Json Public Class ClsGPS - Implements IDisposable + Implements IDisposable #Region "Campos" - 'SQL + 'SQL Private Econ As OleDb.OleDbConnection Private SqlConexion As SqlConnection Private SqlAdapter As SqlDataAdapter @@ -45,9 +45,9 @@ Public Class ClsGPS Public Property EstaDentro As Boolean Public Property CvePuntoDeInteresGrupo As Integer Public Property CveGeoReferencia As Integer - Public Property MensajeError As String + Public Property MensajeError As String #End Region - + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) If TransaccionCompartida Is Nothing Then @@ -74,9 +74,9 @@ Public Class ClsGPS End With If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc Data = New DataTable - End Sub + End Sub #Region "Conexiones" - + Private Sub ConexionAdd() If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then Try @@ -109,7 +109,7 @@ Public Class ClsGPS CveConexion = 0 End If - End Sub + End Sub #End Region Public Function IniciaTransacSQL() As SqlTransaction If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() @@ -120,8 +120,40 @@ Public Class ClsGPS End Sub Public Sub Commit() SqlTransacc.Commit() - End Sub - + End Sub +#Region "Arrastre" + + Public Function GPS_ArrastreGET(CveDispositivo As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_GPS_ArrastreGET") + With SqlAdapter.SelectCommand.Parameters + addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo) + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos de Arrastre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function GPS_ArrastreActivarDesactivar(CveDispositivo As Integer, ArrastreActivo As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_GPS_ArrastreActivarDesactivar") + With SqlAdapter.SelectCommand.Parameters + addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo) + addParameters("@ArrastreActivo", SqlDbType.Bit, ArrastreActivo) + End With + Try + Dataset = New DataSet() + SqlAdapter.Fill(Dataset) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al activar o desactivar la alerta de Arrastre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region Public Function GetTemperatura(CveDispositivo As Integer, CveSensor As Integer, strFechaInicio As String, strFechaFin As String, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_GPS_TramaData") @@ -170,8 +202,8 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener las zonas horarias", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + End Function + #Region "FacturasSims" Public Function GetFacturasSims(CveUsuario As Integer, CveEmpresa As Integer, Periodo As Integer) As Boolean Dim retorno As Boolean = False @@ -258,9 +290,9 @@ Public Class ClsGPS addParameters("@cveGpsFacturaSim", SqlDbType.Int, cveGpsFacturaSim) retorno = RunQuery("Ocurrió un error al eliminar el FacturasSims.") Return retorno - End Function + End Function #End Region - + #Region "M O D E L O S" Public Function AddMarca(Marca As String, Estatus As Boolean, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False @@ -456,13 +488,13 @@ Public Class ClsGPS End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region "Rastreo" - + Public Function CoordenadasGet(id As Integer, Nombre As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Coords_Get") @@ -1565,11 +1597,11 @@ Public Class ClsGPS End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region "Puntos de interes" Public Function PuntoDeInteresAdd(PuntoDeInteres As String, CveCliente As Integer, GEOM As String, Estatus As Boolean, Descripcion As String, CvePuntoDeInteresGrupo As Integer) As Boolean Dim Retorno As Boolean = False @@ -1736,12 +1768,12 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener el reporte de los Puntos de Interés.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - - - + End Function + + + #End Region - + #Region "CONDUCTORES" Public Function ConductorAdd(Conductor As String, Estatus As Boolean, CveUsuario As Integer, SerieLicencia As String, FechaNacimiento As Date, VencimientoLicencia As Date, Optional CveCliente As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1887,9 +1919,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "CONTROLADORES GRAFICOS" Public Function ControladorGraficoAdd(ControladorGrafico As String, UM As String) As Boolean Dim Retorno As Boolean = False @@ -1957,10 +1989,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "V E H I C U L O S" Public Function VehiculoAdd(Modelo As String, Color As String, Serie As String, Nombre As String, NoEconomico As String, CveUsuario As Integer, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -2038,9 +2070,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "TIPO COMUNICACION" Public Function TipoComunicacionAdd(TipoComunicacion As String, Estatus As Boolean, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False @@ -2113,10 +2145,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "R U T A S" Public Function AddRuta(Ruta As String, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -2179,9 +2211,9 @@ Public Class ClsGPS OnError("Ocurrió un error al eliminar la ruta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + Public Function GetResGuardantesSim(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_GPS_ResGuardantesSimnGet") @@ -2195,9 +2227,9 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener el proveedor de comunicacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #Region "Proveedor Comunicacion" - + Public Function ProveedorComunicacion_Add(ProveedorComunicacion As String, Estatus As Byte, CveUsuario As Integer, CveTipoComunicacion As Integer, APNIP As String, APNUSER As String, APNPASS As String, correo As String) As Boolean Dim Retorno As Boolean = False @@ -2279,12 +2311,12 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "Proveedor Comunicacion Cuentas" - + Public Function ProveedoresComunicacionCuentasAdd(CveProveedorComunicacion As Integer, CvePlanDato As Integer, CveUsuario As Integer, IP As String, SSID As String, NumeroTelefono As String, Estatus As Integer, CveEmpresa As Integer, Imei As String, CveUsuarioResguardante As Integer, Optional Activacion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_GPS_ProveedoresComunicacionCuentasAdd") @@ -2423,10 +2455,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "E V E N T O S" Public Function EventoTipoAdd(EventoTipo As String, Estatus As Boolean, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False @@ -2901,15 +2933,15 @@ Public Class ClsGPS End Try Return Retorno - End Function - - - + End Function + + + #End Region - + #Region "Plan de Datos" - - + + Public Function PlanesDatosAdd(CveProveedorComunicacion As Integer, CveUsuario As Integer, PlanDato As String, Importe As Decimal, Estatus As Integer, Capacidad As Integer, TipoPlan As String, CostoAdicional As String, TechoFacturacion As String, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -2998,10 +3030,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "Dispositivos" Public Function DispositivoAdd(TipoDispositivo As Integer, NumTelefono As String, CveModelo As Integer, CveProveedorComunicacionCuenta As Integer, CveCliente As Integer, IMEI As String, Serie As String, CveEstatus As Integer, SerieVehiculo As String, ColorVehiculo As String, NombreVehiculo As String, NoEconomico As String, devID As String, devPort As Integer, ModeloVehiculo As String, AñoVehiculo As String, ClaseVehiculo As String, PlacasVehiculo As String, LimiteVelocidad As Boolean, VelocidadMaxima As Double, @@ -3328,10 +3360,10 @@ Public Class ClsGPS OnError("Ocurrió un error al actualizar los dispositivos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + End Function + #End Region - + #Region "REPORTES" Public Function GetReportes() As Boolean Dim Retorno As Boolean = False @@ -3645,9 +3677,9 @@ Public Class ClsGPS OnError("Ocurrió un obtener el reporte de eventos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + #Region "I N D I C A D O R E S" Public Function IndicadoresGet(CveCliente As Integer, FechaInicio As DateTime, FechaFin As DateTime) As Boolean Dim Retorno As Boolean = False @@ -3664,9 +3696,9 @@ Public Class ClsGPS OnError("Ocurrió un obtener el reporte de indicadores.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + #Region "DashBoard" Public Function GetDashboard(CveCliente As Integer, FechaI As DateTime, FechaF As DateTime, Optional Top As Integer = 5) As String Dim Retorno As String = "[]" @@ -3917,10 +3949,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "Controles" Public Function GetCombustible(CveDispositivo As Integer, CveControl As Integer) As Boolean Dim Retorno As Boolean = False @@ -4275,9 +4307,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "A P L I C A C I O N M O V I L " Public Function AddTrama(DevID As String, Trama As String, Lat As Double, Lng As Double, FechaTrama As DateTime, Optional Speed As Double = 0, Optional Modelo As String = "App") As Boolean Dim Retorno As Boolean = False @@ -4411,9 +4443,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "G R U P O S" Public Function GruposAdd(Nombre As String, CveCliente As Integer) As Integer @@ -4483,10 +4515,10 @@ Public Class ClsGPS End Try Return Retorno - End Function - + End Function + #End Region - + #Region "G R U P O S - D E T A L L E" Public Function GruposDetallesAdd(CveDispositivoGrupo As Integer, CveDispositivo As Integer) As Boolean Dim Retorno As Boolean = False @@ -4535,9 +4567,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "A L T A S - B A J A S" Public Function AddAltaBajas(CveDispositivo As Integer, Fecha As DateTime, CveUsuario As Integer, Tipo As Integer, CveCliente As Integer) As Boolean Dim Retorno As Boolean = False @@ -4578,9 +4610,9 @@ Public Class ClsGPS End Try Return Retorno - End Function + End Function #End Region - + #Region "P A S A J E R O S" Public Function GetCortesChofer(CveCorteChofer As Integer, CveDispositivo As Integer, CveUsuarioIngreso As Integer) As Boolean Dim retorno As Boolean = False @@ -4714,9 +4746,9 @@ 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 Dim retorno As Integer = 0 @@ -5266,10 +5298,10 @@ Public Class ClsGPS OnError("Ocurrió un error al obtener la configuracion de FreightVerify.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return retorno - End Function - + End Function + #End Region - + #Region "F U N C I O N E S" Public Function ReaderToJson(ByVal rdr As SqlDataReader) As String Dim sb As StringBuilder = New StringBuilder() @@ -5323,10 +5355,10 @@ Public Class ClsGPS jsonWriter.WriteEndArray() End Using Return sw.ToString() - End Function - + End Function + #End Region - + Protected Sub addParameters(name As String, tipo As SqlDbType, valor As Object) If SqlConexion.State = ConnectionState.Open Then SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor @@ -5372,9 +5404,9 @@ Public Class ClsGPS addParameters("@FechaFin", SqlDbType.DateTime, fechaFin) retorno = RunQuery("Ocurrió un error al obtener el CombustibleResumen.") Return retorno - End Function + End Function #Region " IDisposable Support " - ' IDisposable + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not disposedValue Then If disposing Then @@ -5405,6 +5437,6 @@ Public Class ClsGPS ConexionClose() Dispose(True) GC.SuppressFinalize(Me) - End Sub + End Sub #End Region End Class diff --git a/GPS/RepArrastre.aspx b/GPS/RepArrastre.aspx index d8f7b0845..dc674de2a 100644 --- a/GPS/RepArrastre.aspx +++ b/GPS/RepArrastre.aspx @@ -3,6 +3,11 @@ + Reporte de Arrastre @@ -10,6 +15,9 @@ +
  • + Apagar vehiculo +
  • @@ -42,42 +50,168 @@ -
    -
    -
    -
    -
    -
    -
    - - TIEMPOS OPERATIVOS -
    -
    -
    -
    + + +
    +
    +
    +
    +
    +
    + + datos vehiculo +
    +
    +
    +
    +
    -
    - -
    -
    -
    -
    -
    - +
    + +
    -
    - -
    -
    - +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    -
    + + +
    + + diff --git a/GPS/RepArrastre.aspx.cs b/GPS/RepArrastre.aspx.cs index cff9cc9c6..722d89e64 100644 --- a/GPS/RepArrastre.aspx.cs +++ b/GPS/RepArrastre.aspx.cs @@ -1,25 +1,98 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Extensiones; public partial class GPS_RepArrastre : ClsPaginas { + + public int CveDispositivo + { + get + { + if (ViewState["CveDispositivo"] != null) + { + return ViewState["CveDispositivo"].ToString().ToEntero(); + + } + else + { + return 0; + } + } + set { ViewState["CveDispositivo"] = value; } + } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { - - DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario) ; + // fijo borrar + DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(263965, 1928) ; + //DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario) ; DdlDispositivo.DataBind(); + getArrastre(); } } + private void getArrastre() + { + CveDispositivo = DdlDispositivo.SelectedValue.ToEntero(); + using (ClsGPS objgps = new ClsGPS()) + { + if (objgps.GPS_ArrastreGET(CveDispositivo) && objgps.DtResultados.Rows.Count > 0) + { + DataRow dtrow = objgps.DtResultados.Rows[0]; + upInfo(dtrow); + } + + } + } + public void upInfo(DataRow dtrow) + { + if ( dtrow != null) + { + LblVelocidad.Text = $"{dtrow["Speed"]:N0}"; + LblEncApa.Text = $"{dtrow["EncendidoText"]}"; + LblFechaInfo.Text = $"{dtrow["FechaTrama"]:dd/MM/yyyy}"; + //LblVelocidad.Text = $"{dtrow[""]}"; + //LblVelocidad.Text = $"{dtrow[""]}";addmarkerActual({ lat: -25.363, lng: 131.044 }) + string pVehiculo = string.Format("{{ lat: {0}, lng: {1}}}", dtrow["Lat"], dtrow["Lng"]); + string parrastre = string.Format("{{ lat: {0}, lng: {1}}}", dtrow["LatArrastre"], dtrow["LngArrastre"]); + TxtFunciones.Text = string.Format("addmarkerActual({0},{3}){1};setCenter({2})", pVehiculo, (dtrow["ArrastreActivo"].ToString() == "1" ? $" ;addmarkerarrastre({parrastre})" : ";addmarkerarrastre()"), (dtrow["ArrastreActivo"].ToString() == "1" ? parrastre : pVehiculo), dtrow["Encendido"].ToString().ToEntero()); + UpInfo.Update(); + } + } protected void BtnConsultar_Click(object sender, EventArgs e) { + getArrastre(); + } + + protected void chkActivarArrastre_CheckedChanged(object sender, EventArgs e) + { + using (ClsGPS objgps = new ClsGPS()) + { + if (objgps.GPS_ArrastreActivarDesactivar(CveDispositivo, chkActivarArrastre.Checked)){ + + if (objgps.GPS_ArrastreGET(CveDispositivo) && objgps.DtResultados.Rows.Count > 0) + { + DataRow dtrow = objgps.DtResultados.Rows[0]; + upInfo(dtrow); + } + if (chkActivarArrastre.Checked) + { + Alert("se ha activado la funcion de arrastre"); + } + else + { + Alert("se ha desactivado la funcion de arrastre"); + } + } + } } } \ No newline at end of file diff --git a/Imagenes/rsz_11rsz_cargreen.png b/Imagenes/rsz_11rsz_cargreen.png index 374265dcd..2d560ffea 100644 Binary files a/Imagenes/rsz_11rsz_cargreen.png and b/Imagenes/rsz_11rsz_cargreen.png differ