mejora en cambio en PS
This commit is contained in:
@@ -34,9 +34,9 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
Private Function Salida(ByVal context As HttpContext) As String
|
Private Function Salida(ByVal context As HttpContext) As String
|
||||||
Dim retorno As String = ""
|
Dim retorno As String = ""
|
||||||
Dim ObjInv As New ClsInventarios
|
|
||||||
Dim Respuesta As New FidelityAppsResponse
|
Dim Respuesta As New APHAppsResponse
|
||||||
Dim RespuestaError As New FidelityAppsResponseError
|
Dim RespuestaError As New APHAppResponseError
|
||||||
Dim TieneError As Boolean = False
|
Dim TieneError As Boolean = False
|
||||||
Dim JsonRequest As JObject = Nothing
|
Dim JsonRequest As JObject = Nothing
|
||||||
Dim ObjInventario As New ClsInventarios
|
Dim ObjInventario As New ClsInventarios
|
||||||
@@ -46,8 +46,8 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
Dim SinExistencia As String = "No hay existencias suficientes del producto: "
|
Dim SinExistencia As String = "No hay existencias suficientes del producto: "
|
||||||
Dim ObjUsuarios As New ClsSisUsuarios
|
Dim ObjUsuarios As New ClsSisUsuarios
|
||||||
Dim CveUsuario As Integer
|
Dim CveUsuario As Integer
|
||||||
Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
|
Dim UsuarioActual As Usuario = Nothing 'ValidaUsuarioSistema(100, CveEmpresa)
|
||||||
|
Dim FolioSalida As Integer = 0
|
||||||
|
|
||||||
Dim ErrorAC As Boolean = False
|
Dim ErrorAC As Boolean = False
|
||||||
Dim ErrorMovInv As Boolean = False
|
Dim ErrorMovInv As Boolean = False
|
||||||
@@ -72,12 +72,10 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) Then
|
If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) Then
|
||||||
Dim Inv As New ClsInventarios
|
|
||||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
|
||||||
Dim ObjContaAC As ClsContPAQi = Nothing
|
Dim ObjContaAC As ClsContPAQi = Nothing
|
||||||
Dim tFolio As Integer = Inv.GetFolioSiguiente(3, CveEmpresa)
|
|
||||||
Dim observaciones As String = IIf(JsonRequest("observaciones").ToString() <> "", JsonRequest("observaciones").ToString(), "Salida Almacen")
|
Dim observaciones As String = IIf(JsonRequest("observaciones").ToString() <> "", JsonRequest("observaciones").ToString(), "Salida Almacen")
|
||||||
Dim CveAlmacen As Integer = 7
|
|
||||||
Dim IDPoliza As Integer = 0
|
Dim IDPoliza As Integer = 0
|
||||||
Dim usuario As String = JsonRequest("usuario").ToString()
|
Dim usuario As String = JsonRequest("usuario").ToString()
|
||||||
If ObjUsuarios.GetUsuariosEmpresas(-1) Then
|
If ObjUsuarios.GetUsuariosEmpresas(-1) Then
|
||||||
@@ -88,14 +86,24 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
Mensaje = "No se encontro el usuario ingresado"
|
Mensaje = "No se encontro el usuario ingresado"
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
Mensaje = "No se encontro el usuario ingresado"
|
||||||
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate
|
|
||||||
Dim almacen As String = JsonRequest("almacen").ToString()
|
|
||||||
Dim Recibe As String = JsonRequest("entrega").ToString()
|
|
||||||
Dim GlobalDTInvConceptos As DataTable
|
|
||||||
Dim EsContabilizable As Boolean = True
|
|
||||||
If Inv.GetConceptos Then GlobalDTInvConceptos = Inv.DtResultados Else GlobalDTInvConceptos = Nothing
|
|
||||||
If Not TieneError Then
|
If Not TieneError Then
|
||||||
|
|
||||||
|
Dim GlobalDTInvConceptos As DataTable
|
||||||
|
If ObjInventario.GetConceptos Then GlobalDTInvConceptos = ObjInventario.DtResultados Else GlobalDTInvConceptos = Nothing
|
||||||
|
|
||||||
|
Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate
|
||||||
|
Dim almacen As String = JsonRequest("almacen").ToString()
|
||||||
|
Dim Recibe As String = JsonRequest("entrega").ToString()
|
||||||
|
Dim CveAlmacen As Integer = GlobalDTAlmacen(CveEmpresa).FiltroPrimeroValor("CveAlmacen", String.Format(" Almacen = '{0}'", almacen)).ToEntero
|
||||||
|
|
||||||
|
Dim EsContabilizable As Boolean = True
|
||||||
|
Dim tFolio As Integer = ObjInventario.GetFolioSiguiente(3, CveEmpresa)
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, CveEmpresa, CveTipoPoliza:=3)
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, CveEmpresa, CveTipoPoliza:=3)
|
||||||
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48")
|
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48")
|
||||||
@@ -115,26 +123,16 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
For Each JsonPS As JObject In ListaPS
|
For Each JsonPS As JObject In ListaPS
|
||||||
|
|
||||||
Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble()
|
Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble()
|
||||||
Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString()).FiltroPrimeroValor("CvePS").ToEntero()
|
Dim dtt As DataTable = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString())
|
||||||
Dim DrPS As DataRow = GlobalDTPS(CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
Dim CvePS As Integer = dtt.FiltroPrimeroValor("CvePS").ToEntero()
|
||||||
Dim CveUM As Integer
|
Dim CveUM As Integer = dtt.FiltroPrimeroValor("CveUnidadMedida").ToEntero()
|
||||||
If ObjProductosServicios.GetPS(CvePS, -1, CveEmpresa) Then
|
|
||||||
If ObjProductosServicios.DtResultados.Rows.Count > 0 Then
|
|
||||||
CveUM = ObjProductosServicios.CveUnidadMedida.ToString.ToEntero
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then
|
|
||||||
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
If CvePS > 0 Then
|
||||||
Mensaje = "Error al guardar los movimientos"
|
If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then
|
||||||
|
|
||||||
ErrorMovInv = True
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
If UsuarioActual.TienePermisoProceso(114) Then
|
|
||||||
If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then
|
|
||||||
Mensaje = "Error al guardar los movimientos"
|
Mensaje = "Error al guardar los movimientos"
|
||||||
|
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@@ -142,7 +140,11 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
||||||
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Cont += 1
|
Cont += 1
|
||||||
Next
|
Next
|
||||||
Mensaje = SinExistencia
|
Mensaje = SinExistencia
|
||||||
@@ -162,8 +164,6 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero
|
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero
|
||||||
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
|
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
|
||||||
TipoMovtoOtro = Not TipoMovtoAlmacen
|
TipoMovtoOtro = Not TipoMovtoAlmacen
|
||||||
@@ -247,15 +247,12 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If IDPoliza > 0 Then
|
If IDPoliza > 0 Then
|
||||||
ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa)
|
ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ErrorAC = True
|
ErrorAC = True
|
||||||
Mensaje = "No se pudo insertar la poliza"
|
Mensaje = "No se pudo insertar la poliza"
|
||||||
@@ -265,6 +262,7 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
If Not ErrorAC And Not ErrorMovInv Then
|
If Not ErrorAC And Not ErrorMovInv Then
|
||||||
Dim Msg As New StringBuilder
|
Dim Msg As New StringBuilder
|
||||||
|
FolioSalida = ObjInventario.Folio
|
||||||
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b>{0}</b>", ObjInventario.Folio)
|
||||||
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
||||||
|
|
||||||
@@ -304,6 +302,8 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End Try
|
End Try
|
||||||
|
Else
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjInventario.Dispose() 'elimino la instancia
|
ObjInventario.Dispose() 'elimino la instancia
|
||||||
@@ -321,7 +321,9 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
retorno = JsonConvert.SerializeObject(RespuestaError).ToString
|
retorno = JsonConvert.SerializeObject(RespuestaError).ToString
|
||||||
Else
|
Else
|
||||||
context.Response.StatusCode = 200
|
context.Response.StatusCode = 200
|
||||||
Respuesta.Message = "La existencia se obtuvo correctamente"
|
Respuesta.Message = "La salida se registró correctamente"
|
||||||
|
Respuesta.Folio = folioSalida
|
||||||
|
|
||||||
retorno = JsonConvert.SerializeObject(Respuesta).ToString
|
retorno = JsonConvert.SerializeObject(Respuesta).ToString
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -331,25 +333,27 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Class FidelityAppsResponse
|
Private Class APHAppsResponse
|
||||||
Sub New()
|
Sub New()
|
||||||
isSuccess = "true"
|
IsSuccess = "true"
|
||||||
End Sub
|
End Sub
|
||||||
Public Property IsSuccess As String
|
Public Property IsSuccess As String
|
||||||
Public Property Message As String
|
Public Property Message As String
|
||||||
|
Public Property Folio As String
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Private Class FidelityAppsResponseError
|
Private Class APHAppResponseError
|
||||||
Sub New()
|
Sub New()
|
||||||
isSuccess = "false"
|
IsSuccess = "false"
|
||||||
End Sub
|
End Sub
|
||||||
Public Property IsSuccess As String
|
Public Property IsSuccess As String
|
||||||
|
Public Property Folio As String
|
||||||
Public Property Message As String
|
Public Property Message As String
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Private Class AuthMessage
|
Private Class AuthMessage
|
||||||
Public Property IsSucces As Boolean
|
Public Property IsSucces As Boolean
|
||||||
Public Property ErrorMessage As FidelityAppsResponseError
|
Public Property ErrorMessage As APHAppResponseError
|
||||||
Public Property StatusCode As Integer
|
Public Property StatusCode As Integer
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user