RecepcionAlmacen.aspx.vb igualar a productivo

This commit is contained in:
Oscar Irigoyen
2023-06-17 12:27:10 -07:00
parent 704664b48f
commit ea5ea34ad0

View File

@@ -3,6 +3,7 @@ Option Explicit On
Imports System.Data
Imports System.IO
Imports System.Text
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
@@ -2299,36 +2300,41 @@ Partial Class Inventarios_RecepcionAlmacen
'VERIFICA EXISTENCIAS
If TipoMovimiento > 1 Then
Dim MensajeExistencias As New StringBuilder
Dim ObjInventarios As New ClsInventarios
For Each gvr As GridViewRow In GvInv.Rows
Dim ExistenciaActual = DtInv.SUM("CantidadSurtidaPantalla", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero} ")
Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero).FiltroPrimeroValor("CveTipoAlmacen", "").ToEntero
Dim ValidaExistencia As Boolean = True
If CveTipoAlmacen.Contiene(6, 21) AndAlso UsuarioActual.CveEmpresa = 140 Then ValidaExistencia = False ' si es garantia no valida existencia
If ValidaExistencia Then
Dim MensajeExistencias As New StringBuilder
Dim ObjInventarios As New ClsInventarios
For Each gvr As GridViewRow In GvInv.Rows
Dim ExistenciaActual = DtInv.SUM("CantidadSurtidaPantalla", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero} ")
If TipoMovimiento = 2 Then
'If gvr.DataKey("CantidadC").ToString.ToDecimal <> ExistenciaActual Then
' Alert("La devolución debe de ser completa.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If TipoMovimiento = 2 Then
'If gvr.DataKey("CantidadC").ToString.ToDecimal <> ExistenciaActual Then
' Alert("La devolución debe de ser completa.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If DtExistencias.SUM("Existencia", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero}") < ExistenciaActual Then
If DtExistencias.SUM("Existencia", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero}") < ExistenciaActual Then
MensajeExistencias.Append($"Producto: <b>{GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}</b>.</br>")
Continue For
End If
End If
Dim Existencia = ObjInventarios.GetExistenciasPS(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=(TxtFecha.Text & " " & Now.ToShortTimeString).ToDateTime.ToString("yyyy/MM/dd HH:mm"))
If Existencia < ExistenciaActual Then
MensajeExistencias.Append($"Producto: <b>{GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}</b>.</br>")
Continue For
End If
Next
ObjInventarios.Dispose()
If MensajeExistencias.ToString <> "" Then
Alert($"Los siguientes productos no cuentan con la existencia suficiente para hacer la devolución. </br></br> {MensajeExistencias.ToString}", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim Existencia = ObjInventarios.GetExistenciasPS(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:= (TxtFecha.Text & " " & Now.ToShortTimeString).ToDateTime.ToString("yyyy/MM/dd HH:mm"))
If Existencia < ExistenciaActual Then
MensajeExistencias.Append($"Producto: <b>{GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}</b>.</br>")
Continue For
End If
Next
ObjInventarios.Dispose()
If MensajeExistencias.ToString <> "" Then
Alert($"Los siguientes productos no cuentan con la existencia suficiente para hacer la devolución. </br></br> {MensajeExistencias.ToString}", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
Return True