public ActionResult Index()
        {
            var model = new ProgramacionModel();
            try
            {
                IList<OrdenVenta> ordenesVenta;
                using (var service = new ProduccionServiceClient())
                {
                    ordenesVenta = service.ListarOrdenesVenta();
                }

                foreach (var item in ordenesVenta)
                {
                    model.OrdenesVenta.Add(new OrdenVentaModel
                    {
                        Id = item.Id,
                        Numero = item.Numero,
                        Cliente = item.Cliente,
                        FechaEntrega = item.FechaEntrega,
                        Estado = item.Estado
                    });
                }

                IList<OrdenProduccion> ordenesProduccion;
                using (var service = new ProduccionServiceClient())
                {
                    ordenesProduccion = service.ListarOrdenesProduccion();
                }

                foreach (var item in ordenesProduccion)
                {
                    model.OrdenesProduccion.Add(new OrdenProduccionModel
                    {
                        Id = item.Id,
                        Numero = item.Numero,
                        NumeroOrdenVenta = item.OrdenVenta.Numero,
                        FechaEntrega = item.OrdenVenta.FechaEntrega,
                        DescripcionProducto = item.OrdenVenta.Producto.Descripcion,
                        Estado = item.Estado
                    });
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
            return View(model);
        }
        public ActionResult MantenerOrdenProduccion()
        {
            var model = new ProgramacionModel();
            try
            {
                Programa programaVigente;
                using (var service = new ProduccionServiceClient())
                {
                    programaVigente = service.ObtenerProgramaVigente();
                }

                if (programaVigente != null)
                {
                    model.ProgramaVigente = new ProgramaModel
                    {
                        Id = programaVigente.Id,
                        Numero = programaVigente.Numero,
                        FechaInicio = programaVigente.FechaInicio,
                        FechaFin = programaVigente.FechaFin
                    };

                    IList<OrdenVenta> ordenesVenta;
                    using (var service = new ProduccionServiceClient())
                    {
                        ordenesVenta = service.ListarOrdenesVentaPorPrograma(model.ProgramaVigente.Id);
                    }

                    foreach (var item in ordenesVenta)
                    {
                        model.OrdenesVenta.Add(new OrdenVentaModel
                        {
                            Id = item.Id,
                            Numero = item.Numero,
                            Cliente = item.Cliente,
                            FechaEntrega = item.FechaEntrega,
                            Estado = item.Estado,
                            IdPrograma = item.IdPrograma
                        });
                    }

                    IList<OrdenProduccion> ordenesProduccion;
                    using (var service = new ProduccionServiceClient())
                    {
                        ordenesProduccion = service.ListarOrdenesProduccionPorPrograma(model.ProgramaVigente.Id);
                    }

                    foreach (var item in ordenesProduccion)
                    {
                        model.OrdenesProduccion.Add(new OrdenProduccionModel
                        {
                            Id = item.Id,
                            Numero = item.Numero,
                            NumeroOrdenVenta = item.OrdenVenta.Numero,
                            FechaEntrega = item.OrdenVenta.FechaEntrega,
                            DescripcionProducto = item.OrdenVenta.Producto.Descripcion,
                            Estado = item.Estado
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
            return View(model);
        }