diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index d84e1613..b937cbb9 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -19357,7 +19357,7 @@ - + - + diff --git a/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs b/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs index c478e6b4..9f3cb957 100644 --- a/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs @@ -481,7 +481,7 @@ namespace FineUIPro.Web.common /// protected int GetSuperCompletedNum() { - var result = Project_HSSEData_HSSEService.GetSuperCompletedNum(ProjectId); + var result = Project_HSSEData_HSSEService.GetSuperFinishedNum(ProjectId); return result; } diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs index a9ec355c..153fd18e 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs @@ -24,15 +24,16 @@ namespace FineUIPro.Web.common { pids = CurrUser.CompanyProjectId.Split(','); } - else { + else + { //加载所有在建项目的数据 - var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x=>x.ProjectId).ToArray(); - if (pidArray.Length>0) + var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToArray(); + if (pidArray.Length > 0) { pids = pidArray; } } - + //未遂事故 var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord @@ -52,21 +53,23 @@ namespace FineUIPro.Web.common { countAqrgsSum = CountAqrgs(); } - else { - countAqrgsSum = CountAqrgs(null,null,pids); + else + { + countAqrgsSum = CountAqrgs(null, null, pids); } - + if (countAqrgsSum > 10000) { countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00); this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万"; } - else { + else + { this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0]; } - + //本月安全人工时 //int wHoursMonth = 0; @@ -85,7 +88,7 @@ namespace FineUIPro.Web.common } else { - countMonthAqrgs = CountAqrgs(d1, d2,pids); + countMonthAqrgs = CountAqrgs(d1, d2, pids); } if (countMonthAqrgs > 10000) { @@ -93,7 +96,8 @@ namespace FineUIPro.Web.common this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万"; } - else { + else + { this.divSafeWorkTimeMonth.InnerHtml = CountAqrgs(d1, d2).ToString().Split('.')[0]; } @@ -113,11 +117,12 @@ namespace FineUIPro.Web.common boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)).ToList().Count; this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString(); } - else { - getTrainRecord = db.EduTrain_TrainRecord.Where(x=>pids.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum) ?? 0; + else + { + getTrainRecord = db.EduTrain_TrainRecord.Where(x => pids.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum) ?? 0; //修改:增加博晟教育中的人数 boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null) - && pids.Contains(x.ProjectId) ).ToList().Count; + && pids.Contains(x.ProjectId)).ToList().Count; this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString(); } @@ -137,7 +142,8 @@ namespace FineUIPro.Web.common select x; this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString(); } - else { + else + { //安全管理人员 var allSum = from x in Funs.DB.SitePerson_Person where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now) @@ -174,11 +180,12 @@ namespace FineUIPro.Web.common select x).Count(); divCqmsPxNum.InnerText = CqmsPxNum.ToString(); } - else { + else + { CqmsManageNum = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.IsUsed == true && y.IsCQMS == true && pids.Contains(x.ProjectId) - select x).Count(); + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsUsed == true && y.IsCQMS == true && pids.Contains(x.ProjectId) + select x).Count(); this.divCqmsManageNum.InnerText = CqmsManageNum.ToString(); CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson @@ -193,10 +200,11 @@ namespace FineUIPro.Web.common { allProjects = ProjectService.GetAllProjectDropDownList(); } - else { + else + { allProjects = ProjectService.GetAllProjectDropDownList(pids); } - + int acount = allProjects.Count(); int pcount1 = 0; int pcount2 = 0; @@ -205,10 +213,12 @@ namespace FineUIPro.Web.common { pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count(); var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(','); - if (pids == null) { + if (pids == null) + { pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x).Count(); } - else { + else + { pidzjsg = pids; pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count(); } @@ -279,7 +289,7 @@ namespace FineUIPro.Web.common /// /// /// - protected decimal CountAqrgs(DateTime? d1 = null, DateTime? d2 = null,string[] pids =null) + protected decimal CountAqrgs(DateTime? d1 = null, DateTime? d2 = null, string[] pids = null) { decimal cout1 = 0; @@ -288,12 +298,13 @@ namespace FineUIPro.Web.common var getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber select x; - if (pids != null) { + if (pids != null) + { getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber where pids.Contains(x.ProjectId) select x; } - if (getAllPersonInOutList.Count() > 0) + if (getAllPersonInOutList.Count() > 0) { if (datetime1.HasValue) { @@ -305,7 +316,16 @@ namespace FineUIPro.Web.common } if (getAllPersonInOutList.Count() > 0) { - cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); + //cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); + foreach (var pid in pids) + { + var q1 = getAllPersonInOutList.Where(x => x.ProjectId == pid).OrderByDescending(x => x.InOutDate); + var q2 = getAllPersonInOutList.Where(x => x.ProjectId == pid).OrderBy(x => x.InOutDate); + if (q1.Count() > 0) + { + cout1 += (q1.First().WorkHours ?? 0) - (q2.First().WorkHours ?? 0); + } + } } } @@ -318,15 +338,15 @@ namespace FineUIPro.Web.common where y.ProjectState == Const.ProjectState_1 select x; - if (pids!=null) + if (pids != null) { getD1 = from x in Funs.DB.Accident_AccidentHandle join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where pids.Contains(x.ProjectId) + where pids.Contains(x.ProjectId) select x; getD2 = from x in Funs.DB.Accident_AccidentReport join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where pids.Contains(x.ProjectId) + where pids.Contains(x.ProjectId) select x; } @@ -716,7 +736,8 @@ namespace FineUIPro.Web.common zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); } - else { + else + { zlallNumber = (from x in Funs.DB.Check_CheckControl where x.CheckDate <= DateTime.Now && pids.Contains(x.ProjectId) select x).Count().ToString(); @@ -736,7 +757,7 @@ namespace FineUIPro.Web.common zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); } - + } #endregion @@ -764,7 +785,8 @@ namespace FineUIPro.Web.common zlgjzgl = zgl.ToString(); zggjzglDataValue = (100 - (100.0 * num2 / num1)).ToString(); } - else { + else + { var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement where pids.Contains(x.ProjectId) select x).Count(); @@ -780,7 +802,7 @@ namespace FineUIPro.Web.common zlgjzgl = zgl.ToString(); zggjzglDataValue = (100 - (100.0 * num2 / num1)).ToString(); } - + } #endregion @@ -799,7 +821,7 @@ namespace FineUIPro.Web.common double result = 0; Model.SGGLDB db = Funs.DB; var ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" select x; - if (pids!=null) + if (pids != null) { ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && pids.Contains(x.ProjectId) select x; } @@ -886,7 +908,8 @@ namespace FineUIPro.Web.common select x).Count(); gjsxZdl = Math.Round((100.0 * ywcnum / znum), 2).ToString(); } - else { + else + { //Check_JointCheck var znum = (from x in Funs.DB.GJSX where pids.Contains(x.ProjectId) @@ -913,7 +936,7 @@ namespace FineUIPro.Web.common select x).Count(); gjsxZdl = Math.Round((100.0 * ywcnum / znum), 2).ToString(); } - + } #endregion @@ -928,8 +951,9 @@ namespace FineUIPro.Web.common { getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now); } - else { - getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now,pids); + else + { + getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now, pids); } AllCount = getallin.Count(); if (AllCount > 0) @@ -954,13 +978,14 @@ namespace FineUIPro.Web.common var list = new List(); if (pids == null) { - list= Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); + list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); } - else { + else + { list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList(); } - - + + foreach (var item in list) { ProjectPersonMc += "'" + item.ShortName + "',"; @@ -981,10 +1006,11 @@ namespace FineUIPro.Web.common { list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.Progress != null).ToList(); } - else { + else + { list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId) && x.Progress != null).ToList(); } - if (list.Count>0) + if (list.Count > 0) { foreach (var item in list) { @@ -994,7 +1020,7 @@ namespace FineUIPro.Web.common ProjectJd = ProjectJd.TrimEnd(','); ProjectMc = ProjectMc.TrimEnd(','); } - + } #endregion @@ -1011,28 +1037,29 @@ namespace FineUIPro.Web.common /// 获取隐患整改闭环项 /// /// - public int GetGeneralClosedNum() + public int GetGeneralClosedNum() { int result = 0; - if (pids==null) + if (pids == null) { result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States == "3" select x).Count(); } - else { + else + { result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States == "3" && pids.Contains(x.ProjectId) select x).Count(); } - + return result; } /// /// 获取隐患未整改完成项 /// /// - public int GetGeneralNotClosedNum() + public int GetGeneralNotClosedNum() { int result = 0; if (pids == null) @@ -1041,12 +1068,13 @@ namespace FineUIPro.Web.common where x.States != "3" select x).Count(); } - else { + else + { result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States != "3" && pids.Contains(x.ProjectId) select x).Count(); } - + return result; } #endregion @@ -1192,7 +1220,7 @@ namespace FineUIPro.Web.common /// 获取未遂事件数 /// /// - private int GetNearMissNum() + private int GetNearMissNum() { if (pids == null) { @@ -1202,7 +1230,8 @@ namespace FineUIPro.Web.common select x).Count(); return result; } - else { + else + { var result = (from x in Funs.DB.Accident_AccidentPersonRecord join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId where x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime @@ -1210,7 +1239,7 @@ namespace FineUIPro.Web.common select x).Count(); return result; } - + } } } \ No newline at end of file