From 3e984020698bcd8b09911307e9cb8930352138f7 Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Sun, 28 Sep 2025 12:59:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=9C=88=E6=8A=A5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CQMS/ManageReportNew/MonthReportEdit.aspx | 2 +- .../ManageReportNew/MonthReportEdit.aspx.cs | 2735 ++++++++++++++++- 2 files changed, 2673 insertions(+), 64 deletions(-) diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx index 106ccefc..2d3ac1e3 100644 --- a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx +++ b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MonthReportEdit.aspx.cs" Inherits="FineUIPro.Web.CQMS.ManageReportNew.MonthReportEdit" %> +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MonthReportEdit.aspx.cs" Inherits="FineUIPro.Web.CQMS.ManageReportNew.MonthReportEdit" Async="true" %> diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx.cs index 9f841835..00a79d68 100644 --- a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReportEdit.aspx.cs @@ -1,13 +1,18 @@ -using System; +using BLL; +using FineUIPro.Web.BaseInfo; +using FineUIPro.Web.DataShow; +using FineUIPro.Web.HJGL.FL; +using ICSharpCode.SharpZipLib.Checksum; +using Model; +using Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; using System.Data; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using System.Web.UI; using System.Web.UI.WebControls; -using BLL; -using Newtonsoft.Json.Linq; -using System.Threading; - namespace FineUIPro.Web.CQMS.ManageReportNew { public partial class MonthReportEdit : PageBase @@ -310,7 +315,9 @@ namespace FineUIPro.Web.CQMS.ManageReportNew #endregion //加载所有grid - lodAllGrid("1"); + // lodAllGrid("1"); + objType = "1"; + RegisterAsyncTask(new PageAsyncTask(lodAllGrid)); } else { @@ -321,7 +328,11 @@ namespace FineUIPro.Web.CQMS.ManageReportNew AddOrUpdate = "add"; //加载所有grid - lodAllGrid("0"); + // lodAllGrid("0"); + objType = "0"; + RegisterAsyncTask(new PageAsyncTask(lodAllGrid)); + + } //Grid10.EmptyText = "
无数据
"; @@ -336,59 +347,2398 @@ namespace FineUIPro.Web.CQMS.ManageReportNew hidReportId.Value = ReportId; } } - + string objType; /// /// 加载grid /// /// - void lodAllGrid(string objType) + async Task lodAllGrid() { + DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); + DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); + var units21 = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList(); + var units2 = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 ).ToList(); + + var remarks = loadRemarksDt(); + var cqmsRemarks = cqmsRemarksDt(); + var generalPlanApproval = loadGeneralPlanApprovalDt(); + var majorPlanApproval = loadMajorPlanApprovalDt(); + var inspectionTestPlan = loadInspectionTestPlanDt(); + var designDetailsApprove = loadDesignDetailsApproveDt(); + var reviewDrawings = loadReviewDrawingsDt(); + var designChangeOrder = loadDesignChangeOrderDt(); + var passWelder = loadPassWelderDt(); + var processControl_NondestructiveTest = loadProcessControl_NondestructiveTest_NewDt(); + var inspectionEquipment = LoadInspectionEquipmentDt(); + var measuringInspection = LoadMeasuringInspectionDt(); + var checkLotBindStatisc = CheckLotBindStatiscDt(); + var pressureInspection = LoadPressureInspectionDt(); + var InspectionDataInspection = loadInspectionDataInspectionDt(); + var pipingInspection = LoadPipingInspectionDt(); + var specialInspection = LoadSpecialInspectionDt(); + var ncrManagementInspection = LoadNcrManagementInspectionDt(); + var qualityInspection = LoadQualityInspectionDt(); + var specialCheck = loadSpecialCheckDt(); + var fileReport = loadFileReportDt(); + await Task.WhenAll(new[] { remarks, cqmsRemarks, generalPlanApproval, majorPlanApproval, inspectionTestPlan, designDetailsApprove, reviewDrawings, designChangeOrder, passWelder, processControl_NondestructiveTest, inspectionEquipment, measuringInspection, checkLotBindStatisc, InspectionDataInspection, pressureInspection, pipingInspection, specialInspection, ncrManagementInspection , qualityInspection, specialCheck, fileReport }); + + var generalPlanApprovalData = await generalPlanApproval; + var remarksData = await remarks; + var cqmsRemarksData = await cqmsRemarks; + var majorPlanApprovalData = await majorPlanApproval; + var inspectionTestPlanData = await inspectionTestPlan; + var designDetailsApproveData = await designDetailsApprove; + var reviewDrawingsData = await reviewDrawings; + var designChangeOrderData = await designChangeOrder; + var passWelderData = await passWelder; + var processControl_NondestructiveTestData = await processControl_NondestructiveTest; + var inspectionEquipmentData = await inspectionEquipment; + var measuringInspectionData = await measuringInspection; + var checkLotBindStatiscData = await checkLotBindStatisc; + var InspectionDataInspectionData = await InspectionDataInspection; + var pressureInspectionData = await pressureInspection; + var pipingInspectionData = await pipingInspection; + var specialInspectionData = await specialInspection; + var ncrManagementInspectionData = await ncrManagementInspection; + var qualityInspectionData = await qualityInspection; + var specialCheckData = await specialCheck; + var fileReportData = await fileReport; + Dictionary remarksDic = new Dictionary(); + Dictionary cqmsremarksDic = new Dictionary(); + if (remarksData != null) + { + foreach (DataRow row in remarksData.Rows) + { + string UnitOrMajor = row["UnitOrMajor"].ToString(); + string Remarks = row["Remarks"].ToString(); + string ReType = row["ReType"].ToString(); + if (!remarksDic.ContainsKey(UnitOrMajor + ReType)) + { + remarksDic.Add(UnitOrMajor + ReType, Remarks); + } + } + + } + if (cqmsRemarksData != null) + { + foreach (DataRow row in cqmsRemarksData.Rows) + { + string ContentName = row["ContentName"].ToString(); + string Remarks = row["Remarks"].ToString(); + string ReType = row["ReType"].ToString(); + if (!cqmsremarksDic.ContainsKey(ContentName + ReType)) + { + cqmsremarksDic.Add(ContentName + ReType, Remarks); + } + } + + } + if (generalPlanApprovalData != null) + { + + var list = new List(); + int Quantity1Sum = 0; + int Quantity2Sum = 0; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + + foreach (DataRow row in generalPlanApprovalData.Rows) + { + string UnitId = row["UnitId"].ToString(); + DateTime? ApprovalDate = Funs.GetNewDateTime(row["ApprovalDate"].ToString()); + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (ApprovalDate.HasValue && ApprovalDate.Value >= startDate && ApprovalDate.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + } + } + + foreach (var item in units21) + { + + Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); + model.Id = Guid.NewGuid().ToString(); + model.UnitOrMajor = item.UnitName; + model.Quantity1 = 0; + model.Quantity2 = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.Quantity1 = Quantity1Dic[item.UnitId]; + } + if (Quantity2Dic.ContainsKey(item.UnitId)) + { + model.Quantity2 = Quantity2Dic[item.UnitId]; + } + if (remarksDic.ContainsKey(item.UnitName + "1")) + { + model.Remarks = remarksDic[item.UnitName + "1"]; + } + model.ReportId = ReportId; + list.Add(model); + Quantity1Sum += model.Quantity1.Value; + Quantity2Sum += model.Quantity2.Value; + + } + Grid2.DataSource = list; + Grid2.DataBind(); + } + + if (majorPlanApprovalData != null) + { + var list = new List(); + int Quantity1Sum = 0; + int Quantity2Sum = 0; + int Quantity3Sum = 0; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in majorPlanApprovalData.Rows) + { + string UnitId = row["UnitId"].ToString(); + string IsReview = row["IsReview"].ToString(); + DateTime? ApprovalDate = Funs.GetNewDateTime(row["ApprovalDate"].ToString()); + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (ApprovalDate.HasValue && ApprovalDate.Value >= startDate && ApprovalDate.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + if (IsReview == "1" || IsReview == "true" || IsReview == "True") + { + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1; + } + } + + + foreach (var item in units21) + { + Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); + model.Id = Guid.NewGuid().ToString(); + model.UnitOrMajor = item.UnitName; + model.Quantity1 = 0; + model.Quantity2 = 0; + model.Quantity3 = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.Quantity1 = Quantity1Dic[item.UnitId]; + } + if (Quantity2Dic.ContainsKey(item.UnitId)) + { + model.Quantity2 = Quantity2Dic[item.UnitId]; + } + if (Quantity3Dic.ContainsKey(item.UnitId)) + { + model.Quantity3 = Quantity3Dic[item.UnitId]; + } + model.ReportId = ReportId; + if (remarksDic.ContainsKey(item.UnitName + "1")) + { + model.Remarks = remarksDic[item.UnitName + "1"]; + } + list.Add(model); + + Quantity1Sum += model.Quantity1.Value; + Quantity2Sum += model.Quantity2.Value; + Quantity3Sum += model.Quantity3.Value; + } + Grid3.DataSource = list; + Grid3.DataBind(); + //合计 + JObject summary = new JObject(); + summary.Add("UnitOrMajor", "合计"); + summary.Add("Quantity1", Quantity1Sum.ToString()); + summary.Add("Quantity2", Quantity2Sum.ToString()); + summary.Add("Quantity3", Quantity3Sum.ToString()); + Grid3.SummaryData = summary; + } + + if (inspectionTestPlanData != null) + { + var list = new List(); + int Quantity1Sum = 0; + int Quantity2Sum = 0; + //加载所有专业 + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + + foreach (DataRow row in inspectionTestPlanData.Rows) + { + string CNProfessionalId = row["CNProfessionalId"].ToString(); + DateTime? ApprovalDate = Funs.GetNewDateTime(row["ApprovalDate"].ToString()); + if (!Quantity2Dic.ContainsKey(CNProfessionalId)) + { + Quantity2Dic.Add(CNProfessionalId, 0); + } + Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1; + + if (!Quantity1Dic.ContainsKey(CNProfessionalId)) + { + Quantity1Dic.Add(CNProfessionalId, 0); + } + if (ApprovalDate.HasValue && ApprovalDate.Value >= startDate && ApprovalDate.Value <= endDate) + { + Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1; + } + } + + foreach (var item in CNProfessionals) + { + + + Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); + + model.Id = Guid.NewGuid().ToString(); + model.UnitOrMajor = item.ProfessionalName; + model.Quantity1 = 0; + model.Quantity2 = 0; + if (Quantity1Dic.ContainsKey(item.CNProfessionalId)) + { + model.Quantity1 = Quantity1Dic[item.CNProfessionalId]; + } + if (Quantity2Dic.ContainsKey(item.CNProfessionalId)) + { + model.Quantity2 = Quantity2Dic[item.CNProfessionalId]; + } + model.ReportId = ReportId; + if (remarksDic.ContainsKey(item.ProfessionalName + "2")) + { + model.Remarks = remarksDic[item.ProfessionalName + "2"]; + + } + list.Add(model); + Quantity1Sum += model.Quantity1.Value; + Quantity2Sum += model.Quantity2.Value; + } + Grid4.DataSource = list; + Grid4.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("UnitOrMajor", "合计"); + summary.Add("Quantity1", Quantity1Sum.ToString()); + summary.Add("Quantity2", Quantity2Sum.ToString()); + Grid4.SummaryData = summary; + } + + if (designDetailsApproveData != null) + { + var list = new List(); + int Quantity1Sum = 0; + int Quantity2Sum = 0; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + + + foreach (DataRow row in designDetailsApproveData.Rows) + { + string CNProfessionalId = row["CNProfessionalId"].ToString(); + DateTime? CompileDate = Funs.GetNewDateTime(row["CompileDate"].ToString()); + if (!Quantity2Dic.ContainsKey(CNProfessionalId)) + { + Quantity2Dic.Add(CNProfessionalId, 0); + } + Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1; + + if (!Quantity1Dic.ContainsKey(CNProfessionalId)) + { + Quantity1Dic.Add(CNProfessionalId, 0); + } + if (CompileDate.HasValue && CompileDate.Value >= startDate && CompileDate.Value <= endDate) + { + Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1; + } + } + foreach (var item in CNProfessionals) + { + + Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); + model.Id = Guid.NewGuid().ToString(); + model.UnitOrMajor = item.ProfessionalName; + model.Quantity1 = 0; + model.Quantity2 = 0; + if (Quantity1Dic.ContainsKey(item.CNProfessionalId)) + { + model.Quantity1 = Quantity1Dic[item.CNProfessionalId]; + } + if (Quantity2Dic.ContainsKey(item.CNProfessionalId)) + { + model.Quantity2 = Quantity2Dic[item.CNProfessionalId]; + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (remarksDic.ContainsKey(item.ProfessionalName + "3")) + { + model.Remarks = remarksDic[item.ProfessionalName + "3"]; + } + list.Add(model); + Quantity1Sum += model.Quantity1.Value; + Quantity2Sum += model.Quantity2.Value; + } + Grid5.DataSource = list; + Grid5.DataBind(); + //合计 + JObject summary = new JObject(); + summary.Add("UnitOrMajor", "合计"); + summary.Add("Quantity1", Quantity1Sum.ToString()); + summary.Add("Quantity2", Quantity2Sum.ToString()); + Grid5.SummaryData = summary; + } + + if (reviewDrawingsData != null) + { + var list = new List(); + int Quantity1Sum = 0; + int Quantity2Sum = 0; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + foreach (DataRow row in reviewDrawingsData.Rows) + { + string CNProfessionalId = row["CNProfessionalId"].ToString(); + DateTime? ReviewDate = Funs.GetNewDateTime(row["ReviewDate"].ToString()); + if (!Quantity2Dic.ContainsKey(CNProfessionalId)) + { + Quantity2Dic.Add(CNProfessionalId, 0); + } + Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1; + + if (!Quantity1Dic.ContainsKey(CNProfessionalId)) + { + Quantity1Dic.Add(CNProfessionalId, 0); + } + if (ReviewDate.HasValue && ReviewDate.Value >= startDate && ReviewDate.Value <= endDate) + { + Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1; + } + } + foreach (var item in CNProfessionals) + { + Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); + model.Id = Guid.NewGuid().ToString(); + model.UnitOrMajor = item.ProfessionalName; + model.Quantity1 = 0; + model.Quantity2 = 0; + if (Quantity1Dic.ContainsKey(item.CNProfessionalId)) + { + model.Quantity1 = Quantity1Dic[item.CNProfessionalId]; + } + if (Quantity2Dic.ContainsKey(item.CNProfessionalId)) + { + model.Quantity2 = Quantity2Dic[item.CNProfessionalId]; + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (remarksDic.ContainsKey(item.ProfessionalName + "4")) + { + model.Remarks = remarksDic[item.ProfessionalName + "4"]; + } + list.Add(model); + Quantity1Sum += model.Quantity1.Value; + Quantity2Sum += model.Quantity2.Value; + } + Grid6.DataSource = list; + Grid6.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("UnitOrMajor", "合计"); + summary.Add("Quantity1", Quantity1Sum.ToString()); + summary.Add("Quantity2", Quantity2Sum.ToString()); + Grid6.SummaryData = summary; + } + + if (designChangeOrderData != null) + { + int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0; + DateTime projectStartDate = Convert.ToDateTime("2015-01-01"); + List StatisticsList = new List(); + Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); + if (project != null) + { + if (project.StartDate != null) + { + projectStartDate = Convert.ToDateTime(project.StartDate); + } + } + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + Dictionary Quantity4Dic = new Dictionary(); + Dictionary Quantity5Dic = new Dictionary(); + Dictionary Quantity6Dic = new Dictionary(); + foreach (DataRow row in designChangeOrderData.Rows) + { + string CNProfessionalId = row["CNProfessionalId"].ToString(); + string ImplementationFrontState = row["ImplementationFrontState"].ToString(); + DateTime? IssuedDate = Funs.GetNewDateTime(row["IssuedDate"].ToString()); + string ApprovalDate = row["ApprovalDate"].ToString() ; + + if (!Quantity1Dic.ContainsKey(CNProfessionalId)) + { + Quantity1Dic.Add(CNProfessionalId, 0); + } + if (!Quantity2Dic.ContainsKey(CNProfessionalId)) + { + Quantity2Dic.Add(CNProfessionalId, 0); + } + if (!Quantity3Dic.ContainsKey(CNProfessionalId)) + { + Quantity3Dic.Add(CNProfessionalId, 0); + } + if (!Quantity4Dic.ContainsKey(CNProfessionalId)) + { + Quantity4Dic.Add(CNProfessionalId, 0); + } + if (!Quantity5Dic.ContainsKey(CNProfessionalId)) + { + Quantity5Dic.Add(CNProfessionalId, 0); + } + if (!Quantity6Dic.ContainsKey(CNProfessionalId)) + { + Quantity6Dic.Add(CNProfessionalId, 0); + } + + if (IssuedDate.HasValue && IssuedDate.Value >= projectStartDate && IssuedDate.Value <= DateTime.Now) + { + Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1; + if (!string.IsNullOrEmpty(ApprovalDate)) + { + Quantity4Dic[CNProfessionalId] = Quantity4Dic[CNProfessionalId] + 1; + + } + if (ImplementationFrontState == "已完成") + { + Quantity6Dic[CNProfessionalId] = Quantity6Dic[CNProfessionalId] + 1; + } + } + if (IssuedDate.HasValue && IssuedDate.Value >= startDate && IssuedDate.Value <= endDate) + { + Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1; + if (!string.IsNullOrEmpty(ApprovalDate)) + { + Quantity3Dic[CNProfessionalId] = Quantity3Dic[CNProfessionalId] + 1; + } + if(ImplementationFrontState== "已完成") + { + Quantity5Dic[CNProfessionalId] = Quantity5Dic[CNProfessionalId] + 1; + } + } + } + int i = 1; + var cNProfessionals = from x in db.Base_CNProfessional + where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId + && x.CNProfessionalId != BLL.Const.ComprehensiveId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId + orderby x.SortIndex + select x; + foreach (var item in cNProfessionals) + { + //专业下所有集合 + List totalManagementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, projectStartDate, DateTime.Now); + //专业下当期集合 + List managementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, startDate, endDate); + Model.CheckStatisc checkStatisc = new Model.CheckStatisc(); + checkStatisc.Num = i; + checkStatisc.WorkName = item.ProfessionalName; + + checkStatisc.OneOKRate = "0"; + checkStatisc.TotalOneOKRate ="0"; + if (Quantity1Dic.ContainsKey(item.CNProfessionalId)) + { + checkStatisc.CheckNum = Quantity1Dic[item.CNProfessionalId]; + checkStatisc.TotalCheckNum = Quantity2Dic[item.CNProfessionalId]; + checkStatisc.OKNum = Quantity3Dic[item.CNProfessionalId]; + checkStatisc.TotalOKNum = Quantity4Dic[item.CNProfessionalId]; + checkStatisc.OneOKRate = Quantity5Dic[item.CNProfessionalId].ToString(); //当期完成数 + checkStatisc.TotalOneOKRate = Quantity6Dic[item.CNProfessionalId].ToString(); //累计完成数 + } + StatisticsList.Add(checkStatisc); + Quantity1Sum += checkStatisc.CheckNum; + Quantity2Sum += checkStatisc.TotalCheckNum; + Quantity3Sum += checkStatisc.OKNum; + Quantity4Sum += checkStatisc.TotalOKNum; + Quantity5Sum += Convert.ToInt32(checkStatisc.OneOKRate); + Quantity6Sum += Convert.ToInt32(checkStatisc.TotalOneOKRate); + + } + + Grid7.DataSource = StatisticsList; + Grid7.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("WorkName", "合计"); + summary.Add("CheckNum", Quantity1Sum.ToString()); + summary.Add("TotalCheckNum", Quantity2Sum.ToString()); + summary.Add("OKNum", Quantity3Sum.ToString()); + summary.Add("TotalOKNum", Quantity4Sum.ToString()); + summary.Add("OneOKRate", Quantity5Sum.ToString()); + summary.Add("TotalOneOKRate", Quantity6Sum.ToString()); + Grid7.SummaryData = summary; + } + + if (passWelderData != null) + { + int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0, Quantity7Sum = 0, Quantity8Sum = 0; + + DateTime projectStartDate = Convert.ToDateTime("2015-01-01"); + List StatisticsList = new List(); + Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); + if (project != null) + { + if (project.StartDate != null) + { + projectStartDate = Convert.ToDateTime(project.StartDate); + } + } + int i = 1; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + Dictionary Quantity4Dic = new Dictionary(); + Dictionary Quantity5Dic = new Dictionary(); + Dictionary Quantity6Dic = new Dictionary(); + Dictionary Quantity7Dic = new Dictionary(); + Dictionary Quantity8Dic = new Dictionary(); + foreach (DataRow row in passWelderData.Rows) + { + string UnitId = row["UnitId"].ToString(); + string ProfessionalName = row["ProfessionalName"].ToString(); + DateTime? ApprovalTime = Funs.GetNewDateTime(row["ApprovalTime"].ToString()); + string PostName = row["PostName"].ToString(); + + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + if (!Quantity4Dic.ContainsKey(UnitId)) + { + Quantity4Dic.Add(UnitId, 0); + } + if (!Quantity5Dic.ContainsKey(UnitId)) + { + Quantity5Dic.Add(UnitId, 0); + } + if (!Quantity6Dic.ContainsKey(UnitId)) + { + Quantity6Dic.Add(UnitId, 0); + } + if (!Quantity7Dic.ContainsKey(UnitId)) + { + Quantity7Dic.Add(UnitId, 0); + } + if (!Quantity8Dic.ContainsKey(UnitId)) + { + Quantity8Dic.Add(UnitId, 0); + } + if (ApprovalTime.HasValue && ApprovalTime.Value >= projectStartDate && ApprovalTime.Value <= DateTime.Now) + { + if (ProfessionalName == "管道" && PostName == "焊工") + { + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + } + if (ProfessionalName == "土建" && PostName == "焊工") + { + Quantity4Dic[UnitId] = Quantity4Dic[UnitId] + 1; + } + if (ProfessionalName == "设备" && PostName == "焊工") + { + Quantity6Dic[UnitId] = Quantity6Dic[UnitId] + 1; + } + if ((ProfessionalName != "管道" && ProfessionalName != "土建" && ProfessionalName != "设备") && PostName == "焊工") + { + Quantity8Dic[UnitId] = Quantity8Dic[UnitId] + 1; + } + } + if (ApprovalTime.HasValue && ApprovalTime.Value >= startDate && ApprovalTime.Value <= endDate) + { + if (ProfessionalName == "管道" && PostName == "焊工") + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + } + if (ProfessionalName == "土建" && PostName == "焊工") + { + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1; + } + if (ProfessionalName == "设备" && PostName == "焊工") + { + Quantity5Dic[UnitId] = Quantity5Dic[UnitId] + 1; + } + if ((ProfessionalName != "管道" && ProfessionalName != "土建" && ProfessionalName != "设备") && PostName == "焊工") + { + Quantity7Dic[UnitId] = Quantity5Dic[UnitId] + 1; + } + } + } + + + foreach (var item in units2) + { + + Model.PassWelderStatisc passWelderStatisc = new Model.PassWelderStatisc(); + passWelderStatisc.Num = i; + passWelderStatisc.UnitName = item.UnitName; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + passWelderStatisc.PipeMountGuard = Quantity1Dic[item.UnitId]; + passWelderStatisc.PipeTotal = Quantity2Dic[item.UnitId]; + passWelderStatisc.SteelStructureMountGuard = Quantity3Dic[item.UnitId]; + passWelderStatisc.SteelStructureTotal = Quantity4Dic[item.UnitId]; + passWelderStatisc.EquipmentMountGuard = Quantity5Dic[item.UnitId]; + passWelderStatisc.EquipmentTotal = Quantity6Dic[item.UnitId]; + passWelderStatisc.OtherMountGuard = Quantity7Dic[item.UnitId]; + passWelderStatisc.OtherTotal = Quantity8Dic[item.UnitId]; + } + StatisticsList.Add(passWelderStatisc); + i++; + Quantity1Sum += passWelderStatisc.PipeMountGuard; + Quantity2Sum += passWelderStatisc.PipeTotal; + Quantity3Sum += passWelderStatisc.SteelStructureMountGuard; + Quantity4Sum += passWelderStatisc.SteelStructureTotal; + Quantity5Sum += passWelderStatisc.EquipmentMountGuard; + Quantity6Sum += passWelderStatisc.EquipmentTotal; + Quantity7Sum += passWelderStatisc.OtherMountGuard; + Quantity8Sum += passWelderStatisc.OtherTotal; + } + + Grid8.DataSource = StatisticsList; + Grid8.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("UnitName", "合计"); + summary.Add("PipeMountGuard", Quantity1Sum.ToString()); + summary.Add("PipeTotal", Quantity2Sum.ToString()); + summary.Add("SteelStructureMountGuard", Quantity3Sum.ToString()); + summary.Add("SteelStructureTotal", Quantity4Sum.ToString()); + summary.Add("EquipmentMountGuard", Quantity5Sum.ToString()); + summary.Add("EquipmentTotal", Quantity6Sum.ToString()); + summary.Add("OtherMountGuard", Quantity7Sum.ToString()); + summary.Add("OtherTotal", Quantity8Sum.ToString()); + Grid8.SummaryData = summary; + } + + if (processControl_NondestructiveTestData != null) + { + + + var list = new List(); + int? totalNum0 = 0, totalNum1 = 0;//拍片数量合计 + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + Dictionary Quantity4Dic = new Dictionary(); + foreach (DataRow row in processControl_NondestructiveTestData.Rows) + { + string UnitId = row["UnitId"].ToString(); + string ProfessionalName = row["ProfessionalName"].ToString(); + int MonthQuantity = Funs.GetNewIntOrZero(row["MonthQuantity"].ToString()); + int TotalQuantity = Funs.GetNewIntOrZero(row["TotalQuantity"].ToString()); + string MonthRate = row["MonthRate"].ToString(); + string TotalRate = row["TotalRate"].ToString(); + + + if (!Quantity1Dic.ContainsKey(UnitId + ProfessionalName)) + { + Quantity1Dic.Add(UnitId + ProfessionalName, MonthQuantity); + } + if (!Quantity2Dic.ContainsKey(UnitId + ProfessionalName)) + { + Quantity2Dic.Add(UnitId + ProfessionalName, TotalQuantity); + } + if (!Quantity3Dic.ContainsKey(UnitId + ProfessionalName)) + { + Quantity3Dic.Add(UnitId + ProfessionalName, MonthRate); + } + if (!Quantity4Dic.ContainsKey(UnitId + ProfessionalName)) + { + Quantity4Dic.Add(UnitId + ProfessionalName, TotalRate); + } + + + } + + + + foreach (var item in units2) + { + int? num0 = 0, num1 = 0;//拍片数量小计 + //加载工艺管道 + if (Quantity1Dic.ContainsKey(item.UnitId + "工艺管道") || Quantity1Dic.ContainsKey(item.UnitId + "地管") || Quantity1Dic.ContainsKey(item.UnitId + "非标")) + { + var model = new Model.ProcessControl_NondestructiveTest_New(); + model.Id = Guid.NewGuid().ToString(); + model.CreateMan = item.UnitName;//用作存储施工单位名称 + model.ProfessionalName = "工艺管道"; + + if (Quantity1Dic.ContainsKey(item.UnitId + "工艺管道")) + { + model.MonthQuantity = Quantity1Dic[item.UnitId + "工艺管道"]; + model.TotalQuantity = Quantity2Dic[item.UnitId + "工艺管道"]; + model.MonthRate = Quantity3Dic[item.UnitId + "工艺管道"] + "%"; + model.TotalRate = Quantity4Dic[item.UnitId + "工艺管道"] + "%"; + #region 小计和合计 + //小计 + num0 += Quantity1Dic[item.UnitId + "工艺管道"]; + num1 += Quantity2Dic[item.UnitId + "工艺管道"]; + + //合计 + totalNum0 += Quantity1Dic[item.UnitId + "工艺管道"]; + totalNum1 += Quantity2Dic[item.UnitId + "工艺管道"]; + + #endregion + list.Add(model); + } + else + { + model.MonthQuantity = 0; + model.TotalQuantity = 0; + model.MonthRate = "0%"; + model.TotalRate = "0%"; + list.Add(model); + } + + //地管 + model = new Model.ProcessControl_NondestructiveTest_New(); + model.Id = Guid.NewGuid().ToString(); + model.CreateMan = item.UnitName;//用作存储施工单位名称 + model.ProfessionalName = "地管"; + if (Quantity1Dic.ContainsKey(item.UnitId + "地管")) + { + model.MonthQuantity = Quantity1Dic[item.UnitId + "地管"]; + model.TotalQuantity = Quantity2Dic[item.UnitId + "地管"]; + model.MonthRate = Quantity3Dic[item.UnitId + "地管"] + "%"; + model.TotalRate = Quantity4Dic[item.UnitId + "地管"] + "%"; + #region 小计和合计 + //小计 + num0 += Quantity1Dic[item.UnitId + "地管"]; + num1 += Quantity2Dic[item.UnitId + "地管"]; + + //合计 + totalNum0 += Quantity1Dic[item.UnitId + "地管"]; + totalNum1 += Quantity2Dic[item.UnitId + "地管"]; + + #endregion + list.Add(model); + } + else + { + model.MonthQuantity = 0; + model.TotalQuantity = 0; + model.MonthRate = "0%"; + model.TotalRate = "0%"; + list.Add(model); + } + + //非标 + model = new Model.ProcessControl_NondestructiveTest_New(); + model.Id = Guid.NewGuid().ToString(); + model.CreateMan = item.UnitName;//用作存储施工单位名称 + model.ProfessionalName = "非标"; + + if (Quantity1Dic.ContainsKey(item.UnitId + "非标")) + { + model.MonthQuantity = Quantity1Dic[item.UnitId + "非标"]; + model.TotalQuantity = Quantity2Dic[item.UnitId + "非标"]; + model.MonthRate = Quantity3Dic[item.UnitId + "非标"] + "%"; + model.TotalRate = Quantity4Dic[item.UnitId + "非标"] + "%"; + #region 小计和合计 + //小计 + num0 += Quantity1Dic[item.UnitId + "非标"]; + num1 += Quantity2Dic[item.UnitId + "非标"]; + //合计 + totalNum0 += Quantity1Dic[item.UnitId + "非标"]; + totalNum1 += Quantity2Dic[item.UnitId + "非标"]; + + #endregion + list.Add(model); + } + else + { + model.MonthQuantity = 0; + model.TotalQuantity = 0; + model.MonthRate = "0%"; + model.TotalRate = "0%"; + list.Add(model); + } + //小计 + model = new Model.ProcessControl_NondestructiveTest_New(); + model.Id = Guid.NewGuid().ToString(); + model.CreateMan = item.UnitName;//用作存储施工单位名称 + model.ProfessionalName = "小计"; + model.MonthQuantity = num0; + model.TotalQuantity = num1; + model.MonthRate = ""; + model.TotalRate = ""; + list.Add(model); + } + + } + if (list.Count == 0) + { + Grid10.Hidden = true; + hidWsjcgl.Hidden = false; + } + else + { + Grid10.Hidden = false; + hidWsjcgl.Hidden = true; + Grid10.DataSource = list; + Grid10.DataBind(); + + //合计 + //合计 + JObject summary = new JObject(); + summary.Add("CreateMan", "合计"); + summary.Add("MonthQuantity", totalNum0.ToString()); + summary.Add("TotalQuantity", totalNum1.ToString()); + + Grid10.SummaryData = summary; + } + } + + if (inspectionEquipmentData != null) + { + var list = new List(); + + + int Quantity1Sum = 0; + int Quantity2Sum = 0; + //加载所有单位 + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in inspectionEquipmentData.Rows) + { + string UnitId = row["UnitId"].ToString(); + string SamplingResult = row["SamplingResult"].ToString(); + DateTime? InspectionDate = Funs.GetNewDateTime(row["InspectionDate"].ToString()); + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + if (SamplingResult == "1") + { + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1; + } + } + foreach (var item in units21) + { + Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); + model.Id = Guid.NewGuid().ToString(); + model.UnitOrMajor = item.UnitName; + model.Quantity1 = 0; + model.Quantity2 = 0; + model.QuaRate = "100%"; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.Quantity1 = Quantity1Dic[item.UnitId]; + model.Quantity2 = Quantity2Dic[item.UnitId]; + //验收合格率 + if (Quantity3Dic[item.UnitId] == Quantity2Dic[item.UnitId] && Quantity2Dic[item.UnitId] != 0) + { + model.QuaRate = "100%"; + } + else if (Quantity3Dic[item.UnitId] == 0 && Quantity2Dic[item.UnitId] == 0) + { + model.QuaRate = "0%"; + } + else + { + var Qualificationrate = (Convert.ToDouble(Quantity3Dic[item.UnitId]) / Convert.ToDouble(Quantity2Dic[item.UnitId])) * 100; + model.QuaRate = Qualificationrate.ToString("0.00") + "%"; + } + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (remarksDic.ContainsKey(item.UnitName + "6")) + { + model.Remarks = remarksDic[item.UnitName + "6"]; + + } + list.Add(model); + Quantity1Sum += model.Quantity1.Value; + Quantity2Sum += model.Quantity2.Value; + } + Grid11.DataSource = list; + Grid11.DataBind(); + //合计 + JObject summary = new JObject(); + summary.Add("UnitOrMajor", "合计"); + summary.Add("Quantity1", Quantity1Sum.ToString()); + summary.Add("Quantity2", Quantity2Sum.ToString()); + Grid11.SummaryData = summary; + } + + if (measuringInspectionData != null) + { + var list = new List(); + int i = 1; + + int Quantity1Sum = 0; + int Quantity2Sum = 0; + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + foreach (DataRow row in measuringInspectionData.Rows) + { + string UnitId = row["UnitId"].ToString(); + DateTime? InspectionDate = Funs.GetNewDateTime(row["InspectionDate"].ToString()); + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + + if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + + } + + foreach (var item in units21) + { + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.UnitName; + model.MonthsCount = 0; + model.ProjectCount = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.MonthsCount = Quantity1Dic[item.UnitId]; + model.ProjectCount = Quantity2Dic[item.UnitId]; + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (cqmsremarksDic.ContainsKey(item.UnitName + "9")) + { + model.Remarks = cqmsremarksDic[item.UnitName + "9"]; + } + + list.Add(model); + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + } + gvMeasuringInspection.DataSource = list; + gvMeasuringInspection.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("MonthsCount", Quantity1Sum.ToString()); + summary.Add("ProjectCount", Quantity2Sum.ToString()); + + gvMeasuringInspection.SummaryData = summary; + } + + if (checkLotBindStatiscData != null) + { + + DateTime projectStartDate = Convert.ToDateTime("2015-01-01"); + List StatisticsListCV = new List(); + List StatisticsListEQ = new List(); + List StatisticsListPP = new List(); + List StatisticsListEL = new List(); + List StatisticsListIN = new List(); + List StatisticsListAC = new List(); + List StatisticsListFF = new List(); + + Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); + if (project != null) + { + if (project.StartDate != null) + { + projectStartDate = Convert.ToDateTime(project.StartDate); + } + } + int CheckNumCV = 0; + int TotalCheckNumCV = 0; + int OKNumCV = 0; + int TotalOKNumCV = 0; + string OneOKRateCV = String.Empty; + string TotalOneOKRateCV = String.Empty; + + int CheckNumEQ = 0; + int TotalCheckNumEQ = 0; + int OKNumEQ = 0; + int TotalOKNumEQ = 0; + string OneOKRateEQ = String.Empty; + string TotalOneOKRateEQ = String.Empty; + + int CheckNumPP = 0; + int TotalCheckNumPP = 0; + int OKNumPP = 0; + int TotalOKNumPP = 0; + string OneOKRatePP = String.Empty; + string TotalOneOKRatePP = String.Empty; + + int CheckNumEL = 0; + int TotalCheckNumEL = 0; + int OKNumEL = 0; + int TotalOKNumEL = 0; + string OneOKRateEL = String.Empty; + string TotalOneOKRateEL = String.Empty; + + int CheckNumIN = 0; + int TotalCheckNumIN = 0; + int OKNumIN = 0; + int TotalOKNumIN = 0; + string OneOKRateIN = String.Empty; + string TotalOneOKRateIN = String.Empty; + + int CheckNumAC = 0; + int TotalCheckNumAC = 0; + int OKNumAC = 0; + int TotalOKNumAC = 0; + string OneOKRateAC = String.Empty; + string TotalOneOKRateAC = String.Empty; + + + int CheckNumFF = 0; + int TotalCheckNumFF = 0; + int OKNumFF = 0; + int TotalOKNumFF = 0; + string OneOKRateFF = String.Empty; + string TotalOneOKRateFF = String.Empty; + + string tempCV = ""; + string tempArea = ""; + Model.CheckStatisc checkStatisc = new Model.CheckStatisc(); + for (int i = 0; i < checkLotBindStatiscData.Rows.Count; i++) + { + string UnitWorkName = checkLotBindStatiscData.Rows[i]["UnitWorkName"].ToString(); + string cNProfessionalCode = checkLotBindStatiscData.Rows[i]["cNProfessionalCode"].ToString(); + string IsOnceQualified = checkLotBindStatiscData.Rows[i]["IsOnceQualified"].ToString(); + DateTime? InspectionDate = Funs.GetNewDateTime(checkLotBindStatiscData.Rows[i]["InspectionDate"].ToString()); + + if (tempCV != cNProfessionalCode || tempArea != UnitWorkName) + { + tempCV = cNProfessionalCode; + tempArea = UnitWorkName; + checkStatisc = new Model.CheckStatisc(); + checkStatisc.Id = Guid.NewGuid().ToString(); + checkStatisc.WorkName = UnitWorkName; + checkStatisc.CheckNum = 0; + checkStatisc.CheckNum = 0; + switch (cNProfessionalCode) + { + case "CV": StatisticsListCV.Add(checkStatisc); break; + case "EQ": StatisticsListEQ.Add(checkStatisc); break; + case "PP": StatisticsListPP.Add(checkStatisc); break; + case "EL": StatisticsListEL.Add(checkStatisc); break; + case "IN": StatisticsListIN.Add(checkStatisc); break; + case "AC": StatisticsListAC.Add(checkStatisc); break; + case "FF": StatisticsListFF.Add(checkStatisc); break; + + } + } + if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate) + { + checkStatisc.CheckNum += 1; + if (IsOnceQualified == "1" || IsOnceQualified == "True" || IsOnceQualified == "true") + { + checkStatisc.OKNum += 1; + } + } + + checkStatisc.TotalCheckNum += 1; + if (IsOnceQualified == "1") + checkStatisc.OKNum += 1; + if (IsOnceQualified == "1" || IsOnceQualified == "True" || IsOnceQualified == "true") + { + checkStatisc.CheckNum += 1; + } + } + + foreach (Model.CheckStatisc cs in StatisticsListCV) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumCV += cs.CheckNum; + TotalCheckNumCV += cs.TotalCheckNum; + OKNumCV += cs.OKNum; + TotalOKNumCV += cs.TotalOKNum; + } + if (CheckNumCV != 0)//被除数不能为零 + { + OneOKRateCV = Math.Round((double)OKNumCV / (double)CheckNumCV * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRateCV = "0"; + } + if (TotalCheckNumCV != 0)//被除数不能为零 + { + TotalOneOKRateCV = Math.Round((double)TotalOKNumCV / (double)TotalCheckNumCV * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRateCV = "0"; + } + //检验批统计:土建 + this.gvTj.DataSource = StatisticsListCV; + this.gvTj.DataBind(); + //合计 + JObject summaryCV = new JObject(); + summaryCV.Add("WorkName", "合计"); + summaryCV.Add("CheckNum", CheckNumCV.ToString()); //当前检查点数 + summaryCV.Add("TotalCheckNum", TotalCheckNumCV.ToString());//累计点数 + summaryCV.Add("OKNum", OKNumCV.ToString());//当前合格点数 + summaryCV.Add("TotalOKNum", TotalOKNumCV.ToString());//累计合格点数 + summaryCV.Add("OneOKRate", OneOKRateCV.ToString());//本月合格点数 + summaryCV.Add("TotalOneOKRate", TotalOneOKRateCV.ToString());//本月累计合格点数 + gvTj.SummaryData = summaryCV; + + + + + foreach (Model.CheckStatisc cs in StatisticsListEQ) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumEQ += cs.CheckNum; + TotalCheckNumEQ += cs.TotalCheckNum; + OKNumEQ += cs.OKNum; + TotalOKNumEQ += cs.TotalOKNum; + } + if (CheckNumEQ != 0)//被除数不能为零 + { + OneOKRateEQ = Math.Round((double)OKNumEQ / (double)CheckNumEQ * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRateEQ = "0"; + } + if (TotalCheckNumEQ != 0)//被除数不能为零 + { + TotalOneOKRateEQ = Math.Round((double)TotalOKNumEQ / (double)TotalCheckNumEQ * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRateEQ = "0"; + } + //检验批统计:设备 + + this.GvSb.DataSource = StatisticsListEQ; + this.GvSb.DataBind(); + + //合计 + JObject summaryEQ = new JObject(); + summaryEQ.Add("WorkName", "合计"); + + summaryEQ.Add("CheckNum", CheckNumEQ.ToString()); //当前检查点数 + summaryEQ.Add("TotalCheckNum", TotalCheckNumEQ.ToString());//累计点数 + + summaryEQ.Add("OKNum", OKNumEQ.ToString());//当前合格点数 + summaryEQ.Add("TotalOKNum", TotalOKNumEQ.ToString());//累计合格点数 + + summaryEQ.Add("OneOKRate", OneOKRateEQ.ToString());//本月合格点数 + summaryEQ.Add("TotalOneOKRate", TotalOneOKRateEQ.ToString());//本月累计合格点数 + GvSb.SummaryData = summaryEQ; + + foreach (Model.CheckStatisc cs in StatisticsListPP) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumPP += cs.CheckNum; + TotalCheckNumPP += cs.TotalCheckNum; + OKNumPP += cs.OKNum; + TotalOKNumPP += cs.TotalOKNum; + } + if (CheckNumPP != 0)//被除数不能为零 + { + OneOKRatePP = Math.Round((double)OKNumPP / (double)CheckNumPP * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRatePP = "0"; + } + if (TotalCheckNumPP != 0)//被除数不能为零 + { + TotalOneOKRatePP = Math.Round((double)TotalOKNumPP / (double)TotalCheckNumPP * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRatePP = "0"; + } + //检验批统计:管道 + + this.GvGD.DataSource = StatisticsListPP; + this.GvGD.DataBind(); + //合计 + JObject summaryPP = new JObject(); + summaryPP.Add("WorkName", "合计"); + + summaryPP.Add("CheckNum", CheckNumPP.ToString()); //当前检查点数 + summaryPP.Add("TotalCheckNum", TotalCheckNumPP.ToString());//累计点数 + + summaryPP.Add("OKNum", OKNumPP.ToString());//当前合格点数 + summaryPP.Add("TotalOKNum", TotalOKNumPP.ToString());//累计合格点数 + + summaryPP.Add("OneOKRate", OneOKRatePP.ToString());//本月合格点数 + summaryPP.Add("TotalOneOKRate", TotalOneOKRatePP.ToString());//本月累计合格点数 + GvGD.SummaryData = summaryPP; + + + foreach (Model.CheckStatisc cs in StatisticsListEL) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumEL += cs.CheckNum; + TotalCheckNumEL += cs.TotalCheckNum; + OKNumEL += cs.OKNum; + TotalOKNumEL += cs.TotalOKNum; + } + if (CheckNumEL != 0)//被除数不能为零 + { + OneOKRateEL = Math.Round((double)OKNumEL / (double)CheckNumEL * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRateEL = "0"; + } + if (TotalCheckNumEL != 0)//被除数不能为零 + { + TotalOneOKRateEL = Math.Round((double)TotalOKNumEL / (double)TotalCheckNumEL * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRateEL = "0"; + } + //检验批统计:电气 + + this.GvDq.DataSource = StatisticsListEL; + this.GvDq.DataBind(); + //合计 + JObject summaryEL = new JObject(); + summaryEL.Add("WorkName", "合计"); + + summaryEL.Add("CheckNum", CheckNumEL.ToString()); //当前检查点数 + summaryEL.Add("TotalCheckNum", TotalCheckNumEL.ToString());//累计点数 + + summaryEL.Add("OKNum", OKNumEL.ToString());//当前合格点数 + summaryEL.Add("TotalOKNum", TotalOKNumEL.ToString());//累计合格点数 + + summaryEL.Add("OneOKRate", OneOKRateEL.ToString());//本月合格点数 + summaryEL.Add("TotalOneOKRate", TotalOneOKRateEL.ToString());//本月累计合格点数 + GvDq.SummaryData = summaryEL; + + + + foreach (Model.CheckStatisc cs in StatisticsListIN) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumIN += cs.CheckNum; + TotalCheckNumIN += cs.TotalCheckNum; + OKNumIN += cs.OKNum; + TotalOKNumIN += cs.TotalOKNum; + } + if (CheckNumIN != 0)//被除数不能为零 + { + OneOKRateIN = Math.Round((double)OKNumIN / (double)CheckNumIN * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRateIN = "0"; + } + if (TotalCheckNumIN != 0)//被除数不能为零 + { + TotalOneOKRateIN = Math.Round((double)TotalOKNumIN / (double)TotalCheckNumIN * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRateIN = "0"; + } + //检验批统计:仪表 + + this.GvYb.DataSource = StatisticsListIN; + this.GvYb.DataBind(); + //合计 + JObject summaryIN = new JObject(); + summaryIN.Add("WorkName", "合计"); + + summaryIN.Add("CheckNum", CheckNumIN.ToString()); //当前检查点数 + summaryIN.Add("TotalCheckNum", TotalCheckNumIN.ToString());//累计点数 + + summaryIN.Add("OKNum", OKNumIN.ToString());//当前合格点数 + summaryIN.Add("TotalOKNum", TotalOKNumIN.ToString());//累计合格点数 + + summaryIN.Add("OneOKRate", OneOKRateIN.ToString());//本月合格点数 + summaryIN.Add("TotalOneOKRate", TotalOneOKRateIN.ToString());//本月累计合格点数 + GvYb.SummaryData = summaryIN; + + + + foreach (Model.CheckStatisc cs in StatisticsListAC) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumAC += cs.CheckNum; + TotalCheckNumAC += cs.TotalCheckNum; + OKNumAC += cs.OKNum; + TotalOKNumAC += cs.TotalOKNum; + } + if (CheckNumAC != 0)//被除数不能为零 + { + OneOKRateAC = Math.Round((double)OKNumAC / (double)CheckNumAC * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRateAC = "0"; + } + if (TotalCheckNumAC != 0)//被除数不能为零 + { + TotalOneOKRateAC = Math.Round((double)TotalOKNumAC / (double)TotalCheckNumAC * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRateAC = "0"; + } + //检验批统计:防腐 + + this.GvFf.DataSource = StatisticsListAC; + this.GvFf.DataBind(); + //合计 + JObject summaryAC = new JObject(); + summaryAC.Add("WorkName", "合计"); + + summaryAC.Add("CheckNum", CheckNumAC.ToString()); //当前检查点数 + summaryAC.Add("TotalCheckNum", TotalCheckNumAC.ToString());//累计点数 + + summaryAC.Add("OKNum", OKNumAC.ToString());//当前合格点数 + summaryAC.Add("TotalOKNum", TotalOKNumAC.ToString());//累计合格点数 + + summaryAC.Add("OneOKRate", OneOKRateAC.ToString());//本月合格点数 + summaryAC.Add("TotalOneOKRate", TotalOneOKRateAC.ToString());//本月累计合格点数 + GvFf.SummaryData = summaryAC; + + + foreach (Model.CheckStatisc cs in StatisticsListFF) + { + if (cs.CheckNum != 0)//被除数不能为零 + { + cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.OneOKRate = "0%"; + } + if (cs.TotalCheckNum != 0)//被除数不能为零 + { + cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + cs.TotalOneOKRate = "0%"; + } + CheckNumFF += cs.CheckNum; + TotalCheckNumFF += cs.TotalCheckNum; + OKNumFF += cs.OKNum; + TotalOKNumFF += cs.TotalOKNum; + } + if (CheckNumFF != 0)//被除数不能为零 + { + OneOKRateFF = Math.Round((double)OKNumFF / (double)CheckNumFF * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OneOKRateFF = "0"; + } + if (TotalCheckNumFF != 0)//被除数不能为零 + { + TotalOneOKRateFF = Math.Round((double)TotalOKNumFF / (double)TotalCheckNumFF * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + TotalOneOKRateFF = "0"; + } + //检验批统计:消防 + + this.GvXf.DataSource = StatisticsListFF; + this.GvXf.DataBind(); + //合计 + JObject summaryFF = new JObject(); + summaryFF.Add("WorkName", "合计"); + + summaryFF.Add("CheckNum", CheckNumFF.ToString()); //当前检查点数 + summaryFF.Add("TotalCheckNum", TotalCheckNumFF.ToString());//累计点数 + + summaryFF.Add("OKNum", OKNumFF.ToString());//当前合格点数 + summaryFF.Add("TotalOKNum", TotalOKNumFF.ToString());//累计合格点数 + + summaryFF.Add("OneOKRate", OneOKRateFF.ToString());//本月合格点数 + summaryFF.Add("TotalOneOKRate", TotalOneOKRateFF.ToString());//本月累计合格点数 + + GvXf.SummaryData = summaryFF; + + } + + if (InspectionDataInspectionData != null) + { + var list = new List(); + + + int CheckNum = 0;//本月检查点数 + int TotalCheckNum = 0;//累计检查点数 + + int OKNum = 0;//本月检查合格点数 + int TotalOKNum = 0;//累计检查合格点数 + + string Quantity1Sum = String.Empty;//本月检查合格点数/本月检查点数 + string Quantity2Sum = String.Empty;//累计检查合格点数/累计检查点数 + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + Dictionary Quantity4Dic = new Dictionary(); + foreach (DataRow row in InspectionDataInspectionData.Rows) + { + string UnitId = row["UnitId"].ToString(); + string IsOnceQualified = row["IsOnceQualified"].ToString(); + DateTime? InspectionDate = Funs.GetNewDateTime(row["InspectionDate"].ToString()); + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + if (!Quantity4Dic.ContainsKey(UnitId)) + { + Quantity4Dic.Add(UnitId, 0); + } + if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + if (IsOnceQualified == "1") + { + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1; + } + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + if (IsOnceQualified == "1") + { + Quantity4Dic[UnitId] = Quantity4Dic[UnitId] + 1; + } + } + + + + foreach (var item in units21) + { + + + Model.CheckStatisc checkStatisc = new Model.CheckStatisc(); + checkStatisc.Id = Guid.NewGuid().ToString(); + checkStatisc.ReportId = ReportId; + checkStatisc.WorkName = item.UnitName; + if (Quantity4Dic.ContainsKey(item.UnitId)) + { + checkStatisc.CheckNum = Quantity1Dic[item.UnitId]; + checkStatisc.TotalCheckNum = Quantity2Dic[item.UnitId]; + checkStatisc.OKNum = Quantity3Dic[item.UnitId]; ; + checkStatisc.TotalOKNum = Quantity4Dic[item.UnitId]; ; + + } + if (checkStatisc.CheckNum != 0)//被除数不能为零 + { + checkStatisc.OneOKRate = Math.Round((double)checkStatisc.OKNum / (double)checkStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + checkStatisc.OneOKRate = "0%"; + } + + if (checkStatisc.TotalCheckNum != 0)//被除数不能为零 + { + checkStatisc.TotalOneOKRate = Math.Round((double)checkStatisc.TotalOKNum / (double)checkStatisc.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + checkStatisc.TotalOneOKRate = "0%"; + } + //如果是修改,查询表中数据 + + if (cqmsremarksDic.ContainsKey(item.UnitName + "10")) + { + checkStatisc.Remarks = cqmsremarksDic[item.UnitName + "10"]; + } + list.Add(checkStatisc); + + CheckNum += checkStatisc.CheckNum; + TotalCheckNum += checkStatisc.TotalCheckNum; + + OKNum += checkStatisc.OKNum; + TotalOKNum += checkStatisc.TotalOKNum; + + + } + + gvInspectionDataInspection.DataSource = list; + gvInspectionDataInspection.DataBind(); + + if (CheckNum != 0)//被除数不能为零 + { + Quantity1Sum = Math.Round((double)OKNum / (double)CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + Quantity1Sum = "0%"; + } + if (TotalCheckNum != 0)//被除数不能为零 + { + Quantity2Sum = Math.Round((double)TotalOKNum / (double)TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + Quantity2Sum = "0%"; + } + + //合计 + JObject summary = new JObject(); + summary.Add("WorkName", "合计"); + summary.Add("CheckNum", CheckNum.ToString()); + summary.Add("OKNum", OKNum.ToString()); + summary.Add("OneOKRate", Quantity1Sum.ToString()); + summary.Add("TotalCheckNum", TotalCheckNum.ToString()); + summary.Add("TotalOKNum", TotalOKNum.ToString()); + summary.Add("TotalOneOKRate", Quantity2Sum.ToString()); + + gvInspectionDataInspection.SummaryData = summary; + } + + if (pressureInspectionData != null) + { + var list = new List(); + + + int Quantity0Sum = 0; + int Quantity1Sum = 0; + int Quantity2Sum = 0; + + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in pressureInspectionData.Rows) + { + string UnitId = row["UnitId"].ToString(); + int ActualNumber = Funs.GetNewIntOrZero(row["ActualNumber"].ToString()); + int PressurePipeNumber = Funs.GetNewIntOrZero( row["PressurePipeNumber"].ToString()); + DateTime? ReportTime = Funs.GetNewDateTime(row["ReportTime"].ToString()); + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + + if (ReportTime.HasValue && ReportTime.Value >= startDate && ReportTime.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + PressurePipeNumber; + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + ActualNumber; + + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + PressurePipeNumber; + + } + foreach (var item in units21) + { + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.UnitName; + model.MonthsCount = 0; + model.ProjectCount = 0; + model.TotalNoBackCount = 0;//总数 + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.MonthsCount = Quantity1Dic[item.UnitId]; + model.ProjectCount = Quantity2Dic[item.UnitId]; + model.TotalNoBackCount = Quantity3Dic[item.UnitId];//总数 + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (cqmsremarksDic.ContainsKey(item.UnitName + "11")) + { + model.Remarks = cqmsremarksDic[item.UnitName + "11"]; + } + list.Add(model); + Quantity0Sum += model.TotalNoBackCount.Value; + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + + } + gvPressureInspection.DataSource = list; + gvPressureInspection.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("TotalNoBackCount", Quantity0Sum.ToString());//总数 + summary.Add("MonthsCount", Quantity1Sum.ToString()); + summary.Add("ProjectCount", Quantity2Sum.ToString()); + + gvPressureInspection.SummaryData = summary; + } + + if (pipingInspectionData != null) + { + var list = new List(); + int Quantity0Sum = 0; + int Quantity1Sum = 0; + int Quantity2Sum = 0; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in pipingInspectionData.Rows) + { + string UnitId = row["UnitId"].ToString(); + int IssuedReportNumber = Funs.GetNewIntOrZero(row["IssuedReportNumber"].ToString()); + int PackageNumber = Funs.GetNewIntOrZero(row["PackageNumber"].ToString()); + DateTime? ReportTime = Funs.GetNewDateTime(row["ReportTime"].ToString()); + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + + if (ReportTime.HasValue && ReportTime.Value >= startDate && ReportTime.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + PackageNumber; + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + IssuedReportNumber; + + } + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + IssuedReportNumber; + + } + foreach (var item in units21) + { + + + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.UnitName; + model.TotalNoBackCount = 0; + model.MonthsCount = 0; + model.ProjectCount = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.TotalNoBackCount = Quantity1Dic[item.UnitId]; + model.MonthsCount = Quantity2Dic[item.UnitId]; + model.ProjectCount = Quantity3Dic[item.UnitId]; + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (cqmsremarksDic.ContainsKey(item.UnitName + "11")) + { + model.Remarks = cqmsremarksDic[item.UnitName + "11"]; + } + list.Add(model); + + Quantity0Sum += model.TotalNoBackCount.Value; + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + + } + gvPipingInspection.DataSource = list; + gvPipingInspection.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("TotalNoBackCount", Quantity0Sum.ToString()); + summary.Add("MonthsCount", Quantity1Sum.ToString()); + summary.Add("ProjectCount", Quantity2Sum.ToString()); + + gvPipingInspection.SummaryData = summary; + + } + + if (specialInspectionData != null) + { + var list = new List(); + int Quantity0Sum = 0; + int Quantity1Sum = 0; + int Quantity2Sum = 0; + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in specialInspectionData.Rows) + { + string UnitId = row["UnitId"].ToString(); + int SunNumber = Funs.GetNewIntOrZero(row["SunNumber"].ToString()); + int MonitoringReportNumber = Funs.GetNewIntOrZero(row["MonitoringReportNumber"].ToString()); + DateTime? ReportTime = Funs.GetNewDateTime(row["ReportTime"].ToString()); + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + + if (ReportTime.HasValue && ReportTime.Value >= startDate && ReportTime.Value <= endDate) + { + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + MonitoringReportNumber; + } + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + SunNumber; + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + MonitoringReportNumber; + + } + foreach (var item in units21) + { + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.UnitName; + model.TotalNoBackCount = 0; + model.MonthsCount = 0; + model.ProjectCount = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.TotalNoBackCount = Quantity1Dic[item.UnitId]; + model.MonthsCount = Quantity2Dic[item.UnitId]; + model.ProjectCount = Quantity3Dic[item.UnitId]; + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (cqmsremarksDic.ContainsKey(item.UnitName + "13")) + { + model.Remarks = cqmsremarksDic[item.UnitName + "13"]; + } + list.Add(model); + Quantity0Sum += model.TotalNoBackCount.Value; + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + + } + gvSpecialInspection.DataSource = list; + gvSpecialInspection.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("TotalNoBackCount", Quantity0Sum.ToString());//总数 + summary.Add("MonthsCount", Quantity1Sum.ToString());//本月完成监检数量 + summary.Add("ProjectCount", Quantity2Sum.ToString());//累计完成监检数量 + + gvSpecialInspection.SummaryData = summary; + } + + if (ncrManagementInspectionData != null) + { + List StatisticsList = new List(); + + + int CurrentPeriodOkNumSum = 0; + int OKNumSum = 0; + int CheckNumSum = 0; + string OKRateSum = string.Empty; + + var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); + DateTime projectStartDate = Convert.ToDateTime("2000-01-01"); + if (project != null && project.StartDate != null) + { + projectStartDate = project.StartDate.Value; + } + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in ncrManagementInspectionData.Rows) + { + string ImplementationFrontState = row["ImplementationFrontState"].ToString(); + DateTime? IssuedDate = Funs.GetNewDateTime(row["IssuedDate"].ToString()); + string ReceiveUnit = row["ReceiveUnit"].ToString(); + string[] unitids = ReceiveUnit.Split(','); + foreach (string UnitId in unitids) + { + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + + if (IssuedDate.HasValue && IssuedDate.Value >= startDate && IssuedDate.Value <= endDate) + { + if (ImplementationFrontState == "已闭合") + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + } + } + if (ImplementationFrontState == "已闭合") + { + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + } + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1; + } + } + foreach (var item in units) + { + Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc(); + NCRStatisc.Id = Guid.NewGuid().ToString(); + NCRStatisc.WorkName = item.UnitName; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + NCRStatisc.CurrentPeriodOkNum = Quantity1Dic[item.UnitId]; + NCRStatisc.OKNum = Quantity2Dic[item.UnitId]; + NCRStatisc.CheckNum = Quantity3Dic[item.UnitId]; + } + if (NCRStatisc.CheckNum != 0)//被除数不能为零 + { + NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + NCRStatisc.OKRate = "0%"; + } + + StatisticsList.Add(NCRStatisc); + + CurrentPeriodOkNumSum += NCRStatisc.CurrentPeriodOkNum; + OKNumSum += NCRStatisc.OKNum; + CheckNumSum += NCRStatisc.CheckNum; + + } + + if (CheckNumSum != 0)//被除数不能为零 + { + OKRateSum = Math.Round((double)OKNumSum / (double)CheckNumSum * 100, 2) + "%";//保留两位小数、后四舍五入 + } + else + { + OKRateSum = "0%"; + } + + this.gvNcrManagementInspection.DataSource = StatisticsList; + this.gvNcrManagementInspection.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("WorkName", "合计"); + summary.Add("CurrentPeriodOkNum", CurrentPeriodOkNumSum.ToString()); + summary.Add("OKNum", OKNumSum.ToString()); + summary.Add("CheckNum", CheckNumSum.ToString()); + summary.Add("OKRate", OKRateSum.ToString()); + + gvNcrManagementInspection.SummaryData = summary; + } + + if (qualityInspectionData != null) + { + var list = new List(); + int i = 1; + + int Quantity1Sum = 0; + int Quantity2Sum = 0; + int ClosedCountSum = 0; + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + foreach (DataRow row in qualityInspectionData.Rows) + { + string UnitId = row["UnitId"].ToString(); + DateTime? CheckDate = Funs.GetNewDateTime(row["CheckDate"].ToString()); + string State = row["State"].ToString(); + + if (!Quantity1Dic.ContainsKey(UnitId)) + { + Quantity1Dic.Add(UnitId, 0); + } + if (!Quantity2Dic.ContainsKey(UnitId)) + { + Quantity2Dic.Add(UnitId, 0); + } + if (!Quantity3Dic.ContainsKey(UnitId)) + { + Quantity3Dic.Add(UnitId, 0); + } + + if (CheckDate.HasValue && CheckDate.Value >= startDate && CheckDate.Value <= endDate) + { + Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1; + + } + Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1; + if (State == "7") + { + Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1; + + } + + } + + foreach (var item in units21) + { + + var ClosedCount = 0; + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.UnitName; + model.MonthsCount = 0; + model.ProjectCount = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + ClosedCount = Quantity3Dic[item.UnitId];//已关闭数量 + model.MonthsCount = Quantity1Dic[item.UnitId]; + model.ProjectCount = Quantity2Dic[item.UnitId]; + if (model.ProjectCount.Value > 0) + { + model.RectificationRate = (100.0 * (ClosedCount/ model.ProjectCount.Value)).ToString("#0.00") + "%"; + } + else + { + model.RectificationRate = "0.00%"; + } + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (objType == "1") + { + var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "1"); + if (NewModel != null) + { + //model.RectificationRate = NewModel.RectificationRate; + model.Remarks = NewModel.Remarks; + } + } + list.Add(model); + + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + ClosedCountSum += ClosedCount; + + i++; + } + gvQualityInspection.DataSource = list; + gvQualityInspection.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("MonthsCount", Quantity1Sum.ToString()); + summary.Add("ProjectCount", Quantity2Sum.ToString()); + if (Quantity2Sum > 0) + { + summary.Add("RectificationRate", (100.00 * (ClosedCountSum / Quantity2Sum)).ToString("#0.00") + "%"); + } + else + { + summary.Add("RectificationRate", "0.00%"); + } + gvQualityInspection.SummaryData = summary; + + } + + if (specialCheckData != null) + { + var list = new List(); + + + int Quantity1Sum = 0; + int Quantity2Sum = 0; + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + foreach (DataRow row in specialCheckData.Rows) + { + string CheckType = row["CheckType"].ToString(); + DateTime? CheckDate = Funs.GetNewDateTime(row["CheckDate"].ToString()); + + if (!Quantity1Dic.ContainsKey(CheckType)) + { + Quantity1Dic.Add(CheckType, 0); + } + if (!Quantity2Dic.ContainsKey(CheckType)) + { + Quantity2Dic.Add(CheckType, 0); + } + + if (CheckDate.HasValue && CheckDate.Value >= startDate && CheckDate.Value <= endDate) + { + Quantity1Dic[CheckType] = Quantity1Dic[CheckType] + 1; + + } + Quantity2Dic[CheckType] = Quantity2Dic[CheckType] + 1; + + + } + + //加载检查类别 + var lists = BLL.JointCheckService.GetCheckTypeList(); + foreach (var item in lists) + { + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.Value; + model.MonthsCount = 0; + model.ProjectCount = 0; + if (Quantity1Dic.ContainsKey(item.Value)) + { + model.MonthsCount = Quantity1Dic[item.Value]; + model.ProjectCount = Quantity2Dic[item.Value]; + } + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (cqmsremarksDic.ContainsKey(item.Value + "2")) + { + model.Remarks = cqmsremarksDic[item.Value + "2"]; + } + list.Add(model); + + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + + } + + gvSpecialCheck.DataSource = list; + gvSpecialCheck.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("MonthsCount", Quantity1Sum.ToString()); + summary.Add("ProjectCount", Quantity2Sum.ToString()); + + gvSpecialCheck.SummaryData = summary; + } + + if (fileReportData != null) + { + var list = new List(); + int i = 1; + + int Quantity1Sum = 0; + int Quantity2Sum = 0; + int Quantity3Sum = 0; + int Quantity4Sum = 0; + + + Dictionary Quantity1Dic = new Dictionary(); + Dictionary Quantity2Dic = new Dictionary(); + Dictionary Quantity3Dic = new Dictionary(); + Dictionary Quantity4Dic = new Dictionary(); + foreach (DataRow row in fileReportData.Rows) + { + string SendUnit = row["SendUnit"].ToString(); + string IsReply = row["IsReply"].ToString(); + string RetrunWuhuangCopies = row["RetrunWuhuangCopies"].ToString(); + DateTime? ReceiveDate = Funs.GetNewDateTime(row["ReceiveDate"].ToString()); + + if (!Quantity1Dic.ContainsKey(SendUnit)) + { + Quantity1Dic.Add(SendUnit, 0); + } + if (!Quantity2Dic.ContainsKey(SendUnit)) + { + Quantity2Dic.Add(SendUnit, 0); + } + if (!Quantity3Dic.ContainsKey(SendUnit)) + { + Quantity3Dic.Add(SendUnit, 0); + } + if (!Quantity4Dic.ContainsKey(SendUnit)) + { + Quantity4Dic.Add(SendUnit, 0); + } + if (IsReply == "1" || IsReply == "True" || IsReply == "true") + { + Quantity1Dic[SendUnit] = Quantity1Dic[SendUnit] + 1; + + + if (ReceiveDate.HasValue && ReceiveDate.Value >= startDate && ReceiveDate.Value <= endDate) + { + Quantity2Dic[SendUnit] = Quantity2Dic[SendUnit] + 1; + if (!string.IsNullOrEmpty(RetrunWuhuangCopies)) + { + Quantity3Dic[SendUnit] = Quantity3Dic[SendUnit] + 1; + } + } + if (!string.IsNullOrEmpty(RetrunWuhuangCopies)) + { + Quantity4Dic[SendUnit] = Quantity4Dic[SendUnit] + 1; + } + } + } + + + + + + foreach (var item in units) + { + var query = from c in db.Comprehensive_DataReceivingDoc + join u in db.Base_Unit on c.SendUnit equals u.UnitId into unitJoin + from u in unitJoin.DefaultIfEmpty() + where c.ProjectId == this.CurrUser.LoginProjectId && c.SendUnit == item.UnitId + select new + { + c.ReceiveDate, + c.ProjectId, + c.IsReply, + c.RetrunWuhuangCopies, + u.UnitId, + u.UnitName + }; + var AllList = query.Where(x => x.IsReply == true).ToList();//项目数 + //本月数 + var monethCount = query.Where(x => x.IsReply == true && (x.ReceiveDate >= Convert.ToDateTime(startDate) && x.ReceiveDate <= Convert.ToDateTime(endDate))); + var yzCount = query.Where(x => x.IsReply == true && x.RetrunWuhuangCopies != null && (x.ReceiveDate >= Convert.ToDateTime(startDate) && x.ReceiveDate <= Convert.ToDateTime(endDate)));//本月业主/ 监理返回数量 + int totalReturnCount = query.Where(x => x.IsReply == true && x.RetrunWuhuangCopies != null).Count();//总的已返回数量 + var NoBackCount = AllList.Count() - totalReturnCount;//累计未返回数量 + Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem(); + model.Id = Guid.NewGuid().ToString(); + model.ContentName = item.UnitName; + model.MonthsCount =0; + model.ProjectCount = 0; + model.MonthsBackCount = 0; + model.TotalNoBackCount = 0; + if (Quantity1Dic.ContainsKey(item.UnitId)) + { + model.MonthsCount = Quantity2Dic[item.UnitId]; + model.ProjectCount = Quantity1Dic[item.UnitId]; + model.MonthsBackCount = Quantity3Dic[item.UnitId]; + model.TotalNoBackCount = Quantity1Dic[item.UnitId]-Quantity4Dic[item.UnitId]; + } + + model.ReportId = ReportId; + //如果是修改,查询表中数据 + if (objType == "1") + { + var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "3"); + if (NewModel != null) + { + model.Remarks = NewModel.Remarks; + } + } + list.Add(model); + + Quantity1Sum += model.MonthsCount.Value; + Quantity2Sum += model.ProjectCount.Value; + Quantity3Sum += model.MonthsBackCount.Value; + Quantity4Sum += model.TotalNoBackCount.Value; + i++; + } + gvFileReport.DataSource = list; + gvFileReport.DataBind(); + + //合计 + JObject summary = new JObject(); + summary.Add("ContentName", "合计"); + summary.Add("MonthsCount", Quantity1Sum.ToString()); + summary.Add("ProjectCount", Quantity2Sum.ToString()); + summary.Add("MonthsBackCount", Quantity3Sum.ToString()); + summary.Add("TotalNoBackCount", Quantity4Sum.ToString()); + + gvFileReport.SummaryData = summary; + + } //3.1 加载一般施工方案审批情况 - loadGeneralPlanApproval(objType); + //loadGeneralPlanApproval(objType); //3.2 加载危大工程方案审批情况 - loadMajorPlanApproval(objType); + //loadMajorPlanApproval(objType); //3.3 质量控制点或检验试验计划(ITP)情况 - loadInspectionTestPlan(objType); + //loadInspectionTestPlan(objType); //4 加载设计交底管理情况 - loadDesignDetailsApprove(objType); + // loadDesignDetailsApprove(objType); //5 加载图纸会审管理情况 - loadReviewDrawings(objType); + // loadReviewDrawings(objType); //6 加载设计变更管理情况 - loadDesignChangeOrder(); + //loadDesignChangeOrder(); //7.1 加载合格焊工管理情况 - loadPassWelder(); + //loadPassWelder(); //7.3 加载无损检测管理 - loadProcessControl_NondestructiveTest_New(); + //loadProcessControl_NondestructiveTest_New(); //8 设备报验管理Grid11 - LoadInspectionEquipment(objType); + //LoadInspectionEquipment(objType); //加载9.计量器具报验管理情况 - loadMeasuringInspection(objType); + //loadMeasuringInspection(objType); //加载10.现场质量共检数据 - loadInspectionDataInspection(objType); + + //loadInspectionDataInspection(objType); //加载11.压力管道监检情况 - loadPressureInspection(objType); + //loadPressureInspection(objType); //加载12.管道试压包管理情况 - loadPipingInspection(objType); + //loadPipingInspection(objType); //加载13.特种设备监检情况 - loadSpecialInspection(objType); + //loadSpecialInspection(objType); ////加载14.NCR管理情况 - loadNcrManagementInspection(objType); + //loadNcrManagementInspection(objType); //加载15.质量巡检情况 - loadQualityInspection(objType); + //loadQualityInspection(objType); //加载16.质量专项检查情况 - loadSpecialCheck(objType); + //loadSpecialCheck(objType); //加载17.质量文件上报情况 - loadFileReport(objType); + //loadFileReport(objType); } #endregion @@ -428,12 +2778,16 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { if (AddOrUpdate == "update") { - lodAllGrid("1"); + // lodAllGrid("1"); + objType = "1"; + RegisterAsyncTask(new PageAsyncTask(lodAllGrid)); PageContext.RegisterStartupScript("rehiden();"); } else { - lodAllGrid("0"); + // lodAllGrid("0"); + objType = "0"; + RegisterAsyncTask(new PageAsyncTask(lodAllGrid)); PageContext.RegisterStartupScript("rehiden();"); } } @@ -486,6 +2840,23 @@ namespace FineUIPro.Web.CQMS.ManageReportNew return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty); } #endregion + async Task loadRemarksDt() + { + return await Task.Run(() => + { + if (objType == "1") + { + string strSql = @"select UnitOrMajor,ReType, Remarks from Report_Construction_Plan + where ReportId='" + ReportId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + } + else + { + return null; + } + }); + } #region 3.1一般施工方案审批情况 Grid2方法 /// @@ -510,12 +2881,9 @@ namespace FineUIPro.Web.CQMS.ManageReportNew foreach (var item in generalPlanUnits) { - var query = from c in db.Comprehensive_GeneralPlanApproval - - join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin - - from u in unitJoin.DefaultIfEmpty() - + var query = from c in db.Comprehensive_GeneralPlanApproval + join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin + from u in unitJoin.DefaultIfEmpty() where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId select new @@ -566,6 +2934,20 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } + async Task loadGeneralPlanApprovalDt() + { + return await Task.Run(() => + { + string strSql = @"select ApprovalDate, + ProjectId, + UnitId, + CompileDate from Comprehensive_GeneralPlanApproval + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + #endregion #region 3.2 危大工程方案审批情况 Grid3方法 @@ -651,6 +3033,21 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Grid3.SummaryData = summary; } + async Task loadMajorPlanApprovalDt() + { + return await Task.Run(() => + { + string strSql = @"select ApprovalDate, + ProjectId, + UnitId,IsReview, + CompileDate from Comprehensive_MajorPlanApproval + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + + #endregion @@ -668,15 +3065,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew int Quantity1Sum = 0; int Quantity2Sum = 0; //加载所有专业 - //var CNProfessionals = from x in db.Base_CNProfessional - // where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId - // && x.CNProfessionalId != BLL.Const.ComprehensiveId - // orderby x.SortIndex - // select new - // { - // x.CNProfessionalId, - // x.ProfessionalName - // }; + foreach (var item in CNProfessionals) @@ -738,7 +3127,20 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Grid4.SummaryData = summary; } - + async Task loadInspectionTestPlanDt() + { + return await Task.Run(() => + { + string strSql = @"select ApprovalDate, + ProjectId, + CNProfessionalId, + CreateDate from Inspection_Test_Plan + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + #endregion #region 4 设计交底管理情况 Grid5方法 @@ -821,7 +3223,19 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Grid5.SummaryData = summary; } - + async Task loadDesignDetailsApproveDt() + { + return await Task.Run(() => + { + string strSql = @"select Status, + ProjectId, + CNProfessionalId, + CompileDate from Comprehensive_DesignDetails + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 5 图纸会审管理情况 Grid6方法 @@ -903,7 +3317,19 @@ namespace FineUIPro.Web.CQMS.ManageReportNew summary.Add("Quantity2", Quantity2Sum.ToString()); Grid6.SummaryData = summary; } - + async Task loadReviewDrawingsDt() + { + return await Task.Run(() => + { + string strSql = @"select Status, + ProjectId, + CNProfessionalId, + ReviewDate from Comprehensive_ReviewDrawings + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion @@ -930,7 +3356,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew int i = 1; var cNProfessionals = from x in db.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId - && x.CNProfessionalId != BLL.Const.ComprehensiveId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId + && x.CNProfessionalId != BLL.Const.ComprehensiveId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x; foreach (var item in cNProfessionals) @@ -972,7 +3398,19 @@ namespace FineUIPro.Web.CQMS.ManageReportNew summary.Add("TotalOneOKRate", Quantity6Sum.ToString()); Grid7.SummaryData = summary; } - + async Task loadDesignChangeOrderDt() + { + return await Task.Run(() => + { + string strSql = @"select ImplementationFrontState, + ProjectId, + CNProfessionalId, + IssuedDate,ApprovalDate from Comprehensive_DesignChangeOrder + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion @@ -984,7 +3422,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew { int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0, Quantity7Sum = 0, Quantity8Sum = 0; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); - DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); + DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59")); DateTime projectStartDate = Convert.ToDateTime("2015-01-01"); List StatisticsList = new List(); Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); @@ -1005,19 +3443,14 @@ namespace FineUIPro.Web.CQMS.ManageReportNew foreach (var item in passWelderUnits) { var query = from c in db.Comprehensive_InspectionPerson - join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin - from u in unitJoin.DefaultIfEmpty() join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnJoin - from cn in cnJoin.DefaultIfEmpty() join p in db.Base_Post on c.PostId equals p.PostId into postJoin - from p in postJoin.DefaultIfEmpty() where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId - select new - + select new { c.InspectionPersonId, c.ProjectId, @@ -1075,6 +3508,20 @@ namespace FineUIPro.Web.CQMS.ManageReportNew summary.Add("OtherTotal", Quantity8Sum.ToString()); Grid8.SummaryData = summary; } + + async Task loadPassWelderDt() + { + return await Task.Run(() => + { + string strSql = @"select InspectionPersonId,UnitId,ApprovalTime,ProfessionalName,PostName + from Comprehensive_InspectionPerson a left join Base_CNProfessional b on a.CNProfessionalId=b.CNProfessionalId + left join Base_Post c on a.PostId=c.PostId + where a.ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + #endregion #region 7.2 PQR/WPS报验情况 Grid9方法 @@ -1242,11 +3689,8 @@ namespace FineUIPro.Web.CQMS.ManageReportNew int? num0 = 0, num1 = 0;//拍片数量小计 var query = from c in db.ProcessControl_NondestructiveTest_New - join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin - from u in unitJoin.DefaultIfEmpty() - where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId && c.CreateDate >= startDate && c.CreateDate <= endDate orderby c.CreateDate descending @@ -1405,6 +3849,23 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Grid10.SummaryData = summary; } } + + async Task loadProcessControl_NondestructiveTest_NewDt() + { + return await Task.Run(() => + { + DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); + DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59")); + + string strSql = @"select UnitId,ProfessionalName,MonthQuantity,TotalQuantity,MonthRate,TotalRate + from ProcessControl_NondestructiveTest_New + where ProjectId='" + this.CurrUser.LoginProjectId + "' and CreateDate >='"+ startDate + "' and CreateDate <='"+ endDate + "'"; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + + #endregion #region 8 设备报验管理情况 Grid11方法 @@ -1504,6 +3965,21 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Grid11.SummaryData = summary; } + async Task LoadInspectionEquipmentDt() + { + return await Task.Run(() => + { + DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); + DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59")); + + string strSql = @"select UnitId,InspectionDate,SamplingResult + from Comprehensive_InspectionEquipment + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + /// /// 新增按钮显示文本框 /// @@ -1585,6 +4061,38 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvMeasuringInspection.SummaryData = summary; } + async Task cqmsRemarksDt() + { + return await Task.Run(() => + { + if (objType == "1") + { + string strSql = @"select ContentName,ReType, Remarks from Report_CQMS_MonthReportItem + where ReportId='" + ReportId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + } + else + { + return null; + } + }); + } + + async Task LoadMeasuringInspectionDt() + { + return await Task.Run(() => + { + DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); + DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59")); + + string strSql = @"select UnitId,InspectionDate + from Comprehensive_InspectionMachine + where ProjectId='" + this.CurrUser.LoginProjectId + "' and InspectionType='计量'"; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 10.现场质量共检数据 gvInspectionDataInspection方法 @@ -1724,7 +4232,17 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvInspectionDataInspection.SummaryData = summary; #endregion } + async Task loadInspectionDataInspectionDt() + { + return await Task.Run(() => + { + string strSql = @"select UnitId,IsOnceQualified, InspectionDate from View_CQMS_InspectionManagementDetail + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } public void CheckLotBindStatisc(string cNProfessionalCode) { DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); @@ -1960,6 +4478,21 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } } + + async Task CheckLotBindStatiscDt() + { + return await Task.Run(() => + { + + string strSql = @"select a.UnitWorkId,UnitWorkName,cNProfessionalCode,IsOnceQualified,InspectionDate from View_MonthReport_InspectionManagement a + left join WBS_UnitWork b on a.UnitWorkId =b.UnitWorkId + left join Base_CNProfessional c on a.CNProfessionalId= c.CNProfessionalId + where a.ProjectId='" + this.CurrUser.LoginProjectId + "' order by cNProfessionalCode,UnitWorkName"; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + #endregion #region 11.压力管道监检情况 gvPressureInspection方法 @@ -2036,6 +4569,18 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvPressureInspection.SummaryData = summary; } + async Task LoadPressureInspectionDt() + { + return await Task.Run(() => + { + + string strSql = @"select UnitId, PressurePipeNumber,ActualNumber, ReportTime from Comprehensive_PressurePipe + where Projctid='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } + #endregion #region 12.管道试压包管理情况 gvPipingInspection方法 @@ -2114,6 +4659,16 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvPipingInspection.SummaryData = summary; } + async Task LoadPipingInspectionDt() + { + return await Task.Run(() => + { + string strSql = @"select UnitId, PackageNumber,IssuedReportNumber, ReportTime from Comprehensive_PressurePipe + where Projctid='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 13.特种设备监检情况 gvSpecialInspection方法 @@ -2190,6 +4745,17 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvSpecialInspection.SummaryData = summary; } + async Task LoadSpecialInspectionDt() + { + return await Task.Run(() => + { + + string strSql = @"select UnitId, SunNumber,MonitoringReportNumber, ReportTime from Comprehensive_SpecialEquipment + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 14.NCR管理情况 gvNcrManagementInspection方法 @@ -2246,10 +4812,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc(); NCRStatisc.Id = Guid.NewGuid().ToString(); NCRStatisc.WorkName = item.UnitName; - //NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Count(x => x.Status == "3"); - //NCRStatisc.OKNum = AllList.Count(x => x.Status == "3"); - //NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Where(x => x.ImplementationFrontState.Trim().Equals("已闭合")).Count(); - //NCRStatisc.OKNum = AllList.Where(x => x.ImplementationFrontState.Trim().Equals("已闭合")).Count(); + NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Where(x => x.ImplementationFrontState == "已闭合").Count(); NCRStatisc.OKNum = AllList.Where(x => x.ImplementationFrontState == "已闭合").Count(); @@ -2294,6 +4857,17 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvNcrManagementInspection.SummaryData = summary; } + async Task LoadNcrManagementInspectionDt() + { + return await Task.Run(() => + { + + string strSql = @"select ReceiveUnit,ImplementationFrontState, IssuedDate from Comprehensive_NCRManagement + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 15.质量巡检情况 gvQualityInspection方法 @@ -2387,6 +4961,17 @@ namespace FineUIPro.Web.CQMS.ManageReportNew } gvQualityInspection.SummaryData = summary; } + async Task LoadQualityInspectionDt() + { + return await Task.Run(() => + { + + string strSql = @"select UnitId,State, CheckDate from Check_CheckControl + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 16.质量专项检查情况 gvSpecialCheck方法 @@ -2452,6 +5037,18 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvSpecialCheck.SummaryData = summary; } + + async Task loadSpecialCheckDt() + { + return await Task.Run(() => + { + + string strSql = @"select CheckType, CheckDate from Check_JointCheck + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 17.质量文件上报情况 gvFileReport方法 @@ -2535,6 +5132,18 @@ namespace FineUIPro.Web.CQMS.ManageReportNew gvFileReport.SummaryData = summary; } + + async Task loadFileReportDt() + { + return await Task.Run(() => + { + + string strSql = @"select SendUnit, ReceiveDate ,IsReply,RetrunWuhuangCopies from Comprehensive_DataReceivingDoc + where ProjectId='" + this.CurrUser.LoginProjectId + "' "; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + return dt; + }); + } #endregion #region 18.本月质量问题处理情况