diff --git a/DataBase/版本日志/SGGLDB_WH_V2024-09-09-phf.sql b/DataBase/版本日志/SGGLDB_WH_V2024-09-09-phf.sql new file mode 100644 index 00000000..dc9137f6 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_WH_V2024-09-09-phf.sql @@ -0,0 +1,2 @@ +alter table Sys_User +add CompanyProjectId nvarchar(2000) null; \ No newline at end of file diff --git a/SGGL/BLL/API/HSSE/APIPageDataService.cs b/SGGL/BLL/API/HSSE/APIPageDataService.cs index ba6d276c..43746f29 100644 --- a/SGGL/BLL/API/HSSE/APIPageDataService.cs +++ b/SGGL/BLL/API/HSSE/APIPageDataService.cs @@ -167,6 +167,37 @@ namespace BLL return getSiteInOutList; } } + + public static List getPersonNumByCompany(DateTime dateValue,string[] pids) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List getSiteInOutList = new List(); + var getDayAll = from x in db.SitePerson_PersonInOutNow + join y in db.SitePerson_Person on x.PersonId equals y.PersonId + join z in db.Base_WorkPost on y.WorkPostId equals z.WorkPostId + where x.ChangeTime.Value.Year == dateValue.Year && x.ChangeTime.Value.Month == dateValue.Month + && x.ChangeTime.Value.Day == dateValue.Day && pids.Contains(x.ProjectId) + select new { x.PersonId, x.ChangeTime, x.IsIn, z.PostType }; + if (getDayAll.Count() > 0) + { + var getInMaxs = from x in getDayAll + group x by x.PersonId into g + select new Model.PageDataPersonInOutItem + { + PersonId = g.First().PersonId, + ChangeTime = g.Max(x => x.ChangeTime), + IsIn = g.First().IsIn, + PostType = g.First().PostType + }; + if (getInMaxs.Count() > 0) + { + getSiteInOutList = getInMaxs.Where(x => x.IsIn == true).ToList(); + } + } + return getSiteInOutList; + } + } #endregion } } diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs index ca2f2232..5d01ccf9 100644 --- a/SGGL/BLL/ProjectData/ProjectService.cs +++ b/SGGL/BLL/ProjectData/ProjectService.cs @@ -251,12 +251,23 @@ /// 获取项目下拉选项 /// /// - public static List GetAllProjectDropDownList() + public static List GetAllProjectDropDownList(string[] pids = null) { - var list = (from x in Funs.DB.Base_Project - orderby x.ProjectCode descending - select x).ToList(); - return list; + if (pids == null) + { + var list = (from x in Funs.DB.Base_Project + orderby x.ProjectCode descending + select x).ToList(); + return list; + } + else { + var list = (from x in Funs.DB.Base_Project + where pids.Contains(x.ProjectId) + orderby x.ProjectCode descending + select x).ToList(); + return list; + } + } @@ -669,5 +680,27 @@ return list; } + + #region 加载公司级别项目 + public static List GetUnEndProjectByUserIdDropDownList(string projectState, + string projectName = null, string projectCode = null) { + IQueryable projects = (from x in Funs.DB.Base_Project + where x.ProjectState == projectState + orderby x.ProjectCode descending + select x); + if (!string.IsNullOrEmpty(projectName)) + { + projects = from x in projects where x.ProjectName.Contains(projectName) select x; + } + if (!string.IsNullOrEmpty(projectCode)) + { + projects = from x in projects where x.ProjectCode.Contains(projectCode) select x; + } + return (from x in projects + join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId + select x).Distinct().ToList(); + + } + #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index ec66dd73..d0037999 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -686,36 +686,67 @@ namespace BLL /// 获取企业负责人带班检查次数 /// /// - public static int GetCompanyLeadShiftCheckNum() + public static int GetCompanyLeadShiftCheckNum(string[] pids=null) { - var result = (from x in Funs.DB.Supervise_SuperviseCheckReport - where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取企业综合检查次数 /// /// - public static int GetCompanyComprehensiveCheckNum() + public static int GetCompanyComprehensiveCheckNum(string[] pids = null) { - var result = (from x in Funs.DB.Supervise_SuperviseCheckReport - where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) { + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取企业专项检查次数 /// /// - public static int GetCompanySpecialCheckNum() + public static int GetCompanySpecialCheckNum(string[] pids = null) { - var result = (from x in Funs.DB.Supervise_SuperviseCheckReport - where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// diff --git a/SGGL/FineUIPro.Web/common/mainMenu_TestRun.aspx b/SGGL/FineUIPro.Web/common/mainMenu_TestRun.aspx index cb378079..1e265a39 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_TestRun.aspx +++ b/SGGL/FineUIPro.Web/common/mainMenu_TestRun.aspx @@ -68,6 +68,11 @@ .tab .t-item { font-size: 13px; } + + .bw-item-content { + overflow: hidden; + overflow-y: scroll; + } @@ -116,11 +121,11 @@
-
未投料
+
未投料
-
投料中
+
投料中
-
投料完成
+
投料完成
@@ -487,7 +492,7 @@ var threeData = JSON.parse(fourDecisionStr); var threewidth = Math.floor(100 / threeData.length); $.each(threeData, function (index, item) { - $("#three").append("
"); + $("#three").append("
"); }); //图4 @@ -495,7 +500,7 @@ var fourData = JSON.parse(fourStr); var fourwidth = Math.floor(100 / (fourData.length / 2)); $.each(fourData, function (index, item) { - $("#four").append("
"); + $("#four").append("
"); }); //图5 @@ -503,7 +508,7 @@ var fiveData = JSON.parse(fiveStr); var fivewidth = Math.floor(100 / (fiveData.length / 2)); $.each(fourData, function (index, item) { - $("#five").append("
"); + $("#five").append("
"); }); //图6 @@ -816,19 +821,26 @@ //if (item.RunType == 3) { // colorData = ["#CCCC33", "#8FCC33", "#57C43C", "#22DD48"]; //} - var colorData = ["#7A7AA7", "#5656CC", "#3939E9", "#2222FF"]; + var colorData = ["#DD226D", "#DD226D", "#DD226D", "#DD226D"]; if (item.RunType == 2) { - colorData = ["#DD226D", "#DD226D", "#E95B39", "#DD226D"]; + colorData = ["#57C43C", "#57C43C", "#57C43C", "#57C43C"]; } if (item.RunType == 3) { - colorData = ["#3fbb6a", "#3fbb6a", "#3fbb6a", "#3fbb6a"]; + colorData = ["#B3764D", "#B3764D", "#B3764D", "#B3764D"]; } var chart = echarts.init(document.getElementById('four' + index)); var value = 100; + + //名称 + var sname = item.SystemName; + var index = sname.indexOf(" ") + if (index!=-1) { + sname = sname.substring(0, index) + "\n" + sname.substring(index + 1, sname.length); + } option = { backgroundColor: '000', title: { - text: `` + item.SystemName, + text: `` + sname, subtext: item.RunType == 1 ? "未投料" : item.RunType == 2 ? "投料中" : "投料完成", left: 'center', top: '45%', //top待调整 @@ -926,10 +938,17 @@ } var chart = echarts.init(document.getElementById('five' + index)); var value = 100; + //名称 + var sname = item.SystemName; + var index = sname.indexOf(" ") + if (index != -1) { + sname = sname.substring(0, index) + "\n" + sname.substring(index + 1, sname.length); + } + option = { backgroundColor: '000', title: { - text: `` + item.SystemName, + text: sname, subtext: item.RunType == 1 ? "未运行" : item.RunType == 2 ? "运行中" : "停车检修", left: 'center', top: '45%', //top待调整 diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx b/SGGL/FineUIPro.Web/common/main_new.aspx index 7613fb34..118182c2 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx +++ b/SGGL/FineUIPro.Web/common/main_new.aspx @@ -39,6 +39,11 @@ .cl-tab { padding: 0.025rem 0 !important; } + + .c-site>.num-box>.num { + font-size: .215rem; + color: #21FFAF; +} @@ -2346,7 +2351,8 @@ dataZoom: [ { // 设置滚动条的隐藏或显示 - show: value.length > 10, + /* show: value.length > 10,*/ + show: true, // 设置类型 type: "slider", // 设置背景颜色 diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs index 30bf2b3c..3a33b6b6 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs @@ -13,11 +13,19 @@ namespace FineUIPro.Web.common { List allProjects; public static List LargerHazard = new List(); + + public string[] pids { get; set; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Model.SGGLDB db = Funs.DB; + if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId)) + { + pids = CurrUser.CompanyProjectId.Split(','); + } + + //未遂事故 var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId @@ -31,7 +39,26 @@ namespace FineUIPro.Web.common //安全人工时 int wHours = db.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0; - this.divSafeWorkTime.InnerHtml = CountAqrgs().ToString().Split('.')[0]; + var countAqrgsSum = Convert.ToDecimal(0); + if (pids == null) + { + countAqrgsSum = CountAqrgs(); + } + else { + countAqrgsSum = CountAqrgs(null,null,pids); + } + + if (countAqrgsSum > 10000) + { + countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00); + + this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万"; + } + else { + this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0]; + } + + //本月安全人工时 //int wHoursMonth = 0; @@ -43,50 +70,125 @@ namespace FineUIPro.Web.common //} DateTime d1 = getStartMonth(); DateTime d2 = getEndMonth(); + var countMonthAqrgs = Convert.ToDecimal(0); + if (pids == null) + { + countMonthAqrgs = CountAqrgs(d1, d2); + } + else + { + countMonthAqrgs = CountAqrgs(d1, d2,pids); + } + if (countMonthAqrgs > 10000) + { + countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00); + + this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万"; + } + else { + this.divSafeWorkTimeMonth.InnerHtml = CountAqrgs(d1, d2).ToString().Split('.')[0]; + } + - this.divSafeWorkTimeMonth.InnerHtml = CountAqrgs(d1, d2).ToString().Split('.')[0]; //int wHoursMonth = db.SitePerson_PersonInOutNumber.Where(x => x.InOutDate > DateTime.Now.AddDays(-Convert.ToInt32(DateTime.Now.Date.Day))) // .Max(x => x.WorkHours) ?? 0; //this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString(); //安全培训累计人员 - var getTrainRecord = db.EduTrain_TrainRecord.Sum(x => x.TrainPersonNum) ?? 0; - //修改:增加博晟教育中的人数 - var boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)).ToList().Count; - this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString(); + var getTrainRecord = 0; + var boShengCount = 0; + if (pids == null) + { + getTrainRecord = db.EduTrain_TrainRecord.Sum(x => x.TrainPersonNum) ?? 0; + //修改:增加博晟教育中的人数 + 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; + //修改:增加博晟教育中的人数 + boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null) + && pids.Contains(x.ProjectId) ).ToList().Count; - //安全管理人员 - var allSum = from x in Funs.DB.SitePerson_Person - where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now) - select x; - var glAllPerson = from x in allSum - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - //where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员 - where y.IsHsse == true - select x; - this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString(); + this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString(); + } - //质量管理人员 - int CqmsManageNum = (from x in Funs.DB.Person_CompanyBranchPerson + + if (pids == null) + { + //安全管理人员 + var allSum = from x in Funs.DB.SitePerson_Person + where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now) + select x; + + var glAllPerson = from x in allSum + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + //where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员 + where y.IsHsse == true + select x; + this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString(); + } + 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) + && pids.Contains(x.ProjectId) + select x; + + var glAllPerson = from x in allSum + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + //where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员 + where y.IsHsse == true + select x; + this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString(); + } + + #region 质量管理人员,质量培训人员 增加公司级 + int CqmsManageNum = 0; + int CqmsPxNum = 0; + //质量培训人员 + DateTime date = DateTime.Now.AddDays(-1); + if (pids == null) + { + CqmsManageNum = (from x in Funs.DB.Person_CompanyBranchPerson join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId where x.IsOnJob == true && y.IsCQMS == true select x).Count() + - (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 - select x).Count(); - this.divCqmsManageNum.InnerText = CqmsManageNum.ToString(); + (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 + select x).Count(); + this.divCqmsManageNum.InnerText = CqmsManageNum.ToString(); - //质量培训人员 - DateTime date = DateTime.Now.AddDays(-1); - int CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson + CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson where x.IsTrain == true select x).Count(); - divCqmsPxNum.InnerText = CqmsPxNum.ToString(); + divCqmsPxNum.InnerText = CqmsPxNum.ToString(); + } + 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(); + this.divCqmsManageNum.InnerText = CqmsManageNum.ToString(); + + CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson + where x.IsTrain == true && pids.Contains(x.ProjectId) + select x).Count(); + divCqmsPxNum.InnerText = CqmsPxNum.ToString(); + } + #endregion //在建项目 - allProjects = ProjectService.GetAllProjectDropDownList(); + if (pids == null) + { + allProjects = ProjectService.GetAllProjectDropDownList(); + } + else { + allProjects = ProjectService.GetAllProjectDropDownList(pids); + } + int acount = allProjects.Count(); int pcount1 = 0; int pcount2 = 0; @@ -94,8 +196,15 @@ namespace FineUIPro.Web.common if (acount > 0) { pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count(); - pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true select x).Count(); - pcount3 = Count3(); + var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(','); + if (pids == null) { + pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x).Count(); + } + else { + pidzjsg = pids; + pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count(); + } + pcount3 = Count3(pidzjsg); } div_zjxmCount.InnerHtml = pcount1.ToString() + "
"; div_cjrsCount.InnerHtml = pcount2.ToString() + "
"; @@ -162,7 +271,7 @@ namespace FineUIPro.Web.common ///
/// /// - protected decimal CountAqrgs(DateTime? d1 = null, DateTime? d2 = null) + protected decimal CountAqrgs(DateTime? d1 = null, DateTime? d2 = null,string[] pids =null) { decimal cout1 = 0; @@ -171,7 +280,12 @@ namespace FineUIPro.Web.common var getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber select x; - if (getAllPersonInOutList.Count() > 0) + if (pids != null) { + getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber + where pids.Contains(x.ProjectId) + select x; + } + if (getAllPersonInOutList.Count() > 0) { if (datetime1.HasValue) { @@ -196,6 +310,18 @@ namespace FineUIPro.Web.common where y.ProjectState == Const.ProjectState_1 select x; + 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) + 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) + select x; + } + if (datetime1.HasValue) { getD1 = getD1.Where(x => x.AccidentDate >= datetime1); @@ -542,10 +668,10 @@ namespace FineUIPro.Web.common /// /// /// - protected int Count3() + protected int Count3(string[] pids) { int cout1 = 0; - cout1 = Funs.DB.Solution_LargerHazard.Where(x => x.States == Const.State_2).Count(); + cout1 = Funs.DB.Solution_LargerHazard.Where(x => x.States == Const.State_2 && pids.Contains(x.ProjectId)).Count(); return cout1; } #endregion @@ -561,20 +687,48 @@ namespace FineUIPro.Web.common protected string zgzglDataValue; protected void getZlwt() { - zlallNumber = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now - select x).Count().ToString(); - var num2 = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now && x.State == "7" - select x).Count(); - zlfinishNumber = num2.ToString(); - var num3 = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now && x.State != "7" - select x).Count(); + if (pids == null) + { + zlallNumber = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now + select x).Count().ToString(); - var zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); - zlzgl = zgl.ToString(); - zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); + var num2 = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State == "7" + select x).Count(); + + zlfinishNumber = num2.ToString(); + var num3 = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State != "7" + select x).Count(); + + var zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); + + zlzgl = zgl.ToString(); + + zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); + } + else { + zlallNumber = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && pids.Contains(x.ProjectId) + select x).Count().ToString(); + + var num2 = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State == "7" && pids.Contains(x.ProjectId) + select x).Count(); + + zlfinishNumber = num2.ToString(); + var num3 = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State != "7" && pids.Contains(x.ProjectId) + select x).Count(); + + var zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); + + zlzgl = zgl.ToString(); + + zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); + } + } #endregion @@ -586,19 +740,39 @@ namespace FineUIPro.Web.common protected string zggjzglDataValue; protected void getZlgj() { - var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement - select x).Count(); - //Check_JointCheck - zlgjallNumber = num1.ToString(); + if (pids == null) + { + var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + select x).Count(); + //Check_JointCheck + zlgjallNumber = num1.ToString(); - var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement - where x.IsOnceQualified == true - select x).Count(); - zlgjfinishNumber = num2.ToString(); + var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.IsOnceQualified == true + select x).Count(); + zlgjfinishNumber = num2.ToString(); - var zgl = String.Format("{0:N2}", 100.0 * num2 / num1); - zlgjzgl = zgl.ToString(); - zggjzglDataValue = (100 - (100.0 * num2 / num1)).ToString(); + var zgl = String.Format("{0:N2}", 100.0 * num2 / num1); + zlgjzgl = zgl.ToString(); + zggjzglDataValue = (100 - (100.0 * num2 / num1)).ToString(); + } + else { + var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where pids.Contains(x.ProjectId) + select x).Count(); + //Check_JointCheck + zlgjallNumber = num1.ToString(); + + var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.IsOnceQualified == true && pids.Contains(x.ProjectId) + select x).Count(); + zlgjfinishNumber = num2.ToString(); + + var zgl = String.Format("{0:N2}", 100.0 * num2 / num1); + zlgjzgl = zgl.ToString(); + zggjzglDataValue = (100 - (100.0 * num2 / num1)).ToString(); + } + } #endregion @@ -617,6 +791,10 @@ 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) + { + ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && pids.Contains(x.ProjectId) select x; + } decimal a = 0, b = 0; if (ndtLists.Count() > 0) { @@ -673,30 +851,61 @@ namespace FineUIPro.Web.common protected string gjsxZdl = "0"; protected void getGjsx() { - //Check_JointCheck - var znum = (from x in Funs.DB.GJSX - select x).Count(); - divGjsxzj.InnerHtml = znum.ToString(); + if (pids == null) + { + //Check_JointCheck + var znum = (from x in Funs.DB.GJSX + select x).Count(); + divGjsxzj.InnerHtml = znum.ToString(); - //到期应完成 - var dqnum = (from x in Funs.DB.GJSX - where x.CompleteDate <= DateTime.Now - select x).Count().ToString(); - divGjsxdq.InnerHtml = dqnum; + //到期应完成 + var dqnum = (from x in Funs.DB.GJSX + where x.CompleteDate <= DateTime.Now + select x).Count().ToString(); + divGjsxdq.InnerHtml = dqnum; - //未准点完成 - var wzdnum = (from x in Funs.DB.GJSX - where x.CompleteDate <= DateTime.Now - && x.State != "0" - select x).Count().ToString(); - divGjsxwzd.InnerHtml = wzdnum; + //未准点完成 + var wzdnum = (from x in Funs.DB.GJSX + where x.CompleteDate <= DateTime.Now + && x.State != "0" + select x).Count().ToString(); + divGjsxwzd.InnerHtml = wzdnum; - //准点率,已完成/总数*100 - var ywcnum = (from x in Funs.DB.GJSX - where x.CompleteDate <= DateTime.Now - && x.State == "0" - select x).Count(); - gjsxZdl = Math.Round((100.0 * ywcnum / znum), 2).ToString(); + //准点率,已完成/总数*100 + var ywcnum = (from x in Funs.DB.GJSX + where x.CompleteDate <= DateTime.Now + && x.State == "0" + select x).Count(); + gjsxZdl = Math.Round((100.0 * ywcnum / znum), 2).ToString(); + } + else { + //Check_JointCheck + var znum = (from x in Funs.DB.GJSX + where pids.Contains(x.ProjectId) + select x).Count(); + divGjsxzj.InnerHtml = znum.ToString(); + + //到期应完成 + var dqnum = (from x in Funs.DB.GJSX + where x.CompleteDate <= DateTime.Now && pids.Contains(x.ProjectId) + select x).Count().ToString(); + divGjsxdq.InnerHtml = dqnum; + + //未准点完成 + var wzdnum = (from x in Funs.DB.GJSX + where x.CompleteDate <= DateTime.Now + && x.State != "0" && pids.Contains(x.ProjectId) + select x).Count().ToString(); + divGjsxwzd.InnerHtml = wzdnum; + + //准点率,已完成/总数*100 + var ywcnum = (from x in Funs.DB.GJSX + where x.CompleteDate <= DateTime.Now + && x.State == "0" && pids.Contains(x.ProjectId) + select x).Count(); + gjsxZdl = Math.Round((100.0 * ywcnum / znum), 2).ToString(); + } + } #endregion @@ -706,7 +915,14 @@ namespace FineUIPro.Web.common { int AllCount = 0; int MCount = 0; - var getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now); + var getallin = new List(); + if (pids == null) + { + getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now); + } + else { + getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now,pids); + } AllCount = getallin.Count(); if (AllCount > 0) { @@ -727,7 +943,16 @@ namespace FineUIPro.Web.common protected string ProjectPersonMc; private void getProjectSitePerson() { - var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); + var list = new List(); + if (pids == null) + { + list= Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); + } + else { + list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList(); + } + + foreach (var item in list) { ProjectPersonMc += "'" + item.ShortName + "',"; @@ -743,14 +968,25 @@ namespace FineUIPro.Web.common protected string ProjectMc; protected void getJd() { - var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.Progress != null).ToList(); - foreach (var item in list) + var list = new List(); + if (pids == null) { - ProjectJd += "'" + item.Progress.Value.ToString("0.##") + "',"; - ProjectMc += "'" + item.ShortName + "',"; + list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.Progress != null).ToList(); } - ProjectJd = ProjectJd.TrimEnd(','); - ProjectMc = ProjectMc.TrimEnd(','); + else { + list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId) && x.Progress != null).ToList(); + } + if (list.Count>0) + { + foreach (var item in list) + { + ProjectJd += "'" + item.Progress.Value.ToString("0.##") + "',"; + ProjectMc += "'" + item.ShortName + "',"; + } + ProjectJd = ProjectJd.TrimEnd(','); + ProjectMc = ProjectMc.TrimEnd(','); + } + } #endregion @@ -767,22 +1003,42 @@ namespace FineUIPro.Web.common /// 获取隐患整改闭环项 /// /// - public static int GetGeneralClosedNum() + public int GetGeneralClosedNum() { - int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + int result = 0; + if (pids==null) + { + result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States == "3" select x).Count(); + } + else { + result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.States == "3" && pids.Contains(x.ProjectId) + select x).Count(); + } + return result; } /// /// 获取隐患未整改完成项 /// /// - public static int GetGeneralNotClosedNum() + public int GetGeneralNotClosedNum() { - int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + int result = 0; + if (pids == null) + { + result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States != "3" select x).Count(); + } + else { + result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.States != "3" && pids.Contains(x.ProjectId) + select x).Count(); + } + return result; } #endregion @@ -797,7 +1053,15 @@ namespace FineUIPro.Web.common { //项目 - var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); + var list = new List(); + if (pids == null) + { + list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.Progress != null).ToList(); + } + else + { + list = Funs.DB.Base_Project.Where(x => pids.Contains(x.ProjectId) && x.Progress != null).ToList(); + } var PipelinList = Funs.DB.CLGL_PipelineMaterialSumList.Where(x => x.Type == "M"); var SbclList = Funs.DB.CLGL_ContractListSum.Where(x => x.C1 == "设备"); foreach (var item in list) @@ -920,13 +1184,25 @@ namespace FineUIPro.Web.common /// 获取未遂事件数 /// /// - public static int GetNearMissNum() + private int GetNearMissNum() { - 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 - select x).Count(); - return result; + if (pids == null) + { + 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 + select x).Count(); + return result; + } + 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 + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/common/main_new0.aspx b/SGGL/FineUIPro.Web/common/main_new0.aspx index 3cf81a61..18da8bca 100644 --- a/SGGL/FineUIPro.Web/common/main_new0.aspx +++ b/SGGL/FineUIPro.Web/common/main_new0.aspx @@ -217,14 +217,14 @@ -
+
隐患排查治理数据
一般隐患 重大隐患
-
+
diff --git a/SGGL/FineUIPro.Web/common/main_new0.aspx.cs b/SGGL/FineUIPro.Web/common/main_new0.aspx.cs index d05b42a8..3d6027d8 100644 --- a/SGGL/FineUIPro.Web/common/main_new0.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new0.aspx.cs @@ -16,6 +16,10 @@ namespace FineUIPro.Web.common { public static List LargerHazard = new List(); + /// + /// 公司级项目筛选 + /// + public string[] pids { get; set; } //页面加载 protected void Page_Load(object sender, EventArgs e) { @@ -24,24 +28,24 @@ namespace FineUIPro.Web.common //安监人员数据 //企业总部总监人数 Model.SGGLDB db = Funs.DB; + if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId)) + { + pids = CurrUser.CompanyProjectId.Split(','); + } + var unitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; div_qyzbzjrs.InnerHtml = (from x in db.Person_CompanyBranchPerson where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId select x).Count().ToString(); - div_qyzbrs1.InnerHtml = (from x in db.SitePerson_Person - where x.IsUsed == true && x.WorkPostId == Const.WorkPost_HSSEDirector - select x).Count().ToString(); + //企业总部专职人数 div_qyzbzzrs.InnerHtml = (from x in db.Person_CompanyBranchPerson join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId select x).Count().ToString(); - div_qyzbzzrs1.InnerHtml = (from x in db.SitePerson_Person - join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.IsUsed == true && y.IsHsse == true - select x).Count().ToString(); + //分支机构总监人数 div_fzjgzjrs.InnerHtml = (from x in db.Person_CompanyBranchPerson where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId @@ -51,25 +55,29 @@ namespace FineUIPro.Web.common join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId select x).Count().ToString(); - //企业总部参建人数 - div_qyzbcjrs.InnerHtml = (from x in db.SitePerson_Person where x.IsUsed == true select x).Count().ToString(); + + if (pids == null) + { + //项目总监 + div_xmrs.InnerHtml = (from x in db.SitePerson_Person + where x.WorkPostId == Const.WorkPost_HSSEDirector && x.IsUsed == true + select x).Count().ToString(); + div_qyzbrs1.InnerHtml = div_xmrs.InnerHtml; + //项目专职 + div_xmzzrs.InnerHtml = (from x in db.SitePerson_Person + join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where y.IsHsse == true && x.IsUsed == true + select x).Count().ToString(); + div_qyzbzzrs1.InnerHtml = div_xmzzrs.InnerHtml; + //项目参建 + div_xmcjrs.InnerHtml = (from x in db.SitePerson_Person + where x.IsUsed == true + select x).Count().ToString(); - //项目总监 - div_xmrs.InnerHtml = (from x in db.SitePerson_Person - where x.WorkPostId == Const.WorkPost_HSSEDirector && x.IsUsed == true - select x).Count().ToString(); - //项目专职 - div_xmzzrs.InnerHtml = (from x in db.SitePerson_Person - join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where y.IsHsse == true && x.IsUsed == true - select x).Count().ToString(); - //项目参建 - div_xmcjrs.InnerHtml = (from x in db.SitePerson_Person - where x.IsUsed == true - select x).Count().ToString(); - - //注安师 - var ZasSql = @"SELECT Person.ProjectId,Project.ProjectCode,Project.ProjectName,Unit.UnitId,Unit.UnitId,Unit.UnitName, + //企业总部参建人数 + div_qyzbcjrs.InnerHtml = div_xmcjrs.InnerHtml; + //注安师 + var ZasSql = @"SELECT Person.ProjectId,Project.ProjectCode,Project.ProjectName,Unit.UnitId,Unit.UnitId,Unit.UnitName, Person.PersonName,Person.PersonId,Person.IdentityCard,Person.Sex,Person.WorkPostId,WorkPost.WorkPostName,Person.Telephone ,(CASE WHEN Sex=2 THEN '女' WHEN Sex=1 THEN '男' ELSE '' END) AS SexStr FROM SitePerson_Person AS Person @@ -79,11 +87,56 @@ namespace FineUIPro.Web.common WHERE IsUsed=1 AND InTime <=GETDATE() AND (OutTime IS NULL OR OutTime > GETDATE()) AND (SELECT COUNT(*) FROM QualityAudit_PersonQuality AS Q LEFT JOIN Base_Certificate AS Cer ON Q.CertificateId =Cer.CertificateId WHERE Q.PersonId = Person.PersonId AND IsRegisterHSSE =1) > 0"; - List listStr = new List(); - SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = SQLHelper.GetDataTableRunText(ZasSql, parameter); + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(ZasSql, parameter); - div_zasrs.InnerHtml = tb.Rows.Count.ToString(); + div_zasrs.InnerHtml = tb.Rows.Count.ToString(); + } + else { + //项目总监 + div_xmrs.InnerHtml = (from x in db.SitePerson_Person + where x.WorkPostId == Const.WorkPost_HSSEDirector && x.IsUsed == true + && pids.Contains(x.ProjectId) + select x).Count().ToString(); + //项目专职 + div_xmzzrs.InnerHtml = (from x in db.SitePerson_Person + join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where y.IsHsse == true && x.IsUsed == true + && pids.Contains(x.ProjectId) + select x).Count().ToString(); + //项目参建 + div_xmcjrs.InnerHtml = (from x in db.SitePerson_Person + where x.IsUsed == true + && pids.Contains(x.ProjectId) + select x).Count().ToString(); + + string s1 = string.Format("'{0}'", String.Join(",", pids).Replace(",", "','")); + + //注安师 + var ZasSql = @"SELECT Person.ProjectId,Project.ProjectCode,Project.ProjectName,Unit.UnitId,Unit.UnitId,Unit.UnitName, + Person.PersonName,Person.PersonId,Person.IdentityCard,Person.Sex,Person.WorkPostId,WorkPost.WorkPostName,Person.Telephone + ,(CASE WHEN Sex=2 THEN '女' WHEN Sex=1 THEN '男' ELSE '' END) AS SexStr + FROM SitePerson_Person AS Person + LEFT JOIN Base_Project AS Project ON Person.ProjectId =Project.ProjectId + LEFT JOIN Base_Unit AS Unit ON Person.UnitId =Unit.UnitId + LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId =WorkPost.WorkPostId + WHERE IsUsed=1 AND InTime <=GETDATE() AND (OutTime IS NULL OR OutTime > GETDATE()) + AND (SELECT COUNT(*) FROM QualityAudit_PersonQuality AS Q LEFT JOIN Base_Certificate AS Cer ON Q.CertificateId + =Cer.CertificateId WHERE Q.PersonId = Person.PersonId AND IsRegisterHSSE =1) > 0 and Person.ProjectId in (" + s1 + ")"; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(ZasSql, parameter); + + div_zasrs.InnerHtml = tb.Rows.Count.ToString(); + + div_qyzbrs1.InnerHtml = div_xmrs.InnerHtml; + div_qyzbzzrs1.InnerHtml = div_xmzzrs.InnerHtml; + div_qyzbcjrs.InnerHtml = div_xmcjrs.InnerHtml; + } + + + //项目信息 getProjectInfo(); @@ -107,16 +160,32 @@ namespace FineUIPro.Web.common protected void getProjectInfo() { Model.SGGLDB db = Funs.DB; - var list = db.Base_Project; - //在建项目 - div_zjxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).Count().ToString(); - //停工项目 - div_tgxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_2 || x.ProjectState == null)).Count().ToString(); - //在施危大工程 - div_wdxm.InnerHtml = db.Solution_LargerHazard.Where(x => x.States == Const.State_2).Count().ToString(); - //安全工时数 - //int wHours = Funs.DB.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0; - this.div_safeworktime.InnerHtml = Count3().ToString().Split('.')[0]; + if (pids == null) + { + var list = db.Base_Project; + //在建项目 + div_zjxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).Count().ToString(); + //停工项目 + div_tgxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_2 || x.ProjectState == null)).Count().ToString(); + //在施危大工程 + div_wdxm.InnerHtml = db.Solution_LargerHazard.Where(x => x.States == Const.State_2).Count().ToString(); + //安全工时数 + //int wHours = Funs.DB.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0; + this.div_safeworktime.InnerHtml = Count3().ToString().Split('.')[0]; + } + else { + var list = db.Base_Project.Where(x=>pids.Contains(x.ProjectId)); + //在建项目 + div_zjxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).Count().ToString(); + //停工项目 + div_tgxm.InnerHtml = list.Where(x => (x.ProjectState == Const.ProjectState_2 || x.ProjectState == null)).Count().ToString(); + //在施危大工程 + div_wdxm.InnerHtml = db.Solution_LargerHazard.Where(x => x.States == Const.State_2 && pids.Contains(x.ProjectId)).Count().ToString(); + //安全工时数 + //int wHours = Funs.DB.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0; + this.div_safeworktime.InnerHtml = Count3().ToString().Split('.')[0]; + } + } #endregion #region 安全人工时穿透数据 @@ -129,36 +198,73 @@ namespace FineUIPro.Web.common { Model.SGGLDB db = Funs.DB; decimal cout1 = 0; - var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber - select x; - if (getAllPersonInOutList.Count() > 0) + if (pids == null) { + var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber + select x; if (getAllPersonInOutList.Count() > 0) { - cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); + if (getAllPersonInOutList.Count() > 0) + { + cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); + } + } + + var getD1 = from x in db.Accident_AccidentHandle + join y in db.Base_Project on x.ProjectId equals y.ProjectId + where y.ProjectState == Const.ProjectState_1 + select x; + var getD2 = from x in db.Accident_AccidentReport + join y in db.Base_Project on x.ProjectId equals y.ProjectId + where y.ProjectState == Const.ProjectState_1 + select x; + + + + + if (getD1.Count() > 0) + { + cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0); + } + if (getD2.Count() > 0) + { + cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0); } } + else { + var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber + where pids.Contains(x.ProjectId) + select x; + if (getAllPersonInOutList.Count() > 0) + { + if (getAllPersonInOutList.Count() > 0) + { + cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); + } + } - var getD1 = from x in db.Accident_AccidentHandle - join y in db.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x; - var getD2 = from x in db.Accident_AccidentReport - join y in db.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x; + var getD1 = from x in db.Accident_AccidentHandle + join y in db.Base_Project on x.ProjectId equals y.ProjectId + where pids.Contains(x.ProjectId) + select x; + var getD2 = from x in db.Accident_AccidentReport + join y in db.Base_Project on x.ProjectId equals y.ProjectId + where pids.Contains(x.ProjectId) + select x; - if (getD1.Count() > 0) - { - cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0); - } - if (getD2.Count() > 0) - { - cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0); + if (getD1.Count() > 0) + { + cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0); + } + if (getD2.Count() > 0) + { + cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0); + } } + return cout1; } @@ -178,14 +284,20 @@ namespace FineUIPro.Web.common protected void getProjectYh() { Model.SGGLDB db = Funs.DB; - var list = db.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); + var list = new List(); + if (pids != null) + { + list = db.Base_Project.Where(x => pids.Contains(x.ProjectId)).ToList(); + } + else { + list = db.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); + } var hazardRegisters = from x in db.HSSE_Hazard_HazardRegister select x; if (list.Count > 0) { foreach (var item in list) { yhXmmc += "'" + item.ShortName + "',"; - //一般 allYhYb += "'" + ((from x in hazardRegisters @@ -234,13 +346,30 @@ namespace FineUIPro.Web.common div_qyawh.InnerHtml = HSSEData_HSSEService.GetSafetyCommitteeMeetingNum().ToString(); //企业专题 div_qyzt.InnerHtml = HSSEData_HSSEService.GetEnterpriseTopicsMeetingNum().ToString(); - //项目安全领导小组 - div_xmaqldxz.InnerHtml = Funs.DB.Meeting_SafetyLeaderGroupMeeting.Where(x => x.CompileDate > Const.DtmarkTime).Count().ToString(); - //项目安全例会 - DateTime date = DateTime.Now; - div_xmalh.InnerHtml = ((from x in Funs.DB.Meeting_WeekMeeting where x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day select x).Count() - + (from x in Funs.DB.Meeting_MonthMeeting where x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day select x).Count()).ToString(); + if (pids == null) + { + //项目安全领导小组 + div_xmaqldxz.InnerHtml = Funs.DB.Meeting_SafetyLeaderGroupMeeting.Where(x => x.CompileDate > Const.DtmarkTime).Count().ToString(); + //项目安全例会 + DateTime date = DateTime.Now; + div_xmalh.InnerHtml = ((from x in Funs.DB.Meeting_WeekMeeting where x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day select x).Count() + + (from x in Funs.DB.Meeting_MonthMeeting where x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day select x).Count()).ToString(); + } + else { + + //项目安全领导小组 + div_xmaqldxz.InnerHtml = Funs.DB.Meeting_SafetyLeaderGroupMeeting.Where(x => x.CompileDate > Const.DtmarkTime + && pids.Contains(x.ProjectId) ).Count().ToString(); + //项目安全例会 + DateTime date = DateTime.Now; + div_xmalh.InnerHtml = ((from x in Funs.DB.Meeting_WeekMeeting where x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day + && pids.Contains(x.ProjectId) + select x).Count() + + (from x in Funs.DB.Meeting_MonthMeeting where x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day + && pids.Contains(x.ProjectId) + select x).Count()).ToString(); + } } #endregion @@ -249,72 +378,135 @@ namespace FineUIPro.Web.common /// 获取费用使用(万元) /// /// - public static int GetCostUse() + public int GetCostUse() { - var result = 0; - var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem - join y in Funs.DB.CostGoods_CostSmallDetail - on x.CostSmallDetailId equals y.CostSmallDetailId - where y.CompileDate > Const.DtmarkTime - select x.CostMoney ?? 0).ToList().Sum(); - result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]); - return result; + if (pids==null) + { + var result = 0; + var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem + join y in Funs.DB.CostGoods_CostSmallDetail + on x.CostSmallDetailId equals y.CostSmallDetailId + where y.CompileDate > Const.DtmarkTime + select x.CostMoney ?? 0).ToList().Sum(); + result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]); + return result; + } + else + { + var result = 0; + var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem + join y in Funs.DB.CostGoods_CostSmallDetail + on x.CostSmallDetailId equals y.CostSmallDetailId + where y.CompileDate > Const.DtmarkTime && pids.Contains(y.ProjectId) + select x.CostMoney ?? 0).ToList().Sum(); + result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]); + return result; + } } /// /// 获取施工机具在用数 /// /// - public static int GetUseEquipmentNum() + public int GetUseEquipmentNum() { - var result = (from x in Funs.DB.InApproveManager_EquipmentInItem - join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId - where x.IsUsed == true - select x).Count() + + if (pids == null) + { + var result = (from x in Funs.DB.InApproveManager_EquipmentInItem + join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId + where x.IsUsed == true + select x).Count() + (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y .GeneralEquipmentInId where x.IsUsed == true select x).Count(); - return result; + return result; + } + else + { + var result = (from x in Funs.DB.InApproveManager_EquipmentInItem + join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId + where x.IsUsed == true && pids.Contains(y.ProjectId) + select x).Count() + + (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem + join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y + .GeneralEquipmentInId + where x.IsUsed == true && pids.Contains(y.ProjectId) + select x).Count(); + return result; + } } /// /// 获取施工机具特种设备数 /// /// - public static int GetSpecialEquipmentNum() + public int GetSpecialEquipmentNum() { - var result = (from x in Funs.DB.InApproveManager_EquipmentInItem - join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId - where x.IsUsed == true - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.InApproveManager_EquipmentInItem + join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId + where x.IsUsed == true + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.InApproveManager_EquipmentInItem + join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId + where x.IsUsed == true && pids.Contains(y.ProjectId) + select x).Count(); + return result; + } } /// /// 获取作业许可项数 /// /// - public static int GetLicensesNum() + public int GetLicensesNum() { - var result = (from x in Funs.DB.License_LicenseManager - where x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.License_LicenseManager + where x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.License_LicenseManager + where x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取作业许可关闭项数 /// /// - public static int GetLicensesCloseNum() + public int GetLicensesCloseNum() { - var result = (from x in Funs.DB.License_LicenseManager - where x.IsHighRisk == true && x.WorkStates == "3" && - x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.License_LicenseManager + where x.IsHighRisk == true && x.WorkStates == "3" && + x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.License_LicenseManager + where x.IsHighRisk == true && x.WorkStates == "3" && + x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -322,33 +514,56 @@ namespace FineUIPro.Web.common /// 获取一般隐患整改闭环项 /// /// - public static int GetGeneralClosedNum() + public int GetGeneralClosedNum() { - var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.Risk_Level == "一般" && x.States == "3" && - x.CheckTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids==null) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "一般" && x.States == "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "一般" && x.States == "3" && + x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取一般隐患未整改完成项 /// /// - public static int GetGeneralNotClosedNum() + public int GetGeneralNotClosedNum() { - var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.Risk_Level == "一般" && x.States != "3" && - x.CheckTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "一般" && x.States != "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "一般" && x.States != "3" && + x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 一般整改率 /// /// - public static string GetGeneralZgl() + public string GetGeneralZgl() { var num1 = Math.Round(100.0 * GetGeneralClosedNum() / (GetGeneralClosedNum() + GetGeneralNotClosedNum()), 0).ToString(); return num1; @@ -358,33 +573,55 @@ namespace FineUIPro.Web.common /// 获取重大隐患整改闭环项 /// /// - public static int GetMajorClosedNum() + public int GetMajorClosedNum() { - var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.Risk_Level == "重大" && x.States == "3" && - x.CheckTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "重大" && x.States == "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "重大" && x.States == "3" && + x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取重大隐患未整改完成项 /// /// - public static int GetMajorNotClosedNum() + public int GetMajorNotClosedNum() { - var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.Risk_Level == "重大" && x.States != "3" && - x.CheckTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "重大" && x.States != "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.Risk_Level == "重大" && x.States != "3" && + x.CheckTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 重大整改率 /// /// - public static string GetMajorZgl() + public string GetMajorZgl() { var num1 = Math.Round(100.0 * GetMajorClosedNum() / (GetMajorClosedNum() + GetMajorNotClosedNum()), 0).ToString(); if (num1 == "NaN") num1 = "0"; @@ -398,9 +635,16 @@ namespace FineUIPro.Web.common /// 获取企业负责人带班检查次数 /// /// - public static int GetCompanyLeadShiftCheckNum() + public int GetCompanyLeadShiftCheckNum() { - return HSSEData_HSSEService.GetCompanyLeadShiftCheckNum(); + if (pids == null) + { + return HSSEData_HSSEService.GetCompanyLeadShiftCheckNum(); + } + else { + return HSSEData_HSSEService.GetCompanyLeadShiftCheckNum(pids); + } + } @@ -409,54 +653,92 @@ namespace FineUIPro.Web.common /// 获取企业综合检查次数 /// /// - public static int GetCompanyComprehensiveCheckNum() + public int GetCompanyComprehensiveCheckNum() { - return HSSEData_HSSEService.GetCompanyComprehensiveCheckNum(); + if (pids == null) + return HSSEData_HSSEService.GetCompanyComprehensiveCheckNum(); + else + return HSSEData_HSSEService.GetCompanyComprehensiveCheckNum(pids); } /// /// 获取企业专项检查次数 /// /// - public static int GetCompanySpecialCheckNum() + public int GetCompanySpecialCheckNum() { - return HSSEData_HSSEService.GetCompanySpecialCheckNum(); + if (pids == null) + return HSSEData_HSSEService.GetCompanySpecialCheckNum(); + else + return HSSEData_HSSEService.GetCompanySpecialCheckNum(pids); } /// /// 获取项目负责人带班检查次数 /// /// - public static int GetProjectLeadShiftCheckNum() + public int GetProjectLeadShiftCheckNum() { - var result = (from x in Funs.DB.Check_ProjectLeaderCheck - where x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Check_ProjectLeaderCheck + where x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.Check_ProjectLeaderCheck + where x.CompileDate > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取项目专项检查次数 /// /// - public static int GetProjectSpecialCheckNum() + public int GetProjectSpecialCheckNum() { - var result = (from x in Funs.DB.Check_CheckSpecial - where x.CheckTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Check_CheckSpecial + where x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.Check_CheckSpecial + where x.CheckTime > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取项目专业检查次数 /// /// - public static int GetProjectMajorCheckNum() + public int GetProjectMajorCheckNum() { - var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.CheckTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.CheckTime > Const.DtmarkTime + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -465,74 +747,135 @@ namespace FineUIPro.Web.common /// 获取未遂事件数 /// /// - public static int GetNearMissNum() + public int GetNearMissNum() { - 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 - select x).Count(); - return result; + if (pids == null) + { + 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 + select x).Count(); + return result; + } + 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 && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取可记录事件数 /// /// - public static int GetRecordableEventNum() + public int GetRecordableEventNum() { - var result = (from x in Funs.DB.Accident_AccidentPersonRecord - join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId - where x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Accident_AccidentPersonRecord + join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId + where x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + 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.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取一般事故数 /// /// - public static int GetGeneralAccidentNum() + public int GetGeneralAccidentNum() { - var result = (from x in Funs.DB.Accident_AccidentReport - where x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取较大事故数 /// /// - public static int GetMajorAccidentNum() + public int GetMajorAccidentNum() { - var result = (from x in Funs.DB.Accident_AccidentReport - where x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取重大事故数 /// /// - public static int GetSeriousAccidentNum() + public int GetSeriousAccidentNum() { - var result = (from x in Funs.DB.Accident_AccidentReport - where x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取特别重大事故数 /// /// - public static int GetSpecialSeriousAccidentNum() + public int GetSpecialSeriousAccidentNum() { - var result = (from x in Funs.DB.Accident_AccidentReport + if (pids == null) { + var result = (from x in Funs.DB.Accident_AccidentReport where x.AccidentDegree == "4" select x).Count(); - return result; + return result; + } + else + { + var result = (from x in Funs.DB.Accident_AccidentReport + where x.AccidentDegree == "4" && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -541,66 +884,125 @@ namespace FineUIPro.Web.common /// 获取企业级综合预案数 /// /// - public static int GetCompanyComprehensivePlanNum() + public int GetCompanyComprehensivePlanNum() { - var result = (from x in Funs.DB.Emergency_EmergencyList_Unit - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime - select x).Count() + + if (pids == null) + { + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime + select x).Count() + (from x in Funs.DB.Emergency_EmergencyList join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime select x).Count(); - return result; + return result; + } + else + { + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count() + + (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + + } } /// /// 获取企业级专项预案数 /// /// - public static int GetCompanySpecialPlanNum() + public int GetCompanySpecialPlanNum() { - var result = (from x in Funs.DB.Emergency_EmergencyList_Unit - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime - select x).Count() + + if (pids == null) + { + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime + select x).Count() + (from x in Funs.DB.Emergency_EmergencyList join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime select x).Count(); - return result; + return result; + } + else + { + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count() + + (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取企业级现场处置预案 /// /// - public static int GetCompanyOnSiteDisposalPlan() + public int GetCompanyOnSiteDisposalPlan() { - var result = (from x in Funs.DB.Emergency_EmergencyList_Unit - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime - select x).Count() + + if (pids == null) + { + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime + select x).Count() + (from x in Funs.DB.Emergency_EmergencyList join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime select x).Count(); - return result; + return result; + } + else + { + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count() + + (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取企业级演练次数 /// /// - public static int GetCompanyDrillNum() + public int GetCompanyDrillNum() { - var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit - where x.CompileDate > Const.DtmarkTime - select x).Count() + + if (pids == null) + { + var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit + where x.CompileDate > Const.DtmarkTime + select x).Count() + (from x in Funs.DB.Emergency_DrillRecordList where x.CompileDate > Const.DtmarkTime select x).Count(); - return result; + return result; + } + else + { + var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit + where x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count() + + (from x in Funs.DB.Emergency_DrillRecordList + where x.CompileDate > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -609,42 +1011,79 @@ namespace FineUIPro.Web.common /// 获取三级安全教育培训数 /// /// - public static int GetSafeTrainNum() + public int GetSafeTrainNum() { - var result = (from x in Funs.DB.EduTrain_TrainRecordDetail - join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId - join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId - where y.TrainType == "1" - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.EduTrain_TrainRecordDetail + join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId + join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId + where y.TrainType == "1" + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.EduTrain_TrainRecordDetail + join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId + join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId + where y.TrainType == "1" && pids.Contains(z.ProjectId) + select x).Count(); + return result; + + } } /// /// 获取专项培训数 /// /// - public static int GetSpecialTrainNum() + public int GetSpecialTrainNum() { - var result = (from x in Funs.DB.EduTrain_TrainRecordDetail - join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId - join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId - where y.TrainType == "2" - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.EduTrain_TrainRecordDetail + join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId + join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId + where y.TrainType == "2" + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.EduTrain_TrainRecordDetail + join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId + join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId + where y.TrainType == "2" && pids.Contains(z.ProjectId) + select x).Count(); + return result; + } } /// /// 获取特种作业培训数 /// /// - public static int GetSpecialOperationTrainNum() + public int GetSpecialOperationTrainNum() { - var result = (from x in Funs.DB.EduTrain_TrainRecordDetail - join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId - join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId - where y.TrainType == "3" - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.EduTrain_TrainRecordDetail + join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId + join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId + where y.TrainType == "3" + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.EduTrain_TrainRecordDetail + join z in Funs.DB.EduTrain_TrainRecord on x.TrainingId equals z.TrainingId + join y in Funs.DB.Base_TrainType on z.TrainTypeId equals y.TrainTypeId + where y.TrainType == "3" && pids.Contains(z.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -653,52 +1092,99 @@ namespace FineUIPro.Web.common /// 获取一般风险数 /// /// - public static int GetGeneralRiskNum() + public int GetGeneralRiskNum() { - var result = (from x in Funs.DB.Hazard_HazardSelectedItem - join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - where y.RiskLevel == 2 && (x.IsStart == true || x.State == "1") - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 2 && (x.IsStart == true || x.State == "1") + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 2 && (x.IsStart == true || x.State == "1") + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取低风险数 /// /// - public static int GetLowRiskNum() + public int GetLowRiskNum() { - var result = (from x in Funs.DB.Hazard_HazardSelectedItem - join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - where y.RiskLevel == 1 && (x.IsStart == true || x.State == "1") - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 1 && (x.IsStart == true || x.State == "1") + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 1 && (x.IsStart == true || x.State == "1") + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取中风险数 /// /// - public static int GetMediumRiskNum() + public int GetMediumRiskNum() { - var result = (from x in Funs.DB.Hazard_HazardSelectedItem - join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - where y.RiskLevel == 3 && (x.IsStart == true || x.State == "1") - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 3 && (x.IsStart == true || x.State == "1") + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 3 && (x.IsStart == true || x.State == "1") + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取高风险数 /// /// - public static int GetHighRiskNum() + public int GetHighRiskNum() { - var result = (from x in Funs.DB.Hazard_HazardSelectedItem - join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - where y.RiskLevel == 4 && (x.IsStart == true || x.State == "1") - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 4 && (x.IsStart == true || x.State == "1") + select x).Count(); + return result; + } + else { + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where y.RiskLevel == 4 && (x.IsStart == true || x.State == "1") + && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -707,103 +1193,190 @@ namespace FineUIPro.Web.common /// 获取危大工程审批完成数 /// /// - public static int GetCompletedNum() + public int GetCompletedNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.States != "0" && x.IsSuperLargerHazard == false && - x.RecordTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States != "0" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States != "0" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取危大工程培训人次数 /// /// - public static int GetTrainPersonNum() + public int GetTrainPersonNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime - select x.TrainPersonNum).ToList().Sum(x => x.Value); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; + } } /// /// 获取危大工程施工个数 /// /// - public static int GetConstructionNum() + public int GetConstructionNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.States == "2" && x.IsSuperLargerHazard == false && - x.RecordTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "2" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "2" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取危大工程完工个数 /// /// - public static int GetFinishedNum() + public int GetFinishedNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.States == "3" && x.IsSuperLargerHazard == false && - x.RecordTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "3" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "3" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取超危大工程审批完成数 /// /// - public static int GetSuperCompletedNum() + public int GetSuperCompletedNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.States != "0" && x.IsSuperLargerHazard == true && - x.RecordTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States != "0" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States != "0" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取超危大工程培训人次数 /// /// - public static int GetSuperTrainPersonNum() + public int GetSuperTrainPersonNum() { - var result = + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard where x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime select x.TrainPersonNum).ToList().Sum(x => x.Value); - return result; + return result; + } + else + { + var result = + (from x in Funs.DB.Solution_LargerHazard + where x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; + } } /// /// 获取超危大工程施工个数 /// /// - public static int GetSuperConstructionNum() + public int GetSuperConstructionNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.States == "2" && x.IsSuperLargerHazard == true && - x.RecordTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "2" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "2" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取超危大工程完工个数 /// /// - public static int GetSuperFinishedNum() + public int GetSuperFinishedNum() { - var result = (from x in Funs.DB.Solution_LargerHazard - where x.States == "3" && x.IsSuperLargerHazard == true && - x.RecordTime > Const.DtmarkTime - select x).Count(); - return result; + if (pids == null) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "3" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + else + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.States == "3" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion } diff --git a/SGGL/FineUIPro.Web/common/main_new1.aspx.cs b/SGGL/FineUIPro.Web/common/main_new1.aspx.cs index 3ffd8ad4..90b9356c 100644 --- a/SGGL/FineUIPro.Web/common/main_new1.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new1.aspx.cs @@ -18,6 +18,12 @@ namespace FineUIPro.Web.common protected string hjallNumber = "0"; protected string hjfinishNumber = "0"; protected string hjzgl = "0"; + + /// + /// 公司级项目筛选 + /// + public string[] pids { get; set; } + /// /// 页面加载 /// @@ -27,6 +33,10 @@ namespace FineUIPro.Web.common { if (!IsPostBack) { + if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId)) + { + pids = CurrUser.CompanyProjectId.Split(','); + } ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_1, false); if (this.drpProject.Items.Count > 0) { @@ -121,78 +131,139 @@ namespace FineUIPro.Web.common /// 获取项目部人数 /// /// - public static int GetProjectPersonNum() + public int GetProjectPersonNum() { - int result = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where y.IsCQMS == true && x.IsUsed == true - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where y.IsCQMS == true && x.IsUsed == true + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where y.IsCQMS == true && x.IsUsed == true && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取在用计量器具数 /// /// - public static int GetUseNum() + public int GetUseNum() { - int result = (from x in Funs.DB.Comprehensive_InspectionMachine - where x.IsOnSite == true && x.InspectionType.Contains("计量") - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.Comprehensive_InspectionMachine + where x.IsOnSite == true && x.InspectionType.Contains("计量") + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.Comprehensive_InspectionMachine + where x.IsOnSite == true && x.InspectionType.Contains("计量") && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } + } /// /// 获取校准合格数 /// /// - public static int GetOKNum() + public int GetOKNum() { - int result = (from x in Funs.DB.Comprehensive_InspectionMachine - where x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.Comprehensive_InspectionMachine + where x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.Comprehensive_InspectionMachine + where x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 机械预警 /// /// - public static int GetJxyjNum() + public int GetJxyjNum() { - int result = 0; - //机具报验的到期提醒和过期提醒记录数加一起 - //机具报验的到期提醒数 - //var num1 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && DateTime.Now < x.NextTestDate - // && ((DateTime)x.NextTestDate).AddDays(-15) < DateTime.Now).Count(); - //过期提醒记录数 - var num2 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && x.NextTestDate < DateTime.Now).Count(); - //result = num1 + num2; - result = num2; - return result; + if (pids == null) + { + int result = 0; + //机具报验的到期提醒和过期提醒记录数加一起 + //机具报验的到期提醒数 + //var num1 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && DateTime.Now < x.NextTestDate + // && ((DateTime)x.NextTestDate).AddDays(-15) < DateTime.Now).Count(); + //过期提醒记录数 + var num2 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && x.NextTestDate < DateTime.Now).Count(); + //result = num1 + num2; + result = num2; + return result; + } + else { + int result = 0; + //过期提醒记录数 + var num2 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && x.NextTestDate < DateTime.Now + && pids.Contains(x.ProjectId)).Count(); + //result = num1 + num2; + result = num2; + return result; + } } /// /// 获取质量培训人次数 /// /// - public static int GetTrainPersonNum() + public int GetTrainPersonNum() { - int result = (from x in Funs.DB.Comprehensive_InspectionPerson - where x.IsTrain == true - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.Comprehensive_InspectionPerson + where x.IsTrain == true + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.Comprehensive_InspectionPerson + where x.IsTrain == true && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取技术交底人次数 /// /// - public static int GetTechnicalDisclosePersonNum() + public int GetTechnicalDisclosePersonNum() { - var result = (from x in Funs.DB.Comprehensive_DesignDetails - select x.JoinPersonNum ?? 0).ToList().Sum(); - var q = Funs.GetNewIntOrZero(result.ToString()); - return q; + if (pids == null) + { + var result = (from x in Funs.DB.Comprehensive_DesignDetails + select x.JoinPersonNum ?? 0).ToList().Sum(); + var q = Funs.GetNewIntOrZero(result.ToString()); + return q; + } + else { + var result = (from x in Funs.DB.Comprehensive_DesignDetails + where pids.Contains(x.ProjectId) + select x.JoinPersonNum ?? 0).ToList().Sum(); + var q = Funs.GetNewIntOrZero(result.ToString()); + return q; + } } /// @@ -200,13 +271,26 @@ namespace FineUIPro.Web.common /// private void getEarlyWarningCounts() { - int allCount = 0; - var getPersonQualitys = from x in Funs.DB.Comprehensive_InspectionPerson - where x.ValidityDate.HasValue && x.ValidityDate < DateTime.Now && x.IsOnSite == true - select x; - //// 预警人数 - allCount = getPersonQualitys.Count(); - this.spanQualityChartAnalysis.InnerHtml = allCount.ToString(); + if (pids == null) + { + int allCount = 0; + var getPersonQualitys = from x in Funs.DB.Comprehensive_InspectionPerson + where x.ValidityDate.HasValue && x.ValidityDate < DateTime.Now && x.IsOnSite == true + select x; + //// 预警人数 + allCount = getPersonQualitys.Count(); + this.spanQualityChartAnalysis.InnerHtml = allCount.ToString(); + + } + else { + int allCount = 0; + var getPersonQualitys = from x in Funs.DB.Comprehensive_InspectionPerson + where x.ValidityDate.HasValue && x.ValidityDate < DateTime.Now && x.IsOnSite == true && pids.Contains(x.ProjectId) + select x; + //// 预警人数 + allCount = getPersonQualitys.Count(); + this.spanQualityChartAnalysis.InnerHtml = allCount.ToString(); + } } #region 质量验收数据 @@ -214,48 +298,73 @@ namespace FineUIPro.Web.common /// 共检总数 /// /// - public static int getAllInspectionManagement() + public int getAllInspectionManagement() { - int result = 0; - ; - //统计所给时间段的全部数量 - //List managementListSunNumber = - // BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate( - // null, null, DateTime.Parse("2001-01-01"), DateTime.Now, false); - var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement - select x).Count(); - result = num1; - //int result = (from x in Funs.DB.Check_CheckControl - // where x.CheckDate <= DateTime.Now && x.State == "7" - // select x).Count(); - return result; + if (pids == null) + { + int result = 0; + //统计所给时间段的全部数量 + //List managementListSunNumber = + // BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate( + // null, null, DateTime.Parse("2001-01-01"), DateTime.Now, false); + var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + select x).Count(); + result = num1; + //int result = (from x in Funs.DB.Check_CheckControl + // where x.CheckDate <= DateTime.Now && x.State == "7" + // select x).Count(); + return result; + } + else { + int result = 0; + var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where pids.Contains(x.ProjectId) + select x).Count(); + result = num1; + + return result; + } } /// /// 次合格数量 /// /// - public static int getIsOnceInspectionManagement() + public int getIsOnceInspectionManagement() { - int result = 0; - //统计所给时间段的合格数量 - //List managementListOneNumber = - // BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate( - // null, null, DateTime.Parse("2001-01-01"), DateTime.Now, true); - var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement - where x.IsOnceQualified == true - select x).Count(); - result = num2; + if (pids == null) + { + int result = 0; + //统计所给时间段的合格数量 + //List managementListOneNumber = + // BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate( + // null, null, DateTime.Parse("2001-01-01"), DateTime.Now, true); + var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.IsOnceQualified == true + select x).Count(); + result = num2; - //int result = (from x in Funs.DB.Check_CheckControl - // where x.CheckDate <= DateTime.Now && x.State != "7" - // select x).Count(); - return result; + //int result = (from x in Funs.DB.Check_CheckControl + // where x.CheckDate <= DateTime.Now && x.State != "7" + // select x).Count(); + return result; + } + else { + int result = 0; + + var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.IsOnceQualified == true && pids.Contains(x.ProjectId) + select x).Count(); + result = num2; + + + return result; + } } /// /// 整改率 /// /// - public static string GetInspectionManagementZgl() + public string GetInspectionManagementZgl() { string zgl = String.Format("{0:N2}", 100.0 * getIsOnceInspectionManagement() / getAllInspectionManagement()); return zgl + "%"; @@ -269,30 +378,48 @@ namespace FineUIPro.Web.common /// 获取整改完成数 /// /// - public static int GetProblemCompletedNum() + public int GetProblemCompletedNum() { - int result = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now && x.State == "7" - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State == "7" + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State == "7" && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取未整改数 /// /// - public static int GetProblemNotCompletedNum() + public int GetProblemNotCompletedNum() { - int result = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now && x.State != "7" - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State != "7" + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && x.State != "7" && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 整改率 /// /// - public static string GetProblemZgl() + public string GetProblemZgl() { string zgl = String.Format("{0:N2}", 100.0 * GetProblemCompletedNum() / (GetProblemCompletedNum() + GetProblemNotCompletedNum())); return zgl + "%"; @@ -316,12 +443,21 @@ namespace FineUIPro.Web.common /// 获取问题个数 /// /// - public static int GetProblemNum() + public int GetProblemNum() { - int result = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now + select x).Count(); + return result; + } + else { + int result = (from x in Funs.DB.Check_CheckControl + where x.CheckDate <= DateTime.Now && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } #endregion @@ -329,114 +465,216 @@ namespace FineUIPro.Web.common /// 获取焊工总数 /// /// - public static int GetWelderNum() + public int GetWelderNum() { - int result = (from x in Funs.DB.BS_Welder - where x.WED_IfOnGuard == true - select x).Count(); - return result; + if (pids == null) + { + int result = (from x in Funs.DB.BS_Welder + where x.WED_IfOnGuard == true + select x).Count(); + return result; + } + else + { + int result = (from x in Funs.DB.BS_Welder + where x.WED_IfOnGuard == true && pids.Contains(x.ProjectId) + select x).Count(); + return result; + } } /// /// 获取总达因数 /// /// - public static int GetTotalDineNum() + public int GetTotalDineNum() { - int result = 0; - var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity - select x; - if (getD1.Count() > 0) + if (pids == null) { - foreach (var item in getD1) + int result = 0; + var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity + select x; + if (getD1.Count() > 0) { - result += Funs.GetNewIntOrZero(item.TotalWeldQuantity.Split('.')[0]); + foreach (var item in getD1) + { + result += Funs.GetNewIntOrZero(item.TotalWeldQuantity.Split('.')[0]); + } } + else + { + var getD2 = (from x in Funs.DB.HJGL_FL_Data + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.TotalWeldQuantity.Split('.')[0]); + } + } + return result; } else { - var getD2 = (from x in Funs.DB.HJGL_FL_Data - orderby x.CompileDate descending - select x).FirstOrDefault(); - if (getD2 != null) + int result = 0; + var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity + where pids.Contains(x.ProjectId) + select x; + if (getD1.Count() > 0) { - result = Funs.GetNewIntOrZero(getD2.TotalWeldQuantity.Split('.')[0]); + foreach (var item in getD1) + { + result += Funs.GetNewIntOrZero(item.TotalWeldQuantity.Split('.')[0]); + } } + else + { + var getD2 = (from x in Funs.DB.HJGL_FL_Data + where pids.Contains(x.ProjectId) + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.TotalWeldQuantity.Split('.')[0]); + } + } + return result; } - return result; } /// /// 获取完成达因数 /// /// - public static int GetCompleteDineNum() + public int GetCompleteDineNum() { - int result = 0; - - var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity - - select x; - if (getD1.Count() > 0) + if (pids == null) { - foreach (var item in getD1) - { - result += Funs.GetNewIntOrZero(item.TotalCompleted.Split('.')[0]); - } - } - else - { - var getD2 = (from x in Funs.DB.HJGL_FL_Data - orderby x.CompileDate descending - select x).FirstOrDefault(); - if (getD2 != null) - { - result = Funs.GetNewIntOrZero(getD2.TotalCompleted.Split('.')[0]); - } + int result = 0; + var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity + + select x; + if (getD1.Count() > 0) + { + foreach (var item in getD1) + { + result += Funs.GetNewIntOrZero(item.TotalCompleted.Split('.')[0]); + } + } + else + { + var getD2 = (from x in Funs.DB.HJGL_FL_Data + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.TotalCompleted.Split('.')[0]); + } + + } + return result; + } + else { + int result = 0; + + var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity + where pids.Contains(x.ProjectId) + select x; + if (getD1.Count() > 0) + { + foreach (var item in getD1) + { + result += Funs.GetNewIntOrZero(item.TotalCompleted.Split('.')[0]); + } + } + else + { + var getD2 = (from x in Funs.DB.HJGL_FL_Data + where pids.Contains(x.ProjectId) + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.TotalCompleted.Split('.')[0]); + } + + } + return result; } - return result; } /// /// 获取总片数 /// /// - public static int GetTotalFilmNum() + public int GetTotalFilmNum() { - //int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem - // join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID - // select x.CHT_TotalFilm).ToList().Sum()); - int result = 0; - - var getD2 = (from x in Funs.DB.HJGL_FL_Data - orderby x.CompileDate descending - select x).FirstOrDefault(); - if (getD2 != null) + if (pids == null) { - result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]); + //int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem + // join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID + // select x.CHT_TotalFilm).ToList().Sum()); + int result = 0; + + var getD2 = (from x in Funs.DB.HJGL_FL_Data + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]); + } + return result; + } + else + { + int result = 0; + + var getD2 = (from x in Funs.DB.HJGL_FL_Data + where pids.Contains(x.ProjectId) + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]); + } + return result; } - return result; } /// /// 获取合格片数 /// /// - public static int GetOKFilmNum() + public int GetOKFilmNum() { - int result = 0; - var getD2 = (from x in Funs.DB.HJGL_FL_Data - orderby x.CompileDate descending - select x).FirstOrDefault(); - if (getD2 != null) + if (pids == null) { - result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]); + int result = 0; + var getD2 = (from x in Funs.DB.HJGL_FL_Data + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]); + } + return result; + } + else + { + int result = 0; + var getD2 = (from x in Funs.DB.HJGL_FL_Data + where pids.Contains(x.ProjectId) + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (getD2 != null) + { + result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]); + } + return result; } - return result; } /// /// 一次拍片合格率 /// /// - public static string GetOKFilmHgl() + public string GetOKFilmHgl() { string zgl = "0"; if (GetOKFilmNum() > 0) @@ -459,7 +697,10 @@ namespace FineUIPro.Web.common private void getInspectionManagementInfo() { - var q = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); + var q=(from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); + + + foreach (var item in q) { //获取专业 @@ -469,9 +710,27 @@ namespace FineUIPro.Web.common // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId // where y.CNProfessionalId == item.CNProfessionalId // select x).ToList().Count; - var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + var num1 = 0; + var num2 = 0; + if (pids == null) + { + num1 = (from x in Funs.DB.ProcessControl_InspectionManagement where x.CNProfessionalId == item.CNProfessionalId select x).Count(); + num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true + select x).Count(); + } + else { + num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId && pids.Contains(x.ProjectId) + select x).Count(); + num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true && pids.Contains(x.ProjectId) + select x).Count(); + } + + InspectionManagementSumCount += "'" + num1 + "',"; //根据专业获取合格数 @@ -479,9 +738,7 @@ namespace FineUIPro.Web.common // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId // where y.CNProfessionalId == item.CNProfessionalId && y.IsOnceQualified==true // select x).ToList().Count; - var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement - where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true - select x).Count(); + InspectionManagementOkCount += "'" + num2 + "',"; //一次验收合格率 @@ -514,29 +771,56 @@ namespace FineUIPro.Web.common protected string ncrCount; private void getNcrInfo() { - //闭环项 有完成日期的 - //var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CompleteDate != null).Count(); - //var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CompleteDate == null).Count(); - var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "已闭合").Count(); - var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "整改中").Count(); - ncrZgbhx = num1.ToString(); - ncrwZgbhx = num2.ToString(); - if ((num1 + num2) > 0) + if (pids==null) { - ncrZgl = String.Format("{0:N2}", 100.0 * num1 / (num1 + num2)) + "%"; - } + //闭环项 有完成日期的 + //var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CompleteDate != null).Count(); + //var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CompleteDate == null).Count(); + var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "已闭合").Count(); + var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "整改中").Count(); + ncrZgbhx = num1.ToString(); + ncrwZgbhx = num2.ToString(); + if ((num1 + num2) > 0) + { + ncrZgl = String.Format("{0:N2}", 100.0 * num1 / (num1 + num2)) + "%"; + } - //加载专业 - var list = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId!=BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); - foreach (var item in list) - { - ncrZy += "'" + item.ProfessionalName + "',"; - //根据专业加载数据量 - var num3 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CNProfessionalId == item.CNProfessionalId).Count(); - ncrCount += "'" + num3 + "',"; + //加载专业 + var list = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); + foreach (var item in list) + { + ncrZy += "'" + item.ProfessionalName + "',"; + //根据专业加载数据量 + var num3 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CNProfessionalId == item.CNProfessionalId).Count(); + ncrCount += "'" + num3 + "',"; + } + ncrZy = ncrZy.TrimEnd(','); + ncrCount = ncrCount.TrimEnd(','); } - ncrZy = ncrZy.TrimEnd(','); - ncrCount = ncrCount.TrimEnd(','); + else + { + var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "已闭合" && pids.Contains(x.ProjectId)).Count(); + var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "整改中" && pids.Contains(x.ProjectId)).Count(); + ncrZgbhx = num1.ToString(); + ncrwZgbhx = num2.ToString(); + if ((num1 + num2) > 0) + { + ncrZgl = String.Format("{0:N2}", 100.0 * num1 / (num1 + num2)) + "%"; + } + + //加载专业 + var list = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); + foreach (var item in list) + { + ncrZy += "'" + item.ProfessionalName + "',"; + //根据专业加载数据量 + var num3 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CNProfessionalId == item.CNProfessionalId && pids.Contains(x.ProjectId)).Count(); + ncrCount += "'" + num3 + "',"; + } + ncrZy = ncrZy.TrimEnd(','); + ncrCount = ncrCount.TrimEnd(','); + } + } #endregion diff --git a/SGGL/FineUIPro.Web/index.aspx b/SGGL/FineUIPro.Web/index.aspx index 508fb88c..55c73ac5 100644 --- a/SGGL/FineUIPro.Web/index.aspx +++ b/SGGL/FineUIPro.Web/index.aspx @@ -43,13 +43,7 @@ background-color: transparent !important; } - .projcet-select { - float: left; - height: 40px; - flex: 1; - display: flex; - justify-content: flex-end; - } + .bgbtn { /*background-image: url(../res/images/login.png) !important;*/ @@ -176,12 +170,122 @@ border: none !important; padding: 0 !important; } - .f-btn .f-btn-text{ - color: #fff; + + .f-btn .f-btn-text { + color: #fff; + } + + .n-btns-r .n-btn-l-act { + background-image: url(./res/images/03.png) !important; + } + + @@ -196,88 +300,151 @@