368 lines
13 KiB
Plaintext
368 lines
13 KiB
Plaintext
<%@ WebService Language="VB" Class="WSCGame" %>
|
|
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports System.Web
|
|
Imports System.Web.Services
|
|
Imports System.Web.Services.Protocols
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Extensiones
|
|
Imports Newtonsoft.Json
|
|
Imports Modelos
|
|
Imports System.IO
|
|
Imports System
|
|
Imports System.Globalization
|
|
Imports Newtonsoft.Json.Linq
|
|
|
|
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
|
|
' <System.Web.Script.Services.ScriptService()> _
|
|
<WebService(Namespace:="http://adcitrusgame.org/")>
|
|
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
|
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
|
Public Class WSCGame
|
|
Inherits System.Web.Services.WebService
|
|
|
|
#Region "USUARIOS"
|
|
|
|
|
|
<WebMethod()>
|
|
Public Function Login(Cadena As String) As String
|
|
Dim retorno As String = ""
|
|
Dim Estructura = New With
|
|
{
|
|
Key .[Usuario] = "",
|
|
Key .[Contrasenia] = "",
|
|
Key .[Ticks] = ""
|
|
}
|
|
|
|
Dim Salida As WSUSER = Nothing
|
|
Try
|
|
Dim decripParams As String = Decripta(Cadena, "AES")
|
|
Dim Entrada = JsonConvert.DeserializeAnonymousType(decripParams, Estructura)
|
|
|
|
If Not IsNothing(Entrada) Then
|
|
Dim tUsuario As New ClsSisUsuarios
|
|
Dim UsuarioActual = tUsuario.ValidaUsuario(Entrada.Usuario, Encripta(Entrada.Contrasenia), IMEI)
|
|
tUsuario.Dispose()
|
|
|
|
If UsuarioActual IsNot Nothing Then
|
|
Salida = New WSUSER
|
|
Salida.CveUsuario = UsuarioActual.CveUsuario
|
|
Salida.CveEmpresa = UsuarioActual.CveEmpresa
|
|
Salida.Usuario = UsuarioActual.Usuario
|
|
Salida.Nombre = UsuarioActual.Nombre
|
|
Salida.CveRol = UsuarioActual.CveRol
|
|
Salida.Rol = UsuarioActual.Rol
|
|
Salida.Contrasenia = UsuarioActual.Contraseña
|
|
Salida.CveSubProyecto = UsuarioActual.CveSubProyecto
|
|
|
|
retorno = Encripta(JsonConvert.SerializeObject(Salida), "AES")
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
End Try
|
|
Return retorno
|
|
End Function
|
|
#End Region
|
|
|
|
#Region "CONCEPTO GASTO CORTE"
|
|
|
|
<WebMethod()>
|
|
Public Function GetConceptoGastoCorte(params As String) As String
|
|
Dim Retorno As String = "[]"
|
|
Dim Estructura = New With
|
|
{
|
|
Key .CveEmpresa = -1,
|
|
Key .CveConceptoGastoCorte = -1,
|
|
Key .Estatus = -1,
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params, "AES")
|
|
Dim CGame = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
Dim ObjCGame As New ClsCGame()
|
|
If ObjCGame.GetConceptoGastoCorte(CGame.CveEmpresa, CGame.CveConceptoGastoCorte, CGame.Estatus) Then
|
|
If ObjCGame.DtResultados.Rows.Count > 0 Then
|
|
Dim json = ObjCGame.DtResultados.ToJson
|
|
Retorno = Encripta(json)
|
|
End If
|
|
End If
|
|
ObjCGame.Dispose()
|
|
Return Retorno
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "CORTE GASTO"
|
|
|
|
|
|
<WebMethod()>
|
|
Public Function GetCorteGasto(CveEmpresa As Integer, CveCorteGasto As Integer, CveHuerta As Integer) As String
|
|
Dim Retorno As String = "[]"
|
|
|
|
|
|
Dim ObjCGame As New ClsCGame()
|
|
If ObjCGame.GetCorteGasto(CveEmpresa, CveCorteGasto, CveHuerta) Then
|
|
If ObjCGame.DtResultados.Rows.Count > 0 Then
|
|
Dim json = ObjCGame.DtResultados.ToJson
|
|
Retorno = json
|
|
End If
|
|
End If
|
|
ObjCGame.Dispose()
|
|
|
|
Return Retorno
|
|
End Function
|
|
|
|
<WebMethod()>
|
|
Public Function AddCorteGasto(params As String) As Boolean
|
|
Dim retorno = False
|
|
Try
|
|
Dim Estructura = New With
|
|
{
|
|
Key .ListaCorteGasto = New List(Of WSCorteGasto),
|
|
Key .ListaCorteGastoDetalle = New List(Of WSCorteGastoDetalle),
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params)
|
|
Dim CGame = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
Dim ObjCGame As New ClsCGame
|
|
ObjCGame.IniciaTransacSQL()
|
|
Dim ErrorTrans As Boolean = False
|
|
For Each item As WSCorteGasto In CGame.ListaCorteGasto
|
|
Dim CveCorteGasto As Integer
|
|
If Not ObjCGame.AddCorteGasto(item.CveOrdenCorte, item.CveUsuario, item.CveEmpresa, item.FechaCorteGasto, item.Cuadro) Then
|
|
ErrorTrans = True
|
|
Exit For
|
|
Else
|
|
CveCorteGasto = ObjCGame.CveCorteGasto
|
|
Dim ListaDetalle = CGame.ListaCorteGastoDetalle.Where(Function(x) x.IdCveCorteGasto = item.IdCveCorteGasto)
|
|
For Each item2 As WSCorteGastoDetalle In ListaDetalle
|
|
If Not ObjCGame.AddCorteGastoDetalle(CveCorteGasto, item2.CveConceptoGastoCorte, item2.Cantidad, item2.PU) Then
|
|
ErrorTrans = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Next
|
|
If ErrorTrans Then
|
|
ObjCGame.RollBack()
|
|
Else
|
|
retorno = True
|
|
ObjCGame.Commit()
|
|
End If
|
|
ObjCGame.Dispose()
|
|
Catch ex As Exception
|
|
OnError("Ocurrio un error al agregar el gasto del corte", ex)
|
|
End Try
|
|
Return retorno
|
|
|
|
End Function
|
|
|
|
<WebMethod()>
|
|
Public Function UpdateCorteGasto(params As String) As Boolean
|
|
Dim retorno = False
|
|
Try
|
|
Dim Estructura = New With
|
|
{
|
|
Key .ListaCorteGasto = New List(Of WSCorteGasto),
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params)
|
|
Dim CGame = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
Dim ObjCGame As New ClsCGame
|
|
For Each item As WSCorteGasto In CGame.ListaCorteGasto
|
|
If ObjCGame.UpdateCorteGasto(item.CveCorteGasto, item.CveOrdenCorte, item.CveUsuario, item.CveEmpresa, item.FechaCorteGasto, item.Cuadro) Then
|
|
retorno = True
|
|
End If
|
|
Next
|
|
ObjCGame.Dispose()
|
|
Catch ex As Exception
|
|
OnError("Ocurrio un error al actualizar el gasto del corte", ex)
|
|
End Try
|
|
Return retorno
|
|
|
|
End Function
|
|
|
|
<WebMethod()>
|
|
Public Function RemoveCorteGasto(params As String) As Boolean
|
|
Dim retorno = False
|
|
Try
|
|
Dim Estructura = New With
|
|
{
|
|
Key .CveCorteGasto = -1,
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params)
|
|
Dim CGame = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
Dim ObjCGame As New ClsCGame
|
|
If ObjCGame.RemoveCorteGasto(CGame.CveCorteGasto) Then
|
|
retorno = True
|
|
End If
|
|
ObjCGame.Dispose()
|
|
Catch ex As Exception
|
|
OnError("Ocurrio un error al eliminar el gasto del corte", ex)
|
|
End Try
|
|
Return retorno
|
|
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "EMPAQUE"
|
|
<WebMethod()>
|
|
Public Function GetEmpaque(params As String) As String
|
|
Dim Retorno As String = "[]"
|
|
Dim Estructura = New With
|
|
{
|
|
Key .CveEmpresa = -1,
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params, "AES")
|
|
Dim CGame = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
Dim ObjCGame As New ClsCGame()
|
|
If ObjCGame.GetEmpaques(CGame.CveEmpresa, Estatus:=1) Then
|
|
If ObjCGame.DtResultados.Rows.Count > 0 Then
|
|
Dim json = ObjCGame.DtResultados.ToJson
|
|
Retorno = Encripta(json)
|
|
End If
|
|
End If
|
|
ObjCGame.Dispose()
|
|
Return Retorno
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "ORDEN DE CORTE"
|
|
|
|
<WebMethod()>
|
|
Public Function GetOrdenCorte(params As String) As String
|
|
Dim Retorno As String = "[]"
|
|
Dim Estructura = New With
|
|
{
|
|
Key .CveEmpresa = -1,
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params, "AES")
|
|
Dim CGame = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
Dim ObjCGame As New ClsCGame()
|
|
If ObjCGame.GetOrdenCorte(CGame.CveEmpresa) Then
|
|
If ObjCGame.DtResultados.Rows.Count > 0 Then
|
|
Dim json = ObjCGame.DtResultados.FiltraParametros("Disponible = 1").ToJson
|
|
Retorno = Encripta(json)
|
|
End If
|
|
End If
|
|
ObjCGame.Dispose()
|
|
Return Retorno
|
|
End Function
|
|
<WebMethod()>
|
|
Public Function UpdateFechaOrdenCorte(params As String) As Boolean
|
|
Dim Retorno As Boolean = False
|
|
Dim Estructura = New With
|
|
{
|
|
Key .CveOrdenCorte = -1,
|
|
Key .CveEmpresa = -1,
|
|
Key .NombreUsuario = "",
|
|
Key .FechaFleteHuertaEmpaque = "",
|
|
Key .CveEmpaque = "",
|
|
Key .Empaque = "",
|
|
Key .CveUsuario = -1,
|
|
Key .[Ticks] = ""
|
|
}
|
|
Dim JsonRequest = Decripta(params, "AES")
|
|
Dim Ent = JsonConvert.DeserializeAnonymousType(JsonRequest, Estructura)
|
|
|
|
Dim Body = ""
|
|
Dim Descripcion = ""
|
|
Dim ObjCGame As New ClsCGame()
|
|
Retorno = ObjCGame.AddFleteHuertaEmpaque(Ent.CveOrdenCorte, Ent.CveEmpaque.ToEntero(), Ent.FechaFleteHuertaEmpaque.ToDate(), Ent.CveUsuario, Ent.CveEmpresa)
|
|
Body = ObjCGame.GeneraCorreoFlete(Ent.CveOrdenCorte, Ent.CveEmpresa, Ent.NombreUsuario, Ent.FechaFleteHuertaEmpaque, Ent.Empaque)
|
|
If ObjCGame.GetFleteHuertaEmpaque(Ent.CveEmpresa, CveFleteHuertaEmpaque:=ObjCGame.CveFleteHuertaEmpaque) Then
|
|
Descripcion = ObjCGame.DtResultados(0)("FolioFechaEmpaque").ToString()
|
|
End If
|
|
ObjCGame.Dispose()
|
|
|
|
'If Retorno AndAlso (Not String.IsNullOrEmpty(Body)) Then
|
|
' Dim ObjMail As New ClsSisMail()
|
|
' 'Dim Correo = "julian@adsistemas.mx"
|
|
' 'Dim Correo = "dany_pimi@hotmail.com"
|
|
' Dim Correo = "eduardo@citrusgame.com.mx;rene@citrusgame.com.mx;monica@citrusgame.com.mx;sergio@citrusgame.com.mx"
|
|
' Dim Asunto = "SIG - Solicitud de Flete Huerta Empaque " + Descripcion
|
|
' ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correo, Asunto, Body)
|
|
'End If
|
|
|
|
Return Retorno
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
Public Class WSUSER
|
|
Public Property CveUsuario As Integer
|
|
Public Property Usuario As String
|
|
Public Property CveEmpresa As Integer
|
|
Public Property Nombre As String
|
|
Public Property CveRol As Integer
|
|
Public Property Rol As String
|
|
Public Property CveSubProyecto As Integer
|
|
Public Property Contrasenia As String
|
|
|
|
End Class
|
|
|
|
Public Class WSConceptoGastoCorte
|
|
Public Property CveConceptoGastoCorte As Integer
|
|
Public Property ConceptoGastoCorte As String
|
|
Public Property Estatus As Boolean
|
|
Public Property FechaIng As DateTime
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveEmpresa As Integer
|
|
|
|
End Class
|
|
|
|
Public Class WSCorteGasto
|
|
Public Property IdCveCorteGasto As Integer
|
|
Public Property CveConceptoGastoCorte As Integer
|
|
Public Property CveCorteGasto As Integer
|
|
Public Property CveOrdenCorte As Integer
|
|
Public Property FechaIng As DateTime
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveEmpresa As Integer
|
|
Public Property FechaCorteGasto As Date
|
|
Public Property Cuadro As Double
|
|
|
|
End Class
|
|
|
|
Public Class WSCorteGastoDetalle
|
|
Public Property IdCveCorteGasto As Integer
|
|
Public Property CveCorteGasto As Integer
|
|
Public Property CveConceptoGastoCorte As Integer
|
|
Public Property Cantidad As Double
|
|
Public Property PU As Double
|
|
|
|
End Class
|
|
|
|
Public Class WSOrdenCorte
|
|
Public Property CveOrdenCorte As Integer
|
|
Public Property CveOrdenProduccion As Integer
|
|
Public Property CveHuerta As Integer
|
|
Public Property FolioFechaHuerta As String
|
|
Public Property FolioOC As String
|
|
Public Property FechaEntrega As Date
|
|
Public Property FechaFleteHuertaEmpaque As Date
|
|
Public Property FechaIng As DateTime
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveEmpresa As Integer
|
|
|
|
End Class
|
|
|
|
Public Class WSEmpaque
|
|
Public Property CveEmpaque As Integer
|
|
Public Property Empaque As String
|
|
Public Property Estatus As Boolean
|
|
Public Property FechaIng As DateTime
|
|
Public Property CveUsuario As Integer
|
|
Public Property CveEmpresa As Integer
|
|
|
|
End Class
|
|
|
|
End Class |