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
|
||||
Dim retorno As String = ""
|
||||
Dim ObjInv As New ClsInventarios
|
||||
Dim Respuesta As New FidelityAppsResponse
|
||||
Dim RespuestaError As New FidelityAppsResponseError
|
||||
|
||||
Dim Respuesta As New APHAppsResponse
|
||||
Dim RespuestaError As New APHAppResponseError
|
||||
Dim TieneError As Boolean = False
|
||||
Dim JsonRequest As JObject = Nothing
|
||||
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 ObjUsuarios As New ClsSisUsuarios
|
||||
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 ErrorMovInv As Boolean = False
|
||||
@@ -72,12 +72,10 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
|
||||
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 tFolio As Integer = Inv.GetFolioSiguiente(3, CveEmpresa)
|
||||
|
||||
Dim observaciones As String = IIf(JsonRequest("observaciones").ToString() <> "", JsonRequest("observaciones").ToString(), "Salida Almacen")
|
||||
Dim CveAlmacen As Integer = 7
|
||||
|
||||
Dim IDPoliza As Integer = 0
|
||||
Dim usuario As String = JsonRequest("usuario").ToString()
|
||||
If ObjUsuarios.GetUsuariosEmpresas(-1) Then
|
||||
@@ -88,14 +86,24 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
Mensaje = "No se encontro el usuario ingresado"
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Mensaje = "No se encontro el usuario ingresado"
|
||||
TieneError = True
|
||||
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
|
||||
|
||||
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
|
||||
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")
|
||||
@@ -115,26 +123,16 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
For Each JsonPS As JObject In ListaPS
|
||||
|
||||
Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble()
|
||||
Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString()).FiltroPrimeroValor("CvePS").ToEntero()
|
||||
Dim DrPS As DataRow = GlobalDTPS(CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
Dim CveUM As Integer
|
||||
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
|
||||
Dim dtt As DataTable = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString())
|
||||
Dim CvePS As Integer = dtt.FiltroPrimeroValor("CvePS").ToEntero()
|
||||
Dim CveUM As Integer = dtt.FiltroPrimeroValor("CveUnidadMedida").ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
If CvePS > 0 Then
|
||||
If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then
|
||||
|
||||
ErrorMovInv = True
|
||||
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
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -142,7 +140,11 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
Else
|
||||
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
Cont += 1
|
||||
Next
|
||||
Mensaje = SinExistencia
|
||||
@@ -162,8 +164,6 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero
|
||||
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
|
||||
TipoMovtoOtro = Not TipoMovtoAlmacen
|
||||
@@ -247,15 +247,12 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If IDPoliza > 0 Then
|
||||
ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa)
|
||||
End If
|
||||
|
||||
Else
|
||||
ErrorAC = True
|
||||
Mensaje = "No se pudo insertar la poliza"
|
||||
@@ -265,6 +262,7 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
If Not ErrorAC And Not ErrorMovInv Then
|
||||
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/><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
|
||||
End Try
|
||||
Else
|
||||
|
||||
End If
|
||||
|
||||
ObjInventario.Dispose() 'elimino la instancia
|
||||
@@ -321,7 +321,9 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
retorno = JsonConvert.SerializeObject(RespuestaError).ToString
|
||||
Else
|
||||
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
|
||||
|
||||
End If
|
||||
@@ -331,25 +333,27 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
End Function
|
||||
|
||||
Private Class FidelityAppsResponse
|
||||
Private Class APHAppsResponse
|
||||
Sub New()
|
||||
isSuccess = "true"
|
||||
IsSuccess = "true"
|
||||
End Sub
|
||||
Public Property IsSuccess As String
|
||||
Public Property Message As String
|
||||
Public Property Folio As String
|
||||
End Class
|
||||
|
||||
Private Class FidelityAppsResponseError
|
||||
Private Class APHAppResponseError
|
||||
Sub New()
|
||||
isSuccess = "false"
|
||||
IsSuccess = "false"
|
||||
End Sub
|
||||
Public Property IsSuccess As String
|
||||
Public Property Folio As String
|
||||
Public Property Message As String
|
||||
End Class
|
||||
|
||||
Private Class AuthMessage
|
||||
Public Property IsSucces As Boolean
|
||||
Public Property ErrorMessage As FidelityAppsResponseError
|
||||
Public Property ErrorMessage As APHAppResponseError
|
||||
Public Property StatusCode As Integer
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user