示例#1
0
        public ActionResult Gantte()
        {
            string defineID         = this.GetQueryString("DefineID");
            var    engineeringInfos = entities.Set <S_I_Engineering>().ToList();

            ViewBag.DefineID = defineID;

            var infra  = FormulaHelper.GetEntities <InfrastructureEntities>();
            var define = infra.Set <S_C_ScheduleDefine>().Find(defineID);

            if (define == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("未找到【" + defineID + "】计划");
            }

            var nodeTypeEnum = EnumBaseHelper.GetEnumDef("Base.WBSType");

            if (nodeTypeEnum == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到编号为【Base.WBSType】的枚举");
            }
            var nodeTypeList = define.S_C_ScheduleDefine_Nodes.Where(c => c.NodeType != WBSConst.taskNodeType && c.Visible == "1").Select(c => c.NodeType).Distinct().ToList();
            var list         = nodeTypeEnum.EnumItem.Where(c => nodeTypeList.Contains(c.Code)).OrderBy(c => c.SortIndex).ToList();
            var enumNodeType = new List <Dictionary <string, object> >();

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];
                var dic  = new Dictionary <string, object>();
                dic.SetValue("value", i + 1);
                dic.SetValue("text", item.Name);
                dic.SetValue("sortindex", item.SortIndex);
                enumNodeType.Add(dic);
                if (i == list.Count - 1)
                {
                    ViewBag.ExpandLevel = i + 1;
                }
            }
            ViewBag.NodeTypeEnum  = JsonHelper.ToJson(enumNodeType);
            ViewBag.HolidayTable  = JsonHelper.ToJson(HolidayHelper.GetHolidayTable());
            ViewBag.MonthFirstDay = DateTime.Now.ToString("yyyy-MM");
            ViewBag.MonthLastDay  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
            return(View());
        }
示例#2
0
        public ActionResult Gantte()
        {
            string engineeringInfoID = this.GetQueryString("EngineeringInfoID");
            var    engineeringInfo   = this.GetEntityByID <S_I_Engineering>(engineeringInfoID);

            if (engineeringInfo == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到指定的工程信息");
            }
            if (engineeringInfo.Mode == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("工程未关联任何管理模式,请联系管理员");
            }
            string versionID = this.GetQueryString("VersionID");
            string Code      = this.GetQueryString("ScheduleCode");
            var    define    = engineeringInfo.Mode.S_C_ScheduleDefine.FirstOrDefault(c => c.Code == Code);

            if (define == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到编号为【" + Code + "】的计划定义视图,请联系管理员");
            }
            var version = engineeringInfo.S_I_WBS_Version.Where(c => c.ScheduleCode == Code && c.FlowPhase == "End").
                          OrderByDescending(c => c.ID).FirstOrDefault();
            bool flowEnd = true;

            if (version == null)
            {
                ViewBag.VersionID = "";
                ViewBag.FlowPhase = "";
                ViewBag.VersionNo = "0";
            }
            else
            {
                if (version.FlowPhase != "End")
                {
                    flowEnd = false;
                }
                ViewBag.FlowPhase = version.FlowPhase;
                ViewBag.VersionID = version.ID;
                ViewBag.VersionNo = version.VersionNumber;
            }
            ViewBag.FlowEnd           = flowEnd;
            ViewBag.EngineeringInfoID = engineeringInfoID;
            ViewBag.ScheduleCode      = Code;
            ViewBag.DefineID          = define.ID;

            var nodeTypeEnum = EnumBaseHelper.GetEnumDef("Base.WBSType");

            if (nodeTypeEnum == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到编号为【Base.WBSType】的枚举");
            }
            var nodeTypeList = define.S_C_ScheduleDefine_Nodes.Where(c => c.NodeType != WBSConst.taskNodeType && c.Visible == "1").Select(c => c.NodeType).Distinct().ToList();
            var list         = nodeTypeEnum.EnumItem.Where(c => nodeTypeList.Contains(c.Code)).OrderBy(c => c.SortIndex).ToList();
            var enumNodeType = new List <Dictionary <string, object> >();

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];
                var dic  = new Dictionary <string, object>();
                dic.SetValue("value", i + 1);
                dic.SetValue("text", item.Name);
                dic.SetValue("sortindex", item.SortIndex);
                enumNodeType.Add(dic);
                if (i == list.Count - 1)
                {
                    ViewBag.ExpandLevel = i + 1;
                }
            }
            ViewBag.NodeTypeEnum = JsonHelper.ToJson(enumNodeType);
            ViewBag.HolidayTable = JsonHelper.ToJson(HolidayHelper.GetHolidayTable());
            return(View());
        }