public static List <AlmacenInventarioLoteInfo> ObtenerLotesDelProducto(int formulaId) { var seguridad = HttpContext.Current.Session["Seguridad"] as SeguridadInfo; List <AlmacenInventarioLoteInfo> listaLotes = null; if (seguridad != null) { var formulaPl = new FormulaPL(); FormulaInfo formulaInfo = formulaPl.ObtenerPorID(formulaId); if (formulaInfo.Descripcion.Trim() != "F1") { var almaceninventariolotepl = new AlmacenInventarioLotePL(); listaLotes = almaceninventariolotepl.ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto( new ParametrosOrganizacionTipoAlmacenProductoActivo { Activo = 1, OrganizacionId = seguridad.Usuario.Organizacion.OrganizacionID, ProductoId = formulaInfo.Producto.ProductoId, TipoAlmacenId = (int)TipoAlmacenEnum.MateriasPrimas, UsuarioId = seguridad.Usuario.UsuarioID }); } } return(listaLotes); }
public static RespuestaInventarioLoteInfo ObtenerLotePorTipoAlmacen(ParametroRecepcionMateriaPrimaLote parametroLoteMateriaPrima) { try { RespuestaInventarioLoteInfo listadoLotes = null; var almacenInventarioLotePl = new AlmacenInventarioLotePL(); var seguridad = HttpContext.Current.Session["Seguridad"] as SeguridadInfo; int organizacionId = 0, tipoAlmacen = 0; if (seguridad != null) { organizacionId = seguridad.Usuario.Organizacion.OrganizacionID; } switch (parametroLoteMateriaPrima.TipoAlmacen) { case "rbLoteAlmacen": tipoAlmacen = (int)TipoAlmacenEnum.MateriasPrimas; break; case "rbLoteProceso": tipoAlmacen = (int)TipoAlmacenEnum.PlantaDeAlimentos; break; case "rbBodegaExterna": tipoAlmacen = (int)TipoAlmacenEnum.BodegaExterna; break; } var almacenInventarioLote = almacenInventarioLotePl .ObtenerListadoLotesPorOrganizacionTipoAlmacenProducto( new ParametrosOrganizacionTipoAlmacenProductoActivo { OrganizacionId = organizacionId, ProductoId = parametroLoteMateriaPrima.ProductoId, TipoAlmacenId = tipoAlmacen }); if (almacenInventarioLote != null) { foreach (var almacenInventario in almacenInventarioLote.Where(almacen => almacen.Lote == parametroLoteMateriaPrima.Lote)) { var almacenPl = new AlmacenPL(); var almacen = almacenPl.ObtenerPorID(almacenInventario.AlmacenInventario.AlmacenID); listadoLotes = new RespuestaInventarioLoteInfo { AlmacenInventarioLoteId = almacenInventario.AlmacenInventarioLoteId, AlmacenId = almacenInventario.AlmacenInventario.AlmacenID, CodigoAlmacen = almacen.CodigoAlmacen, Lote = almacenInventario.Lote, Cantidad = almacenInventario.Cantidad }; } } return(listadoLotes); } catch (Exception ex) { Logger.Error(ex); throw new SystemException(ex.Message); } }