From f353e5b4cf5d206822591b15ee4fc555d15c3607 Mon Sep 17 00:00:00 2001 From: xiaju <1784803958@qq.com> Date: Wed, 11 Mar 2026 17:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=83=E5=A4=A7=E9=9A=90=E6=82=A3=E6=95=B4?= =?UTF-8?q?=E6=94=B9=E6=B1=87=E6=80=BB=E6=95=B0=E6=8C=87=E6=A0=87=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E9=9B=86=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../版本日志/SUBQHSE_V2026-03-11-xiaj.sql | 23 ++++ .../BLL/ZHGL/DataSync/HSSEData_HSSEService.cs | 65 ++++++++++- SGGL/Model/Model.cs | 102 +++++++++++++++++- SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs | 3 + 4 files changed, 188 insertions(+), 5 deletions(-) create mode 100644 DataBase/版本日志/SUBQHSE_V2026-03-11-xiaj.sql diff --git a/DataBase/版本日志/SUBQHSE_V2026-03-11-xiaj.sql b/DataBase/版本日志/SUBQHSE_V2026-03-11-xiaj.sql new file mode 100644 index 00000000..df77bc43 --- /dev/null +++ b/DataBase/版本日志/SUBQHSE_V2026-03-11-xiaj.sql @@ -0,0 +1,23 @@ + + + + +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'HSSEData_HSSE' AND COLUMN_NAME = 'LargerClosedNum') +BEGIN + ALTER TABLE HSSEData_HSSE ADD LargerClosedNum int; + ALTER TABLE HSSEData_HSSE ADD LargerNotClosedNum int; + EXEC sp_addextendedproperty 'MS_Description', N'ϴıջ','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'LargerClosedNum'; + EXEC sp_addextendedproperty 'MS_Description', N'ϴδ','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'LargerNotClosedNum'; +END +GO + +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_HSSEData_HSSE' AND COLUMN_NAME = 'LargerClosedNum') +BEGIN + ALTER TABLE Project_HSSEData_HSSE ADD LargerClosedNum int; + ALTER TABLE Project_HSSEData_HSSE ADD LargerNotClosedNum int; + EXEC sp_addextendedproperty 'MS_Description', N'ϴıջ','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'LargerClosedNum'; + EXEC sp_addextendedproperty 'MS_Description', N'ϴδ','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'LargerNotClosedNum'; +END +GO + + diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index 95e46db5..e9cf5466 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -103,6 +103,8 @@ namespace BLL LicensesCloseNum = newtable.LicensesCloseNum, GeneralClosedNum = newtable.GeneralClosedNum, GeneralNotClosedNum = newtable.GeneralNotClosedNum, + LargerClosedNum = newtable.LargerClosedNum, + LargerNotClosedNum = newtable.LargerNotClosedNum, MajorClosedNum = newtable.MajorClosedNum, MajorNotClosedNum = newtable.MajorNotClosedNum, GeneralRiskNum = newtable.GeneralRiskNum, @@ -194,6 +196,9 @@ namespace BLL item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum; item.GeneralRate = ""; item.GeneralRiskNum = dataHsse.GeneralRiskNum; + item.LargerClosedNum = dataHsse.LargerClosedNum; + item.LargerNotClosedNum = dataHsse.LargerNotClosedNum; + item.LargerRate = ""; item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum; item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum; item.HighRiskNum = dataHsse.HighRiskNum; @@ -315,6 +320,9 @@ namespace BLL item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum; item.GeneralRate = ""; item.GeneralRiskNum = dataHsse.GeneralRiskNum; + item.LargerClosedNum = dataHsse.LargerClosedNum; + item.LargerNotClosedNum = dataHsse.LargerNotClosedNum; + item.LargerRate = ""; item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum; item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum; item.HighRiskNum = dataHsse.HighRiskNum; @@ -527,6 +535,8 @@ namespace BLL LicensesCloseNum = projectData.Sum(x => x.LicensesCloseNum), GeneralClosedNum = projectData.Sum(x => x.GeneralClosedNum), GeneralNotClosedNum = projectData.Sum(x => x.GeneralNotClosedNum), + LargerClosedNum = projectData.Sum(x => x.LargerClosedNum), + LargerNotClosedNum = projectData.Sum(x => x.LargerNotClosedNum), MajorClosedNum = projectData.Sum(x => x.MajorClosedNum), MajorNotClosedNum = projectData.Sum(x => x.MajorNotClosedNum), GeneralRiskNum = projectData.Sum(x => x.GeneralRiskNum), @@ -630,6 +640,7 @@ namespace BLL var licensesTask = HSSEData_HSSEService.GetLicensesAsync(); var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync(); var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync(); + var largerHiddenRectificationOutputsTask = HSSEData_HSSEService.GetLargerHiddenRectificationOutputsAsync(); var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync(); // 等待所有异步方法执行完成 @@ -767,6 +778,7 @@ namespace BLL var licensesList = await licensesTask; var licensesCloseList = await licensesCloseTask; var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; + var largerHiddenRectificationOutputsList = await largerHiddenRectificationOutputsTask; var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; // 构造结果对象 @@ -848,6 +860,8 @@ namespace BLL LicensesCloseNum = licensesCloseList.Count(), GeneralClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.RecNum), GeneralNotClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.NoRecNum), + LargerClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.RecNum), + LargerNotClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.NoRecNum), MajorClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.RecNum), MajorNotClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.NoRecNum), LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum), @@ -878,6 +892,12 @@ namespace BLL g => g.Key, g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) } ); + var largerHiddenRectificationOutputsDict = largerHiddenRectificationOutputsList + .GroupBy(x => x.ProjectId) + .ToDictionary( + g => g.Key, + g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) } + ); var majorHiddenRectificationOutputsDict = majorHiddenRectificationOutputsList .GroupBy(x => x.ProjectId) .ToDictionary( @@ -921,6 +941,7 @@ namespace BLL foreach (var projectid in BeUnderConstructionList) { generalHiddenRectificationOutputsDict.TryGetValue(projectid, out var generalHiddenRectificationOutputs); + largerHiddenRectificationOutputsDict.TryGetValue(projectid, out var largerHiddenRectificationOutputs); majorHiddenRectificationOutputsDict.TryGetValue(projectid, out var majorHiddenRectificationOutputs); securityRiskOutputDict.TryGetValue(projectid, out var securityRiskOutputs); largeEngineeringOutputsDict.TryGetValue(projectid, out var largeEngineeringOutputs); @@ -1000,6 +1021,8 @@ namespace BLL LicensesCloseNum = licensesCloseList.Count(x => x.ProjectId == projectid), GeneralClosedNum = generalHiddenRectificationOutputs?.ClosedNum ?? 0, GeneralNotClosedNum = generalHiddenRectificationOutputs?.NotClosedNum ?? 0, + LargerClosedNum = largerHiddenRectificationOutputs?.ClosedNum ?? 0, + LargerNotClosedNum = largerHiddenRectificationOutputs?.NotClosedNum ?? 0, MajorClosedNum = majorHiddenRectificationOutputs?.ClosedNum ?? 0, MajorNotClosedNum = majorHiddenRectificationOutputs?.NotClosedNum ?? 0, LowRiskNum = securityRiskOutputs?.LowRiskNum ?? 0, @@ -1124,6 +1147,8 @@ namespace BLL table.LicensesCloseNum = newtable.LicensesCloseNum; table.GeneralClosedNum = newtable.GeneralClosedNum; table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; + table.LargerClosedNum = newtable.LargerClosedNum; + table.LargerNotClosedNum = newtable.LargerNotClosedNum; table.MajorClosedNum = newtable.MajorClosedNum; table.MajorNotClosedNum = newtable.MajorNotClosedNum; table.GeneralRiskNum = newtable.GeneralRiskNum; @@ -3949,7 +3974,6 @@ namespace BLL /// public static List GetGeneralHiddenRectificationOutputs() { - var query = (from x in Funs.DB.Base_Project join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup from y in yGroup.DefaultIfEmpty() @@ -3979,6 +4003,41 @@ namespace BLL return await Task.Run(GetGeneralHiddenRectificationOutputs); } + /// + /// 获取较大隐患数据 + /// + /// + public static List GetLargerHiddenRectificationOutputs() + { + var query = (from x in Funs.DB.Base_Project + join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup + from y in yGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.Risk_Level == "较大事故隐患" && y.CheckTime > Const.DtmarkTime + group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg + select new HiddenRectificationOutput + { + ProjectId = gg.Key.ProjectId, + ProjectName = gg.Key.ProjectName, + ProjectCode = gg.Key.ProjectCode, + ProNum = gg.Count(y => y.States != "4" && y.States != "-1"), + RecNum = gg.Count(y => y.States == "3"), + NoRecNum = gg.Count(y => y.States != "3" && y.States != "4" && y.States != "-1"), + RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" : + Math.Round(Convert.ToDecimal(gg.Count(y => y.States == "3") / + gg.Count(y => y.States != "4" && y.States != "-1") * 100), 2, MidpointRounding.AwayFromZero).ToString() + }).ToList(); + + foreach (var item in query) + { + item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数 + } + return query; + } + public static async Task> GetLargerHiddenRectificationOutputsAsync() + { + return await Task.Run(GetLargerHiddenRectificationOutputs); + } + /// /// 获取重大隐患数据 /// @@ -3997,7 +4056,7 @@ namespace BLL ProjectCode = gg.Key.ProjectCode, ProNum = gg.Count(y => y.States != "4" && y.States != "-1"), RecNum = gg.Count(y => y.States == "3"), - NoRecNum = gg.Count(y => y.States != "3" && y.States != "-1"), + NoRecNum = gg.Count(y => y.States != "3" && y.States != "4" && y.States != "-1"), RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" : Math.Round((decimal)gg.Count(y => y.States == "3") / gg.Count(y => y.States != "4" && y.States != "-1") * 100, 2, MidpointRounding.AwayFromZero).ToString() @@ -4298,6 +4357,8 @@ namespace BLL x.LicensesCloseNum, x.GeneralClosedNum, x.GeneralNotClosedNum, + x.LargerClosedNum, + x.LargerNotClosedNum, x.MajorClosedNum, x.MajorNotClosedNum, x.GeneralRiskNum, diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 403ea306..dae6b803 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -189616,6 +189616,10 @@ namespace Model private System.Nullable _ProjectSubFullTimeNum; + private System.Nullable _LargerClosedNum; + + private System.Nullable _LargerNotClosedNum; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -189812,6 +189816,10 @@ namespace Model partial void OnBranchDrillPersonNumChanged(); partial void OnProjectSubFullTimeNumChanging(System.Nullable value); partial void OnProjectSubFullTimeNumChanged(); + partial void OnLargerClosedNumChanging(System.Nullable value); + partial void OnLargerClosedNumChanged(); + partial void OnLargerNotClosedNumChanging(System.Nullable value); + partial void OnLargerNotClosedNumChanged(); #endregion public HSSEData_HSSE() @@ -191739,6 +191747,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LargerClosedNum", DbType="Int")] + public System.Nullable LargerClosedNum + { + get + { + return this._LargerClosedNum; + } + set + { + if ((this._LargerClosedNum != value)) + { + this.OnLargerClosedNumChanging(value); + this.SendPropertyChanging(); + this._LargerClosedNum = value; + this.SendPropertyChanged("LargerClosedNum"); + this.OnLargerClosedNumChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LargerNotClosedNum", DbType="Int")] + public System.Nullable LargerNotClosedNum + { + get + { + return this._LargerNotClosedNum; + } + set + { + if ((this._LargerNotClosedNum != value)) + { + this.OnLargerNotClosedNumChanging(value); + this.SendPropertyChanging(); + this._LargerNotClosedNum = value; + this.SendPropertyChanged("LargerNotClosedNum"); + this.OnLargerNotClosedNumChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -315554,6 +315602,10 @@ namespace Model private System.Nullable _ProjectSubFullTimeNum; + private System.Nullable _LargerClosedNum; + + private System.Nullable _LargerNotClosedNum; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -315746,6 +315798,10 @@ namespace Model partial void OnBranchDrillPersonNumChanged(); partial void OnProjectSubFullTimeNumChanging(System.Nullable value); partial void OnProjectSubFullTimeNumChanged(); + partial void OnLargerClosedNumChanging(System.Nullable value); + partial void OnLargerClosedNumChanged(); + partial void OnLargerNotClosedNumChanging(System.Nullable value); + partial void OnLargerNotClosedNumChanged(); #endregion public Project_HSSEData_HSSE() @@ -317633,6 +317689,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LargerClosedNum", DbType="Int")] + public System.Nullable LargerClosedNum + { + get + { + return this._LargerClosedNum; + } + set + { + if ((this._LargerClosedNum != value)) + { + this.OnLargerClosedNumChanging(value); + this.SendPropertyChanging(); + this._LargerClosedNum = value; + this.SendPropertyChanged("LargerClosedNum"); + this.OnLargerClosedNumChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LargerNotClosedNum", DbType="Int")] + public System.Nullable LargerNotClosedNum + { + get + { + return this._LargerNotClosedNum; + } + set + { + if ((this._LargerNotClosedNum != value)) + { + this.OnLargerNotClosedNumChanging(value); + this.SendPropertyChanging(); + this._LargerNotClosedNum = value; + this.SendPropertyChanged("LargerNotClosedNum"); + this.OnLargerNotClosedNumChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -461379,7 +461475,7 @@ namespace Model private System.Nullable _ProjectSubFullTimeNum; - private System.Nullable _TotalWorkNum; + private System.Nullable _TotalWorkNum; public View_Project_HSSEData_HSSE() { @@ -462921,8 +463017,8 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalWorkNum", DbType="Decimal(38,4)")] - public System.Nullable TotalWorkNum + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalWorkNum", DbType="Int")] + public System.Nullable TotalWorkNum { get { diff --git a/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs b/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs index 3e2a0f10..a9eaaa96 100644 --- a/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs +++ b/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs @@ -57,6 +57,9 @@ namespace Model public int? GeneralNotClosedNum { get; set; } public string GeneralRate { get; set; } public int? GeneralRiskNum { get; set; } + public int? LargerClosedNum { get; set; } + public int? LargerNotClosedNum { get; set; } + public string LargerRate { get; set; } public int? HeadOfficeFullTimeNum { get; set; } public int? HeadOfficeInspectorGeneralNum { get; set; } public int? HighRiskNum { get; set; }