From eb17a1e45f09858b2d02c210cd0edc50cc65d115 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Wed, 10 Apr 2024 15:43:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/FineUIPro.Web/common/main_new.aspx.cs | 190 +++++++++++---------- 1 file changed, 102 insertions(+), 88 deletions(-) diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs index ab63d555..0f37aaee 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs @@ -44,14 +44,14 @@ namespace FineUIPro.Web.common DateTime d1 = getStartMonth(); DateTime d2 = getEndMonth(); - 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 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(); @@ -68,15 +68,20 @@ namespace FineUIPro.Web.common //质量管理人员 int CqmsManageNum = (from x in Funs.DB.Person_CompanyBranchPerson - where x.IsOnJob == true - select x).Count(); + 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(); //质量培训人员 DateTime date = DateTime.Now.AddDays(-1); int CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson - where x.IsTrain == true - select x).Count(); + where x.IsTrain == true + select x).Count(); divCqmsPxNum.InnerText = CqmsPxNum.ToString(); //质量问题 @@ -97,10 +102,10 @@ namespace FineUIPro.Web.common int pcount1 = 0; int pcount2 = 0; int pcount3 = 0; - if (acount>0) + 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(); + 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(); } div_zjxmCount.InnerText = pcount1.ToString(); @@ -159,57 +164,57 @@ namespace FineUIPro.Web.common protected decimal CountAqrgs(DateTime? d1 = null, DateTime? d2 = null) { decimal cout1 = 0; - - var datetime1 = d1; - var datetime2 = d2; - var getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber - - select x; - if (getAllPersonInOutList.Count() > 0) - { - if (datetime1.HasValue) - { - getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate >= datetime1); - } - if (datetime2.HasValue) - { - getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2); - } - if (getAllPersonInOutList.Count() > 0) - { - cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); - } - } - var getD1 = from x in Funs.DB.Accident_AccidentHandle - join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x; - var getD2 = from x in Funs.DB.Accident_AccidentReport - join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x; + var datetime1 = d1; + var datetime2 = d2; + var getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber + select x; + if (getAllPersonInOutList.Count() > 0) + { if (datetime1.HasValue) { - getD1 = getD1.Where(x => x.AccidentDate >= datetime1); - getD2 = getD2.Where(x => x.CompileDate >= datetime1); + getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate >= datetime1); } if (datetime2.HasValue) { - getD1 = getD1.Where(x => x.AccidentDate <= datetime2); - getD2 = getD2.Where(x => x.CompileDate <= datetime2); + getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2); } + if (getAllPersonInOutList.Count() > 0) + { + cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours); + } + } + + var getD1 = from x in Funs.DB.Accident_AccidentHandle + join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId + where y.ProjectState == Const.ProjectState_1 + select x; + var getD2 = from x in Funs.DB.Accident_AccidentReport + join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId + where y.ProjectState == Const.ProjectState_1 + select x; + + if (datetime1.HasValue) + { + getD1 = getD1.Where(x => x.AccidentDate >= datetime1); + getD2 = getD2.Where(x => x.CompileDate >= datetime1); + } + if (datetime2.HasValue) + { + getD1 = getD1.Where(x => x.AccidentDate <= datetime2); + getD2 = getD2.Where(x => x.CompileDate <= datetime2); + } - 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; } @@ -222,7 +227,7 @@ namespace FineUIPro.Web.common Model.SGGLDB db = Funs.DB; List reports = new List(); var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber - + select x; if (getAllPersonInOutList.Count() > 0) { @@ -240,7 +245,7 @@ namespace FineUIPro.Web.common Model.SitePerson_MonthReport reportItem = new Model.SitePerson_MonthReport { MonthReportId = SQLHelper.GetNewID(), - + CompileDate = Funs.GetNewDateTime(item.Year.ToString() + "-" + item.Month.ToString()), TotalPersonWorkTime = getNow, }; @@ -439,19 +444,20 @@ namespace FineUIPro.Web.common //修改日期 2023-10-30 10:43:57 //内容:项目名称、开工日期、完工日期、剩余天数、进度 - mapStr += item.ProjectId+","; + mapStr += item.ProjectId + ","; mapStr += string.Format("{0:yyyy-MM-dd}", item.StartDate) + ","; if (string.IsNullOrEmpty(item.EndDate.ToString())) { mapStr += ","; } - else { + else + { //获取剩余天数 var residueDay = DateDiff(DateTime.Now, Convert.ToDateTime(item.EndDate)).ToString(); - mapStr += string.Format("{0:yyyy-MM-dd}", item.EndDate) + ","+residueDay; + mapStr += string.Format("{0:yyyy-MM-dd}", item.EndDate) + "," + residueDay; } - + @@ -508,7 +514,8 @@ namespace FineUIPro.Web.common protected string zlzgl; protected string zgzglDataValue; - protected void getZlwt() { + protected void getZlwt() + { zlallNumber = (from x in Funs.DB.Check_CheckControl where x.CheckDate <= DateTime.Now select x).Count().ToString(); @@ -517,8 +524,8 @@ namespace FineUIPro.Web.common 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(); + 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(); @@ -532,11 +539,12 @@ namespace FineUIPro.Web.common protected string zlgjzgl; protected string zggjzglDataValue; - protected void getZlgj() { + protected void getZlgj() + { //Check_JointCheck zlgjallNumber = (from x in Funs.DB.Check_JointCheck - where x.CheckDate <= DateTime.Now - select x).Count().ToString(); + where x.CheckDate <= DateTime.Now + select x).Count().ToString(); var num2 = (from x in Funs.DB.Check_JointCheck where x.CheckDate <= DateTime.Now && x.State == BLL.Const.JointCheck_Complete @@ -555,11 +563,11 @@ namespace FineUIPro.Web.common #endregion #region 焊接 - protected string hjallNumber="0"; - protected string hjfinishNumber="0"; - protected string hjzgl="0"; + protected string hjallNumber = "0"; + protected string hjfinishNumber = "0"; + protected string hjzgl = "0"; - protected string hjDataValue="0"; + protected string hjDataValue = "0"; protected void getHj() { Model.SingleSerie series = new Model.SingleSerie(); @@ -601,7 +609,7 @@ namespace FineUIPro.Web.common } } - + } #endregion @@ -613,27 +621,28 @@ namespace FineUIPro.Web.common { //Check_JointCheck var znum = (from x in Funs.DB.GJSX - select x).Count(); + select x).Count(); divGjsxzj.InnerHtml = znum.ToString(); //到期应完成 - var dqnum = (from x in Funs.DB.GJSX where x.CompleteDate<=DateTime.Now + 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(); + && 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(); + 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(); } #endregion @@ -671,7 +680,7 @@ namespace FineUIPro.Web.common foreach (var item in list) { ProjectPersonMc += "'" + item.ShortName + "',"; - ProjectPersonCount += "'" + APIPageDataService.getPersonNum(item.ProjectId,DateTime.Now).Count() + "',"; + ProjectPersonCount += "'" + APIPageDataService.getPersonNum(item.ProjectId, DateTime.Now).Count() + "',"; } ProjectPersonMc = ProjectPersonMc.TrimEnd(','); ProjectPersonCount = ProjectPersonCount.TrimEnd(','); @@ -681,7 +690,8 @@ namespace FineUIPro.Web.common #region 进度情况 protected string ProjectJd; protected string ProjectMc; - protected void getJd() { + 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) { @@ -694,11 +704,12 @@ namespace FineUIPro.Web.common #endregion #region 整改数据 - protected void getZgsj() { + protected void getZgsj() + { div_zgsj.InnerHtml = (GetGeneralClosedNum() + GetGeneralNotClosedNum()).ToString(); div_zgywc.InnerHtml = GetGeneralClosedNum().ToString(); div_zgwwc.InnerHtml = GetGeneralNotClosedNum().ToString(); - div_zgwcl.InnerHtml= String.Format("{0:N2}", 100.0 * GetGeneralClosedNum() / (GetGeneralNotClosedNum() + GetGeneralClosedNum()))+"%"; + div_zgwcl.InnerHtml = String.Format("{0:N2}", 100.0 * GetGeneralClosedNum() / (GetGeneralNotClosedNum() + GetGeneralClosedNum())) + "%"; } /// @@ -731,8 +742,9 @@ namespace FineUIPro.Web.common protected string gdclHead = "项目管子管件阀门垫片紧固件"; protected string sbclHead = "项目采购量到货量已到货百分比"; - private void getCldh() { - + private void getCldh() + { + //项目 var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList(); var PipelinList = Funs.DB.CLGL_PipelineMaterialSumList.Where(x => x.Type == "M"); @@ -801,7 +813,7 @@ namespace FineUIPro.Web.common #region 设备材料 sbclHtml += "
"; - pname=item.ShortName; + pname = item.ShortName; if (item.ShortName.Length > 5) { pname = item.ShortName.Substring(0, 5) + "..."; @@ -818,8 +830,9 @@ namespace FineUIPro.Web.common SbcllCgl += 0; Sbdhs += 0; } - else { - SbcllCgl +=Convert.ToDouble(itemCgl.C7); + else + { + SbcllCgl += Convert.ToDouble(itemCgl.C7); Sbdhs += Convert.ToDouble(itemCgl.C9); } } @@ -832,12 +845,13 @@ namespace FineUIPro.Web.common var dhbfb = String.Format("{0:N2}", 100.0 * Sbdhs / (Sbdhs + SbcllCgl), 2) + "%"; sbclHtml += "" + dhbfb + ""; } - else { + else + { sbclHtml += "0%"; } - - + + sbclHtml += "
"; #endregion