Пример #1
0
        public AlmacenInventarioLoteInfo CrearLotePorOrganizacionTipoAlmacenProducto(ParametrosOrganizacionTipoAlmacenProductoActivo parametro)
        {
            AlmacenInventarioLoteInfo almacenInventarioLote = null;

            try
            {
                var almacenBl = new AlmacenInventarioLoteBL();
                almacenInventarioLote = almacenBl.CrearLotePorOrganizacionTipoAlmacenProducto(parametro);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(almacenInventarioLote);
        }
Пример #2
0
 /// <summary>
 /// Obtiene los almacenes por organizacion y tipo de almacen
 /// </summary>
 /// <param name="datos"></param>
 /// <returns></returns>
 public AlmacenInventarioInfo ObtenerAlmacenInventarioPorOrganizacionTipoAlmacen(
     ParametrosOrganizacionTipoAlmacenProductoActivo datos)
 {
     try
     {
         Logger.Info();
         var almacenBl = new AlmacenBL();
         return(almacenBl.ObtenerAlmacenInventarioPorOrganizacionTipoAlmacen(datos));
     }
     catch (ExcepcionGenerica)
     {
         throw;
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }
Пример #3
0
 /// <summary>
 /// Obtener parametros almacen inventario por organizacion, tipo de almacen y producto
 /// </summary>
 /// <param name="datos"></param>
 /// <returns></returns>
 internal static Dictionary <string, object> ObtenerAlmacenInventarioPorOrganizacionTipoAlmacenProducto(ParametrosOrganizacionTipoAlmacenProductoActivo datos)
 {
     try
     {
         Logger.Info();
         var parametros =
             new Dictionary <string, object>
         {
             { "@Activo", datos.Activo },
             { "@OrganizacionID", datos.OrganizacionId },
             { "@TipoAlmacen", datos.TipoAlmacenId },
             { "@ProductoId", datos.ProductoId },
             { "@AlmacenID", datos.AlmacenID },
         };
         return(parametros);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
     }
 }
Пример #4
0
        /// <summary>
        /// Obtiene los almacenes en base a la organizacion, el tipo de almacen y el producto
        /// </summary>
        /// <param name="datosLotes"></param>
        /// <returns></returns>
        public List <AlmacenInventarioLoteInfo> ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(ParametrosOrganizacionTipoAlmacenProductoActivo datosLotes)
        {
            List <AlmacenInventarioLoteInfo> almacenInventarioLote = null;

            try
            {
                var almacenBl = new AlmacenInventarioLoteBL();
                almacenInventarioLote = almacenBl.ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(datosLotes);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(almacenInventarioLote);
        }
Пример #5
0
        /// <summary>
        /// Obtiene el almacen en base al lote,organizacion, el tipo de almacen y el producto
        /// </summary>
        /// <param name="lote"></param>
        /// <param name="datosLotes"></param>
        /// <returns></returns>
        public AlmacenInventarioLoteInfo ObtenerPorLoteOrganizacionTipoAlmacenProducto(int lote, ParametrosOrganizacionTipoAlmacenProductoActivo datosLotes)
        {
            AlmacenInventarioLoteInfo almacenInventarioLote = null;

            try
            {
                var almacenBl = new AlmacenInventarioLoteBL();
                almacenInventarioLote = almacenBl.ObtenerPorLoteTipoAlmacenProducto(lote, datosLotes);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(almacenInventarioLote);
        }
        /// <summary>
        /// Obtiene los almacenes en base a la organizacion, el tipo de almacen y el producto
        /// </summary>
        /// <returns></returns>
        internal List <AlmacenInventarioLoteInfo> ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(ParametrosOrganizacionTipoAlmacenProductoActivo datosLotes)
        {
            List <AlmacenInventarioLoteInfo> almacen = null;

            try
            {
                Dictionary <string, object> parametros = AuxAlmacenInventarioLoteDAL.ObtenerParametroObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(datosLotes);
                DataSet ds = Retrieve("AlmacenInventarioLote_ObtenerLotesPorOrganizacionProductoTipoAlmacen", parametros);
                if (ValidateDataSet(ds))
                {
                    almacen = MapAlmacenInventarioLoteDAL.ObtenerListadoAlmacenInventarioLoteTipoAlmacen(ds);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(almacen);
        }
Пример #7
0
        /// <summary>
        /// Obtiene los almacenes en base a la organizacion, el tipo de almacen y el producto
        /// </summary>
        /// <param name="datosLotes"></param>
        /// <returns></returns>
        internal List <AlmacenInventarioLoteInfo> ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(ParametrosOrganizacionTipoAlmacenProductoActivo datosLotes)
        {
            List <AlmacenInventarioLoteInfo> almacenInventarioLote = null;

            try
            {
                var almacenDAL = new AlmacenInventarioLoteDAL();
                almacenInventarioLote = almacenDAL.ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(datosLotes);

                if (almacenInventarioLote != null)
                {
                    foreach (var almacenInventario in almacenInventarioLote)
                    {
                        if (almacenInventario.AlmacenInventario.AlmacenInventarioID > 0)
                        {
                            var almacenInventarioBl = new AlmacenInventarioBL();
                            almacenInventario.AlmacenInventario =
                                almacenInventarioBl.ObtenerAlmacenInventarioPorId(
                                    almacenInventario.AlmacenInventario.AlmacenInventarioID);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(almacenInventarioLote);
        }
Пример #8
0
        /// <summary>
        /// Crea el nuevo lote para la organizacion producto tipo almacen seleccionados
        /// </summary>
        /// <param name="parametro"></param>
        /// <returns></returns>
        internal AlmacenInventarioLoteInfo CrearLotePorOrganizacionTipoAlmacenProducto(ParametrosOrganizacionTipoAlmacenProductoActivo parametro)
        {
            try
            {
                var almacenBl               = new AlmacenBL();
                var almacenInventarioBl     = new AlmacenInventarioBL();
                var almacenInventarioLoteBl = new AlmacenInventarioLoteBL();

                AlmacenInventarioLoteInfo almacenInventarioLote = null;

                var almacenInventario =
                    almacenBl.ObtenerAlmacenInventarioPorOrganizacionTipoAlmacen(new ParametrosOrganizacionTipoAlmacenProductoActivo
                {
                    OrganizacionId = parametro.OrganizacionId,
                    TipoAlmacenId  = parametro.TipoAlmacenId,
                    Activo         = parametro.Activo,
                    ProductoId     = parametro.ProductoId
                });

                // Si el producto no se encuentra en el almacen inventario, lo insertamos
                if (almacenInventario == null)
                {
                    var listaAlmacenOrganizacion = almacenBl.ObtenerAlmacenPorOrganizacion(parametro.OrganizacionId);
                    if (listaAlmacenOrganizacion != null)
                    {
                        // Obtenemos el almacen y validamos que sea del mismo tipo Almacen
                        foreach (AlmacenInfo almacenInfo in listaAlmacenOrganizacion)
                        {
                            // Aqui se valida que el almacen sea del tipo seleccionado
                            if (almacenInfo.TipoAlmacen.TipoAlmacenID == parametro.TipoAlmacenId)
                            {
                                almacenInventario = new AlmacenInventarioInfo
                                {
                                    AlmacenInventarioID =
                                        almacenInventarioBl.Crear(new AlmacenInventarioInfo
                                    {
                                        AlmacenID         = almacenInfo.AlmacenID,
                                        ProductoID        = parametro.ProductoId,
                                        UsuarioCreacionID = parametro.UsuarioId
                                    }),
                                    AlmacenID = almacenInfo.AlmacenID
                                };
                                break;
                            }
                        }
                    }
                }

                if (almacenInventario != null)
                {
                    int loteIdCreado = almacenInventarioLoteBl.Crear(new AlmacenInventarioLoteInfo
                    {
                        AlmacenInventarioLoteId = 0,
                        AlmacenInventario       =
                            new AlmacenInventarioInfo
                        {
                            AlmacenInventarioID = almacenInventario.AlmacenInventarioID
                        },
                        Cantidad          = 0,
                        PrecioPromedio    = 0,
                        Piezas            = 0,
                        Importe           = 0,
                        Activo            = (EstatusEnum)parametro.Activo,
                        UsuarioCreacionId = parametro.UsuarioId,
                    }, new AlmacenInventarioInfo
                    {
                        AlmacenID  = almacenInventario.AlmacenID,
                        ProductoID = parametro.ProductoId
                    });

                    almacenInventarioLote =
                        almacenInventarioLoteBl.ObtenerAlmacenInventarioLotePorId(loteIdCreado);
                }

                return(almacenInventarioLote);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
        }
Пример #9
0
        /// <summary>
        /// Obtiene el almacen en base a la organizacion, el tipo de almacen , el producto y el numero de lote
        /// </summary>
        /// <param name="lote"></param>
        /// <param name="datosLotes"></param>
        /// <returns></returns>
        internal AlmacenInventarioLoteInfo ObtenerPorLoteTipoAlmacenProducto(int lote, ParametrosOrganizacionTipoAlmacenProductoActivo datosLotes)
        {
            AlmacenInventarioLoteInfo almacenInventarioLote = null;

            try
            {
                var listaInventariosLote = ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto(datosLotes);
                if (listaInventariosLote != null && listaInventariosLote.Count > 0)
                {
                    var listaAlmacenInventarioLote = (from inventarioLote in listaInventariosLote
                                                      where inventarioLote.Lote == lote
                                                      select inventarioLote);

                    if (listaAlmacenInventarioLote != null && listaAlmacenInventarioLote.Count() > 0)
                    {
                        almacenInventarioLote = listaAlmacenInventarioLote.First();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }

            return(almacenInventarioLote);
        }