Exemple #1
0
        public ActionResult ProjectMappingStaChild()
        {
            var picSpecifications = EnumBaseHelper.GetEnumDef("Project.BorderSize").EnumItem.ToList();

            ViewBag.PicSpecifications = picSpecifications;
            return(View());
        }
Exemple #2
0
        public JsonResult GetBorderInfo(string ManageInfoID, string BorderType, string BorderSize)
        {
            var sql  = "select * from S_F_BorderConfig where ManageInfoID='" + ManageInfoID + "'";
            var list = this.ProjectSQLDB.ExecuteDataTable(sql);

            if (string.IsNullOrEmpty(ManageInfoID) || list.Rows.Count == 0)
            {
                var categoryList = EnumBaseHelper.GetEnumDef("Project.BorderCategory").EnumItem;
                sql = "select * from S_F_BorderConfig where (ManageInfoID='' or ManageInfoID is null) and CurrentDefault='1'";
                var defaultList = this.ProjectSQLDB.ExecuteDataTable(sql);
                foreach (var category in categoryList)
                {
                    var newRow = list.NewRow();
                    var rows   = defaultList.Select("Category='" + category.Code + "'");
                    if (rows.Length > 0)
                    {
                        newRow.ItemArray = rows[0].ItemArray;
                    }
                    else
                    {
                        newRow["Category"] = category.Code;
                    }
                    list.Rows.Add(newRow);
                }
            }
            return(Json(list));
        }
Exemple #3
0
        public override ActionResult List()
        {
            var level = EnumBaseHelper.GetEnumDef(typeof(Project.Logic.MileStoneType)).EnumItem.ToList();

            ViewBag.MileStoneLevel = level;

            var enumDt = EnumBaseHelper.GetEnumTable("Project.Major");

            ViewBag.Major = JsonHelper.ToJson(enumDt);
            var row = enumDt.NewRow();

            row["value"] = "All";
            row["text"]  = "所有";
            enumDt.Rows.InsertAt(row, 0);
            ViewBag.MajorWithAll = JsonHelper.ToJson(enumDt);

            var tab          = new Tab();
            var deptCategory = CategoryFactory.GetCategory("Project.Phase", "阶段", "PhaseValue");

            deptCategory.Multi = false;
            deptCategory.SetDefaultItem();
            tab.Categories.Add(deptCategory);

            var projectClassCategory = CategoryFactory.GetCategory("Base.ProjectClass", "业务类型", "ProjectClass");

            projectClassCategory.Multi = false;
            projectClassCategory.SetDefaultItem();
            tab.Categories.Add(projectClassCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            return(View());
        }
Exemple #4
0
        public ActionResult ProjectHourRpt()
        {
            var items = EnumBaseHelper.GetEnumDef("System.WorkHourType").EnumItem.ToList();

            ViewBag.WorkHourTypeInfo = items;

            var tab           = new Tab();
            var stateCategory = CategoryFactory.GetCategory(typeof(ProjectCommoneState), "State");

            stateCategory.SetDefaultItem();
            stateCategory.Multi = false;
            tab.Categories.Add(stateCategory);

            var deptCategory = CategoryFactory.GetCategory("System.ManDept", "负责部门", "ChargeDeptID");

            deptCategory.SetDefaultItem();
            deptCategory.Multi = false;
            tab.Categories.Add(deptCategory);

            var workHourCategory = CategoryFactory.GetCategory("System.DateFilder", "工时日期", "WorkHourDate");

            workHourCategory.SetDefaultItem();
            workHourCategory.Multi = false;
            tab.Categories.Add(workHourCategory);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;

            return(View());
        }
Exemple #5
0
        public override ActionResult List()
        {
            var specifications = EnumBaseHelper.GetEnumDef("Project.BorderSize").EnumItem.ToList();

            ViewBag.Specifications = specifications;
            return(View());
        }
Exemple #6
0
        public ActionResult PersonalAnalyze()
        {
            var mistakeLevels = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem;

            ViewBag.MistakeLevel = mistakeLevels;
            var tab = new Tab();

            //var category = CategoryFactory.GetCategory("Market.ManDept", "部门", "DeptID");
            //category.SetDefaultItem();
            //tab.Categories.Add(category);

            var category = CategoryFactory.GetYearCategory("MistakeYear");

            category.SetDefaultItem(DateTime.Now.Year.ToString());
            tab.Categories.Add(category);

            category = CategoryFactory.GetMonthCategory("MistakeMonth");
            category.SetDefaultItem(DateTime.Now.Month.ToString());
            tab.Categories.Add(category);

            category = CategoryFactory.GetQuarterCategory("MistakeSeason");
            category.SetDefaultItem();
            tab.Categories.Add(category);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
        private string getNodeType(Dictionary <string, object> dic)
        {
            var enumDefine = EnumBaseHelper.GetEnumDef("Base.PBSType");

            if (dic.ContainsKey("NodeType") && String.IsNullOrEmpty(dic.GetValue("NodeType")))
            {
                return("Detail");
            }
            else if (!String.IsNullOrEmpty(dic.GetValue("NodeType")))
            {
                var name = dic.GetValue("NodeType");
                var item = enumDefine.EnumItem.FirstOrDefault(c => c.Name == name);
                if (item != null)
                {
                    return(item.Code);
                }
                else
                {
                    return("Detail");
                }
            }
            else
            {
                return("Detail");
            }
        }
Exemple #8
0
        public ActionResult UserSummaryList()
        {
            var mistakeLevels = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem;

            ViewBag.MistakeLevel = mistakeLevels;
            return(View());
        }
Exemple #9
0
        public ActionResult ProjectAnalyze()
        {
            var mistakeLevels = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem;

            ViewBag.MistakeLevel = mistakeLevels;

            var tab = new Tab();
            //var levelCategory = CategoryFactory.GetCategory("Market.CustomerLevel", "项目等级", "CustomerLevel");
            //levelCategory.SetDefaultItem();
            //tab.Categories.Add(levelCategory);

            //业务类型
            var category = CategoryFactory.GetCategory("Market.BusinessType", "业务类型", "ProjectClass");

            category.SetDefaultItem();
            tab.Categories.Add(category);
            //主责部门
            category = CategoryFactory.GetCategory("Market.ManDept", "主责部门", "ChargeDeptID");
            category.SetDefaultItem();
            tab.Categories.Add(category);
            //设计阶段
            category = CategoryFactory.GetCategory("Project.Phase", "设计阶段", "PhaseValue");
            category.SetDefaultItem();
            tab.Categories.Add(category);

            tab.IsDisplay = true;
            ViewBag.Tab   = tab;
            return(View());
        }
Exemple #10
0
        public ActionResult DeptAnalyze()
        {
            var mistakeLevels = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem;

            ViewBag.MistakeLevel = mistakeLevels;
            return(View());
        }
 public JsonResult GetQualityList()
 {
     Dictionary<string, object> results = new Dictionary<string, object>();
     var enumDef = EnumBaseHelper.GetEnumDef("EPC.ProblemType");
     string engineeringID = GetQueryString("EngineeringInfoID");
     var year = string.IsNullOrEmpty(GetQueryString("Year")) ? System.DateTime.Now.Year : int.Parse(GetQueryString("Year"));
     var month = string.IsNullOrEmpty(GetQueryString("Month")) ? System.DateTime.Now.Month : int.Parse(GetQueryString("Month"));
     var thisMonthF = new DateTime(year, month, 1);
     var nextMonthF = month == 12 ? new DateTime(year + 1, 1, 1) : new DateTime(year, month + 1, 1);
     var dataList = entities.Set<S_C_RectifySheet_RectifyProblems>().Where(a => a.EngineeringInfo == engineeringID).ToList();
     var dataTable = new DataTable();
     dataTable.Columns.Add("ID");
     dataTable.Columns.Add("TypeName");
     dataTable.Columns.Add("QuestionCount");
     dataTable.Columns.Add("TotalQuestionCount");
     dataTable.Columns.Add("ClosedCount");
     dataTable.Columns.Add("TotalClosedCount");
     dataTable.Columns.Add("For");
     foreach (var item in enumDef.EnumItem)
     {
         var row = dataTable.NewRow();
         row["ID"] = "";
         row["TypeName"] = item.Code;
         row["QuestionCount"] = dataList.Count(a => a.ProType == item.Code && a.OpenDate >= thisMonthF && a.OpenDate < nextMonthF);
         row["TotalQuestionCount"] = dataList.Count(a => a.ProType == item.Code && a.OpenDate < nextMonthF);
         row["ClosedCount"] = dataList.Count(a => a.ProType == item.Code && a.RectifyState == "Closed" && a.CloseDate >= thisMonthF && a.CloseDate < nextMonthF);
         row["TotalClosedCount"] = dataList.Count(a => a.ProType == item.Code && a.RectifyState == "Closed" && a.OpenDate < nextMonthF);
         row["For"] = dataList.Count(a => a.ProType == item.Code && a.RectifyState != "Closed" && a.OpenDate < nextMonthF);
         dataTable.Rows.Add(row);
     }
     results.SetValue("data", dataTable);
     results.SetValue("chartData", GetQualityCharts(dataTable, enumDef.EnumItem.ToList()));
     return Json(results);
 }
        public ActionResult FeedbackListWithWBS()
        {
            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 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 attrDefine = new List <Dictionary <string, object> >();

            if (!String.IsNullOrEmpty(define.AttrDefine))
            {
                attrDefine = JsonHelper.ToList(define.AttrDefine);
            }
            ViewBag.AttrDefine        = JsonHelper.ToJson(attrDefine);
            ViewBag.Define            = define;
            ViewBag.DefineID          = define.ID;
            ViewBag.EngineeringInfoID = engineeringInfoID;
            ViewBag.ScheduleCode      = Code;

            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);
            return(View());
        }
Exemple #13
0
        public JsonResult GetPersonHourList(QueryBuilder qb)
        {
            qb.IsOrRelateion = false;
            qb.Items.RemoveWhere(d => d.Field == "WorkHourDate");
            string startTime = GetQueryString("WorkHourStart");
            string endTime   = GetQueryString("WorkHourEnd");

            string where = "";
            if (!string.IsNullOrEmpty(startTime))
            {
                where += string.Format(" and WorkHourDate>='{0}' ", DateTime.Parse(startTime));
            }
            if (!string.IsNullOrEmpty(endTime))
            {
                where += string.Format(" and WorkHourDate<='{0}' ", DateTime.Parse(endTime));
            }

            SQLHelper shBase          = SQLHelper.CreateSqlHelper(ConnEnum.Base);
            SQLHelper shHR            = SQLHelper.CreateSqlHelper(ConnEnum.HR);
            int       normalHours     = int.Parse(System.Configuration.ConfigurationManager.AppSettings["NormalHoursMax"]);
            var       calendarService = FormulaHelper.GetService <ICalendarService>();

            string fields = @"--人员部门信息
uo.ID,uo.UserCode,uo.UserName,uo.DeptID,uo.DeptName,
--正班工时,加班工时
isnull(wh.NormalValue,0) as NormalValue,isnull(wh.AdditionalValue,0) as AdditionalValue,isnull(wh.WorkHourValue,0) as WorkHourValue";


            string sql = "SELECT {0} From {1}";
            //查询人员部门信息,工时填报统计
            string middleSql = string.Format(@"(select distinct ID,Code as UserCode,Name as UserName,DeptID,DeptName from dbo.S_A_User
where IsDeleted='0'
union
select distinct UserID as ID,UserCode,UserName,u.DeptID,u.DeptName
from {0}.dbo.S_W_UserWorkHour wh
left join S_A_User u
on wh.UserID=u.ID
where u.IsDeleted='1' {1}) uo
LEFT JOIN (
	select UserID,sum(NormalValue) as NormalValue,sum(AdditionalValue) as AdditionalValue,sum(WorkHourValue) as WorkHourValue from {0}.dbo.S_W_UserWorkHour  where 1=1 {1}
	group by UserID
	) as wh ON wh.UserID=uo.ID"    , shHR.DbName, where);

            //员工按工时类别分类工时合计
            var whCategory = EnumBaseHelper.GetEnumDef("System.WorkHourType");

            foreach (var item in whCategory.EnumItem)
            {
                middleSql += string.Format(@" Left JOIN (
	Select UserID,isnull(sum(WorkHourValue),0) as {0}Hours 
	from {1}.dbo.S_W_UserWorkHour where WorkHourType='{0}' {2} group by UserID ) wh{0} On uo.ID= wh{0}.UserID "    , item.Code, shHR.DbName, where);
                fields    += string.Format(",isnull({0}Hours,0) {0}Hours", item.Code);
            }
            sql = string.Format(sql, fields, middleSql);

            GridData data = shBase.ExecuteGridData(sql, qb);

            return(Json(data));
        }
Exemple #14
0
        public Dictionary <string, object> GetYearChartData(string belongYear)
        {
            var    depts      = EnumBaseHelper.GetEnumDef("System.ManDept").EnumItem;
            string sql        = @"select Sum(ToA1) as ToA1,
BelongYear,BelongMonth  from S_EP_PublishInfo 
left join S_I_ProjectInfo on S_EP_PublishInfo.ProjectInfoID=S_I_ProjectInfo.ID
where ChargeDeptID in ('" + string.Join("','", depts.Select(a => a.Code).ToArray()) + @"') and PublishTime is not null and BelongYear='{0}' group by BelongYear,BelongMonth";
            var    db         = SQLHelper.CreateSqlHelper(ConnEnum.Project);
            var    dt         = db.ExecuteDataTable(String.Format(sql, belongYear));
            var    dataSource = new DataTable();

            dataSource.Columns.Add("BelongYear", typeof(string));
            dataSource.Columns.Add("BelongMonth", typeof(string));
            dataSource.Columns.Add("ToA1", typeof(decimal));
            dataSource.Columns.Add("SumToA1", typeof(decimal));
            var sumValue = 0m;

            for (int i = 1; i <= 12; i++)
            {
                var row = dataSource.NewRow();
                row["BelongMonth"] = i + "月";
                row["BelongYear"]  = belongYear;
                var value     = 0m;
                var monthRows = dt.Select("BelongMonth = '" + i.ToString() + "'");
                if (monthRows.Length > 0)
                {
                    value = monthRows[0]["ToA1"] == null || monthRows[0]["ToA1"] == DBNull.Value ? 0m : Convert.ToDecimal(monthRows[0]["ToA1"]);
                }
                sumValue      += value;
                row["SumToA1"] = sumValue;
                row["ToA1"]    = value;
                dataSource.Rows.Add(row);
            }
            #region 生成图表
            var yAxies = new List <yAxis>();
            var y1     = new yAxis {
                MiniValue = 0, TitleInfo = new Dictionary <string, object>(), Lable = new Dictionary <string, object>()
            };
            y1.TitleInfo.SetValue("text", "折合A1数");
            y1.Lable.SetValue("format", "{value}张");
            yAxies.Add(y1);

            var serDefines = new List <Series>();


            var costSer = new Series {
                Name = "当月出图", Field = "ToA1", Type = "column", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };
            var sumCostSer = new Series {
                Name = "累计出图", Field = "SumToA1", Type = "spline", yAxis = 0, Tooltip = new Dictionary <string, object>()
            };
            serDefines.Add(costSer);
            serDefines.Add(sumCostSer);

            var chart = HighChartHelper.CreateColumnXYChart(belongYear + "年度出图分析", "", dataSource, "BelongMonth", yAxies, serDefines, null);
            return(chart);

            #endregion
        }
Exemple #15
0
        public ActionResult MajorDetailList()
        {
            var mistakeLevels = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem;

            ViewBag.MistakeLevel  = mistakeLevels;
            ViewBag.ProjectInfoID = GetQueryString("ProjectInfoFO");
            return(View());
        }
Exemple #16
0
        public JsonResult GetProjectList(QueryBuilder qb)
        {
            var misQb = new QueryBuilder();

            foreach (var condition in qb.Items.Where(a => a.Field == "MistakeDate"))
            {
                misQb.Add("CreateDate", condition.Method, condition.Value, condition.OrGroup, condition.BaseOrGroup);
            }
            qb.Items.RemoveWhere(a => a.Field == "MistakeDate");
            string misWhereStr = misQb.GetWhereString(false);
            string joinType    = "left";

            if (!string.IsNullOrEmpty(misWhereStr))
            {
                joinType = "inner";
            }

            string sql = @"select prj.*,{1} from s_i_projectinfo prj
 {3} join (SELECT ProjectInfoID ,{0}{2} FROM 
(select ProjectInfoID,MistakeLevel,Count(1) MistakeCount from S_AE_Mistake
where 1=1 {4}
group by ProjectInfoID,MistakeLevel) tmp
PIVOT (Sum(MistakeCount) FOR MistakeLevel IN ({0}) ) AS tmp 
) mis on prj.id = mis.ProjectInfoID ";
            string fields = string.Empty, rowSumStr = string.Empty, filedsStr = string.Empty;
            string columnSumStr     = string.Empty;
            var    mistakeLevelEnum = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem.ToList();

            foreach (var item in mistakeLevelEnum)
            {
                fields       += item.Code + ",";
                filedsStr    += "isnull(" + item.Code + ",0) " + item.Code + ",";
                rowSumStr    += "isnull(" + item.Code + ",0)+";
                columnSumStr += "isnull(Sum(" + item.Code + "),0) " + item.Code + ",";
            }
            filedsStr    += "isnull(Summary,0) Summary,";
            rowSumStr     = ",(" + rowSumStr.TrimEnd('+') + ") Summary";
            columnSumStr += "isnull(Sum(Summary),0) Summary,";
            var db = SQLHelper.CreateSqlHelper(ConnEnum.Project);

            sql = String.Format(sql, fields.TrimEnd(','), filedsStr.TrimEnd(','), rowSumStr, joinType, misWhereStr);
            var result = db.ExecuteGridData(sql, qb);

            //合计
            string sumSql = @"select " + columnSumStr.TrimEnd(',') + " from (" + sql + qb.GetWhereString() + ") sumTableInfo ";
            var    sumDt  = this.SqlHelper.ExecuteDataTable(sumSql);

            if (sumDt.Rows.Count > 0)
            {
                var sumRow = sumDt.Rows[0];
                foreach (var item in mistakeLevelEnum)
                {
                    result.sumData.SetValue(item.Code, Convert.ToDecimal(sumRow[item.Code]));
                }
                result.sumData.SetValue("Summary", Convert.ToDecimal(sumRow["Summary"]));
            }
            return(Json(result));
        }
Exemple #17
0
        public ActionResult PublishInfoAnylise()
        {
            var picFileType       = EnumBaseHelper.GetEnumDef("Project.PublicationType").EnumItem.ToList();
            var picSpecifications = EnumBaseHelper.GetEnumDef("Project.BorderSize").EnumItem.ToList();

            ViewBag.PicFileType       = picFileType;
            ViewBag.PicSpecifications = picSpecifications;
            return(View());
        }
        public ActionResult MileStoneFinishApplyList()
        {
            var level = EnumBaseHelper.GetEnumDef(typeof(Project.Logic.MileStoneType)).EnumItem.ToList();

            ViewBag.MileStoneLevel = level;
            ViewBag.FinishState    = ProjectCommoneState.Finish.ToString();
            ViewBag.ExecuteState   = ProjectCommoneState.Execute.ToString();
            return(View());
        }
Exemple #19
0
        public JsonResult AddVersionDetail(string NodeID, string NodeType, string VersionID, string MajorCode)
        {
            var version = this.GetEntityByID <S_E_Bom>(VersionID);

            if (version == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("未能找到指定的BOM清单版本,无法新增");
            }
            if (version.FlowPhase == "End")
            {
                throw new Formula.Exceptions.BusinessValidationException("不能对已确认完成的BOM清单版本进行新增操作,请先点击升版按钮进行升版");
            }
            var result   = new Dictionary <string, object>();
            var bomMajor = EnumBaseHelper.GetEnumDef("Base.BOMMajor");

            if (bomMajor == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("未能找到 设备分类专业枚举【Base.BOMMajor】请联系管理员");
            }
            var enumMajor = bomMajor.EnumItem.FirstOrDefault(c => c.Code == MajorCode);

            if (NodeType.ToLower() == "detail")
            {
                var preDetail = version.S_E_Bom_Detail.FirstOrDefault(c => c.ID == NodeID);
                if (preDetail == null)
                {
                    throw new Formula.Exceptions.BusinessValidationException("未能找到指定的数据清单,无法再后面插入新行");
                }
                var newDetail = version.AddNewDetail(preDetail);
                if (enumMajor != null)
                {
                    newDetail.MajorCode = MajorCode;
                    newDetail.MajorName = enumMajor.Name;
                }
                result = FormulaHelper.ModelToDic <S_E_Bom_Detail>(newDetail);
                result.SetValue("NodeType", "Detail");
            }
            else
            {
                var pbs = this.GetEntityByID <S_I_PBS>(NodeID);
                //if (pbs.StructNodeInfo.Children.Count > 0)去掉限制(有的项目模式不需要挂pbs子节点下,直接挂在根下面)
                //{
                //    throw new Formula.Exceptions.BusinessValidationException("不能在指定的PBS节点下新增BOM数据,请检查定义,BOM数据只能新增在PBS叶子节点上");
                //}
                var newDetail = version.AddNewDetail(pbs);
                if (enumMajor != null)
                {
                    newDetail.MajorCode = MajorCode;
                    newDetail.MajorName = enumMajor.Name;
                }
                result = FormulaHelper.ModelToDic <S_E_Bom_Detail>(newDetail);
                result.SetValue("NodeType", "Detail");
            }
            this.entities.SaveChanges();
            return(Json(result));
        }
Exemple #20
0
        public ActionResult PlotSealSelector()
        {
            var PlotSealType = EnumBaseHelper.GetEnumDef("Project.PlotSealType").EnumItem;
            var list         = new List <object>();

            list.AddRange(PlotSealType.Select(a => new { text = a.Name, value = a.Code }));
            list.Add(new { text = "组合章", value = "Group" });
            ViewBag.PlotSealType = "var PlotSealType = " + JsonHelper.ToJson(list);
            return(View());
        }
Exemple #21
0
        public override JsonResult GetList(QueryBuilder qb)
        {
            string sql          = @"select * from (select ID as ID,Name as DeptName,SortIndex,{1},0 as Summary,0 as Avg
from S_A_Org where  Type='{0}' ) TableInfo ";
            string fields       = String.Empty;
            string seriesNames  = String.Empty;
            string seriesFields = String.Empty;

            qb.PageSize = 0;
            var orgService       = FormulaHelper.GetService <IOrgService>();
            var mistakeLevelEnum = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem.ToList();

            foreach (var item in mistakeLevelEnum)
            {
                fields       += " 0 as " + item.Code + ",";
                seriesFields += item.Code + ",";
                seriesNames  += item.Name + ",";
            }
            var db          = SQLHelper.CreateSqlHelper(ConnEnum.Base);
            var dt          = db.ExecuteDataTable(String.Format(sql, OrgType.ManufactureDept.ToString(), fields.TrimEnd(',')));
            var mistakeList = this.entities.Set <S_AE_Mistake>().Where(qb).ToList();

            foreach (DataRow deptRow in dt.Rows)
            {
                double mistakeSum = 0;
                var    deptID     = deptRow["ID"].ToString();
                foreach (var item in mistakeLevelEnum)
                {
                    var count = mistakeList.Count(d => d.DeptID == deptID && d.MistakeLevel == item.Code);
                    mistakeSum        += count;
                    deptRow[item.Code] = count;
                }
                deptRow["Summary"] = mistakeSum;
                double userCount = orgService.GetOrgUsers(deptRow["ID"].ToString()).Count;
                double avg       = 0;
                if (userCount > 0)
                {
                    avg = Math.Round(Convert.ToDouble(mistakeSum / userCount), 2);
                }
                deptRow["Avg"] = avg;
            }
            var result = new List <Dictionary <string, object> >();

            var data = new Dictionary <string, object>();

            data.SetValue("data", dt);
            var pieChart = HighChartHelper.CreatePieChart("部门质量问题分析", "错误", dt, "DeptName", "Summary");

            data.SetValue("PieChart", pieChart.Render());
            var columnChart = HighChartHelper.CreateColumnChart("部门质量问题分类分析", dt, "DeptName", seriesNames.TrimEnd(',').Split(',')
                                                                , seriesFields.TrimEnd(',').Split(','));

            data.SetValue("ColumnChart", columnChart.Render());
            return(Json(data));
        }
Exemple #22
0
        public Dictionary <string, object> GetColumnChart(S_I_ProjectInfo projectInfo)
        {
            var majorList   = projectInfo.GetMajors();
            var picFileType = EnumBaseHelper.GetEnumDef("Project.PublicationType").EnumItem.ToList();
            var dataSource  = new DataTable();

            dataSource.Columns.Add("MajorName");
            var seriesNames  = "出图费用(元)";
            var seriesFields = "CostValue";

            //foreach (var item in picFileType)
            //{
            //    dataSource.Columns.Add(item.Code, typeof(decimal));
            //    seriesNames += item.Name + "折A1,";
            //    seriesFields += item.Code + ",";
            //}
            dataSource.Columns.Add("CostValue", typeof(decimal));

            string sql             = @"select SUM(CostValue) CostValue,Extend5 MajorValue from S_FC_CostInfo
where ProjectID = '" + projectInfo.MarketProjectInfoID + "' and SubjectCode = 'PublishFee' group by Extend5";
            var    marketSqlHepler = SQLHelper.CreateSqlHelper(ConnEnum.Market);
            var    dt = marketSqlHepler.ExecuteDataTable(sql);

            foreach (var major in majorList)
            {
                var row = dataSource.NewRow();
                row["MajorName"] = major.GetValue("Name");
                //foreach (var item in picFileType)
                //{
                //    var value = 0m;
                //    var list = dt.Select("MajorValue='" + major.GetValue("Value") + "' and PublishType='" + item.Code + "'");
                //    if (list.Length > 0)
                //    {
                //        value = list[0]["ToA1"] == null || list[0]["ToA1"] == DBNull.Value ? 0m : Convert.ToDecimal(list[0]["ToA1"]);
                //    }
                //    row[item.Code] = value;
                //}
                var value = 0m;
                var list  = dt.Select("MajorValue='" + major.GetValue("Value") + "'");
                if (list.Length > 0)
                {
                    value = list[0]["CostValue"] == null || list[0]["CostValue"] == DBNull.Value ? 0m : Convert.ToDecimal(list[0]["CostValue"]);
                }
                row["CostValue"] = value;
                dataSource.Rows.Add(row);
            }
            var chart   = HighChartHelper.CreateColumnChart("各专业出图费用统计", dataSource, "MajorName", seriesNames.TrimEnd(',').Split(','), seriesFields.TrimEnd(',').Split(','));
            var result  = chart.Render();
            var credits = new Dictionary <string, object>();

            credits.SetValue("enabled", false);
            result.SetValue("credits", credits);
            return(result);
        }
Exemple #23
0
        //档案收进统计按档案类型
        public JsonResult DocumentTypeGetList(string SpaceID)
        {
            var           entities        = Formula.FormulaHelper.GetEntities <DocConfigEntities>();
            var           space           = entities.S_DOC_Space.FirstOrDefault(a => a.ID.Equals(SpaceID));
            string        sql             = @"select * from ({0}) fileTemp full join ({1}) node on fileTemp.FileNodeYear=NodeYear";
            string        fileSql         = @"SELECT Year(CreateTime) FileNodeYear,
                                count(case when StorageType='Electronic' then StorageType end) ElecCount,
                                count(case when StorageType='Physical' then StorageType end) PhyFileCount,
                                {0}{1}
                                  FROM S_FileInfo 
                                  where Year(CreateTime)>Year(Getdate())-5 group by Year(CreateTime)
                                ";
            string        nodeSql         = @"SELECT Year(CreateTime) NodeYear,
                                count(case when IsElectronicBox='true' then IsElectronicBox end) ElecNodeCount,
                                count(case when IsPhysicalBox='true' then IsPhysicalBox end) PhyNodeCount,
                                {0}
                                  FROM S_NodeInfo 
                                  where Year(CreateTime)>Year(Getdate())-5 and ConfigID in ('{1}') group by Year(CreateTime) 
                                ";
            StringBuilder fileKeepYearStr = new StringBuilder();
            StringBuilder nodeKeepYearStr = new StringBuilder();

            /* @"count(case when KeepYear='999' then KeepYear end) fileForever,
             *              count(case when KeepYear='30' then KeepYear end) fileThirty,
             *              count(case when KeepYear='10' then KeepYear end) fileTen";*/
            StringBuilder mediaStr  = new StringBuilder();
            var           keepYears = EnumBaseHelper.GetEnumDef("DocConst.KeepYear").EnumItem;
            var           medias    = EnumBaseHelper.GetEnumDef("DocConst.Media").EnumItem;

            //保管期限
            foreach (var keepYear in keepYears)
            {
                fileKeepYearStr.Append("count(case when KeepYear='" + keepYear.ID + "' then KeepYear end) FileYear_" + keepYear.ID + ",");
                nodeKeepYearStr.Append("count(case when KeepYear='" + keepYear.ID + "' then KeepYear end) NodeYear_" + keepYear.ID + ",");
            }
            //载体
            foreach (var media in medias)
            {
                mediaStr.Append("count(case when Media='" + media.ID + "' then Media end) " + media.ID + ",");
            }
            //卷册

            var docNodes = entities.S_DOC_Node.Where(a => a.SpaceID.Equals(space.ID) && a.Name.Equals("卷册")).Select(a => a.ID).ToList();

            fileSql = string.Format(fileSql, fileKeepYearStr.ToString(), mediaStr.ToString().TrimEnd(','));          //查询文件表数据
            nodeSql = string.Format(nodeSql, nodeKeepYearStr.ToString().TrimEnd(','), string.Join("','", docNodes)); //查询卷册

            SQLHelper sqlHelper = SQLHelper.CreateSqlHelper(space.SpaceKey, space.ConnectString);

            sql = string.Format(sql, fileSql, nodeSql);
            var db = sqlHelper.ExecuteDataTable(sql);

            return(Json(db, JsonRequestBehavior.AllowGet));
        }
Exemple #24
0
        public JsonResult GetEmployeeByProjectInfoID(QueryBuilder qb)
        {
            string startTime = GetQueryString("StartTime");
            string endTime   = GetQueryString("EndTime");

            string where = " ";
            if (!string.IsNullOrEmpty(startTime))
            {
                where += string.Format(" and WorkHourDate>='{0}' ", DateTime.Parse(startTime));
            }
            if (!string.IsNullOrEmpty(endTime))
            {
                where += string.Format(" and WorkHourDate<='{0}' ", DateTime.Parse(endTime));
            }

            string    projectInfoID   = GetQueryString("ProjectInfoID");
            SQLHelper shProject       = SQLHelper.CreateSqlHelper(ConnEnum.Project);
            SQLHelper shHrTime        = SQLHelper.CreateSqlHelper(ConnEnum.HR);
            SQLHelper shBase          = SQLHelper.CreateSqlHelper(ConnEnum.Base);
            string    manufactureDept = OrgType.ManufactureDept.ToString();//生产部门
            //string dept = OrgType.Dept.ToString();

            string field = "wh.UserDeptName,wh.UserDeptID,wh.UserName,wh.UserID as ID,isnull(TotalNormalValue,0) TotalNormalValue,isnull(TotalAdditionalValue,0) TotalAdditionalValue,isnull(TotalWorkHourValue,0) TotalWorkHourValue";
            string sql   = @"Select {0} From {2} ";

            //获取员工部门信息,员工工时合计
            string middleSql = string.Format(@" (
    Select UserDeptName,UserDeptID,UserName,UserID From {0}.dbo.S_W_UserWorkHour 
    where ProjectID='{1}' {2} group by userID,UserdeptID,UserdeptName,username
    ) wh 
Left JOIN(
	Select UserID,UserDeptID,sum(NormalValue) as TotalNormalValue,sum(AdditionalValue) as TotalAdditionalValue,sum(WorkHourValue) as TotalWorkHourValue
	from {0}.dbo.S_W_UserWorkHour where ProjectID='{1}'  {2} group by UserID,UserDeptID
	) whTotal ON whTotal.UserID=wh.UserID and whTotal.UserDeptID=wh.UserDeptID "    , shHrTime.DbName, projectInfoID, where);

            //员工按工时类别分类工时合计
            var whCategory = EnumBaseHelper.GetEnumDef("System.WorkHourType");

            foreach (var item in whCategory.EnumItem)
            {
                middleSql += string.Format(@" Left JOIN (
	Select UserID,UserDeptID,isnull(sum(WorkHourValue),0) as {0}Hours 
	from {1}.dbo.S_W_UserWorkHour where WorkHourType='{0}' and ProjectID='{2}' {3} group by UserID,UserDeptID ) wh{0} On whTotal.UserID= wh{0}.UserID and whTotal.UserDeptID=wh{0}.UserDeptID "    , item.Code, shHrTime.DbName, projectInfoID, where);
                field     += string.Format(",isnull({0}Hours,0) {0}Hours", item.Code);
            }

            sql = string.Format(sql, field, projectInfoID, middleSql);

            GridData data = shProject.ExecuteGridData(sql, qb);

            return(Json(data));
        }
Exemple #25
0
        public ActionResult QualityInfoList()
        {
            var mistakeLevels = EnumBaseHelper.GetEnumDef("Project.MistakeLevel").EnumItem;

            ViewBag.MistakeLevel = mistakeLevels;

            string projectInfoID = this.Request["ProjectInfoID"];
            var    list          = this.entities.Set <S_AE_Mistake>().Where(d => d.ProjectInfoID == projectInfoID).ToList();
            var    majors        = this.entities.Set <S_W_WBS>().Where(d => d.ProjectInfoID == projectInfoID && d.WBSType == "Major").
                                   Select(c => new { MajorName = c.Name, WBSValue = c.WBSValue, SortIndex = c.SortIndex }).Distinct().OrderBy(d => d.SortIndex).ToList();

            return(View());
        }
        public ActionResult List()
        {
            var startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            var endDate   = startDate.AddMonths(1);

            ViewBag.StartDate = startDate;
            ViewBag.EndDate   = endDate;
            var def   = EnumBaseHelper.GetEnumDef("EPC.SaleWorkContent");
            var items = def.EnumItem.ToList();

            ViewBag.Columns = items;
            return(View());
        }
Exemple #27
0
        protected override void BeforeSave(S_FileInfo file, Dictionary <string, object> row, bool isNew)
        {
            if (isNew)
            {
                var isPhys = row.GetValue("StorageType") == "Physical";
                var node   = S_NodeInfo.GetNode(row.GetValue("NodeID"), row.GetValue("SpaceID"));
                if (isPhys && node.ConfigInfo.IsPhysicalBox != "True")
                {
                    throw new Formula.Exceptions.BusinessException("当前编目节点不能保存实物文件");
                }
                if (!isPhys && node.ConfigInfo.IsElectronicBox != "True")
                {
                    throw new Formula.Exceptions.BusinessException("当前编目节点不能保存电子档文件");
                }
            }
            else
            {
                string     detail    = string.Empty;
                S_FileInfo oldFile   = new S_FileInfo(file.ID, file.Space);
                var        fileAttrs = file.ConfigInfo.S_DOC_FileAttr.Select(a => a);
                foreach (S_DOC_FileAttr fileAttr in fileAttrs)
                {
                    if (fileAttr.InputType.Equals("ButtonEdit"))//弹出选择
                    {
                        detail += file.DataEntity.GetValue(fileAttr.FileAttrField + "Name") == oldFile.DataEntity.GetValue(fileAttr.FileAttrField + "Name") ? "" : "\"" + fileAttr.FileAttrName + ":" + oldFile.DataEntity.GetValue(fileAttr.FileAttrField + "Name") + "\"修改为\"" + file.DataEntity.GetValue(fileAttr.FileAttrField + "Name") + "\";";
                    }

                    else if (fileAttr.InputType.Equals("Combobox"))//枚举
                    {
                        var    enums       = EnumBaseHelper.GetEnumDef(fileAttr.EnumKey).EnumItem;
                        var    enumNameOld = enums.FirstOrDefault(a => a.Code.Equals(oldFile.DataEntity.GetValue(fileAttr.FileAttrField)));
                        string oldName     = enumNameOld != null?enumNameOld.Name:"";
                        var    enumName    = enums.FirstOrDefault(a => a.Code.Equals(file.DataEntity.GetValue(fileAttr.FileAttrField)));
                        detail += file.DataEntity.GetValue(fileAttr.FileAttrField) == oldFile.DataEntity.GetValue(fileAttr.FileAttrField) ? "" : "\"" + fileAttr.FileAttrName + ":" + oldName + "\"修改为\"" + enumName.Name + "\";";
                    }
                    else
                    {
                        if (fileAttr.FileAttrField.Equals("SortIndex") || fileAttr.FileAttrField.Equals("DocIndexID"))
                        {
                            continue;
                        }
                        detail += file.DataEntity.GetValue(fileAttr.FileAttrField) == oldFile.DataEntity.GetValue(fileAttr.FileAttrField) ? "" : "\"" + fileAttr.FileAttrName + ":" + oldFile.DataEntity.GetValue(fileAttr.FileAttrField) + "\"修改为\"" + file.DataEntity.GetValue(fileAttr.FileAttrField) + "\";";
                    }
                }
                if (!string.IsNullOrEmpty(detail))
                {
                    //修改,详情说明
                    InventoryFO.CreateNewInventoryLedger(oldFile, detail, InventoryType.Update);
                }
            }
        }
Exemple #28
0
        public JsonResult GetProjectByUserID(QueryBuilder qb)
        {
            string startTime = GetQueryString("StartTime");
            string endTime   = GetQueryString("EndTime");

            string where = " ";
            if (!string.IsNullOrEmpty(startTime))
            {
                where += string.Format(" and WorkHourDate>='{0}' ", DateTime.Parse(startTime));
            }
            if (!string.IsNullOrEmpty(endTime))
            {
                where += string.Format(" and WorkHourDate<='{0}' ", DateTime.Parse(endTime));
            }

            string    userID     = GetQueryString("UserID");
            SQLHelper shWorkTime = SQLHelper.CreateSqlHelper(ConnEnum.HR);
            SQLHelper shBase     = SQLHelper.CreateSqlHelper(ConnEnum.Base);
            SQLHelper shProject  = SQLHelper.CreateSqlHelper(ConnEnum.Project);
            SQLHelper shMarket   = SQLHelper.CreateSqlHelper(ConnEnum.Market);

            string field = "whTotal.Name,whTotal.ProjectID as ID,whTotal.Code,whTotal.ChargeUserID,whTotal.ChargeUserName,isnull(TotalNormalValue,0) TotalNormalValue,isnull(TotalAdditionalValue,0) TotalAdditionalValue,isnull(TotalWorkHourValue,0) TotalWorkHourValue";
            string sql   = @"Select {0} From  {1} ";

            //获取项目信息,项目工时合计
            string middleSql = string.Format(@"(select total.*,prj.Name,prj.Code,prj.ChargeUserID,prj.ChargeUserName from (
    Select ProjectID,sum(NormalValue) as TotalNormalValue,sum(AdditionalValue) as TotalAdditionalValue,sum(WorkHourValue) as TotalWorkHourValue
    from {0}.dbo.S_W_UserWorkHour where UserID='{1}' {2} group by ProjectID
) total left join (select ID,Name,Code,ChargeUserID,ChargeUserName from {3}.dbo.S_I_ProjectInfo 
 union all select ID,ProjectName as Name,ProjectCode as Code,ChargeUserID='',ChargeUserName='' from {0}.dbo.S_W_ProjectInfo
 union all select ID,Name as Name,SerialNumber as Code,BusinessManager as ChargerUser,BusinessManagerName as ChargerUserName from {4}.dbo.S_P_MarketClue) prj
on total.ProjectID=prj.ID ) whTotal", shWorkTime.DbName, userID, where, shProject.DbName, shMarket.DbName);

            //员工按工时类别分类工时合计
            var whCategory = EnumBaseHelper.GetEnumDef("System.WorkHourType");

            foreach (var item in whCategory.EnumItem)
            {
                middleSql += string.Format(@" Left JOIN (
	Select ProjectID,isnull(sum(WorkHourValue),0) as {1}Hours 
	from {0}.dbo.S_W_UserWorkHour where WorkHourType='{1}' and UserID='{2}' {3} group by ProjectID ) wh{1} On whTotal.ProjectID= wh{1}.ProjectID "    , shWorkTime.DbName, item.Code, userID, where);
                field     += string.Format(",isnull({0}Hours,0) {0}Hours", item.Code);
            }

            sql = string.Format(sql, field, middleSql);

            GridData data = shBase.ExecuteGridData(sql, qb);

            return(Json(data));
        }
Exemple #29
0
        protected override void OnFlowEnd(T_EXE_PublishApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var publishInfo = this.GetEntityByID <S_EP_PublishInfo>(entity.ID);
            var majors      = EnumBaseHelper.GetEnumDef("Project.Major").EnumItem.ToList();

            if (publishInfo == null)
            {
                publishInfo = new S_EP_PublishInfo();
                this.BusinessEntities.Set <S_EP_PublishInfo>().Add(publishInfo);
            }
            this.UpdateEntity <S_EP_PublishInfo>(publishInfo, entity.ToDic());
            publishInfo.ID            = entity.ID;
            publishInfo.SubmitTime    = DateTime.Now;
            publishInfo.BelongYear    = ((DateTime)publishInfo.SubmitTime).Year;
            publishInfo.BelongMonth   = ((DateTime)publishInfo.SubmitTime).Month;
            publishInfo.BelongQuarter = ((publishInfo.BelongMonth - 1) / 3) + 1;
            var major = majors.FirstOrDefault(a => a.Code == publishInfo.MajorCode);

            if (major != null)
            {
                publishInfo.MajorName = major.Name;
            }
            foreach (var item in entity.T_EXE_PublishApply_PriceDetail)
            {
                var price = this.GetEntityByID <S_EP_PublishInfo_PriceDetail>(item.ID);
                if (price == null)
                {
                    price = new S_EP_PublishInfo_PriceDetail();
                    this.BusinessEntities.Set <S_EP_PublishInfo_PriceDetail>().Add(price);
                }
                this.UpdateEntity <S_EP_PublishInfo_PriceDetail>(price, item.ToDic());
                price.ID = item.ID;
                price.S_EP_PublishInfoID = publishInfo.ID;
            }
            foreach (var item in entity.T_EXE_PublishApply_Products)
            {
                var product = this.GetEntityByID <S_EP_PublishInfo_Products>(item.ID);
                if (product == null)
                {
                    product = new S_EP_PublishInfo_Products();
                    this.BusinessEntities.Set <S_EP_PublishInfo_Products>().Add(product);
                }
                this.UpdateEntity <S_EP_PublishInfo_Products>(product, item.ToDic());
                product.ID = item.ID;
                product.S_EP_PublishInfoID = publishInfo.ID;
            }
            entity.SetProductPrintState(PrintState.Printed.ToString());
            this.BusinessEntities.SaveChanges();
        }
        public ActionResult MileStoneFinishApplyTab()
        {
            string projectInfoID = this.Request["ProjectInfoID"];
            var    projectInfo   = this.GetEntityByID <S_I_ProjectInfo>(projectInfoID);

            if (projectInfo == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到ID为【" + projectInfoID + "】的项目信息,无法进行里程碑策划");
            }
            var level = EnumBaseHelper.GetEnumDef(typeof(Project.Logic.MileStoneType)).EnumItem.ToList();

            ViewBag.MileStoneLevel = level;
            ViewBag.ProjectInfoID  = projectInfoID;
            return(View());
        }