-- sugerencia en fecha caducidd/lote
This commit is contained in:
@@ -3863,6 +3863,7 @@ Partial Class Inventarios_EntregaAlmacen
|
|||||||
dr("Lote") = drl("Lote")
|
dr("Lote") = drl("Lote")
|
||||||
dr("FechaCaducidad") = drl("FechaCaducidad")
|
dr("FechaCaducidad") = drl("FechaCaducidad")
|
||||||
TempDT.ImportRow(dr)
|
TempDT.ImportRow(dr)
|
||||||
|
CantidadSurtir = 0
|
||||||
Else
|
Else
|
||||||
CantidadSurtir -= drl("Cantidad").ToString.ToDecimal
|
CantidadSurtir -= drl("Cantidad").ToString.ToDecimal
|
||||||
dr("CantidadF") = drl("Cantidad").ToString.ToDecimal
|
dr("CantidadF") = drl("Cantidad").ToString.ToDecimal
|
||||||
@@ -3871,6 +3872,7 @@ Partial Class Inventarios_EntregaAlmacen
|
|||||||
dr("FechaCaducidad") = drl("FechaCaducidad")
|
dr("FechaCaducidad") = drl("FechaCaducidad")
|
||||||
TempDT.ImportRow(dr)
|
TempDT.ImportRow(dr)
|
||||||
End If
|
End If
|
||||||
|
If CantidadSurtir <= 0 Then Exit For
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@@ -3886,73 +3888,5 @@ Partial Class Inventarios_EntregaAlmacen
|
|||||||
DtDatos = TempDT
|
DtDatos = TempDT
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub SugerirFecha()
|
|
||||||
|
|
||||||
Dim ObjInventarios As New ClsInventarios()
|
|
||||||
Dim FechasExcluidas As New List(Of String)
|
|
||||||
|
|
||||||
Dim TempDT As New DataTable
|
|
||||||
TempDT = DtDatos.Copy
|
|
||||||
Dim DtAux As New DataTable
|
|
||||||
DtAux = DtDatos.Clone
|
|
||||||
|
|
||||||
For Each DtRow As DataRow In DtDatos.Rows
|
|
||||||
Dim Row As DataRow = DtAux.NewRow()
|
|
||||||
For Each Column As DataColumn In DtDatos.Columns
|
|
||||||
Row.Item(Column.ColumnName) = DtRow.Item(Column.ColumnName)
|
|
||||||
Next
|
|
||||||
DtAux.Rows.Add(Row)
|
|
||||||
SugerirFechaLote(0, MinFecha, FechasExcluidas, ObjInventarios, DtAux)
|
|
||||||
TempDT.Merge(DtAux)
|
|
||||||
DtAux.Clear()
|
|
||||||
Next
|
|
||||||
|
|
||||||
ObjInventarios.Dispose()
|
|
||||||
|
|
||||||
DtDatos = TempDT
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub SugerirFechaLote(contador As Integer, FechaExcluida As Date, FechasExcluidas As List(Of String), ObjInventarios As ClsInventarios, DataTableAux As DataTable)
|
|
||||||
FechasExcluidas.Add(FechaExcluida.ToDate.ToString)
|
|
||||||
|
|
||||||
Dim DtRow As DataRow = DataTableAux.Rows(contador)
|
|
||||||
Dim AplicaCaducidad As Boolean = DtRow.Item("AplicaCaducidad").ToString = "True"
|
|
||||||
Dim AplicaLote As Boolean = DtRow.Item("AplicaLote").ToString = "True"
|
|
||||||
Dim Cantidad As Integer = DtRow.Item("CantidadC").ToString.ToEntero
|
|
||||||
Dim FechasExcluidasFiltro As String = String.Format("FechaCaducidad NOT IN('{0}')", String.Join("','", FechasExcluidas))
|
|
||||||
If AplicaCaducidad Or AplicaLote Then
|
|
||||||
Dim CvePS As Integer = DtRow.Item("CvePS").ToString.ToEntero
|
|
||||||
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
||||||
If ObjInventarios.DtResultados.Rows.Count > 0 Then
|
|
||||||
Dim MinimumRow As DataRow = ObjInventarios.DtResultados.FiltroPrimero(FechasExcluidasFiltro, "FechaCaducidad")
|
|
||||||
DtRow.Item("FechaCaducidad") = MinimumRow.Item("FechaCaducidad").ToString
|
|
||||||
DtRow.Item("Lote") = MinimumRow.Item("Lote").ToString
|
|
||||||
Dim CantidadDisponible As Integer = MinimumRow.Item("Cantidad").ToString.ToEntero
|
|
||||||
DtRow.Item("CantidadF") = CantidadDisponible
|
|
||||||
DtRow.Item("CantidadS") = CantidadDisponible
|
|
||||||
|
|
||||||
If Cantidad > CantidadDisponible Then
|
|
||||||
Dim RowFaltante As DataRow = DataTableAux.NewRow()
|
|
||||||
Dim CantidadFaltante As Integer = (Cantidad - CantidadDisponible)
|
|
||||||
RowFaltante.Item("CantidadC") = CantidadFaltante
|
|
||||||
RowFaltante.Item("CantidadF") = CantidadFaltante
|
|
||||||
RowFaltante.Item("CantidadS") = CantidadFaltante
|
|
||||||
DtRow.Item("CantidadC") = CantidadDisponible
|
|
||||||
For Each Column As DataColumn In DataTableAux.Columns
|
|
||||||
If Not Column.ColumnName.Contiene("CantidadC", "CantidadF", "CantidadS") Then
|
|
||||||
RowFaltante.Item(Column.ColumnName) = DtRow.Item(Column.ColumnName)
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
DataTableAux.Rows.Add(RowFaltante)
|
|
||||||
SugerirFechaLote(contador + 1, MinimumRow.Item("FechaCaducidad").ToString.ToDate, FechasExcluidas, ObjInventarios, DataTableAux)
|
|
||||||
Else
|
|
||||||
DtRow.Item("CantidadF") = Cantidad
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user