diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.sln b/SGGL/FineUIPro.Web/FineUIPro.Web.sln new file mode 100644 index 00000000..61644947 --- /dev/null +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FineUIPro.Web", "FineUIPro.Web.csproj", "{5BFDC841-2DBC-F866-44C3-59D17FD957BC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5BFDC841-2DBC-F866-44C3-59D17FD957BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BFDC841-2DBC-F866-44C3-59D17FD957BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BFDC841-2DBC-F866-44C3-59D17FD957BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BFDC841-2DBC-F866-44C3-59D17FD957BC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A9E8FD10-65F9-4E22-92C9-035EDA2902F7} + EndGlobalSection +EndGlobal diff --git a/SGGL/FineUIPro.Web/common/Menu_JDGL.xml b/SGGL/FineUIPro.Web/common/Menu_JDGL.xml index 101ae28b..88a255c8 100644 --- a/SGGL/FineUIPro.Web/common/Menu_JDGL.xml +++ b/SGGL/FineUIPro.Web/common/Menu_JDGL.xml @@ -22,6 +22,4 @@ - - \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/common/Menu_PGJSX.xml b/SGGL/FineUIPro.Web/common/Menu_PGJSX.xml index 2b9b3fb8..d3beefd2 100644 --- a/SGGL/FineUIPro.Web/common/Menu_PGJSX.xml +++ b/SGGL/FineUIPro.Web/common/Menu_PGJSX.xml @@ -1,9 +1,8 @@  - + - diff --git a/SGGL/FineUIPro.Web/common/Menu_SysSet.xml b/SGGL/FineUIPro.Web/common/Menu_SysSet.xml index f0871715..51a57bc0 100644 --- a/SGGL/FineUIPro.Web/common/Menu_SysSet.xml +++ b/SGGL/FineUIPro.Web/common/Menu_SysSet.xml @@ -22,8 +22,7 @@ - - + @@ -65,8 +64,6 @@ - - diff --git a/SGGL/FineUIPro.Web/common/Menu_TestRun.xml b/SGGL/FineUIPro.Web/common/Menu_TestRun.xml index 4056ca52..a02a6f60 100644 --- a/SGGL/FineUIPro.Web/common/Menu_TestRun.xml +++ b/SGGL/FineUIPro.Web/common/Menu_TestRun.xml @@ -49,9 +49,9 @@ - + @@ -69,11 +69,9 @@ - - diff --git a/SGGL/FineUIPro.Web/common/Menu_Transfer.xml b/SGGL/FineUIPro.Web/common/Menu_Transfer.xml index 283e3429..3abd6e40 100644 --- a/SGGL/FineUIPro.Web/common/Menu_Transfer.xml +++ b/SGGL/FineUIPro.Web/common/Menu_Transfer.xml @@ -3,17 +3,4 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/common/Menu_ZHGL.xml b/SGGL/FineUIPro.Web/common/Menu_ZHGL.xml index e3c0f11a..4536b2ad 100644 --- a/SGGL/FineUIPro.Web/common/Menu_ZHGL.xml +++ b/SGGL/FineUIPro.Web/common/Menu_ZHGL.xml @@ -27,8 +27,8 @@ - - + + @@ -88,6 +88,4 @@ - - \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx b/SGGL/FineUIPro.Web/common/main_new.aspx index f178c5cb..d5afd85d 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx +++ b/SGGL/FineUIPro.Web/common/main_new.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main_new.aspx.cs" Inherits="FineUIPro.Web.common.main_new" %> +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main_new.aspx.cs" Inherits="FineUIPro.Web.common.main_new" Async="true"%> diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs index 47b1c2dc..05a40cc9 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs @@ -1,10 +1,12 @@ using BLL; +using FineUIPro.Web.DataShow; using Model; using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; @@ -17,278 +19,38 @@ namespace FineUIPro.Web.common public static List LargerHazard = new List(); public string[] pids { get; set; } - protected void Page_Load(object sender, EventArgs e) + protected async void Page_Load(object sender, EventArgs e) { - /* if (!IsPostBack) - { - Model.SGGLDB db = Funs.DB; - if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId)) - { - pids = CurrUser.CompanyProjectId.Split(','); - } - else - { - //加载所有在建项目的数据 - var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToArray(); - if (pidArray.Length > 0) - { - pids = pidArray; - } - } - - - //未遂事故 - this.divWS.InnerHtml = GetNearMissNum().ToString(); - - //安全人工时 - 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; - //DateTime? sDate = Funs.GetNewDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString()); - //var dayReports = getMonthReportsByCompany(sDate); - //if (dayReports.Count > 0) - //{ - // wHoursMonth = Convert.ToInt32(dayReports[0].DayWorkTime); - //} - 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]; - } - - - - //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 = 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; - - this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString(); - } - - - 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(); - - CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson - where x.IsTrain == true - select x).Count(); - 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 - - //在建项目 - if (pids == null) - { - allProjects = ProjectService.GetAllProjectDropDownList(); - } - else - { - allProjects = ProjectService.GetAllProjectDropDownList(pids); - } - - int acount = allProjects.Count(); - int pcount1 = 0; - int pcount2 = 0; - int pcount3 = 0; - if (acount > 0) - { - pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count(); - var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(','); - if (pids == null) - { - 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() + "
"; - div_wdgcCount.InnerHtml = pcount3.ToString() + "
"; - - //质量问题 - getZlwt(); - - //质量共检 - getZlgj(); - - //焊接 - getHj(); - - //关键事项 - getGjsx(); - - //人员信息 - getSitePerson(); - - //项目人员图表 - getProjectSitePerson(); - - //进度 - getJd(); - - //整改数据 - getZgsj(); - - //材料到货表格 - getCldh(); - } - */ - - if (!IsPostBack) { InitializeProjectIds(); // 项目ID初始化封装 - BindSafetyStatistics(); // 安全统计模块 - BindQualityStatistics(); // 质量统计模块 - BindProjectStatistics(); // 项目统计模块 - getZlwt(); - //质量共检 - getZlgj(); + var projectTask = GetProjectAsync(); + var project2Task = GetProject2Async(); + var otherTasks = new List + { + BindSafetyStatisticsAsync(), // 安全统计模块 + BindQualityStatisticsAsync(), // 质量统计模块 + BindProjectStatisticsAsync(), // 项目统计模块 + GetZlwtAsync(), // 质量问题 + GetZlgjAsync(), // 质量共检 + GetHjAsync(), // 焊接 + GetGjsxAsync(), // 关键事项 + GetSitePersonAsync(), // 人员信息 + GetProjectSitePersonAsync(), // 项目人员图表 + GetJdAsync(), // 进度 + GetZgsjAsync(), // 整改数据 + GetCldhAsync() // 材料到货表格 + }; - //焊接 - getHj(); + await Task.WhenAll(otherTasks.Concat(new[] { projectTask, project2Task })); - //关键事项 - getGjsx(); - - //人员信息 - getSitePerson(); - - //项目人员图表 - getProjectSitePerson(); - - //进度 - getJd(); - - //整改数据 - getZgsj(); - - //材料到货表格 - getCldh(); + // 设置项目信息 + Project = await projectTask; + Project2 = await project2Task; } - - } - - // 初始化项目ID集合 private void InitializeProjectIds() { @@ -299,77 +61,89 @@ namespace FineUIPro.Web.common .Where(x => x.ProjectState == "1") .Select(x => x.ProjectId) .ToArray(); + //在建项目 + if (pids == null) + { + allProjects = ProjectService.GetAllProjectDropDownList(); + } + else + { + allProjects = ProjectService.GetAllProjectDropDownList(pids); + } } // 安全统计模块封装 - private void BindSafetyStatistics() + private async Task BindSafetyStatisticsAsync() { - var db = Funs.DB; - // 未遂事故 - divWS.InnerHtml = GetNearMissNum().ToString(); - // 安全人工时(合并重复逻辑) - var countAqrgsSum = pids?.Any() == true - ? CountAqrgs(d1: null, d2: null, pids) - : CountAqrgs(); - - if (countAqrgsSum > 10000) + await Task.Run(() => { - countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00); + var db = Funs.DB; + // 未遂事故 + divWS.InnerHtml = GetNearMissNum().ToString(); + // 安全人工时(合并重复逻辑) + var countAqrgsSum = pids?.Any() == true + ? CountAqrgs(d1: null, d2: null, pids) + : CountAqrgs(); - this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万"; - } - else - { - this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0]; - } + if (countAqrgsSum > 10000) + { + countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00); - // 当月安全人工时 - var countMonthAqrgs = pids?.Any() == true - ? CountAqrgs(getStartMonth(), getEndMonth(), pids) - : CountAqrgs(getStartMonth(), getEndMonth()); + this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万"; + } + else + { + this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0]; + } + + // 当月安全人工时 + var countMonthAqrgs = pids?.Any() == true + ? CountAqrgs(getStartMonth(), getEndMonth(), pids) + : CountAqrgs(getStartMonth(), getEndMonth()); - if (countMonthAqrgs > 10000) - { - countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00); + if (countMonthAqrgs > 10000) + { + countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00); - this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万"; - } - else - { - this.divSafeWorkTimeMonth.InnerHtml = countMonthAqrgs.ToString().Split('.')[0]; - } - // 安全培训人员(合并数据库查询) - var trainingQuery = db.EduTrain_TrainRecord - .Where(x => pids.Contains(x.ProjectId)) - .GroupBy(x => 1) - .Select(g => new { - TrainCount = g.Sum(x => x.TrainPersonNum) ?? 0, - BoShengCount = db.Bo_Sheng_TrainPerson - .Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)) - .Where(x => pids.Contains(x.ProjectId)) - .Count() - }).FirstOrDefault(); + this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万"; + } + else + { + this.divSafeWorkTimeMonth.InnerHtml = countMonthAqrgs.ToString().Split('.')[0]; + } + // 安全培训人员(合并数据库查询) + var trainingQuery = db.EduTrain_TrainRecord + .Where(x => pids.Contains(x.ProjectId)) + .GroupBy(x => 1) + .Select(g => new { + TrainCount = g.Sum(x => x.TrainPersonNum) ?? 0, + BoShengCount = db.Bo_Sheng_TrainPerson + .Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)) + .Where(x => pids.Contains(x.ProjectId)) + .Count() + }).FirstOrDefault(); - divSafePersonNum.InnerHtml = trainingQuery != null - ? (trainingQuery.TrainCount + trainingQuery.BoShengCount).ToString() - : "0"; + divSafePersonNum.InnerHtml = trainingQuery != null + ? (trainingQuery.TrainCount + trainingQuery.BoShengCount).ToString() + : "0"; - // 安全管理人员(优化关联查询) - var safetyStaffCount = db.SitePerson_Person - .Where(x=> x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)) - .Where(x => pids.Contains(x.ProjectId)) - .Join(db.Base_WorkPost.Where(x => x.IsHsse==true), - person => person.WorkPostId, - post => post.WorkPostId, - (person, post) => person) - .Count(); - divSafeManagePersonNum.InnerText = safetyStaffCount.ToString(); + // 安全管理人员(优化关联查询) + var safetyStaffCount = db.SitePerson_Person + .Where(x=> x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)) + .Where(x => pids.Contains(x.ProjectId)) + .Join(db.Base_WorkPost.Where(x => x.IsHsse==true), + person => person.WorkPostId, + post => post.WorkPostId, + (person, post) => person) + .Count(); + divSafeManagePersonNum.InnerText = safetyStaffCount.ToString(); + }); } // 质量统计模块封装 - private void BindQualityStatistics() + private async Task BindQualityStatisticsAsync() { var db = Funs.DB; // 质量管理人员(合并公司+项目级查询) @@ -389,18 +163,10 @@ namespace FineUIPro.Web.common .Count(x => x.IsTrain == true).ToString(); } // 项目统计优化 - private void BindProjectStatistics() + private async Task BindProjectStatisticsAsync() { var db = Funs.DB; - //在建项目 - if (pids == null) - { - allProjects = ProjectService.GetAllProjectDropDownList(); - } - else - { - allProjects = ProjectService.GetAllProjectDropDownList(pids); - } + int acount = allProjects.Count(); int pcount1 = 0; @@ -573,7 +339,13 @@ namespace FineUIPro.Web.common #region 项目信息 protected string Project { - get + get; + set; + } + + protected async Task GetProjectAsync() + { + return await Task.Run(() => { Model.SingleSerie series = new Model.SingleSerie(); var project1s = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null); @@ -782,14 +554,20 @@ namespace FineUIPro.Web.common series.convert = convert; series.loc = loc; return JsonConvert.SerializeObject(series); - } + }); } #endregion #region 项目信息 protected string Project2 { - get + get; + set; + } + + protected async Task GetProject2Async() + { + return await Task.Run(() => { Model.SingleSerie series = new Model.SingleSerie(); var project1s = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null); @@ -809,7 +587,6 @@ namespace FineUIPro.Web.common if (item.EndDate != null) { endDate = string.Format("{0:yyyy-MM-dd}", item.EndDate); - //获取剩余天数 residueDay = DateDiff(DateTime.Now, Convert.ToDateTime(item.EndDate)).ToString(); } decimal jdNum = 0; @@ -826,7 +603,7 @@ namespace FineUIPro.Web.common str = str.Substring(0, str.Length - 1); } return str; - } + }); } /// @@ -867,51 +644,53 @@ namespace FineUIPro.Web.common protected string zlzgl; protected string zgzglDataValue; - protected void getZlwt() + private async Task GetZlwtAsync() { - if (pids == null) + await Task.Run(() => { - zlallNumber = (from x in Funs.DB.Check_CheckControl - where x.CheckDate <= DateTime.Now - select x).Count().ToString(); + if (pids == null) + { + 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(); + 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(); + 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)); + var zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); - zlzgl = zgl.ToString(); + 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(); + 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(); + 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(); + 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)); + var zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); - zlzgl = zgl.ToString(); - - zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); - } + zlzgl = zgl.ToString(); + zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); + } + }); } #endregion @@ -921,42 +700,42 @@ namespace FineUIPro.Web.common protected string zlgjzgl; protected string zggjzglDataValue; - protected void getZlgj() + private async Task GetZlgjAsync() { - if (pids == null) + await Task.Run(() => { - 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(); + 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(); - } - else - { - var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement - where pids.Contains(x.ProjectId) - select x).Count(); - //Check_JointCheck - zlgjallNumber = 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(); + 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(); - } + 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 @@ -967,84 +746,50 @@ namespace FineUIPro.Web.common protected string hjzgl = "0"; protected string hjDataValue = "0"; - protected void getHj() + private async Task GetHjAsync() { - Model.SingleSerie series = new Model.SingleSerie(); - Model.BusinessColumn businessColumn = new Model.BusinessColumn(); - List listdata = new List(); - 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) + await Task.Run(() => { - ndtLists = ndtLists.Where(x=>pids.Contains(x.ProjectId)); - } - decimal a = 0, b = 0; + Model.SingleSerie series = new Model.SingleSerie(); + Model.BusinessColumn businessColumn = new Model.BusinessColumn(); + List listdata = new List(); + 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 = ndtLists.Where(x=>pids.Contains(x.ProjectId)); + } + decimal a = 0, b = 0; - - var sumResult = ndtLists - .GroupBy(x => x.ProjectId) - .Select(g => new { - TotalQ = g.OrderByDescending(x => x.CreateDate) - .Select(x => x.TotalQuantity) - .FirstOrDefault(), - Rate = g.OrderByDescending(x => x.CreateDate) - .Select(x => x.TotalRate) - .FirstOrDefault() - }) - .Where(x => x.TotalQ.HasValue).ToList() - .Select(x => new { - A = Math.Floor(x.TotalQ.Value * (decimal.Parse(x.Rate)) / 100), - B = x.TotalQ.Value - }); - a = sumResult.Sum(x=>x.A); - b = sumResult.Sum(x => x.B); - /* if (ndtLists.Count() > 0) - { - foreach (var project in allProjects) - { - var ndt = (from x in ndtLists - where x.ProjectId == project.ProjectId - orderby x.CreateDate descending - select x).FirstOrDefault(); - if (ndt != null) - { - if (ndt.TotalQuantity.HasValue) - { - a += Math.Floor(ndt.TotalQuantity.Value * Funs.GetNewDecimalOrZero(ndt.TotalRate) / 100); - b += ndt.TotalQuantity.Value; - } - } - } - }*/ - if (b > 0) - { - result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2)); + var sumResult = ndtLists + .GroupBy(x => x.ProjectId) + .Select(g => new { + TotalQ = g.OrderByDescending(x => x.CreateDate) + .Select(x => x.TotalQuantity) + .FirstOrDefault(), + Rate = g.OrderByDescending(x => x.CreateDate) + .Select(x => x.TotalRate) + .FirstOrDefault() + }) + .Where(x => x.TotalQ.HasValue).ToList() + .Select(x => new { + A = Math.Floor(x.TotalQ.Value * (decimal.Parse(x.Rate)) / 100), + B = x.TotalQ.Value + }); + a = sumResult.Sum(x=>x.A); + b = sumResult.Sum(x => x.B); - hjallNumber = b.ToString(); - hjfinishNumber = a.ToString(); - hjzgl = result.ToString(); - hjDataValue = (100 - result).ToString(); - } + if (b > 0) + { + result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2)); - //if (ndtLists.Count() > 0) - //{ - - // foreach (var item in ndtLists) - // { - // //a += Funs.GetNewDecimalOrZero(item.OneTimeFilmQualifiedAmount); - // //b += Funs.GetNewDecimalOrZero(item.OneTimeFilmAmount); - // } - // if (b > 0) - // { - // result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2)); - - // hjallNumber = b.ToString(); - // hjfinishNumber = a.ToString(); - // hjzgl = result.ToString(); - // hjDataValue = (100 - result).ToString(); - // } - //} + hjallNumber = b.ToString(); + hjfinishNumber = a.ToString(); + hjzgl = result.ToString(); + hjDataValue = (100 - result).ToString(); + } + }); } #endregion @@ -1052,127 +797,122 @@ namespace FineUIPro.Web.common #region 关键事项 //准点率 protected string gjsxZdl = "0"; - protected void getGjsx() + private async Task GetGjsxAsync() { - if (pids == null) + await Task.Run(() => { - //Check_JointCheck - var znum = (from x in Funs.DB.GJSX - select x).Count(); - divGjsxzj.InnerHtml = znum.ToString(); + if (pids == null) + { + 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(); - } - else - { - //Check_JointCheck - var znum = (from x in Funs.DB.GJSX - where pids.Contains(x.ProjectId) - select x).Count(); - divGjsxzj.InnerHtml = znum.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(); + } + else + { + 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 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(); - } + 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; + 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 #region 人员信息 - private void getSitePerson() + private async Task GetSitePersonAsync() { - int AllCount = 0; - int MCount = 0; - var getallin = new List(); - if (pids == null) + await Task.Run(() => { - getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now); - } - else - { - getallin = APIPageDataService.getPersonNumByCompany(DateTime.Now, pids); - } - AllCount = getallin.Count(); - if (AllCount > 0) - { - MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count(); - } + int AllCount = 0; + int MCount = 0; + 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) + { + MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count(); + } - ////当前现场总人数 - div_xcrs.InnerHtml = AllCount.ToString(); - //作业人数 - div_zyxcrs.InnerHtml = (AllCount - MCount).ToString(); - //管理人数 - div_glxcrs.InnerHtml = MCount.ToString(); + div_xcrs.InnerHtml = AllCount.ToString(); + div_zyxcrs.InnerHtml = (AllCount - MCount).ToString(); + div_glxcrs.InnerHtml = MCount.ToString(); + }); } #endregion #region 项目人员图表 protected string ProjectPersonCount; protected string ProjectPersonMc; - private void getProjectSitePerson() + private async Task GetProjectSitePersonAsync() { - var list = new List(); - if (pids == null) + await Task.Run(() => { - 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(); - } + 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 + "',"; - ProjectPersonCount += "'" + APIPageDataService.getPersonNum(item.ProjectId, DateTime.Now).Count() + "',"; - } - ProjectPersonMc = ProjectPersonMc.TrimEnd(','); - ProjectPersonCount = ProjectPersonCount.TrimEnd(','); + foreach (var item in list) + { + ProjectPersonMc += "'" + item.ShortName + "',"; + ProjectPersonCount += "'" + APIPageDataService.getPersonNum(item.ProjectId, DateTime.Now).Count() + "',"; + } + ProjectPersonMc = ProjectPersonMc.TrimEnd(','); + ProjectPersonCount = ProjectPersonCount.TrimEnd(','); + }); } #endregion #region 进度情况 protected string ProjectJd; protected string ProjectMc; - protected void getJd() + protected async Task GetJdAsync() { var list = new List(); if (pids == null) @@ -1195,12 +935,11 @@ namespace FineUIPro.Web.common ProjectJd = ProjectJd.TrimEnd(','); ProjectMc = ProjectMc.TrimEnd(','); } - } #endregion #region 整改数据 - protected void getZgsj() + protected async Task GetZgsjAsync() { div_zgsj.InnerHtml = (GetGeneralClosedNum() + GetGeneralNotClosedNum()).ToString(); div_zgywc.InnerHtml = GetGeneralClosedNum().ToString(); @@ -1260,10 +999,8 @@ namespace FineUIPro.Web.common protected string gdclHead = "
项目
管子
管件
阀门
垫片
紧固件
"; protected string sbclHead = "
项目
采购量
到货量
已到货百分比
"; - private void getCldh() + private async Task GetCldhAsync() { - - //项目 var list = new List(); if (pids == null) { @@ -1382,12 +1119,6 @@ namespace FineUIPro.Web.common sbclHtml += " "; #endregion } - - - - - - } #endregion @@ -1414,7 +1145,6 @@ namespace FineUIPro.Web.common select x).Count(); return result; } - } } } \ No newline at end of file