/// <summary> /// Validar lote en uso /// </summary> /// <returns></returns> private bool ValidarLoteEnUso() { decimal cantidadProgramadaAux = 0; var datosLote = new AlmacenInventarioLoteInfo { ProductoId = producto.ProductoId, OrganizacionId = pedido.Organizacion.OrganizacionID, TipoAlmacenId = (int)TipoAlmacenEnum.MateriasPrimas, Activo = EstatusEnum.Activo }; var almacenInventarioLotePL = new AlmacenInventarioLotePL(); IList <AlmacenInventarioLoteInfo> resultado = almacenInventarioLotePL.ObtenerLotesUso(datosLote); if (resultado != null) { if (Convert.ToInt32(skAyudaLote.Clave) == resultado[0].Lote || Autorizado) { Autorizado = false; return(true); } if (Convert.ToInt32(skAyudaLote.Clave) == resultado[1].Lote) { var pedidoPL = new PedidosPL(); int cantidadProgramada = pedidoPL.ObtenerPedidosProgramadosPorLoteCantidadProgramada(resultado[0].Lote); if (detallePedido.ProgramacionMateriaPrima != null) { foreach ( var programacionMateriaPrimaInfo in detallePedido.ProgramacionMateriaPrima.Where( programacionMateriaPrimaInfo => programacionMateriaPrimaInfo.InventarioLoteOrigen.Lote == resultado[0].Lote)) { cantidadProgramadaAux = programacionMateriaPrimaInfo.CantidadProgramada; } } if ((resultado[0].Cantidad - (cantidadProgramada + cantidadProgramadaAux)) == 0) { return(true); } } loteEnUso = resultado[0].Lote; } SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], string.Format(Properties.Resources.SolicitudProgramacionMateriaPrima_RequiereAutorizacion, skAyudaLote.Clave), MessageBoxButton.OK, MessageImage.Warning); SolicitarAutorizacionLoteUso(); return(false); }