SMS 2024.02.08 Paquetes valiad existencia, calendario

This commit is contained in:
rakcsle
2024-02-08 19:35:36 -07:00
parent bf9fd0425c
commit 52838030ad
2 changed files with 186 additions and 25 deletions

View File

@@ -490,6 +490,91 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
End If
Dim TextoError As New StringBuilder
If Tipo = 1 Then
Dim ObjInventarioVal As New ClsInventarios
Dim StrXML As New StringBuilder
StrXML.Append("<conceptos>")
Dim FechaCaducidad As Date
Dim Lote As String = ""
Dim TieneErrorExistencia As Boolean = False
For Each GvRow As GridViewRow In GvDatosArmado.Rows
FechaCaducidad = If(CBool(GvRow.DataKey("AplicaCaducidad")) AndAlso GvRow.FCTextBox("TxtCaducidad").ToString().ToDate > MinFecha, GvRow.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha)
Lote = If(CBool(GvRow.DataKey("AplicaLote")), GvRow.FCTextBox("TxtLote").Text.Trim, "-1")
Dim Existencia As Decimal = ObjInventarioVal.GetExistenciasPS(GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenArmado.SelectedValue.ToEntero(), FechaMovto:=TxtFechaArmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:="-1", Lote:=Lote, FechaCaducidad:=FechaCaducidad)
If GvRow.DataKey("Cantidad").ToDecimal > Existencia Then
TieneErrorExistencia = True
TextoError.AppendFormat("<b> - {0}</b> Existencia: {1:#,##0.##} <br/>", GvRow.DataKey("CodigoPS"), Existencia)
End If
''If Dr("CantidadGV").ToString().ToDecimal > 0 Then
'If CBool(GvRow.DataKey("AplicaSerie")) Then
' Alert("Aplica serie ")
' TieneErrorExistencia = True
' ' StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" CveSeccionAlmacen=""{3}"" Serie=""{4}"" Lote=""{5}"" FechaCaducidad=""{6}""></concepto>", GvRow.DataKey("CvePS"), GvRow.DataKey("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToString("yyyy/MM/dd"))
'Else
' StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" CveSeccionAlmacen=""{3}"" Serie=""{4}"" Lote=""{5}"" FechaCaducidad=""{6}""></concepto>", GvRow.DataKey("CvePS"), GvRow.DataKey("CveUM"), GvRow.DataKey("Cantidad"), -1, "-1", Lote, FechaCaducidad.ToString("yyyy/MM/dd"))
'End If
'End If
Next
'For Each Dr As DataRow In DtDatos.Rows
' FechaCaducidad = If(CBool(Dr("AplicaCaducidad")) AndAlso Dr("FechaCaducidad").ToString() <> "", Dr("FechaCaducidad").ToString().ToDate, MinFecha)
' Lote = If(CBool(Dr("AplicaLote")), Dr("Lote").ToString().Trim, "-1")
' If Dr("CantidadGV").ToString().ToDecimal > 0 Then
' If CBool(Dr("AplicaSerie")) Then
' DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
' For Each Dr1 As DataRow In DtDetalle.Rows
' StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" CveSeccionAlmacen=""{3}"" Serie=""{4}"" Lote=""{5}"" FechaCaducidad=""{6}""></concepto>", Dr1("CvePS"), Dr1("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToString("yyyy/MM/dd"))
' Next
' Else
' StrXML.AppendFormat("<concepto CvePS=""{0}"" CveUM=""{1}"" Cantidad= ""{2}"" CveSeccionAlmacen=""{3}"" Serie=""{4}"" Lote=""{5}"" FechaCaducidad=""{6}""></concepto>", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), IfNull(Dr("CveSeccion"), -1), "-1", Lote, FechaCaducidad.ToString("yyyy/MM/dd"))
' End If
' End If
'Next
'StrXML.Append("</conceptos>")
'If ObjInventarioVal.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacenArmado.SelectedValue.ToEntero(), TxtFechaArmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), -1, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(Tipo = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
' If ObjInventarioVal.DtResultados.Rows.Count > 0 Then
' TieneErrorExistencia = True
' For Each Dr As DataRow In ObjInventarioVal.DtResultados.Rows
' TextoError.AppendFormat("<b> - {0}</b> Existencia: {1:#,##0.##} <br/>", Dr("CodigoPS"), Dr("Existencia"))
' Next
' End If
'Else
' TieneErrorExistencia = True
'End If
If TieneErrorExistencia Then
'ObjInventarioVal.RollBack()
ObjInventarioVal.Dispose()
If TextoError.Length > 0 Then
Alert($" Lo(s) siguiente(s) Productos <b>no tienen</b> existencia suficiente:<br/><br/>{TextoError}", TipoMensaje.MsgAdvertencia)
End If
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
Exit Sub
End If
End If
Exit Sub
Dim ObjInventario As New ClsInventarios
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
@@ -864,20 +949,25 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenArmado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa)
End If
Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl)
If e.Row.DataKey("AplicaCaducidad") = "True" Then
e.Row.FCTextBox("TxtCaducidad").Visible = True
e.Row.FCLinkButton("LnkCaducidad").Visible = True
'e.Row.FCTextBox("TxtCaducidad").Visible = True
'e.Row.FCLinkButton("LnkCaducidad").Visible = True
e.Row.FCTextBox("TxtCaducidad").ReadOnly = False
CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True
e.Row.FCTextBox("TxtCaducidad").Enabled = True
'e.Row.FCTextBox("TxtCaducidad").ReadOnly = False
''CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True
'e.Row.FCTextBox("TxtCaducidad").Enabled = True
DvFechaCaducidad.Visible = True
Else
e.Row.FCTextBox("TxtCaducidad").Visible = False
e.Row.FCLinkButton("LnkCaducidad").Visible = False
e.Row.FCTextBox("TxtCaducidad").Enabled = True
'e.Row.FCTextBox("TxtCaducidad").Visible = False
'e.Row.FCLinkButton("LnkCaducidad").Visible = False
'e.Row.FCTextBox("TxtCaducidad").Enabled = True
e.Row.FCTextBox("TxtCaducidad").ReadOnly = True
CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False
'e.Row.FCTextBox("TxtCaducidad").ReadOnly = True
''CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False
DvFechaCaducidad.Visible = False
End If
e.Row.FCTextBox("TxtLote").Visible = e.Row.DataKey("AplicaLote") = "True"
@@ -1019,21 +1109,44 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenDesarmado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa)
End If
Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl)
If e.Row.DataKey("AplicaCaducidad") = "True" Then
e.Row.FCTextBox("TxtCaducidad").Visible = True
e.Row.FCLinkButton("LnkCaducidad").Visible = True
'e.Row.FCTextBox("TxtCaducidad").Visible = True
'e.Row.FCLinkButton("LnkCaducidad").Visible = True
e.Row.FCTextBox("TxtCaducidad").ReadOnly = False
CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True
e.Row.FCTextBox("TxtCaducidad").Enabled = True
'e.Row.FCTextBox("TxtCaducidad").ReadOnly = False
''CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True
'e.Row.FCTextBox("TxtCaducidad").Enabled = True
DvFechaCaducidad.Visible = True
Else
e.Row.FCTextBox("TxtCaducidad").Visible = False
e.Row.FCLinkButton("LnkCaducidad").Visible = False
e.Row.FCTextBox("TxtCaducidad").Enabled = True
'e.Row.FCTextBox("TxtCaducidad").Visible = False
'e.Row.FCLinkButton("LnkCaducidad").Visible = False
'e.Row.FCTextBox("TxtCaducidad").Enabled = True
e.Row.FCTextBox("TxtCaducidad").ReadOnly = True
CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False
'e.Row.FCTextBox("TxtCaducidad").ReadOnly = True
''CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False
DvFechaCaducidad.Visible = False
End If
'If e.Row.DataKey("AplicaCaducidad") = "True" Then
' e.Row.FCTextBox("TxtCaducidad").Visible = True
' e.Row.FCLinkButton("LnkCaducidad").Visible = True
' e.Row.FCTextBox("TxtCaducidad").ReadOnly = False
' CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True
' e.Row.FCTextBox("TxtCaducidad").Enabled = True
'Else
' e.Row.FCTextBox("TxtCaducidad").Visible = False
' e.Row.FCLinkButton("LnkCaducidad").Visible = False
' e.Row.FCTextBox("TxtCaducidad").Enabled = True
' e.Row.FCTextBox("TxtCaducidad").ReadOnly = True
' CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False
'End If
e.Row.FCTextBox("TxtLote").Visible = e.Row.DataKey("AplicaLote") = "True"
e.Row.FCTextBox("TxtCosto").Attributes.Add("onkeyup", "SumaValores();")