-- ajustes secciones

This commit is contained in:
rrene
2020-07-17 17:51:19 -07:00
parent 8a9db7a6c5
commit bb324aa0f2
2 changed files with 17 additions and 8 deletions

View File

@@ -115,8 +115,6 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Dim Lote As String = Row("Lote").ToString() Dim Lote As String = Row("Lote").ToString()
Dim FechaCaducidad As Date = IfNull(Row("FechaCaducidad"), MinFecha).ToString.ToDate Dim FechaCaducidad As Date = IfNull(Row("FechaCaducidad"), MinFecha).ToString.ToDate
'actualizamos el PS, para que tenga el aplica seccion 'actualizamos el PS, para que tenga el aplica seccion
ObjPS.UpdateAplicaSeccionAlmacen(Row("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, True) ObjPS.UpdateAplicaSeccionAlmacen(Row("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, True)
@@ -325,11 +323,11 @@ Partial Class Inventarios_AjustesSeccionAlmacen
CveSeccionAlmacen = DrSeccion("CveSeccion").ToString().ToEntero() CveSeccionAlmacen = DrSeccion("CveSeccion").ToString().ToEntero()
End If End If
Dim Serie As String = RowExcel("Serie").ToString() Dim Serie As String = RowExcel("Serie").ToString().Trim
Dim Lote As String = RowExcel("Lote").ToString() Dim Lote As String = RowExcel("Lote").ToString()
Dim FechaCaducidad As Date = IfNull(RowExcel("FechaCaducidad"), MinFecha).ToString.ToDate Dim FechaCaducidad As Date = IfNull(RowExcel("FechaCaducidad"), MinFecha).ToString.ToDate
Dim RowExistencia As DataRow = DtExistenciasSecciones.FiltroPrimero($"CvePS={CvePS}") Dim RowExistencia As DataRow = DtExistenciasSecciones.FiltroPrimero($"CvePS={CvePS} and ISNULL(Serie,'') = '{Serie}'")
If RowExistencia IsNot Nothing AndAlso CveSeccionAlmacen > 0 Then If RowExistencia IsNot Nothing AndAlso CveSeccionAlmacen > 0 Then
Dim CveSeccionAlmacenSalida As Integer = RowExistencia("CveSeccionAlmacen").ToString().ToEntero() Dim CveSeccionAlmacenSalida As Integer = RowExistencia("CveSeccionAlmacen").ToString().ToEntero()
@@ -339,6 +337,13 @@ Partial Class Inventarios_AjustesSeccionAlmacen
Dim FechaCaducidadSalida As Date = IfNull(RowExistencia("FechaCaducidad"), MinFecha).ToString.ToDate Dim FechaCaducidadSalida As Date = IfNull(RowExistencia("FechaCaducidad"), MinFecha).ToString.ToDate
Dim PUSalida As Decimal = RowExistencia("PU").ToString() Dim PUSalida As Decimal = RowExistencia("PU").ToString()
'condicion para ajustar la seccion y permita hacer los cambios en el trigger
If CveSeccionAlmacenSalida > 0 Then
ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, True)
Else
ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, False)
End If
'GENERA LA SALIDA DE LOS PRODUCTOS QUE VIENEN EN EL EXCEL 'GENERA LA SALIDA DE LOS PRODUCTOS QUE VIENEN EN EL EXCEL
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadSalida, CveUM, CvePS, PUSalida, CveSeccionAlmacen:=CveSeccionAlmacenSalida, Serie:=SerieSalida, Lote:=LoteSalida, FechaCaducidad:=FechaCaducidadSalida, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadSalida, CveUM, CvePS, PUSalida, CveSeccionAlmacen:=CveSeccionAlmacenSalida, Serie:=SerieSalida, Lote:=LoteSalida, FechaCaducidad:=FechaCaducidadSalida, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
ErrorMovInv = True ErrorMovInv = True
@@ -362,6 +367,9 @@ Partial Class Inventarios_AjustesSeccionAlmacen
'ACTUALIZAMOS EL PS, PARA QUE TENGA EL APLICA SECCION 'ACTUALIZAMOS EL PS, PARA QUE TENGA EL APLICA SECCION
ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, True) ErrorMovInv = Not ObjPS.UpdateAplicaSeccionAlmacen(CvePS, UsuarioActual.CveEmpresa, True)
If Not ObjInventario.AddProductosServiciosAlmacenSeccion(CvePS, CveAlmacen, CveSeccionAlmacen) Then
ErrorMovInv = True
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadEntrada, CveUMEntrada, CvePSEntrada, PUEntrada, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadEntrada, CveUMEntrada, CvePSEntrada, PUEntrada, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
ErrorMovInv = True ErrorMovInv = True
@@ -377,7 +385,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End If End If
If RowExistencia Is Nothing Then If RowExistencia Is Nothing Then
ExistenciasNoEncontradas.AppendFormat("{0},", SeccionAlmacen) ExistenciasNoEncontradas.AppendFormat("{0} - S:{1}<br/>", Codigo, Serie)
ErrorMovInv = True ErrorMovInv = True
End If End If

View File

@@ -2,6 +2,7 @@
Option Explicit On Option Explicit On
Imports System.Data Imports System.Data
Imports System.Data.Entity.Core.Common.CommandTrees
Imports System.IO Imports System.IO
Imports Extensiones Imports Extensiones
@@ -655,7 +656,7 @@ Partial Class Inventarios_EntregaAlmacen
Select Case ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString Select Case ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString
Case "Ing", "Ped" Case "Ing", "Ped"
Filtro = "CveConcepto IN (3,40)" Filtro = "CveConcepto IN (3,40)"
Case "Dev" Case "Dev", "dPe"
'cuand es devolucionventa=1, es cancelación de la devolución 'cuand es devolucionventa=1, es cancelación de la devolución
If EsDevolucionVenta = 1 Then Filtro = "CveConcepto = 18" Else Filtro = "CveConcepto IN (3,40)" If EsDevolucionVenta = 1 Then Filtro = "CveConcepto = 18" Else Filtro = "CveConcepto IN (3,40)"
Case Else Case Else
@@ -2180,7 +2181,7 @@ Partial Class Inventarios_EntregaAlmacen
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccionAlmacen").ToString.ToEntero, -1)) Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.")
Exit For Exit For
@@ -2339,7 +2340,7 @@ Partial Class Inventarios_EntregaAlmacen
End If End If
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), EsInterno:=EsInterno) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccionAlmacen").ToString.ToEntero, -1), EsInterno:=EsInterno) Then
ErrorMovInv = True ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.")
Exit For Exit For