Cambios estatus de trayectos
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
Imports Fluent
|
||||
Imports System
|
||||
Imports System.Web
|
||||
Imports System.Net
|
||||
Imports System.Net.Http
|
||||
Imports System.Web.Http
|
||||
Imports System.Data
|
||||
@@ -11,6 +12,9 @@ Imports Newtonsoft.Json.Linq
|
||||
Imports Extensiones
|
||||
Imports System.IO
|
||||
Imports System.Runtime.CompilerServices
|
||||
Imports System.Xml
|
||||
Imports System.Xml.Serialization
|
||||
Imports System.Linq
|
||||
|
||||
Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
@@ -56,11 +60,19 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
#End Region
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
context.Response.ContentType = "application/json"
|
||||
context.Response.ContentType = "application/xml"
|
||||
|
||||
Dim UsuarioActual = ValidaUsuarioSistema(1, 100)
|
||||
'Dim ObjFactura As New Modelos.Factura(usuario, 898028, 140)
|
||||
|
||||
CancelarFacturaPADE(context, UsuarioActual)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub TimbrarFacturaPADE(ByVal context As HttpContext, UsuarioActual As Usuario)
|
||||
|
||||
Dim UsuarioServicio As String = "rene.molina@adssistemas.mx"
|
||||
Dim ClaveServicio As String = "Facturacion2021#"
|
||||
|
||||
@@ -125,11 +137,189 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
New JProperty("opciones", New String(0) {""})
|
||||
)
|
||||
|
||||
Dim resp = EnviarInformacionPADE("https://timbrado.pade.mx/servicio/rest/timbrado/timbrarConCSD", payload.ToString(), TokenAuth)
|
||||
Dim Respuesta = EnviarInformacionPADE("https://timbrado.pade.mx/servicio/rest/timbrado/timbrarConCSD", payload.ToString(), TokenAuth)
|
||||
|
||||
context.Response.Write(resp)
|
||||
If Not String.IsNullOrEmpty(Respuesta) Then
|
||||
Dim result As PADEServicioTimbradoResp = Nothing
|
||||
Dim serializer As XmlSerializer = New XmlSerializer(GetType(PADEServicioTimbradoResp))
|
||||
|
||||
Try
|
||||
Using reader As TextReader = New StringReader(Respuesta)
|
||||
result = CType(serializer.Deserialize(reader), PADEServicioTimbradoResp)
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener los resultados", ex)
|
||||
End Try
|
||||
|
||||
If result IsNot Nothing Then
|
||||
Dim xmlGuardar = result.xmlBase64.ToBase64Decode()
|
||||
context.Response.Write(xmlGuardar)
|
||||
Else
|
||||
context.Response.Write(Respuesta)
|
||||
End If
|
||||
Else
|
||||
context.Response.Write(Respuesta)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CancelarFacturaPADE(ByVal context As HttpContext, UsuarioActual As Usuario)
|
||||
|
||||
Dim UsuarioServicio As String = "rene.molina@adssistemas.mx"
|
||||
Dim ClaveServicio As String = "Facturacion2021#"
|
||||
|
||||
Dim EmisorRFC As String = "ZUÑ920208KL4"
|
||||
Dim ArchivoLLave As String = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key"
|
||||
Dim ArchivoCertificado As String = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer"
|
||||
Dim Clave = "12345678a"
|
||||
Dim TimbraProduccion = False
|
||||
|
||||
If Not File.Exists(ArchivoCertificado) Then
|
||||
context.Response.Write("El archivo de llave privada no existe")
|
||||
Exit Sub
|
||||
End If
|
||||
If Not File.Exists(ArchivoLLave) Then
|
||||
context.Response.Write("El archivo de llave privada no existe")
|
||||
Exit Sub
|
||||
End If
|
||||
If UsuarioActual.Empresa.ContraseñaKey = "" Then
|
||||
context.Response.Write("La clave no puede ser vacía")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim llaveByte As Byte(), certByte As Byte()
|
||||
Dim llaveBase64 As String = "", certBase64 As String = ""
|
||||
Dim cfdi As New GoFac.GoCfdi()
|
||||
Dim complemento As String = ""
|
||||
Dim complementoConcepto As String = ""
|
||||
|
||||
|
||||
Try
|
||||
llaveByte = System.IO.File.ReadAllBytes(ArchivoLLave)
|
||||
llaveBase64 = Convert.ToBase64String(llaveByte)
|
||||
Catch ex As Exception
|
||||
context.Response.Write($"Error al leer la llave privada: {ex.Message}")
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
|
||||
Try
|
||||
certByte = System.IO.File.ReadAllBytes(ArchivoCertificado)
|
||||
certBase64 = Convert.ToBase64String(certByte)
|
||||
Catch ex As Exception
|
||||
context.Response.Write($"Error al leer el certificado: {ex.Message}")
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
Dim TokenAuth As String = ToBase64Encode($"{UsuarioServicio}:{ClaveServicio}")
|
||||
|
||||
Dim Contrato As String = "72330711-cac6-4106-8051-cbcda1aef495"
|
||||
|
||||
Dim FolioFiscal As String = "9A46AD71-560B-4048-8B40-80ADC57C1CDC"
|
||||
|
||||
'Dim Respuesta As String = EnviarInformacionCancelacionPADE("https://timbrado.pade.mx/servicio/rest/cancelacion/cancelar", TokenAuth, Contrato, EmisorRFC, certBase64, llaveBase64, Clave, FolioFiscal)
|
||||
|
||||
'context.Response.Write(Respuesta)
|
||||
|
||||
Dim Respuesta As String = EnviarInformacionCancelacionPADESOAP("https://timbrado.pade.mx/servicio/Timbrado3.3?wsdl", UsuarioServicio, ClaveServicio, Contrato, EmisorRFC, certBase64, llaveBase64, Clave, FolioFiscal, TimbraProduccion)
|
||||
|
||||
If Not String.IsNullOrEmpty(Respuesta) Then
|
||||
Dim result As PADEServicioCancelacionResp = Nothing
|
||||
Dim serializer As XmlSerializer = New XmlSerializer(GetType(PADEServicioCancelacionResp))
|
||||
|
||||
Try
|
||||
Using reader As TextReader = New StringReader(Respuesta)
|
||||
result = CType(serializer.Deserialize(reader), PADEServicioCancelacionResp)
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener los resultados", ex)
|
||||
End Try
|
||||
|
||||
If result IsNot Nothing Then
|
||||
context.Response.ContentType = "application/json"
|
||||
context.Response.Write(JsonConvert.SerializeObject(result))
|
||||
Else
|
||||
context.Response.Write(Respuesta)
|
||||
End If
|
||||
Else
|
||||
context.Response.Write(Respuesta)
|
||||
End If
|
||||
|
||||
'Dim arrayFolioFiscal = New String(0) {FolioFiscal}
|
||||
'Dim arrayOpciones = New List(Of String)
|
||||
'If Not TimbraProduccion Then
|
||||
' arrayOpciones.Add("MODO_PRUEBA:1")
|
||||
'End If
|
||||
|
||||
'Dim pade = New PADE33.PadeTimbradoServiceClient()
|
||||
|
||||
'Dim Res = pade.cancelarConOpciones(Contrato, UsuarioServicio, ClaveServicio, EmisorRFC, arrayFolioFiscal, certByte, llaveByte, Clave, arrayOpciones.ToArray())
|
||||
|
||||
'context.Response.Write(Res)
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function EnviarInformacionCancelacionPADESOAP(ByVal url As String, UsuarioServicio As String, PassServicio As String, contrato As String, rfcEmisor As String,
|
||||
certBase64 As String, keyBase64 As String, keyPass As String, arregloUUID As String, TimbraProduccion As Boolean) As String
|
||||
Dim retorno = ""
|
||||
Try
|
||||
|
||||
Dim request As HttpWebRequest = CType(WebRequest.Create($"{url}"), HttpWebRequest)
|
||||
'request.Headers.Add("SOAPAction:http://tempuri.org/TestCfd33 ")
|
||||
request.ContentType = "text/xml;charset=""utf-8"""
|
||||
request.Accept = "text/xml"
|
||||
request.Method = "POST"
|
||||
|
||||
Dim XMLString As String = $"<Envelope xmlns=""http://schemas.xmlsoap.org/soap/envelope/"">
|
||||
<Body>
|
||||
<cancelarConOpciones xmlns=""timbrado.ws.pade.mx"">
|
||||
<contrato xmlns="""">{contrato}</contrato>
|
||||
<usuario xmlns="""">{UsuarioServicio}</usuario>
|
||||
<passwd xmlns="""">{PassServicio}</passwd>
|
||||
<rfcEmisor xmlns="""">{rfcEmisor}</rfcEmisor>
|
||||
<arregloUUID xmlns="""">{arregloUUID}</arregloUUID>
|
||||
<cert xmlns="""">{certBase64}</cert>
|
||||
<key xmlns="""">{keyBase64}</key>
|
||||
<keyPass xmlns="""">{keyPass}</keyPass>
|
||||
<opciones xmlns="""">{If(TimbraProduccion, "", "MODO_PRUEBA:3")}</opciones>
|
||||
</cancelarConOpciones>
|
||||
</Body>
|
||||
</Envelope>"
|
||||
|
||||
Dim SOAPReqBody As XmlDocument = New XmlDocument()
|
||||
SOAPReqBody.LoadXml(XMLString)
|
||||
|
||||
Using stream As Stream = request.GetRequestStream()
|
||||
SOAPReqBody.Save(stream)
|
||||
End Using
|
||||
|
||||
Dim response As String = ""
|
||||
|
||||
Using Serviceres As WebResponse = request.GetResponse()
|
||||
Using rd As StreamReader = New StreamReader(Serviceres.GetResponseStream())
|
||||
response = rd.ReadToEnd()
|
||||
End Using
|
||||
End Using
|
||||
|
||||
If Not String.IsNullOrEmpty(response) Then
|
||||
Dim xmlRetorno = New XmlDocument()
|
||||
xmlRetorno.LoadXml(response)
|
||||
Dim elemList As XmlNodeList = xmlRetorno.GetElementsByTagName("return")
|
||||
|
||||
If elemList.Count > 0 Then
|
||||
If elemList(0).ChildNodes.Count > 0 Then
|
||||
retorno = elemList(0).ChildNodes(0).Value
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
retorno = ""
|
||||
OnError("Ocurrió un error al cancelar", ex)
|
||||
End Try
|
||||
|
||||
Return retorno
|
||||
End Function
|
||||
|
||||
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||
Get
|
||||
@@ -159,6 +349,46 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
End Function
|
||||
|
||||
|
||||
Private Function EnviarInformacionCancelacionPADE(url As String, tokenAuth As String, contrato As String, rfcEmisor As String,
|
||||
certBase64 As String, keyBase64 As String, keyPass As String, arregloUUID As String) As String
|
||||
Dim Retorno As String = ""
|
||||
Try
|
||||
Dim urlParametros As String = String.Format("contrato={0}&rfcEmisor={1}&certBase64={2}&keyBase64={3}&keyPass={4}&arregloUUID={5}&opciones={6}", contrato, rfcEmisor, certBase64, keyBase64, keyPass, arregloUUID, "MODO_PRUEBA:1")
|
||||
|
||||
Dim urlRequest As String = String.Format("{0}?{1}", url, urlParametros)
|
||||
|
||||
Using httpClient = New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 1, 0)
|
||||
Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(urlRequest))
|
||||
request.Headers.Add("Authorization", $"Basic {tokenAuth}")
|
||||
|
||||
Dim response = httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result
|
||||
Retorno = response.Content.ReadAsStringAsync().Result
|
||||
'Dim Parametros = New List(Of KeyValuePair(Of String, String))
|
||||
|
||||
'Parametros.Add(New KeyValuePair(Of String, String)("contrato", contrato))
|
||||
'Parametros.Add(New KeyValuePair(Of String, String)("rfcEmisor", rfcEmisor))
|
||||
'Parametros.Add(New KeyValuePair(Of String, String)("certBase64", certBase64))
|
||||
'Parametros.Add(New KeyValuePair(Of String, String)("keyBase64", keyBase64))
|
||||
'Parametros.Add(New KeyValuePair(Of String, String)("keyPass", keyPass))
|
||||
'Parametros.Add(New KeyValuePair(Of String, String)("arregloUUID", arregloUUID))
|
||||
|
||||
'Using content = New FormUrlEncodedContent(Parametros)
|
||||
' request.Content = content
|
||||
|
||||
|
||||
'End Using
|
||||
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Retorno = ""
|
||||
OnError("Ocurrió un error al enviar la informacion", ex)
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
Public Function ToBase64Encode(ByVal plainText As String) As String
|
||||
Dim plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText)
|
||||
Return System.Convert.ToBase64String(plainTextBytes)
|
||||
@@ -170,6 +400,53 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
Return System.Text.Encoding.UTF8.GetString(base64EncodedBytes)
|
||||
End Function
|
||||
|
||||
<Serializable(), XmlRoot("servicioTimbrado")>
|
||||
Public Class PADEServicioTimbradoResp
|
||||
<XmlElement("id")>
|
||||
Public Property id As String
|
||||
<XmlElement("timbradoOk")>
|
||||
Public Property timbradoOk As Boolean
|
||||
<XmlElement("contrato")>
|
||||
Public Property contrato As String
|
||||
<XmlElement("codigo")>
|
||||
Public Property codigo As String
|
||||
<XmlElement("mensaje")>
|
||||
Public Property mensaje As String
|
||||
<XmlElement("UUID")>
|
||||
Public Property UUID As String
|
||||
<XmlElement("FechaTimbrado")>
|
||||
Public Property FechaTimbrado As DateTime
|
||||
<XmlElement("xmlBase64")>
|
||||
Public Property xmlBase64 As String
|
||||
End Class
|
||||
|
||||
<Serializable(), XmlRoot("servicioCancel")>
|
||||
Public Class PADEServicioCancelacionResp
|
||||
<XmlElement("statusOk")>
|
||||
Public Property statusOk As Boolean
|
||||
<XmlElement("codigo")>
|
||||
Public Property codigo As String
|
||||
<XmlElement("mensaje")>
|
||||
Public Property mensaje As String
|
||||
<XmlElement("procesados")>
|
||||
Public Property procesados As Integer
|
||||
<XmlElement("cancelados")>
|
||||
Public Property cancelados As Integer
|
||||
<XmlArray("cancelaciones")>
|
||||
<XmlArrayItem("cancelacion")>
|
||||
Public Property cancelaciones As List(Of PADECancelacion)
|
||||
End Class
|
||||
|
||||
<Serializable(), XmlRoot("cancelacion")>
|
||||
Public Class PADECancelacion
|
||||
<XmlElement("uuid")>
|
||||
Public Property uuid As String
|
||||
<XmlElement("codigo")>
|
||||
Public Property codigo As String
|
||||
<XmlElement("mensaje")>
|
||||
Public Property mensaje As String
|
||||
End Class
|
||||
|
||||
Public Property XMLPrueba As String = "<?xml version=""1.0"" encoding=""UTF-8""?><cfdi:Comprobante xmlns:cfdi=""http://www.sat.gob.mx/cfd/3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd"" Version=""3.3"" Serie=""HM"" Folio=""1682"" Fecha=""2021-05-20T17:43:32"" Sello=""BdE1N3CwiqU6KKOWT80N6X/9kELGK22bRmfHfXHUaYvOCmOixuAN3a0yyd5Yzf4lD0sVs+OScZ1rgNKhWWyRwAJzw/avfGod2l7LIGbyYLGoUHUPpY3swDgTk+zq29PUbf3500YPf4qkXx3GcKYkIb4TnQPnvFnjE8FvcV+p8wETuvijm5T3HzFKCXG6ePrERIt2PN1NM26p2NIOzMSUksSNUtC6rqEI8G2yIUIMZqQ4bHTo1WdV0UPKBaqjkPLyY8Q1TMFZDbiudE454bUJWjxv6KYicXgfH17HJY91XTncCgwwrwlcPrKK7ea/xPzYumHMurEl5arjfqE6+nI3Fw=="" FormaPago=""01"" NoCertificado=""30001000000400002442"" Certificado=""MIIFuzCCA6OgAwIBAgIUMzAwMDEwMDAwMDA0MDAwMDI0NDIwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9yaXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0wGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWRpejEOMAwGA1UEEQwFMDYzNzAxCzAJBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhDT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3BvbnNhYmxlOiBBQ0RNQS1TQVQwHhcNMTkwNjE3MjAxODA2WhcNMjMwNjE3MjAxODA2WjCB4jEnMCUGA1UEAxQeWkFQQVRFUklBIFVSVEFETyDRRVJJIFNBIERFIENWMScwJQYDVQQpFB5aQVBBVEVSSUEgVVJUQURPINFFUkkgU0EgREUgQ1YxJzAlBgNVBAoUHlpBUEFURVJJQSBVUlRBRE8g0UVSSSBTQSBERSBDVjElMCMGA1UELRQcWlXROTIwMjA4S0w0IC8gS0FITzY0MTEwMUIzOTEeMBwGA1UEBRMVIC8gS0FITzY0MTEwMUhOVExLUzA2MR4wHAYDVQQLFBVaYXBhdGVy7WEgVXJ0YWRvINFlcmkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCX4ICuLAA/GYfEdRUMBLolOHKOUTDyw//CQjcj6dmCUWP8Y2UIhbq1JJ5nClsmhg6WThXjYqzRiYSAYagzrtwWri8I7oURIoTDeuxU69UOg1shuCEo89prJfx8ZIGKwB+GedC6dFdKGZLKn4ksSuyfntXmW4rZLup2j24mQx+jpdmcQIGMe6A/2668ZhpYpCw/vwfH8edkS5X41yp/zj6Z9mIySRWaMHm5eT/X0D01l3gX2gJVXY5ebUsKIEmDCP5pmBmyFyJjqYUhYi3+nYARrVPdZ53RPigcoLspXyIBVf2CPansqOYiRIqxLjfsL6B1qGJmpFN1RHd+XF9GzkHzAgMBAAGjHTAbMAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgbAMA0GCSqGSIb3DQEBCwUAA4ICAQAw5nqLkVuaTWX/qnPqWpOlSfrfVF2plqAPu1sdgzU/vZGgZCLxq3cY3Dg02khdsM74A3fYFQGxFFo6zDt5Ru9VySBks2gmbebRuuYKAKHMoi0tNpvI2arOMaiJsq2yzGAox6e+MXhhQ1oV+28HaxjYIWuVSwWAzie+n6VloWXMDDxTg7t9URJ7d8E7ZrPZ2X0+7h6b8sfnOjTljUm+Mt6e6AIl1+lA7Ar4YeJgIOeU/RKSOcvrCGDNtz7kpn0XdsFC/m1xG1bIdhyv0zkRmKvtpVGROsSEHPLBwuTENIkm0Cw2/FQsPrG8S9Yer451Jv0H+heFfJXqVrHv8Azba5OkotK5IlPaHm9voxfhwI1aXHbUS+NwpTHHOeVsvzsC9LQDiLGO3MQLn7VFZebFa84CddwLWf/JTyPYIcg3I/BRDFqbrVNRRDJwVlxIgbU7ZhRIcjiRLFx6UbAd8B2fe+GHgxw/x/6Pop65ca32iGAJgojtXWdD5gZvh6PlhEhWMhIOCvAesE52L4wmIHofAIZjlPRXNaitZ74xDEIpQ9f5X0w/4ltB7OOBYYfu8z9lzCc4M2iSmtq1rvSYxnLI/nvt7D0uYrq82ZeG3kzungcS8qNjufGJeEHNeyDxMXF9rYU4KLxK8KLzA2Ldh7+3zywU/pwXhW/aTS42EViWPbffng=="" CondicionesDePago=""01 - Efectivo"" SubTotal=""100.00"" Moneda=""MXN"" TipoCambio=""1"" Total=""116.00"" TipoDeComprobante=""I"" MetodoPago=""PPD"" LugarExpedicion=""82250""><cfdi:Emisor Rfc=""ZUÑ920208KL4"" Nombre=""Empresa de DEMO"" RegimenFiscal=""601"" /><cfdi:Receptor Rfc=""VOC990129I26"" Nombre=""Cliente Demostracion"" UsoCFDI=""G03"" /><cfdi:Conceptos><cfdi:Concepto ClaveProdServ=""10101902"" NoIdentificacion=""124"" Cantidad=""1.00"" ClaveUnidad=""EA"" Unidad=""PZA"" Descripcion=""ESCOBA "" ValorUnitario=""100.00"" Importe=""100.00""><cfdi:Impuestos><cfdi:Traslados><cfdi:Traslado Base=""100.00"" Impuesto=""002"" TipoFactor=""Tasa"" TasaOCuota=""0.160000"" Importe=""16.00"" /></cfdi:Traslados></cfdi:Impuestos></cfdi:Concepto></cfdi:Conceptos><cfdi:Impuestos TotalImpuestosTrasladados=""16.00""><cfdi:Traslados><cfdi:Traslado Impuesto=""002"" TipoFactor=""Tasa"" TasaOCuota=""0.160000"" Importe=""16.00"" /></cfdi:Traslados></cfdi:Impuestos></cfdi:Comprobante>"
|
||||
|
||||
|
||||
|
||||
@@ -644,7 +644,10 @@
|
||||
}, 250);
|
||||
}
|
||||
|
||||
function creaPoligono(coords, color, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior, cruzo) {
|
||||
var geoReferenciaSeguir = '';
|
||||
var estatusSiguiente = '';
|
||||
|
||||
function creaPoligono(coords, color, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior, cruzo, geocercaASeguir, estatusaSeguir) {
|
||||
var polygon = new google.maps.Polygon({
|
||||
paths: coords,
|
||||
strokeColor: color,
|
||||
@@ -656,6 +659,11 @@
|
||||
polygon.setMap(map);
|
||||
polygons.push(polygon);
|
||||
|
||||
if (geocercaASeguir != '') {
|
||||
geoReferenciaSeguir = geocercaASeguir;
|
||||
estatusSiguiente = estatusaSeguir;
|
||||
}
|
||||
|
||||
CreaMarcadorPoligono(coords, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior, cruzo)
|
||||
}
|
||||
|
||||
@@ -935,7 +943,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
LblETA.innerText = formatETA(duracionTotal);
|
||||
LblETA.innerHTML = formatETA(duracionTotal) + '<br> <b>Geocerca:</b> ' + geoReferenciaSeguir + '.<br> <b>Estatus:</b> ' + estatusSiguiente;
|
||||
})
|
||||
.catch((error) => {
|
||||
alert('Error:' + error);
|
||||
|
||||
@@ -50,6 +50,15 @@ Partial Class GPS_TrayectoDetalle
|
||||
ViewState("CveEstatusActual") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property OrdenActual As Integer
|
||||
Get
|
||||
Return CType(ViewState("OrdenActual"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("OrdenActual") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -148,6 +157,7 @@ Partial Class GPS_TrayectoDetalle
|
||||
LblTitulo.Text = $"Trayecto: {RowEstatus("Trayecto")}"
|
||||
LtlEstatusActual.Text = RowEstatus("Estatus").ToString()
|
||||
CveEstatusActual = RowEstatus("CveEstatusActual").ToString().ToEntero()
|
||||
OrdenActual = RowEstatus("OrdenActual").ToString().ToEntero()
|
||||
|
||||
If CBool(RowEstatus("EsFin")) Then
|
||||
BtnTerminarTrayeto.Visible = False
|
||||
@@ -158,7 +168,7 @@ Partial Class GPS_TrayectoDetalle
|
||||
|
||||
LtlDispositivo.Text = RowEstatus("Vehiculo").ToString()
|
||||
LtlFechaI.Text = If(String.IsNullOrEmpty(RowEstatus("FechaInicio").ToString()), "No ha ingresado a la geocerca de inicio", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaInicio").ToString().ToDateTime()))
|
||||
LtlFechaF.Text = If(String.IsNullOrEmpty(RowEstatus("FechaFin").ToString()), "No ha Terminado", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaFin").ToString().ToDateTime()))
|
||||
LtlFechaF.Text = If(String.IsNullOrEmpty(RowEstatus("FechaFin").ToString()), "No ha terminado", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaFin").ToString().ToDateTime()))
|
||||
LtlVMedia.Text = String.Format("{0:N2} KM/H", RowEstatus("VMedia"))
|
||||
LtlVMax.Text = String.Format("{0:N2} KM/H", RowEstatus("VMax"))
|
||||
LtlTiempo.Text = String.Format("{0}", RowEstatus("TiempoOperativo"))
|
||||
@@ -214,18 +224,41 @@ Partial Class GPS_TrayectoDetalle
|
||||
Dim CoordAnterior As String = ""
|
||||
Dim CveEstatus As Integer = -1
|
||||
Dim CveEstatusAnterior As Integer = -1
|
||||
Dim GeoreferenciaASeguir As String = ""
|
||||
Dim EstatusSiguiente As String = ""
|
||||
Dim OrdenEstatus As Integer = 0
|
||||
|
||||
'GEOCERCAS
|
||||
For Each Row As DataRow In DtGeocercas.Rows
|
||||
count += 1
|
||||
Coord = SQLToGmaps(Row("Geom").ToString, "POLYGON")
|
||||
CveEstatus = Row("CveEstatusTrayecto").ToString.ToEntero
|
||||
CveEstatusAnterior = Row("CveEstatusAnterior").ToString.ToEntero
|
||||
OrdenEstatus = Row("OrdenEstatus").ToString.ToEntero
|
||||
|
||||
Dim EsInicio As Boolean = CBool(IfNull(Row("EsInicio"), 0))
|
||||
Dim EsFin As Boolean = CBool(IfNull(Row("EsFin"), 0))
|
||||
Dim InicioFin As Integer = If(EsInicio, 1, If(EsFin, 2, 0))
|
||||
Dim Cruzo As String = IfNull(Row("Cruzo"), "0").ToString()
|
||||
|
||||
RegistraScript($"creaPoligono({Coord}, '{Row("Color").ToString}', '{Row("GeoReferencia")}', '{Row("EstatusTrayecto")}',{InicioFin},{CveEstatus},{CveEstatusAnterior},{Cruzo})", count.ToString())
|
||||
'MARCA PARA QUE NO CALCULE EL TIEMPO DE LAS GEOCERCAS RESTANTES
|
||||
If Not String.IsNullOrEmpty(GeoreferenciaASeguir) Then
|
||||
Cruzo = "1"
|
||||
End If
|
||||
|
||||
'VERIFICA SI SE ACTUALIZO MANUALMENTE
|
||||
If Cruzo = "0" Then
|
||||
If OrdenEstatus <= OrdenActual Then
|
||||
Cruzo = "1"
|
||||
End If
|
||||
End If
|
||||
|
||||
If Cruzo = "0" Then
|
||||
GeoreferenciaASeguir = Row("GeoReferencia").ToString()
|
||||
EstatusSiguiente = Row("EstatusTrayecto").ToString()
|
||||
End If
|
||||
|
||||
RegistraScript($"creaPoligono({Coord}, '{Row("Color").ToString}', '{Row("GeoReferencia")}', '{Row("EstatusTrayecto")}',{InicioFin},{CveEstatus},{CveEstatusAnterior},{Cruzo},'{GeoreferenciaASeguir}','{EstatusSiguiente}')", count.ToString())
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -324,11 +357,16 @@ Partial Class GPS_TrayectoDetalle
|
||||
Dim ObjGPS As New ClsGPS
|
||||
|
||||
Try
|
||||
If ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente) Then
|
||||
DtEstatus = ObjGPS.DtResultados.Copy()
|
||||
Dim CveEstatusFinal As Integer = -1
|
||||
If ObjGPS.GetTrayectosGeoReferencias(CveTrayecto) Then
|
||||
'TOMA LA GEOCERCA FINAL
|
||||
Dim Row As DataRow = ObjGPS.DtResultados.FiltroPrimero($"EsFin = True")
|
||||
If Row IsNot Nothing Then
|
||||
CveEstatusFinal = Row("CveEstatusTrayecto").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim CveEstatusFinal As Integer = DtEstatus.FiltroPrimeroValor("CveEstatusTrayecto", "EsFin = True").ToEntero()
|
||||
If CveEstatusFinal > 0 Then
|
||||
If ObjGPS.UpdateTrayectoEstatus(CveTrayecto, CveEstatusFinal) Then
|
||||
Alert("El trayecto se finalizo correctamente", JSBtnAceptar:="RefrescarPagina();", ShowCloseButton:=False)
|
||||
@@ -336,6 +374,19 @@ Partial Class GPS_TrayectoDetalle
|
||||
Else
|
||||
Alert("No se pudo obtener el estatus final", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
'If ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente) Then
|
||||
' DtEstatus = ObjGPS.DtResultados.Copy()
|
||||
'End If
|
||||
|
||||
'Dim CveEstatusFinal As Integer = DtEstatus.FiltroPrimeroValor("CveEstatusTrayecto", "EsFin = True").ToEntero()
|
||||
'If CveEstatusFinal > 0 Then
|
||||
' If ObjGPS.UpdateTrayectoEstatus(CveTrayecto, CveEstatusFinal) Then
|
||||
' Alert("El trayecto se finalizo correctamente", JSBtnAceptar:="RefrescarPagina();", ShowCloseButton:=False)
|
||||
' End If
|
||||
'Else
|
||||
' Alert("No se pudo obtener el estatus final", TipoMensaje.MsgError)
|
||||
'End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar el trayecto", ex)
|
||||
End Try
|
||||
|
||||
@@ -322,6 +322,40 @@
|
||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" InitialValue="-1" CssClass="help-block errorimput" ControlToValidate="DdlDispositivoNuevo" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Dispositivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpNuevo"></asp:RequiredFieldValidator>
|
||||
<label for="<%= DdlDispositivoNuevo.ClientID.ToString()%>" style="width: 50%">Vehículo:</label>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input">
|
||||
Notificar:
|
||||
<asp:CheckBox ID="ChkNotificarApartirDe" AutoPostBack="true" OnCheckedChanged="ChkNotificacionApartirDe_CheckedChanged" Checked="false" CssClass="md-checksd" runat="server" />
|
||||
</div>
|
||||
<div class="row" id="DivNotificarApartirDe" runat="server" visible="false">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCorreNotApartidDe" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
<label for="<%= TxtCorreNotApartidDe.ClientID.ToString()%>">Correo(s):</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlIntervaloAPartirDe" CssClass="form-control select2me" runat="server">
|
||||
<asp:ListItem Selected="True" Text="30 Min" Value="30"></asp:ListItem>
|
||||
<asp:ListItem Text="60 Min" Value="60"></asp:ListItem>
|
||||
<asp:ListItem Text="2 Hrs" Value="120"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<label for="<%= DdlIntervaloAPartirDe.ClientID.ToString()%>" style="width: 50%">Intervalo:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input">
|
||||
Enviar Liga:
|
||||
<asp:CheckBox ID="ChkEnviarLigaApartirDe" Checked="false" CssClass="make-switchsd" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqued2a" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqued2a','{0}')", GvEstatus.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
|
||||
@@ -113,8 +113,8 @@ Partial Class GPS_Trayectos
|
||||
Dim ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente) Then
|
||||
GvEstatus.DataSource = ObjGPS.DtResultados.FiltraParametros("CveCliente > 0")
|
||||
GvEstatusNuevo.DataSource = ObjGPS.DtResultados
|
||||
DdlEstatusTrayecto.DataSource = ObjGPS.DtResultados
|
||||
GvEstatusNuevo.DataSource = ObjGPS.DtResultados.FiltraParametros("CveCliente > 0")
|
||||
DdlEstatusTrayecto.DataSource = ObjGPS.DtResultados.FiltraParametros("CveCliente > 0")
|
||||
End If
|
||||
ObjGPS.Dispose()
|
||||
GvEstatus.DataBind()
|
||||
@@ -237,7 +237,9 @@ Partial Class GPS_Trayectos
|
||||
Dim Nombre As String = TxtNombreNuevo.Text
|
||||
Dim CveDispositivo As Integer = DdlDispositivoNuevo.SelectedValue.ToEntero
|
||||
If CveDispositivo > 0 Then
|
||||
Dim CveTrayectoNuevo As Integer = ObjGPS.AddTrayecto(Nombre, DateTime.Now, "", CveDispositivo, UsuarioActual.CveCliente)
|
||||
Dim CveTrayectoNuevo As Integer = ObjGPS.AddTrayecto(Nombre, DateTime.Now, "", CveDispositivo, UsuarioActual.CveCliente, EnviarNotificacion:=ChkNotificarApartirDe.Checked,
|
||||
CorreosNotificacion:=TxtCorreNotApartidDe.Text, Intervalo:=If(ChkNotificarApartirDe.Checked, DdlIntervaloAPartirDe.SelectedValue.ToEntero(), 0),
|
||||
EnviarLiga:=ChkEnviarLigaApartirDe.Checked)
|
||||
If CveTrayectoNuevo > 0 Then
|
||||
For Each Row As GridViewRow In GvEstatusNuevo.Rows
|
||||
If Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -413,6 +415,10 @@ Partial Class GPS_Trayectos
|
||||
DivNotificaciones.Visible = ChkNotificacion.Checked
|
||||
UpAgregar.Update()
|
||||
End Sub
|
||||
Protected Sub ChkNotificacionApartirDe_CheckedChanged(sender As Object, e As EventArgs)
|
||||
DivNotificarApartirDe.Visible = ChkNotificarApartirDe.Checked
|
||||
UpDdlTrayecto.Update()
|
||||
End Sub
|
||||
Protected Sub LnkEnviar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user