From 8a9db7a6c5356508ee05242cb9aa83075c41e0d8 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 16 Jul 2020 17:46:34 -0700 Subject: [PATCH] -- ajuste en recomendar la seccion --- Inventarios/AjustesSeccionAlmacen.aspx.vb | 13 ++++++++++--- Inventarios/Apartados.aspx | 4 ++-- Inventarios/Apartados.aspx.vb | 8 ++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Inventarios/AjustesSeccionAlmacen.aspx.vb b/Inventarios/AjustesSeccionAlmacen.aspx.vb index 478c321f9..6eec3379f 100644 --- a/Inventarios/AjustesSeccionAlmacen.aspx.vb +++ b/Inventarios/AjustesSeccionAlmacen.aspx.vb @@ -76,6 +76,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen Dim CveMovimientoDetalleEntrada As Integer = 0 Dim Cont As Integer = 0 + Dim Lista As New Hashtable For Each gvr As GridViewRow In GvD.Rows 'que este seleccionado y que tenga diferente seccion @@ -84,7 +85,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen If gvr.DataKey("CveSeccionAlmacen").ToEntero > 0 Then ObjPS.UpdateAplicaSeccionAlmacen(gvr.DataKey("CvePS").ToEntero, UsuarioActual.CveEmpresa, True) End If - + Lista.Add(gvr.DataKey("CvePS").ToEntero, gvr.FCDropDownList("DDlS").SelectedValue.ToEntero) 'guardo que dato le corresponde If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.DataKey("Existencia").ToDecimal, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, 0, -1, CveSeccionAlmacen:=gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=gvr.DataKey("Serie"), Lote:=gvr.DataKey("Lote"), FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de salida" @@ -108,15 +109,20 @@ Partial Class Inventarios_AjustesSeccionAlmacen Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal() Dim CveUM As Integer = Row("CveUM").ToString().ToEntero() - Dim CveSeccionAlmacen As Integer = GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero() + Dim CveSeccionAlmacen As Integer = Lista(Row("CvePS").ToString().ToEntero()) 'GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero() Dim CostoIndirecto As Decimal = Row("CostoIndirecto").ToString().ToDecimal() Dim Serie As String = Row("Serie").ToString() Dim Lote As String = Row("Lote").ToString() Dim FechaCaducidad As Date = IfNull(Row("FechaCaducidad"), MinFecha).ToString.ToDate + + 'actualizamos el PS, para que tenga el aplica seccion ObjPS.UpdateAplicaSeccionAlmacen(Row("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, True) + If Not ObjInventario.AddProductosServiciosAlmacenSeccion(CvePS, CveAlmacen, CveSeccionAlmacen) Then + ErrorMovInv = True + End If If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, PU, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True @@ -132,11 +138,12 @@ Partial Class Inventarios_AjustesSeccionAlmacen End If End If - + Lista = Nothing End If If Not ErrorMovInv Then ObjInventario.Commit() + GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, -1, -1) = Nothing CargaDatos() Alert("El Movimiento quede registrado correctamente", TipoMensaje.MsgInformacion) Else diff --git a/Inventarios/Apartados.aspx b/Inventarios/Apartados.aspx index 36a17a7c0..27be34de9 100644 --- a/Inventarios/Apartados.aspx +++ b/Inventarios/Apartados.aspx @@ -403,7 +403,7 @@
- + @@ -418,7 +418,7 @@ - + diff --git a/Inventarios/Apartados.aspx.vb b/Inventarios/Apartados.aspx.vb index f48ad283d..21708ab8a 100644 --- a/Inventarios/Apartados.aspx.vb +++ b/Inventarios/Apartados.aspx.vb @@ -805,10 +805,14 @@ Partial Class Inventarios_Apartados If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCTextBox("TxtCantidad").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad"))) If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero > 0 Then + Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True - e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) + e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = dtt e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() - e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) + If dtt.Rows.Count = 0 Then + e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + dtt.Dispose() End If End If