public JsonResult PlanificacionIns(EPlanificacion entidadPlanificacion)
        {
            string xml = string.Empty;

            foreach (EPlanificacionSucursalAlmacen eps in entidadPlanificacion.ListaPlanificacionSucursalAlmacen)
            {
                if (eps.IdSucursalAlmacen == 0)
                {
                    return(Json(new ERespuesta {
                        Estado = 0, Mensaje = "Seleccionar el sucursal-almacén"
                    }));
                }
            }

            if (entidadPlanificacion.FechaInicioWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha de ejecucion"
                }));
            }

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionIns(xml);

            return(Json(objRespuesta));
        }
        public JsonResult GrabarPropuesta(EPlanificacion entidadPlanificacion)
        {
            string           xml = string.Empty;
            List <EProducto> listaProductosPropuestos = new List <EProducto>();

            foreach (EPlanificacionSucursal eps in entidadPlanificacion.ListaPlanificacionSucursal)
            {
                if (eps.COD_SUCURSAL == null)
                {
                    return(Json(new Entidades.DTO_TP3.ERespuesta {
                        Estado = 0, Mensaje = "Seleccionar el sucursal"
                    }));
                }
            }

            if (entidadPlanificacion.FechaInicioWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha inicio de ejecucion"
                }));
            }

            if (entidadPlanificacion.FechaFinWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha fin de ejecucion"
                }));
            }

            //Obtener lista de productos propuestos.
            //En base a estas listas, se crearán dos tipos de planificaciones: Laboratorio y Campo

            listaProductosPropuestos = objProducto.GCPS_SP_ProductoEnPlanificacionSel();

            //PLANIFICACION TIPO LABORATORIO
            entidadPlanificacion.TipoPlanificacion = Constantes.TipoPlanificacion.LABORATORIO;
            entidadPlanificacion.detalleProductos  = listaProductosPropuestos.Where(x => x.TIPOPLAN.Equals(Constantes.TipoPlanificacion.LABORATORIO)).ToList();

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            objPlanificacion.GCPS_SP_PlanificacionIns(xml);


            //PLANIFICACION TIPO CAMPO
            entidadPlanificacion.TipoPlanificacion = Constantes.TipoPlanificacion.CAMPO;
            entidadPlanificacion.detalleProductos  = listaProductosPropuestos.Where(x => x.TIPOPLAN.Equals(Constantes.TipoPlanificacion.CAMPO)).ToList();;

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            ERespuesta objRespuesta = objPlanificacion.GCPS_SP_PlanificacionIns(xml);

            return(Json(objRespuesta));
        }