From 15cdfb8abd6bf7e9451af8c90d01b5a96655ef7c Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Tue, 23 Dec 2025 09:53:06 +0800 Subject: [PATCH 1/4] 1 --- DataBase/版本日志/SGGLDB_V2025-12-20.sql | 36 ++ SGGL/Model/Model.cs | 721 +++++++++++++++++------ 2 files changed, 574 insertions(+), 183 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2025-12-20.sql diff --git a/DataBase/版本日志/SGGLDB_V2025-12-20.sql b/DataBase/版本日志/SGGLDB_V2025-12-20.sql new file mode 100644 index 00000000..83d9a18f --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-12-20.sql @@ -0,0 +1,36 @@ +INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'项目设备', NULL, N'ProjectData/ProjectDevices.aspx', '86', N'0', N'Menu_ProjectSet', '0', '1', '1'); + +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'1E3A5ADC-BAA7-45BC-AAF9-012A024F4752', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'保存', '4'); +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'37E51622-FB4E-40F4-8D37-603EE626DB7F', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'增加', '1'); +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'6EBFA308-581A-4260-9ECA-7E30283EF9EA', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'删除', '3'); +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'939F4F2D-F03B-4DBD-963C-D55196535D8C', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'修改', '2'); + + + +Alter TABLE [dbo].[Base_Project] + add + [IsYunMou] [bit] NULL, + [YunMouGroupId] [nvarchar](50) NULL + +GO + +CREATE TABLE [dbo].[Project_Devices]( + [DeviceId] [nvarchar](50) NOT NULL, + [DeviceName] [nvarchar](50) NULL, + [Address] [nvarchar](500) NULL, + [CreateDate] [date] NULL, + [ProjectId] [nvarchar](50) NULL, + [DeviceSerial] [nvarchar](50) NULL, + [isInOut] [nvarchar](50) NULL, + [ValidateCode] [nvarchar](50) NULL, + [YunMouDeviceId] [nvarchar](50) NULL, + [YunMouPermission] [nvarchar](50) NULL, + CONSTRAINT [PK_Project_Devices] PRIMARY KEY CLUSTERED +( + [DeviceId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] + +GO + + diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index f283c84e..9d3b943d 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -1268,6 +1268,9 @@ namespace Model partial void InsertProject_CQMSData_CQMS(Project_CQMSData_CQMS instance); partial void UpdateProject_CQMSData_CQMS(Project_CQMSData_CQMS instance); partial void DeleteProject_CQMSData_CQMS(Project_CQMSData_CQMS instance); + partial void InsertProject_Devices(Project_Devices instance); + partial void UpdateProject_Devices(Project_Devices instance); + partial void DeleteProject_Devices(Project_Devices instance); partial void InsertProject_FileCabinet(Project_FileCabinet instance); partial void UpdateProject_FileCabinet(Project_FileCabinet instance); partial void DeleteProject_FileCabinet(Project_FileCabinet instance); @@ -5241,6 +5244,14 @@ namespace Model } } + public System.Data.Linq.Table Project_Devices + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Project_FileCabinet { get @@ -12291,7 +12302,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(2000)")] public string ApproveIdea { get @@ -22470,8 +22481,6 @@ namespace Model private string _UnitId; - private string _ProjectId; - private string _MaterialId; private string _ColorName; @@ -22482,6 +22491,8 @@ namespace Model private string _Remark; + private string _ProjectId; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -22490,8 +22501,6 @@ namespace Model partial void OnMaterialColorIdChanged(); partial void OnUnitIdChanging(string value); partial void OnUnitIdChanged(); - partial void OnProjectIdChanging(string value); - partial void OnProjectIdChanged(); partial void OnMaterialIdChanging(string value); partial void OnMaterialIdChanged(); partial void OnColorNameChanging(string value); @@ -22502,6 +22511,8 @@ namespace Model partial void OnRGBChanged(); partial void OnRemarkChanging(string value); partial void OnRemarkChanged(); + partial void OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); #endregion public Base_MaterialColor() @@ -22549,26 +22560,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] - public string ProjectId - { - get - { - return this._ProjectId; - } - set - { - if ((this._ProjectId != value)) - { - this.OnProjectIdChanging(value); - this.SendPropertyChanging(); - this._ProjectId = value; - this.SendPropertyChanged("ProjectId"); - this.OnProjectIdChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialId", DbType="NVarChar(50)")] public string MaterialId { @@ -22669,6 +22660,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -24600,6 +24611,10 @@ namespace Model private string _MasterSysId; + private System.Nullable _IsYunMou; + + private string _YunMouGroupId; + private EntitySet _Accident_AccidentHandle; private EntitySet _Accident_AccidentPersonRecord; @@ -25030,6 +25045,10 @@ namespace Model partial void OnIsCNCECShowChanged(); partial void OnMasterSysIdChanging(string value); partial void OnMasterSysIdChanged(); + partial void OnIsYunMouChanging(System.Nullable value); + partial void OnIsYunMouChanged(); + partial void OnYunMouGroupIdChanging(string value); + partial void OnYunMouGroupIdChanged(); #endregion public Base_Project() @@ -25847,6 +25866,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsYunMou", DbType="Bit")] + public System.Nullable IsYunMou + { + get + { + return this._IsYunMou; + } + set + { + if ((this._IsYunMou != value)) + { + this.OnIsYunMouChanging(value); + this.SendPropertyChanging(); + this._IsYunMou = value; + this.SendPropertyChanged("IsYunMou"); + this.OnIsYunMouChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouGroupId", DbType="NVarChar(50)")] + public string YunMouGroupId + { + get + { + return this._YunMouGroupId; + } + set + { + if ((this._YunMouGroupId != value)) + { + this.OnYunMouGroupIdChanging(value); + this.SendPropertyChanging(); + this._YunMouGroupId = value; + this.SendPropertyChanged("YunMouGroupId"); + this.OnYunMouGroupIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentHandle_Base_Project", Storage="_Accident_AccidentHandle", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")] public EntitySet Accident_AccidentHandle { @@ -97844,10 +97903,10 @@ namespace Model private string _TrainNumber; - private string _TrainNumberId; - private System.Nullable _TypeInt; + private string _TrainNumberId; + private string _CompileMan; private System.Nullable _CompileDate; @@ -97882,10 +97941,10 @@ namespace Model partial void OnReceiveDateChanged(); partial void OnTrainNumberChanging(string value); partial void OnTrainNumberChanged(); - partial void OnTrainNumberIdChanging(string value); - partial void OnTrainNumberIdChanged(); partial void OnTypeIntChanging(System.Nullable value); partial void OnTypeIntChanged(); + partial void OnTrainNumberIdChanging(string value); + partial void OnTrainNumberIdChanged(); partial void OnCompileManChanging(string value); partial void OnCompileManChanged(); partial void OnCompileDateChanging(System.Nullable value); @@ -98139,26 +98198,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainNumberId", DbType="VarChar(50)")] - public string TrainNumberId - { - get - { - return this._TrainNumberId; - } - set - { - if ((this._TrainNumberId != value)) - { - this.OnTrainNumberIdChanging(value); - this.SendPropertyChanging(); - this._TrainNumberId = value; - this.SendPropertyChanged("TrainNumberId"); - this.OnTrainNumberIdChanged(); - } - } - } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TypeInt", DbType="Int")] public System.Nullable TypeInt { @@ -98179,6 +98218,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainNumberId", DbType="VarChar(50)")] + public string TrainNumberId + { + get + { + return this._TrainNumberId; + } + set + { + if ((this._TrainNumberId != value)) + { + this.OnTrainNumberIdChanging(value); + this.SendPropertyChanging(); + this._TrainNumberId = value; + this.SendPropertyChanged("TrainNumberId"); + this.OnTrainNumberIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")] public string CompileMan { @@ -109426,7 +109485,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(500)")] public string Rectification { get @@ -109552,7 +109611,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(500)")] public string Measures { get @@ -162267,7 +162326,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(3000)")] public string AttentPerson { get @@ -193250,7 +193309,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(255)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)] public string ProjectDescription { get @@ -193370,7 +193429,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(255)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)] public string CalculationRule { get @@ -193430,7 +193489,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(100)")] public string ConstructionSubcontractor { get @@ -193814,7 +193873,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,2)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,3)")] public System.Nullable WorkPackageEstimate { get @@ -194119,6 +194178,16 @@ namespace Model private string _ProjectId; + private string _ContractId; + + private string _OrderCode; + + private System.Nullable _OrderInDate; + + private System.Nullable _OrderOutDate; + + private string _MaterialRequisitionUnit; + private System.Nullable _State; private string _InvoiceCode; @@ -194147,16 +194216,6 @@ namespace Model private string _CreateUser; - private string _ContractId; - - private System.Nullable _OrderInDate; - - private string _OrderCode; - - private System.Nullable _OrderOutDate; - - private string _MaterialRequisitionUnit; - #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -194165,6 +194224,16 @@ namespace Model partial void OnInvoiceIdChanged(); partial void OnProjectIdChanging(string value); partial void OnProjectIdChanged(); + partial void OnContractIdChanging(string value); + partial void OnContractIdChanged(); + partial void OnOrderCodeChanging(string value); + partial void OnOrderCodeChanged(); + partial void OnOrderInDateChanging(System.Nullable value); + partial void OnOrderInDateChanged(); + partial void OnOrderOutDateChanging(System.Nullable value); + partial void OnOrderOutDateChanged(); + partial void OnMaterialRequisitionUnitChanging(string value); + partial void OnMaterialRequisitionUnitChanged(); partial void OnStateChanging(System.Nullable value); partial void OnStateChanged(); partial void OnInvoiceCodeChanging(string value); @@ -194193,16 +194262,6 @@ namespace Model partial void OnCreateDateChanged(); partial void OnCreateUserChanging(string value); partial void OnCreateUserChanged(); - partial void OnContractIdChanging(string value); - partial void OnContractIdChanged(); - partial void OnOrderInDateChanging(System.Nullable value); - partial void OnOrderInDateChanged(); - partial void OnOrderCodeChanging(string value); - partial void OnOrderCodeChanged(); - partial void OnOrderOutDateChanging(System.Nullable value); - partial void OnOrderOutDateChanged(); - partial void OnMaterialRequisitionUnitChanging(string value); - partial void OnMaterialRequisitionUnitChanged(); #endregion public PHTGL_Invoice() @@ -194250,6 +194309,106 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")] + public string ContractId + { + get + { + return this._ContractId; + } + set + { + if ((this._ContractId != value)) + { + this.OnContractIdChanging(value); + this.SendPropertyChanging(); + this._ContractId = value; + this.SendPropertyChanged("ContractId"); + this.OnContractIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")] + public string OrderCode + { + get + { + return this._OrderCode; + } + set + { + if ((this._OrderCode != value)) + { + this.OnOrderCodeChanging(value); + this.SendPropertyChanging(); + this._OrderCode = value; + this.SendPropertyChanged("OrderCode"); + this.OnOrderCodeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")] + public System.Nullable OrderInDate + { + get + { + return this._OrderInDate; + } + set + { + if ((this._OrderInDate != value)) + { + this.OnOrderInDateChanging(value); + this.SendPropertyChanging(); + this._OrderInDate = value; + this.SendPropertyChanged("OrderInDate"); + this.OnOrderInDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")] + public System.Nullable OrderOutDate + { + get + { + return this._OrderOutDate; + } + set + { + if ((this._OrderOutDate != value)) + { + this.OnOrderOutDateChanging(value); + this.SendPropertyChanging(); + this._OrderOutDate = value; + this.SendPropertyChanged("OrderOutDate"); + this.OnOrderOutDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")] + public string MaterialRequisitionUnit + { + get + { + return this._MaterialRequisitionUnit; + } + set + { + if ((this._MaterialRequisitionUnit != value)) + { + this.OnMaterialRequisitionUnitChanging(value); + this.SendPropertyChanging(); + this._MaterialRequisitionUnit = value; + this.SendPropertyChanged("MaterialRequisitionUnit"); + this.OnMaterialRequisitionUnitChanged(); + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="Int")] public System.Nullable State { @@ -194530,106 +194689,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")] - public string ContractId - { - get - { - return this._ContractId; - } - set - { - if ((this._ContractId != value)) - { - this.OnContractIdChanging(value); - this.SendPropertyChanging(); - this._ContractId = value; - this.SendPropertyChanged("ContractId"); - this.OnContractIdChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")] - public System.Nullable OrderInDate - { - get - { - return this._OrderInDate; - } - set - { - if ((this._OrderInDate != value)) - { - this.OnOrderInDateChanging(value); - this.SendPropertyChanging(); - this._OrderInDate = value; - this.SendPropertyChanged("OrderInDate"); - this.OnOrderInDateChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")] - public string OrderCode - { - get - { - return this._OrderCode; - } - set - { - if ((this._OrderCode != value)) - { - this.OnOrderCodeChanging(value); - this.SendPropertyChanging(); - this._OrderCode = value; - this.SendPropertyChanged("OrderCode"); - this.OnOrderCodeChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")] - public System.Nullable OrderOutDate - { - get - { - return this._OrderOutDate; - } - set - { - if ((this._OrderOutDate != value)) - { - this.OnOrderOutDateChanging(value); - this.SendPropertyChanging(); - this._OrderOutDate = value; - this.SendPropertyChanged("OrderOutDate"); - this.OnOrderOutDateChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")] - public string MaterialRequisitionUnit - { - get - { - return this._MaterialRequisitionUnit; - } - set - { - if ((this._MaterialRequisitionUnit != value)) - { - this.OnMaterialRequisitionUnitChanging(value); - this.SendPropertyChanging(); - this._MaterialRequisitionUnit = value; - this.SendPropertyChanged("MaterialRequisitionUnit"); - this.OnMaterialRequisitionUnitChanged(); - } - } - } - public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -205038,6 +205097,284 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Project_Devices")] + public partial class Project_Devices : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _DeviceId; + + private string _DeviceName; + + private string _Address; + + private System.Nullable _CreateDate; + + private string _ProjectId; + + private string _DeviceSerial; + + private string _IsInOut; + + private string _ValidateCode; + + private string _YunMouDeviceId; + + private string _YunMouPermission; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnDeviceIdChanging(string value); + partial void OnDeviceIdChanged(); + partial void OnDeviceNameChanging(string value); + partial void OnDeviceNameChanged(); + partial void OnAddressChanging(string value); + partial void OnAddressChanged(); + partial void OnCreateDateChanging(System.Nullable value); + partial void OnCreateDateChanged(); + partial void OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); + partial void OnDeviceSerialChanging(string value); + partial void OnDeviceSerialChanged(); + partial void OnIsInOutChanging(string value); + partial void OnIsInOutChanged(); + partial void OnValidateCodeChanging(string value); + partial void OnValidateCodeChanged(); + partial void OnYunMouDeviceIdChanging(string value); + partial void OnYunMouDeviceIdChanged(); + partial void OnYunMouPermissionChanging(string value); + partial void OnYunMouPermissionChanged(); + #endregion + + public Project_Devices() + { + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeviceId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string DeviceId + { + get + { + return this._DeviceId; + } + set + { + if ((this._DeviceId != value)) + { + this.OnDeviceIdChanging(value); + this.SendPropertyChanging(); + this._DeviceId = value; + this.SendPropertyChanged("DeviceId"); + this.OnDeviceIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeviceName", DbType="NVarChar(50)")] + public string DeviceName + { + get + { + return this._DeviceName; + } + set + { + if ((this._DeviceName != value)) + { + this.OnDeviceNameChanging(value); + this.SendPropertyChanging(); + this._DeviceName = value; + this.SendPropertyChanged("DeviceName"); + this.OnDeviceNameChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Address", DbType="NVarChar(500)")] + public string Address + { + get + { + return this._Address; + } + set + { + if ((this._Address != value)) + { + this.OnAddressChanging(value); + this.SendPropertyChanging(); + this._Address = value; + this.SendPropertyChanged("Address"); + this.OnAddressChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateDate", DbType="Date")] + public System.Nullable CreateDate + { + get + { + return this._CreateDate; + } + set + { + if ((this._CreateDate != value)) + { + this.OnCreateDateChanging(value); + this.SendPropertyChanging(); + this._CreateDate = value; + this.SendPropertyChanged("CreateDate"); + this.OnCreateDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeviceSerial", DbType="NVarChar(50)")] + public string DeviceSerial + { + get + { + return this._DeviceSerial; + } + set + { + if ((this._DeviceSerial != value)) + { + this.OnDeviceSerialChanging(value); + this.SendPropertyChanging(); + this._DeviceSerial = value; + this.SendPropertyChanged("DeviceSerial"); + this.OnDeviceSerialChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Name="isInOut", Storage="_IsInOut", DbType="NVarChar(50)")] + public string IsInOut + { + get + { + return this._IsInOut; + } + set + { + if ((this._IsInOut != value)) + { + this.OnIsInOutChanging(value); + this.SendPropertyChanging(); + this._IsInOut = value; + this.SendPropertyChanged("IsInOut"); + this.OnIsInOutChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ValidateCode", DbType="NVarChar(50)")] + public string ValidateCode + { + get + { + return this._ValidateCode; + } + set + { + if ((this._ValidateCode != value)) + { + this.OnValidateCodeChanging(value); + this.SendPropertyChanging(); + this._ValidateCode = value; + this.SendPropertyChanged("ValidateCode"); + this.OnValidateCodeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouDeviceId", DbType="NVarChar(50)")] + public string YunMouDeviceId + { + get + { + return this._YunMouDeviceId; + } + set + { + if ((this._YunMouDeviceId != value)) + { + this.OnYunMouDeviceIdChanging(value); + this.SendPropertyChanging(); + this._YunMouDeviceId = value; + this.SendPropertyChanged("YunMouDeviceId"); + this.OnYunMouDeviceIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouPermission", DbType="NVarChar(50)")] + public string YunMouPermission + { + get + { + return this._YunMouPermission; + } + set + { + if ((this._YunMouPermission != value)) + { + this.OnYunMouPermissionChanging(value); + this.SendPropertyChanging(); + this._YunMouPermission = value; + this.SendPropertyChanged("YunMouPermission"); + this.OnYunMouPermissionChanged(); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Project_FileCabinet")] public partial class Project_FileCabinet : INotifyPropertyChanging, INotifyPropertyChanged { @@ -282807,6 +283144,8 @@ namespace Model private string _ProblemTypes; + private string _RiskLevel; + private System.Nullable _SortIndex; private string _Situation; @@ -283131,6 +283470,22 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RiskLevel", DbType="NVarChar(50)")] + public string RiskLevel + { + get + { + return this._RiskLevel; + } + set + { + if ((this._RiskLevel != value)) + { + this._RiskLevel = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SortIndex", DbType="Int")] public System.Nullable SortIndex { @@ -317351,7 +317706,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(200)")] public string Name { get @@ -317928,7 +318283,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -318119,7 +318474,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -323458,7 +323813,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -324930,7 +325285,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -334481,7 +334836,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(1500)")] public string ContractNo { get @@ -334501,7 +334856,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(1500)")] public string UnitWorks { get From 8815b755bda5f0173a99d15297499733db0acca5 Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Tue, 23 Dec 2025 16:01:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=84=8A=E6=8E=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs | 12 +++++++----- SGGL/BLL/HJGL/TestPackage/TestPackagePrintService.cs | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs b/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs index 12d3f01a..cca4cf4a 100644 --- a/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs +++ b/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs @@ -472,7 +472,9 @@ namespace BLL join n in db.Base_Project on x.ProjectId equals n.ProjectId join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt from t in tt.DefaultIfEmpty() - select new { x, n, t }; + join train in db.HJGL_TrainNumberManage on x.TrainNumberId equals train.Id into trains + from train in trains.DefaultIfEmpty() + select new { x, n, t , train }; if (filter != null) { @@ -510,7 +512,7 @@ namespace BLL } if (!string.IsNullOrEmpty(filter.ReceiveMan)) { - baseQuery = baseQuery.Where(z => z.x.ReceiveMan == filter.ReceiveMan || (z.t != null && z.t.PersonName.Contains(filter.ReceiveMan))); + baseQuery = baseQuery.Where(z => z.train.ContactName == filter.ReceiveMan || (z.train != null && z.train.ContactName.Contains(filter.ReceiveMan))); } if (!string.IsNullOrEmpty(filter.ReceiveDate)) { @@ -524,7 +526,7 @@ namespace BLL } if (!string.IsNullOrEmpty(filter.TrainNumberId)) { - baseQuery = baseQuery.Where(z => z.x.TrainNumber != null && z.x.TrainNumber.Contains(filter.TrainNumberId)); + baseQuery = baseQuery.Where(z => z.train.Id != null && z.train.Id.Contains(filter.TrainNumberId)); } } @@ -540,9 +542,9 @@ namespace BLL ContactPhone = z.x.ContactPhone, StackingPosition = z.x.StackingPosition, State = z.x.State, - ReceiveMan = z.t.PersonName, + ReceiveMan = z.train.ContactName, ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate), - TrainNumber = z.x.TrainNumber, + TrainNumber = z.train.TrainNumber, }).Distinct(); totalCount = q.Count(); diff --git a/SGGL/BLL/HJGL/TestPackage/TestPackagePrintService.cs b/SGGL/BLL/HJGL/TestPackage/TestPackagePrintService.cs index f08e7895..b69b4495 100644 --- a/SGGL/BLL/HJGL/TestPackage/TestPackagePrintService.cs +++ b/SGGL/BLL/HJGL/TestPackage/TestPackagePrintService.cs @@ -593,16 +593,17 @@ namespace BLL var q = iosList[0]; var isoNos = string.Join(",", iosList.Select(x => x.PipelineCode).ToArray()); var isoIds = string.Join("','", iosList.Select(x => x.PipelineId).ToArray()); + var pipelineIdList = iosList.Select(x => x.PipelineId).ToList(); // 修复:创建实际的ID列表 //获取打底和盖面的焊工单位名称 var CoverWelderUnitName = (from x in Funs.DB.HJGL_WeldJoint join y in Funs.DB.SitePerson_Person on x.CoverWelderId equals y.PersonId join z in Funs.DB.Base_Unit on y.UnitId equals z.UnitId - where isoIds.Contains(x.PipelineId) + where pipelineIdList.Contains(x.PipelineId) // 修复:使用实际的列表 select z.UnitName ).Distinct().ToList(); var BackingWelderUnitName = (from x in Funs.DB.HJGL_WeldJoint join y in Funs.DB.SitePerson_Person on x.BackingWelderId equals y.PersonId join z in Funs.DB.Base_Unit on y.UnitId equals z.UnitId - where isoIds.Contains(x.PipelineId) + where pipelineIdList.Contains(x.PipelineId) // 修复:使用实际的列表 select z.UnitName).Distinct().ToList(); CoverWelderUnitName.AddRange(BackingWelderUnitName); Dictionary keyValuePairs = new Dictionary(); From 6aa4cc93bcb581ec66e814307432ab7a9087d87e Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Tue, 23 Dec 2025 16:33:37 +0800 Subject: [PATCH 3/4] 1 --- DataBase/版本日志/SGGLDB_V2025-12-20.sql | 36 +++ SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 2 +- SGGL/Model/Model.cs | 385 +++++++++++++++++++++++ 3 files changed, 422 insertions(+), 1 deletion(-) diff --git a/DataBase/版本日志/SGGLDB_V2025-12-20.sql b/DataBase/版本日志/SGGLDB_V2025-12-20.sql index 83d9a18f..1457e7be 100644 --- a/DataBase/版本日志/SGGLDB_V2025-12-20.sql +++ b/DataBase/版本日志/SGGLDB_V2025-12-20.sql @@ -34,3 +34,39 @@ CREATE TABLE [dbo].[Project_Devices]( GO +Alter TABLE [dbo].[Person_Persons] +add [YunMouState] [nvarchar](50) NULL +GO + + + + +CREATE TABLE [dbo].[Kqgl_DateManage]( + [Id] [nvarchar](50) NOT NULL, + [ProjectId] [nvarchar](50) NULL, + [AmStartTime1] [time](7) NULL, + [AmStartTime2] [time](7) NULL, + [AmEndTime1] [time](7) NULL, + [AmEndTime2] [time](7) NULL, + [PmStartTime1] [time](7) NULL, + [PmStartTime2] [time](7) NULL, + [PmEndTime1] [time](7) NULL, + [PmEndTime2] [time](7) NULL, + [LateTime] [int] NULL, + [LeaveTime] [int] NULL, + [EquipmentCode] [nvarchar](500) NULL, + CONSTRAINT [PK_Kqgl_DateManage] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] + +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'允许迟到' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Kqgl_DateManage', @level2type=N'COLUMN',@level2name=N'LateTime' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'允许早退' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Kqgl_DateManage', @level2type=N'COLUMN',@level2name=N'LeaveTime' +GO + + diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index ba58f7e9..a4dfcd34 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -16838,7 +16838,7 @@ - + diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 9d3b943d..d873c5d0 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -914,6 +914,9 @@ namespace Model partial void InsertInterFaceTask(InterFaceTask instance); partial void UpdateInterFaceTask(InterFaceTask instance); partial void DeleteInterFaceTask(InterFaceTask instance); + partial void InsertKqgl_DateManage(Kqgl_DateManage instance); + partial void UpdateKqgl_DateManage(Kqgl_DateManage instance); + partial void DeleteKqgl_DateManage(Kqgl_DateManage instance); partial void InsertLaw_HSSEStandardsList(Law_HSSEStandardsList instance); partial void UpdateLaw_HSSEStandardsList(Law_HSSEStandardsList instance); partial void DeleteLaw_HSSEStandardsList(Law_HSSEStandardsList instance); @@ -4292,6 +4295,14 @@ namespace Model } } + public System.Data.Linq.Table Kqgl_DateManage + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Law_HSSEStandardsList { get @@ -144327,6 +144338,356 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Kqgl_DateManage")] + public partial class Kqgl_DateManage : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _Id; + + private string _ProjectId; + + private System.Nullable _AmStartTime1; + + private System.Nullable _AmStartTime2; + + private System.Nullable _AmEndTime1; + + private System.Nullable _AmEndTime2; + + private System.Nullable _PmStartTime1; + + private System.Nullable _PmStartTime2; + + private System.Nullable _PmEndTime1; + + private System.Nullable _PmEndTime2; + + private System.Nullable _LateTime; + + private System.Nullable _LeaveTime; + + private string _EquipmentCode; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnIdChanging(string value); + partial void OnIdChanged(); + partial void OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); + partial void OnAmStartTime1Changing(System.Nullable value); + partial void OnAmStartTime1Changed(); + partial void OnAmStartTime2Changing(System.Nullable value); + partial void OnAmStartTime2Changed(); + partial void OnAmEndTime1Changing(System.Nullable value); + partial void OnAmEndTime1Changed(); + partial void OnAmEndTime2Changing(System.Nullable value); + partial void OnAmEndTime2Changed(); + partial void OnPmStartTime1Changing(System.Nullable value); + partial void OnPmStartTime1Changed(); + partial void OnPmStartTime2Changing(System.Nullable value); + partial void OnPmStartTime2Changed(); + partial void OnPmEndTime1Changing(System.Nullable value); + partial void OnPmEndTime1Changed(); + partial void OnPmEndTime2Changing(System.Nullable value); + partial void OnPmEndTime2Changed(); + partial void OnLateTimeChanging(System.Nullable value); + partial void OnLateTimeChanged(); + partial void OnLeaveTimeChanging(System.Nullable value); + partial void OnLeaveTimeChanged(); + partial void OnEquipmentCodeChanging(string value); + partial void OnEquipmentCodeChanged(); + #endregion + + public Kqgl_DateManage() + { + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string Id + { + get + { + return this._Id; + } + set + { + if ((this._Id != value)) + { + this.OnIdChanging(value); + this.SendPropertyChanging(); + this._Id = value; + this.SendPropertyChanged("Id"); + this.OnIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AmStartTime1", DbType="Time(7)")] + public System.Nullable AmStartTime1 + { + get + { + return this._AmStartTime1; + } + set + { + if ((this._AmStartTime1 != value)) + { + this.OnAmStartTime1Changing(value); + this.SendPropertyChanging(); + this._AmStartTime1 = value; + this.SendPropertyChanged("AmStartTime1"); + this.OnAmStartTime1Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AmStartTime2", DbType="Time(7)")] + public System.Nullable AmStartTime2 + { + get + { + return this._AmStartTime2; + } + set + { + if ((this._AmStartTime2 != value)) + { + this.OnAmStartTime2Changing(value); + this.SendPropertyChanging(); + this._AmStartTime2 = value; + this.SendPropertyChanged("AmStartTime2"); + this.OnAmStartTime2Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AmEndTime1", DbType="Time(7)")] + public System.Nullable AmEndTime1 + { + get + { + return this._AmEndTime1; + } + set + { + if ((this._AmEndTime1 != value)) + { + this.OnAmEndTime1Changing(value); + this.SendPropertyChanging(); + this._AmEndTime1 = value; + this.SendPropertyChanged("AmEndTime1"); + this.OnAmEndTime1Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AmEndTime2", DbType="Time(7)")] + public System.Nullable AmEndTime2 + { + get + { + return this._AmEndTime2; + } + set + { + if ((this._AmEndTime2 != value)) + { + this.OnAmEndTime2Changing(value); + this.SendPropertyChanging(); + this._AmEndTime2 = value; + this.SendPropertyChanged("AmEndTime2"); + this.OnAmEndTime2Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmStartTime1", DbType="Time(7)")] + public System.Nullable PmStartTime1 + { + get + { + return this._PmStartTime1; + } + set + { + if ((this._PmStartTime1 != value)) + { + this.OnPmStartTime1Changing(value); + this.SendPropertyChanging(); + this._PmStartTime1 = value; + this.SendPropertyChanged("PmStartTime1"); + this.OnPmStartTime1Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmStartTime2", DbType="Time(7)")] + public System.Nullable PmStartTime2 + { + get + { + return this._PmStartTime2; + } + set + { + if ((this._PmStartTime2 != value)) + { + this.OnPmStartTime2Changing(value); + this.SendPropertyChanging(); + this._PmStartTime2 = value; + this.SendPropertyChanged("PmStartTime2"); + this.OnPmStartTime2Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmEndTime1", DbType="Time(7)")] + public System.Nullable PmEndTime1 + { + get + { + return this._PmEndTime1; + } + set + { + if ((this._PmEndTime1 != value)) + { + this.OnPmEndTime1Changing(value); + this.SendPropertyChanging(); + this._PmEndTime1 = value; + this.SendPropertyChanged("PmEndTime1"); + this.OnPmEndTime1Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmEndTime2", DbType="Time(7)")] + public System.Nullable PmEndTime2 + { + get + { + return this._PmEndTime2; + } + set + { + if ((this._PmEndTime2 != value)) + { + this.OnPmEndTime2Changing(value); + this.SendPropertyChanging(); + this._PmEndTime2 = value; + this.SendPropertyChanged("PmEndTime2"); + this.OnPmEndTime2Changed(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LateTime", DbType="Int")] + public System.Nullable LateTime + { + get + { + return this._LateTime; + } + set + { + if ((this._LateTime != value)) + { + this.OnLateTimeChanging(value); + this.SendPropertyChanging(); + this._LateTime = value; + this.SendPropertyChanged("LateTime"); + this.OnLateTimeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LeaveTime", DbType="Int")] + public System.Nullable LeaveTime + { + get + { + return this._LeaveTime; + } + set + { + if ((this._LeaveTime != value)) + { + this.OnLeaveTimeChanging(value); + this.SendPropertyChanging(); + this._LeaveTime = value; + this.SendPropertyChanged("LeaveTime"); + this.OnLeaveTimeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EquipmentCode", DbType="NVarChar(500)")] + public string EquipmentCode + { + get + { + return this._EquipmentCode; + } + set + { + if ((this._EquipmentCode != value)) + { + this.OnEquipmentCodeChanging(value); + this.SendPropertyChanging(); + this._EquipmentCode = value; + this.SendPropertyChanged("EquipmentCode"); + this.OnEquipmentCodeChanged(); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Law_HSSEStandardsList")] public partial class Law_HSSEStandardsList : INotifyPropertyChanging, INotifyPropertyChanged { @@ -167237,6 +167598,8 @@ namespace Model private System.Nullable _IsInspectionBrigade; + private string _YunMouState; + private EntitySet _Accident_AccidentHandle; private EntitySet _Accident_AccidentPersonRecord; @@ -167851,6 +168214,8 @@ namespace Model partial void OnLogMachineIdChanged(); partial void OnIsInspectionBrigadeChanging(System.Nullable value); partial void OnIsInspectionBrigadeChanged(); + partial void OnYunMouStateChanging(string value); + partial void OnYunMouStateChanged(); #endregion public Person_Persons() @@ -169433,6 +169798,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouState", DbType="NVarChar(50)")] + public string YunMouState + { + get + { + return this._YunMouState; + } + set + { + if ((this._YunMouState != value)) + { + this.OnYunMouStateChanging(value); + this.SendPropertyChanging(); + this._YunMouState = value; + this.SendPropertyChanged("YunMouState"); + this.OnYunMouStateChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentHandle_Person_Persons", Storage="_Accident_AccidentHandle", ThisKey="PersonId", OtherKey="CompileMan", DeleteRule="NO ACTION")] public EntitySet Accident_AccidentHandle { From 984a1932130a8840149652cc152ffd5ccd3e40c6 Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Tue, 23 Dec 2025 17:16:35 +0800 Subject: [PATCH 4/4] =?UTF-8?q?perf=EF=BC=9A=E4=BC=98=E5=8C=96=E7=84=8A?= =?UTF-8?q?=E6=8E=A5=E9=A6=96=E9=A1=B5=E5=8A=A0=E8=BD=BD=E9=80=9F=E5=BA=A6?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/.claude/settings.local.json | 3 +- .../common/mainMenu_HJGL3.aspx.cs | 368 ++++++++++++++---- 2 files changed, 288 insertions(+), 83 deletions(-) diff --git a/SGGL/.claude/settings.local.json b/SGGL/.claude/settings.local.json index c4bae7e3..45798113 100644 --- a/SGGL/.claude/settings.local.json +++ b/SGGL/.claude/settings.local.json @@ -11,7 +11,8 @@ "Bash(cat:*)", "Bash(pip install:*)", "Bash(msbuild:*)", - "Bash(\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe\":*)" + "Bash(\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe\":*)", + "Bash(\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe\" \"D:\\数据\\诺必达\\赛鼎\\SGGL_SeDin_New\\SGGL\\FineUIPro.Web\\FineUIPro.Web.csproj\" /t:Build /p:Configuration=Release /nologo /v:minimal)" ], "deny": [], "ask": [] diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs index 8e5cfd25..f5ee4fe7 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL3.aspx.cs @@ -30,6 +30,7 @@ namespace FineUIPro.Web.common #region 加载树装置-单位-工作区 /// /// 加载树 + /// 优化版本:解决 N+1 查询问题,一次性获取所有管线统计数据 /// private void InitTreeMenu() { @@ -49,6 +50,13 @@ namespace FineUIPro.Web.common rootNode2.Expanded = true; this.tvControlItem.Nodes.Add(rootNode2); + // 优化:一次性获取所有管线统计数据,避免 N+1 查询 + var pipelineCountByUnitWork = (from x in Funs.DB.HJGL_Pipeline + where x.ProjectId == this.CurrUser.LoginProjectId + group x by x.UnitWorkId into g + select new { UnitWorkId = g.Key, Count = g.Count() }) + .ToDictionary(x => x.UnitWorkId, x => x.Count); + var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); // 获取当前用户所在单位 var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId); @@ -61,27 +69,15 @@ namespace FineUIPro.Web.common List unitWork1 = null; List unitWork2 = null; - //// 当前为施工单位,只能操作本单位的数据 - //if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2) - //{ - // unitWork1 = (from x in unitWorkList - // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1" - // select x).ToList(); - // unitWork2 = (from x in unitWorkList - // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2" - // select x).ToList(); - //} - //else - //{ unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList(); unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList(); - //} if (unitWork1.Count() > 0) { foreach (var q in unitWork1) { - int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count(); + // 优化:从内存字典中获取管线数量,避免数据库查询 + int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn1 = new TreeNode(); tn1.NodeID = q.UnitWorkId; @@ -95,7 +91,8 @@ namespace FineUIPro.Web.common { foreach (var q in unitWork2) { - int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId select x).Count(); + // 优化:从内存字典中获取管线数量,避免数据库查询 + int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn2 = new TreeNode(); tn2.NodeID = q.UnitWorkId; @@ -125,7 +122,8 @@ namespace FineUIPro.Web.common #region 数据绑定 /// - /// 数据绑定 + /// 数据绑定 - 项目进度统计 + /// 优化版本:使用 CTE 和 JOIN 替代嵌套子查询,提高性能 /// private void BindGrid1() { @@ -133,25 +131,87 @@ namespace FineUIPro.Web.common List listStr = new List(); if (this.rbType.SelectedValue == "1") { - strSql = @"select ProjectId,TotalDin,TodayFinishSize,FinishSize,CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(TotalDin,0) WHEN 0 THEN 0 - ELSE 100.0 * ISNULL(FinishSize,0)/(1.0 * TotalDin) END) AS DECIMAL(8,2))))+'%' - AS Rate from - (select b.ProjectId,CAST((SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint WHERE ProjectId=b.ProjectId) AS DECIMAL(12,3)) AS TotalDin, -CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE jot.ProjectId=b.ProjectId AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate=@WeldingDate) AS DECIMAL(12,3)) AS TodayFinishSize, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE jot.ProjectId=b.ProjectId AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingDate) AS DECIMAL(12,3)) AS FinishSize - from Base_Project b) v where ProjectId=@ProjectId "; + // 优化:使用 CTE 和 LEFT JOIN 替代嵌套子查询 + strSql = @" +WITH AllWeldJoints AS ( + -- 所有焊口总量 + SELECT ProjectId, SUM(ISNULL(Size, 0)) AS TotalDin + FROM dbo.HJGL_WeldJoint + WHERE ProjectId = @ProjectId + GROUP BY ProjectId +), +TodayWelding AS ( + -- 当日焊接记录(返回 WeldingDailyId) + SELECT wd.WeldingDailyId + FROM dbo.HJGL_WeldingDaily wd + WHERE wd.ProjectId = @ProjectId AND wd.WeldingDate = @WeldingDate +), +TodayWeldJoints AS ( + -- 当日完成焊口 + SELECT jot.ProjectId, SUM(ISNULL(jot.Size, 0)) AS TodayFinishSize + FROM dbo.HJGL_WeldJoint jot + INNER JOIN TodayWelding tw ON jot.WeldingDailyId = tw.WeldingDailyId + WHERE jot.ProjectId = @ProjectId AND jot.WeldingDailyId IS NOT NULL + GROUP BY jot.ProjectId +), +CumulativeWeldJoints AS ( + -- 累计完成焊口 + SELECT jot.ProjectId, SUM(ISNULL(jot.Size, 0)) AS FinishSize + FROM dbo.HJGL_WeldJoint jot + INNER JOIN dbo.HJGL_WeldingDaily wd ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE jot.ProjectId = @ProjectId AND jot.WeldingDailyId IS NOT NULL AND wd.WeldingDate <= @WeldingDate + GROUP BY jot.ProjectId +) +SELECT b.ProjectId, + ISNULL(aw.TotalDin, 0) AS TotalDin, + ISNULL(tw.TodayFinishSize, 0) AS TodayFinishSize, + ISNULL(cw.FinishSize, 0) AS FinishSize, + CONVERT(NVARCHAR(10), CAST(CASE ISNULL(aw.TotalDin, 0) WHEN 0 THEN 0 + ELSE 100.0 * ISNULL(cw.FinishSize, 0) / (1.0 * aw.TotalDin) END AS DECIMAL(8, 2))) + '%' AS Rate +FROM Base_Project b +LEFT JOIN AllWeldJoints aw ON b.ProjectId = aw.ProjectId +LEFT JOIN TodayWeldJoints tw ON b.ProjectId = tw.ProjectId +LEFT JOIN CumulativeWeldJoints cw ON b.ProjectId = cw.ProjectId +WHERE b.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", (CurrUser != null) ? CurrUser.LoginProjectId : "")); listStr.Add(new SqlParameter("@WeldingDate", this.txtWeldingDate.Text.Trim())); } else { - strSql = @"select ProjectId,TotalDin,TodayFinishSize,FinishSize,CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(TotalDin,0) WHEN 0 THEN 0 - ELSE 100.0 * ISNULL(FinishSize,0)/(1.0 * TotalDin) END) AS DECIMAL(8,2))))+'%' - AS Rate from - (select b.ProjectId,CAST((SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint WHERE ProjectId=b.ProjectId) AS DECIMAL(12,3)) AS TotalDin, -CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE jot.ProjectId=b.ProjectId AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate>=@WeldingStartDate and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS TodayFinishSize, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE jot.ProjectId=b.ProjectId AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS FinishSize - from Base_Project b) v where ProjectId=@ProjectId "; + // 优化:使用 CTE 和 LEFT JOIN 替代嵌套子查询(时间段模式) + strSql = @" +WITH AllWeldJoints AS ( + SELECT ProjectId, SUM(ISNULL(Size, 0)) AS TotalDin + FROM dbo.HJGL_WeldJoint + WHERE ProjectId = @ProjectId + GROUP BY ProjectId +), +PeriodWeldJoints AS ( + SELECT jot.ProjectId, SUM(ISNULL(jot.Size, 0)) AS TodayFinishSize + FROM dbo.HJGL_WeldJoint jot + INNER JOIN dbo.HJGL_WeldingDaily wd ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE jot.ProjectId = @ProjectId AND jot.WeldingDailyId IS NOT NULL + AND wd.WeldingDate >= @WeldingStartDate AND wd.WeldingDate <= @WeldingEndDate + GROUP BY jot.ProjectId +), +CumulativeWeldJoints AS ( + SELECT jot.ProjectId, SUM(ISNULL(jot.Size, 0)) AS FinishSize + FROM dbo.HJGL_WeldJoint jot + INNER JOIN dbo.HJGL_WeldingDaily wd ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE jot.ProjectId = @ProjectId AND jot.WeldingDailyId IS NOT NULL AND wd.WeldingDate <= @WeldingEndDate + GROUP BY jot.ProjectId +) +SELECT b.ProjectId, + ISNULL(aw.TotalDin, 0) AS TotalDin, + ISNULL(pw.TodayFinishSize, 0) AS TodayFinishSize, + ISNULL(cw.FinishSize, 0) AS FinishSize, + CONVERT(NVARCHAR(10), CAST(CASE ISNULL(aw.TotalDin, 0) WHEN 0 THEN 0 + ELSE 100.0 * ISNULL(cw.FinishSize, 0) / (1.0 * aw.TotalDin) END AS DECIMAL(8, 2))) + '%' AS Rate +FROM Base_Project b +LEFT JOIN AllWeldJoints aw ON b.ProjectId = aw.ProjectId +LEFT JOIN PeriodWeldJoints pw ON b.ProjectId = pw.ProjectId +LEFT JOIN CumulativeWeldJoints cw ON b.ProjectId = cw.ProjectId +WHERE b.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", (CurrUser != null) ? CurrUser.LoginProjectId : "")); listStr.Add(new SqlParameter("@WeldingStartDate", this.txtWeldingStartDate.Text.Trim())); listStr.Add(new SqlParameter("@WeldingEndDate", this.txtWeldingEndDate.Text.Trim())); @@ -163,14 +223,18 @@ CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left var table = GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; Grid1.DataBind(); - decimal totalDin = Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[0].ToString()); - decimal finishSize = Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[2].ToString()); - decimal notCompleteDin = totalDin - finishSize; - this.lbNotCompleteDinTotal.Text = notCompleteDin.ToString(); + if (Grid1.Rows.Count > 0) + { + decimal totalDin = Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[0].ToString()); + decimal finishSize = Funs.GetNewDecimalOrZero(this.Grid1.Rows[0].Values[2].ToString()); + decimal notCompleteDin = totalDin - finishSize; + this.lbNotCompleteDinTotal.Text = notCompleteDin.ToString(); + } } /// - /// 数据绑定 + /// 数据绑定 - 单位工程进度统计 + /// 优化版本:使用 CTE 替代复杂嵌套子查询,提高性能 /// private void BindGrid2(string unitWorkId) { @@ -178,41 +242,128 @@ CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left List listStr = new List(); if (this.rbType.SelectedValue == "1") { - strSql = @"select '工厂预制焊口' as PipeArea,UnitWorkId,TotalDin,TodayFinishSize,FinishSize,CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(TotalDin,0) WHEN 0 THEN 0 - ELSE 100.0 * ISNULL(FinishSize,0)/(1.0 * TotalDin) END) AS DECIMAL(8,2))))+'%' - AS Rate from - (select b.UnitWorkId,CAST((SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='预制口') AS DECIMAL(12,3)) AS TotalDin, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='预制口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate=@WeldingDate) AS DECIMAL(12,3)) AS TodayFinishSize, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='预制口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingDate) AS DECIMAL(12,3)) AS FinishSize - from WBS_UnitWork b) v where UnitWorkId=@UnitWorkId -union -select '现场施工焊口' as PipeArea,UnitWorkId,TotalDin,TodayFinishSize,FinishSize,CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(TotalDin,0) WHEN 0 THEN 0 - ELSE 100.0 * ISNULL(FinishSize,0)/(1.0 * TotalDin) END) AS DECIMAL(8,2))))+'%' - AS Rate from - (select b.UnitWorkId,CAST((SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='2')+(SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='安装口') AS DECIMAL(12,3)) AS TotalDin, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='2' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate=@WeldingDate)+(SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='安装口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate=@WeldingDate) AS DECIMAL(12,3)) AS TodayFinishSize, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='2' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingDate)+(SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='安装口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingDate) AS DECIMAL(12,3)) AS FinishSize - from WBS_UnitWork b) v where UnitWorkId=@UnitWorkId"; + // 优化:使用 CTE 和条件聚合替代 UNION 和嵌套子查询 + strSql = @" +WITH UnitWorkData AS ( + -- 获取单位工程的管线数据 + SELECT p.PipelineId, p.PipeArea, p.UnitWorkId + FROM dbo.HJGL_Pipeline p + WHERE p.UnitWorkId = @UnitWorkId +), +JointData AS ( + -- 获取焊口数据并分类 + SELECT + j.WeldJointId, + j.Size, + j.WeldingDailyId, + j.JointAttribute, + p.PipeArea, + p.UnitWorkId + FROM dbo.HJGL_WeldJoint j + INNER JOIN UnitWorkData p ON j.PipelineId = p.PipelineId +), +WeldingInfo AS ( + -- 焊接日期信息 + SELECT wd.WeldingDailyId, wd.WeldingDate + FROM dbo.HJGL_WeldingDaily wd + WHERE wd.WeldingDate = @WeldingDate +), +Stats AS ( + SELECT + ud.UnitWorkId, + -- 工厂预制总量 + SUM(CASE WHEN ud.PipeArea = '1' AND jd.JointAttribute = '预制口' THEN ISNULL(jd.Size, 0) ELSE 0 END) AS FactoryTotal, + -- 现场施工总量 (PipeArea='2' 或 PipeArea='1' 且为安装口) + SUM(CASE WHEN ud.PipeArea = '2' OR (ud.PipeArea = '1' AND jd.JointAttribute = '安装口') THEN ISNULL(jd.Size, 0) ELSE 0 END) AS SiteTotal, + -- 工厂预制当日完成 + SUM(CASE WHEN ud.PipeArea = '1' AND jd.JointAttribute = '预制口' AND jd.WeldingDailyId IS NOT NULL AND wi.WeldingDailyId IS NOT NULL THEN ISNULL(jd.Size, 0) ELSE 0 END) AS FactoryToday, + -- 现场施工当日完成 + SUM(CASE WHEN (ud.PipeArea = '2' OR (ud.PipeArea = '1' AND jd.JointAttribute = '安装口')) AND jd.WeldingDailyId IS NOT NULL AND wi.WeldingDailyId IS NOT NULL THEN ISNULL(jd.Size, 0) ELSE 0 END) AS SiteToday, + -- 工厂预制累计完成 + SUM(CASE WHEN ud.PipeArea = '1' AND jd.JointAttribute = '预制口' AND jd.WeldingDailyId IS NOT NULL THEN ISNULL(jd.Size, 0) ELSE 0 END) AS FactoryCumulative, + -- 现场施工累计完成 + SUM(CASE WHEN (ud.PipeArea = '2' OR (ud.PipeArea = '1' AND jd.JointAttribute = '安装口')) AND jd.WeldingDailyId IS NOT NULL THEN ISNULL(jd.Size, 0) ELSE 0 END) AS SiteCumulative + FROM UnitWorkData ud + LEFT JOIN JointData jd ON ud.PipelineId = jd.PipelineId + LEFT JOIN WeldingInfo wi ON jd.WeldingDailyId = wi.WeldingDailyId + GROUP BY ud.UnitWorkId +) +SELECT '工厂预制焊口' AS PipeArea, UnitWorkId, + CAST(ISNULL(FactoryTotal, 0) AS DECIMAL(12, 3)) AS TotalDin, + CAST(ISNULL(FactoryToday, 0) AS DECIMAL(12, 3)) AS TodayFinishSize, + CAST(ISNULL(FactoryCumulative, 0) AS DECIMAL(12, 3)) AS FinishSize, + CONVERT(NVARCHAR(10), CAST(CASE ISNULL(FactoryTotal, 0) WHEN 0 THEN 0 + ELSE 100.0 * ISNULL(FactoryCumulative, 0) / (1.0 * FactoryTotal) END AS DECIMAL(8, 2))) + '%' AS Rate +FROM Stats +WHERE UnitWorkId = @UnitWorkId +UNION ALL +SELECT '现场施工焊口' AS PipeArea, UnitWorkId, + CAST(ISNULL(SiteTotal, 0) AS DECIMAL(12, 3)) AS TotalDin, + CAST(ISNULL(SiteToday, 0) AS DECIMAL(12, 3)) AS TodayFinishSize, + CAST(ISNULL(SiteCumulative, 0) AS DECIMAL(12, 3)) AS FinishSize, + CONVERT(NVARCHAR(10), CAST(CASE ISNULL(SiteTotal, 0) WHEN 0 THEN 0 + ELSE 100.0 * ISNULL(SiteCumulative, 0) / (1.0 * SiteTotal) END AS DECIMAL(8, 2))) + '%' AS Rate +FROM Stats +WHERE UnitWorkId = @UnitWorkId"; listStr.Add(new SqlParameter("@UnitWorkId", unitWorkId)); listStr.Add(new SqlParameter("@WeldingDate", this.txtWeldingDate.Text.Trim())); } else { - strSql = @"select '工厂预制焊口' as PipeArea,UnitWorkId,TotalDin,TodayFinishSize,FinishSize,CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(TotalDin,0) WHEN 0 THEN 0 - ELSE 100.0 * ISNULL(FinishSize,0)/(1.0 * TotalDin) END) AS DECIMAL(8,2))))+'%' - AS Rate from - (select b.UnitWorkId,CAST((SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='预制口') AS DECIMAL(12,3)) AS TotalDin, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='预制口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate>=@WeldingStartDate and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS TodayFinishSize, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='预制口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS FinishSize - from WBS_UnitWork b) v where UnitWorkId=@UnitWorkId -union -select '现场施工焊口' as PipeArea,UnitWorkId,TotalDin,TodayFinishSize,FinishSize,CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(TotalDin,0) WHEN 0 THEN 0 - ELSE 100.0 * ISNULL(FinishSize,0)/(1.0 * TotalDin) END) AS DECIMAL(8,2))))+'%' - AS Rate from - (select b.UnitWorkId,CAST((SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='2')+(SELECT ISNULL(SUM(ISNULL(Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='安装口') AS DECIMAL(12,3)) AS TotalDin, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='2' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate>=@WeldingStartDate and d.WeldingDate<=@WeldingEndDate)+(SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='安装口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate>=@WeldingStartDate and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS TodayFinishSize, - CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='2' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingEndDate)+(SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_Pipeline pipeline on jot.PipelineId=pipeline.PipelineId left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE pipeline.UnitWorkId=b.UnitWorkId and PipeArea='1' and jot.JointAttribute='安装口' AND jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS FinishSize - from WBS_UnitWork b) v where UnitWorkId=@UnitWorkId"; + // 优化:使用 CTE 和条件聚合(时间段模式) + strSql = @" +WITH UnitWorkData AS ( + SELECT p.PipelineId, p.PipeArea, p.UnitWorkId + FROM dbo.HJGL_Pipeline p + WHERE p.UnitWorkId = @UnitWorkId +), +JointData AS ( + SELECT + j.WeldJointId, + j.Size, + j.WeldingDailyId, + j.JointAttribute, + p.PipeArea, + p.UnitWorkId + FROM dbo.HJGL_WeldJoint j + INNER JOIN UnitWorkData p ON j.PipelineId = p.PipelineId +), +WeldingInfo AS ( + SELECT wd.WeldingDailyId, wd.WeldingDate + FROM dbo.HJGL_WeldingDaily wd + WHERE wd.WeldingDate >= @WeldingStartDate AND wd.WeldingDate <= @WeldingEndDate +), +Stats AS ( + SELECT + ud.UnitWorkId, + SUM(CASE WHEN ud.PipeArea = '1' AND jd.JointAttribute = '预制口' THEN ISNULL(jd.Size, 0) ELSE 0 END) AS FactoryTotal, + SUM(CASE WHEN ud.PipeArea = '2' OR (ud.PipeArea = '1' AND jd.JointAttribute = '安装口') THEN ISNULL(jd.Size, 0) ELSE 0 END) AS SiteTotal, + SUM(CASE WHEN ud.PipeArea = '1' AND jd.JointAttribute = '预制口' AND jd.WeldingDailyId IS NOT NULL AND wi.WeldingDailyId IS NOT NULL THEN ISNULL(jd.Size, 0) ELSE 0 END) AS FactoryToday, + SUM(CASE WHEN (ud.PipeArea = '2' OR (ud.PipeArea = '1' AND jd.JointAttribute = '安装口')) AND jd.WeldingDailyId IS NOT NULL AND wi.WeldingDailyId IS NOT NULL THEN ISNULL(jd.Size, 0) ELSE 0 END) AS SiteToday, + SUM(CASE WHEN ud.PipeArea = '1' AND jd.JointAttribute = '预制口' AND jd.WeldingDailyId IS NOT NULL AND wi.WeldingDate <= @WeldingEndDate THEN ISNULL(jd.Size, 0) ELSE 0 END) AS FactoryCumulative, + SUM(CASE WHEN (ud.PipeArea = '2' OR (ud.PipeArea = '1' AND jd.JointAttribute = '安装口')) AND jd.WeldingDailyId IS NOT NULL AND wi.WeldingDate <= @WeldingEndDate THEN ISNULL(jd.Size, 0) ELSE 0 END) AS SiteCumulative + FROM UnitWorkData ud + LEFT JOIN JointData jd ON ud.PipelineId = jd.PipelineId + LEFT JOIN WeldingInfo wi ON jd.WeldingDailyId = wi.WeldingDailyId + GROUP BY ud.UnitWorkId +) +SELECT '工厂预制焊口' AS PipeArea, UnitWorkId, + CAST(ISNULL(FactoryTotal, 0) AS DECIMAL(12, 3)) AS TotalDin, + CAST(ISNULL(FactoryToday, 0) AS DECIMAL(12, 3)) AS TodayFinishSize, + CAST(ISNULL(FactoryCumulative, 0) AS DECIMAL(12, 3)) AS FinishSize, + CONVERT(NVARCHAR(10), CAST(CASE ISNULL(FactoryTotal, 0) WHEN 0 THEN 0 + ELSE 100.0 * ISNULL(FactoryCumulative, 0) / (1.0 * FactoryTotal) END AS DECIMAL(8, 2))) + '%' AS Rate +FROM Stats +WHERE UnitWorkId = @UnitWorkId +UNION ALL +SELECT '现场施工焊口' AS PipeArea, UnitWorkId, + CAST(ISNULL(SiteTotal, 0) AS DECIMAL(12, 3)) AS TotalDin, + CAST(ISNULL(SiteToday, 0) AS DECIMAL(12, 3)) AS TodayFinishSize, + CAST(ISNULL(SiteCumulative, 0) AS DECIMAL(12, 3)) AS FinishSize, + CONVERT(NVARCHAR(10), CAST(CASE ISNULL(SiteTotal, 0) WHEN 0 THEN 0 + ELSE 100.0 * ISNULL(SiteCumulative, 0) / (1.0 * SiteTotal) END AS DECIMAL(8, 2))) + '%' AS Rate +FROM Stats +WHERE UnitWorkId = @UnitWorkId"; listStr.Add(new SqlParameter("@UnitWorkId", unitWorkId)); listStr.Add(new SqlParameter("@WeldingStartDate", this.txtWeldingStartDate.Text.Trim())); listStr.Add(new SqlParameter("@WeldingEndDate", this.txtWeldingEndDate.Text.Trim())); @@ -230,15 +381,19 @@ select '现场施工焊口' as PipeArea,UnitWorkId,TotalDin,TodayFinishSize,Fini decimal finishSize1 = Funs.GetNewDecimalOrZero(this.Grid2.Rows[0].Values[3].ToString()); decimal notCompleteDin1 = totalDin1 - finishSize1; this.lbNotCompleteDin1.Text = notCompleteDin1.ToString(); - decimal totalDin2 = Funs.GetNewDecimalOrZero(this.Grid2.Rows[1].Values[1].ToString()); - decimal finishSize2 = Funs.GetNewDecimalOrZero(this.Grid2.Rows[1].Values[3].ToString()); - decimal notCompleteDin2 = totalDin2 - finishSize2; - this.lbNotCompleteDin2.Text = notCompleteDin2.ToString(); + if (Grid2.Rows.Count > 1) + { + decimal totalDin2 = Funs.GetNewDecimalOrZero(this.Grid2.Rows[1].Values[1].ToString()); + decimal finishSize2 = Funs.GetNewDecimalOrZero(this.Grid2.Rows[1].Values[3].ToString()); + decimal notCompleteDin2 = totalDin2 - finishSize2; + this.lbNotCompleteDin2.Text = notCompleteDin2.ToString(); + } } } /// - /// 数据绑定 + /// 数据绑定 - 施工单位进度统计 + /// 优化版本:使用 CTE 和 JOIN 替代嵌套子查询 /// private void BindGrid3() { @@ -246,23 +401,72 @@ select '现场施工焊口' as PipeArea,UnitWorkId,TotalDin,TodayFinishSize,Fini List listStr = new List(); if (this.rbType.SelectedValue == "1") { - strSql = @"select distinct UnitName, -CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE d.ProjectId=@ProjectId and d.UnitId=b.UnitId and jot.WeldingDailyId IS NOT NULL and d.WeldingDate=@WeldingDate) AS DECIMAL(12,3)) AS TodayFinishSize, -CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE d.ProjectId=@ProjectId and d.UnitId=b.UnitId and jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingDate) AS DECIMAL(12,3)) AS FinishSize - from HJGL_WeldingDaily b - left join Base_Unit u on b.UnitId=u.UnitId - where b.ProjectId=@ProjectId "; + // 优化:使用 CTE 和聚合替代嵌套子查询 + strSql = @" +WITH UnitWeldingDaily AS ( + -- 获取项目的所有焊接日报记录 + SELECT DISTINCT wd.UnitId, u.UnitName + FROM dbo.HJGL_WeldingDaily wd + INNER JOIN Base_Unit u ON wd.UnitId = u.UnitId + WHERE wd.ProjectId = @ProjectId +), +TodayStats AS ( + -- 当日完成统计 + SELECT wd.UnitId, SUM(ISNULL(jot.Size, 0)) AS TodayFinishSize + FROM dbo.HJGL_WeldingDaily wd + INNER JOIN dbo.HJGL_WeldJoint jot ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE wd.ProjectId = @ProjectId AND wd.WeldingDate = @WeldingDate AND jot.WeldingDailyId IS NOT NULL + GROUP BY wd.UnitId +), +CumulativeStats AS ( + -- 累计完成统计 + SELECT wd.UnitId, SUM(ISNULL(jot.Size, 0)) AS FinishSize + FROM dbo.HJGL_WeldingDaily wd + INNER JOIN dbo.HJGL_WeldJoint jot ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE wd.ProjectId = @ProjectId AND wd.WeldingDate <= @WeldingDate AND jot.WeldingDailyId IS NOT NULL + GROUP BY wd.UnitId +) +SELECT uwd.UnitName, + CAST(ISNULL(ts.TodayFinishSize, 0) AS DECIMAL(12, 3)) AS TodayFinishSize, + CAST(ISNULL(cs.FinishSize, 0) AS DECIMAL(12, 3)) AS FinishSize +FROM UnitWeldingDaily uwd +LEFT JOIN TodayStats ts ON uwd.UnitId = ts.UnitId +LEFT JOIN CumulativeStats cs ON uwd.UnitId = cs.UnitId"; listStr.Add(new SqlParameter("@ProjectId", (CurrUser != null) ? CurrUser.LoginProjectId : "")); listStr.Add(new SqlParameter("@WeldingDate", this.txtWeldingDate.Text.Trim())); } else { - strSql = @"select distinct UnitName, -CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE d.ProjectId=@ProjectId and d.UnitId=b.UnitId and jot.WeldingDailyId IS NOT NULL and d.WeldingDate>=@WeldingStartDate and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS TodayFinishSize, -CAST((SELECT ISNULL(SUM(ISNULL(jot.Size,0)),0) FROM dbo.HJGL_WeldJoint jot left join dbo.HJGL_WeldingDaily d on d.WeldingDailyId=jot.WeldingDailyId WHERE d.ProjectId=@ProjectId and d.UnitId=b.UnitId and jot.WeldingDailyId IS NOT NULL and d.WeldingDate<=@WeldingEndDate) AS DECIMAL(12,3)) AS FinishSize - from HJGL_WeldingDaily b - left join Base_Unit u on b.UnitId=u.UnitId - where b.ProjectId=@ProjectId "; + // 优化:使用 CTE 和聚合(时间段模式) + strSql = @" +WITH UnitWeldingDaily AS ( + SELECT DISTINCT wd.UnitId, u.UnitName + FROM dbo.HJGL_WeldingDaily wd + INNER JOIN Base_Unit u ON wd.UnitId = u.UnitId + WHERE wd.ProjectId = @ProjectId +), +PeriodStats AS ( + -- 时间段完成统计 + SELECT wd.UnitId, SUM(ISNULL(jot.Size, 0)) AS TodayFinishSize + FROM dbo.HJGL_WeldingDaily wd + INNER JOIN dbo.HJGL_WeldJoint jot ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE wd.ProjectId = @ProjectId AND wd.WeldingDate >= @WeldingStartDate AND wd.WeldingDate <= @WeldingEndDate AND jot.WeldingDailyId IS NOT NULL + GROUP BY wd.UnitId +), +CumulativeStats AS ( + -- 累计完成统计 + SELECT wd.UnitId, SUM(ISNULL(jot.Size, 0)) AS FinishSize + FROM dbo.HJGL_WeldingDaily wd + INNER JOIN dbo.HJGL_WeldJoint jot ON jot.WeldingDailyId = wd.WeldingDailyId + WHERE wd.ProjectId = @ProjectId AND wd.WeldingDate <= @WeldingEndDate AND jot.WeldingDailyId IS NOT NULL + GROUP BY wd.UnitId +) +SELECT uwd.UnitName, + CAST(ISNULL(ps.TodayFinishSize, 0) AS DECIMAL(12, 3)) AS TodayFinishSize, + CAST(ISNULL(cs.FinishSize, 0) AS DECIMAL(12, 3)) AS FinishSize +FROM UnitWeldingDaily uwd +LEFT JOIN PeriodStats ps ON uwd.UnitId = ps.UnitId +LEFT JOIN CumulativeStats cs ON uwd.UnitId = cs.UnitId"; listStr.Add(new SqlParameter("@ProjectId", (CurrUser != null) ? CurrUser.LoginProjectId : "")); listStr.Add(new SqlParameter("@WeldingStartDate", this.txtWeldingStartDate.Text.Trim())); listStr.Add(new SqlParameter("@WeldingEndDate", this.txtWeldingEndDate.Text.Trim()));