From a05f64004739875855111dd94a3cf67656128736 Mon Sep 17 00:00:00 2001
From: geh <1923421292@qq.com>
Date: Fri, 6 Mar 2026 14:24:20 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=A9=BF=E9=80=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
DataBase/版本日志/SUBQHSE_V2026-02-02-lpf.sql | 91 +
DataBase/版本日志/SUBQHSE_V2026-02-06-geh.sql | 17 +
DataBase/版本日志/SUBQHSE_V2026-02-09-lpf.sql | 17 +
.../SUBQHSE_V2026-02-09-xiaj(DataIdMove).sql | 21 +
.../SUBQHSE_V2026-02-10-xiaj(SP_DataIdMove).sql | 42 +
.../版本日志/SUBQHSE_V2026-02-13-xiaj.sql | 86 +
DataBase/版本日志/SUBQHSE_V2026-02-26-gf.sql | 6 +
DataBase/版本日志/SUBQHSE_V2026-02-27-geh.sql | 78 +
...2026-03-01-xiaj(View_CheckSpecialDetail).sql | 86 +
...-03-03-xiaj(View_License_LicenseManager).sql | 57 +
DataBase/版本日志/SUBQHSE_V2026-03-04-geh.sql | 19 +
SUBQHSE/BLL/BLL.csproj | 10 +
.../BLL/BaseInfo/SuperviseCheckTypeService.cs | 19 +
SUBQHSE/BLL/Common/Const.cs | 18 +-
SUBQHSE/BLL/Common/DataCleanupMergeHelper.cs | 71 +
SUBQHSE/BLL/Common/UploadAttachmentService.cs | 14 +
.../BLL/DataShare/APIDataShareSyncService.cs | 615 +++++++
.../HSSE/APICheckSpecialSyncService.cs | 531 ++++++
.../HSSE/APIHazardRegisterSyncService.cs | 467 +++++
.../DataShare/HSSE/APILicenseSyncService.cs | 265 +++
.../DataShare/HSSE/APIMeetingSyncService.cs | 275 +++
.../DataShare/HSSE/APIPersonSyncService.cs | 574 ++++++
.../HSSE/Check/Check_CheckSpecialService.cs | 13 +-
.../Solution/TemporaryElectricityService.cs | 72 +
SUBQHSE/BLL/OpenService/FileInsertService.cs | 164 +-
SUBQHSE/BLL/ProjectData/ProjectService.cs | 4 +
SUBQHSE/BLL/SQLHelper.cs | 37 +
SUBQHSE/BLL/SysManage/UnitService.cs | 158 +-
.../UnitHazardRegisterItemService.cs | 338 ++++
.../Supervise/UnitHazardRegisterService.cs | 301 +++
SUBQHSE/FineUIPro.Web/BaseInfo/WorkPost.aspx | 6 +
.../FineUIPro.Web/BaseInfo/WorkPost.aspx.cs | 29 +
.../BaseInfo/WorkPost.aspx.designer.cs | 98 +-
.../BaseInfo/WorkPostCleanupMerge.aspx | 161 ++
.../BaseInfo/WorkPostCleanupMerge.aspx.cs | 281 +++
.../WorkPostCleanupMerge.aspx.designer.cs | 224 +++
.../QCManage/QCGroupRegistration.aspx | 2 +-
.../QCGroupRegistration.aspx.designer.cs | 10 +-
.../QCManage/QCGroupRegistrationEdit.aspx | 7 +-
.../QCGroupRegistrationEdit.aspx.designer.cs | 2 +-
.../Excel/DataIn/专项检查明细导入模板.xls | Bin 0 -> 19456 bytes
SUBQHSE/FineUIPro.Web/FineUIPro.Web.csproj | 89 +-
.../HSSE/Check/CheckSpecial.aspx | 2 +
.../HSSE/Check/CheckSpecial.aspx.cs | 13 +
.../HSSE/Check/CheckSpecial.aspx.designer.cs | 9 +
.../HSSE/Check/CheckSpecialDetailIn.aspx | 80 +
.../HSSE/Check/CheckSpecialDetailIn.aspx.cs | 571 ++++++
.../CheckSpecialDetailIn.aspx.designer.cs | 143 ++
.../HSSE/Check/CheckSpecialEdit.aspx | 8 +
.../HSSE/Check/CheckSpecialEdit.aspx.cs | 95 +-
.../Check/CheckSpecialEdit.aspx.designer.cs | 18 +
.../HiddenRectificationList.aspx | 22 +-
.../HiddenRectificationList.aspx.cs | 74 +-
.../HiddenRectificationList.aspx.designer.cs | 36 +
.../HiddenRectificationRectify.aspx.cs | 12 +
.../HSSE/License/LicenseManager.aspx | 15 +
.../HSSE/License/LicenseManager.aspx.cs | 51 +-
.../License/LicenseManager.aspx.designer.cs | 18 +
.../HSSE/License/LicenseManagerEdit.aspx.cs | 9 +-
.../HSSE/License/LicenseManagerView.aspx.cs | 3 +-
.../HSSE/Meeting/ClassMeeting.aspx | 9 +
.../HSSE/Meeting/ClassMeeting.aspx.cs | 85 +-
.../Meeting/ClassMeeting.aspx.designer.cs | 9 +
.../HSSE/Meeting/ClassMeetingEdit.aspx.cs | 10 +-
.../HSSE/Meeting/ClassMeetingView.aspx.cs | 4 +-
.../HSSE/SitePerson/PersonIn.aspx.cs | 16 +
.../HSSE/SitePerson/PersonListEdit.aspx | 4 +-
.../HSSE/SitePerson/PersonListEdit.aspx.cs | 8 +
.../HSSE/Solution/TemporaryElectricity.aspx | 127 ++
.../Solution/TemporaryElectricity.aspx.cs | 240 +++
.../TemporaryElectricity.aspx.designer.cs | 197 ++
.../Solution/TemporaryElectricityEdit.aspx | 102 ++
.../Solution/TemporaryElectricityEdit.aspx.cs | 119 ++
.../TemporaryElectricityEdit.aspx.designer.cs | 188 ++
.../Solution/TemporaryElectricityView.aspx | 100 +
.../Solution/TemporaryElectricityView.aspx.cs | 78 +
.../TemporaryElectricityView.aspx.designer.cs | 179 ++
.../ProjectData/ProjectSetSave.aspx | 9 +
.../ProjectData/ProjectSetSave.aspx.cs | 70 +-
.../ProjectSetSave.aspx.designer.cs | 18 +
SUBQHSE/FineUIPro.Web/SysManage/Unit.aspx | 4 +-
SUBQHSE/FineUIPro.Web/SysManage/Unit.aspx.cs | 24 +-
.../SysManage/Unit.aspx.designer.cs | 9 +
.../SysManage/UnitCleanupMerge.aspx | 151 ++
.../SysManage/UnitCleanupMerge.aspx.cs | 299 +++
.../UnitCleanupMerge.aspx.designer.cs | 224 +++
.../ZHGL/Supervise/UnitHazardRegister.aspx | 122 ++
.../ZHGL/Supervise/UnitHazardRegister.aspx.cs | 166 ++
.../UnitHazardRegister.aspx.designer.cs | 170 ++
.../Supervise/UnitHazardRegisterEdit.aspx | 169 ++
.../Supervise/UnitHazardRegisterEdit.aspx.cs | 425 +++++
.../UnitHazardRegisterEdit.aspx.designer.cs | 287 +++
.../Supervise/UnitHazardRegisterRecord.aspx | 225 +++
.../UnitHazardRegisterRecord.aspx.cs | 288 +++
.../UnitHazardRegisterRecord.aspx.designer.cs | 242 +++
.../UnitHazardRegisterRecordEdit.aspx | 113 ++
.../UnitHazardRegisterRecordEdit.aspx.cs | 255 +++
...tHazardRegisterRecordEdit.aspx.designer.cs | 215 +++
.../APIItem/DataShare/CheckSpecialSyncData.cs | 97 +
.../APIItem/DataShare/ClassMeetingData.cs | 93 +
.../DataShare/HazardRegisterSyncData.cs | 89 +
.../APIItem/DataShare/LicenseManagerData.cs | 94 +
.../Model/APIItem/DataShare/PersonSyncData.cs | 118 ++
SUBQHSE/Model/Model.cs | 1607 ++++++++++++++++-
SUBQHSE/Model/Model.csproj | 9 +
SUBQHSE/Model/ZHGL/UnitHazardRegisterInput.cs | 30 +
.../Model/ZHGL/UnitHazardRegisterItemInput.cs | 63 +
.../ZHGL/UnitHazardRegisterItemOutput.cs | 96 +
.../Model/ZHGL/UnitHazardRegisterOutput.cs | 75 +
.../HSSE/CheckSpecialSyncController.cs | 119 ++
.../HSSE/HazardRegisterSyncController.cs | 119 ++
.../DataShare/HSSE/LicenseSyncController.cs | 64 +
.../DataShare/HSSE/MeetingSyncController.cs | 64 +
.../DataShare/HSSE/PersonSyncController.cs | 120 ++
SUBQHSE/WebAPI/WebAPI.csproj | 5 +
115 files changed, 14173 insertions(+), 203 deletions(-)
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-02-lpf.sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-06-geh.sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-09-lpf.sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-09-xiaj(DataIdMove).sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-10-xiaj(SP_DataIdMove).sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-13-xiaj.sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-26-gf.sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-02-27-geh.sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-03-01-xiaj(View_CheckSpecialDetail).sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-03-03-xiaj(View_License_LicenseManager).sql
create mode 100644 DataBase/版本日志/SUBQHSE_V2026-03-04-geh.sql
create mode 100644 SUBQHSE/BLL/Common/DataCleanupMergeHelper.cs
create mode 100644 SUBQHSE/BLL/DataShare/APIDataShareSyncService.cs
create mode 100644 SUBQHSE/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs
create mode 100644 SUBQHSE/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs
create mode 100644 SUBQHSE/BLL/DataShare/HSSE/APILicenseSyncService.cs
create mode 100644 SUBQHSE/BLL/DataShare/HSSE/APIMeetingSyncService.cs
create mode 100644 SUBQHSE/BLL/DataShare/HSSE/APIPersonSyncService.cs
create mode 100644 SUBQHSE/BLL/HSSE/Solution/TemporaryElectricityService.cs
create mode 100644 SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs
create mode 100644 SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs
create mode 100644 SUBQHSE/FineUIPro.Web/BaseInfo/WorkPostCleanupMerge.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/BaseInfo/WorkPostCleanupMerge.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/BaseInfo/WorkPostCleanupMerge.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/File/Excel/DataIn/专项检查明细导入模板.xls
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricity.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricity.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricity.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricityEdit.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricityEdit.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricityEdit.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricityView.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricityView.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/HSSE/Solution/TemporaryElectricityView.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/SysManage/UnitCleanupMerge.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/SysManage/UnitCleanupMerge.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/SysManage/UnitCleanupMerge.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx.designer.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecordEdit.aspx
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecordEdit.aspx.cs
create mode 100644 SUBQHSE/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecordEdit.aspx.designer.cs
create mode 100644 SUBQHSE/Model/APIItem/DataShare/CheckSpecialSyncData.cs
create mode 100644 SUBQHSE/Model/APIItem/DataShare/ClassMeetingData.cs
create mode 100644 SUBQHSE/Model/APIItem/DataShare/HazardRegisterSyncData.cs
create mode 100644 SUBQHSE/Model/APIItem/DataShare/LicenseManagerData.cs
create mode 100644 SUBQHSE/Model/APIItem/DataShare/PersonSyncData.cs
create mode 100644 SUBQHSE/Model/ZHGL/UnitHazardRegisterInput.cs
create mode 100644 SUBQHSE/Model/ZHGL/UnitHazardRegisterItemInput.cs
create mode 100644 SUBQHSE/Model/ZHGL/UnitHazardRegisterItemOutput.cs
create mode 100644 SUBQHSE/Model/ZHGL/UnitHazardRegisterOutput.cs
create mode 100644 SUBQHSE/WebAPI/Controllers/DataShare/HSSE/CheckSpecialSyncController.cs
create mode 100644 SUBQHSE/WebAPI/Controllers/DataShare/HSSE/HazardRegisterSyncController.cs
create mode 100644 SUBQHSE/WebAPI/Controllers/DataShare/HSSE/LicenseSyncController.cs
create mode 100644 SUBQHSE/WebAPI/Controllers/DataShare/HSSE/MeetingSyncController.cs
create mode 100644 SUBQHSE/WebAPI/Controllers/DataShare/HSSE/PersonSyncController.cs
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-02-lpf.sql b/DataBase/版本日志/SUBQHSE_V2026-02-02-lpf.sql
new file mode 100644
index 0000000..f1353f5
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-02-lpf.sql
@@ -0,0 +1,91 @@
+-- auto-generated definition
+create table dbo.Supervise_UnitHazardRegister
+(
+ UnitHazardRegisterId nvarchar(50) not null
+ primary key,
+ UnitHazardRegisterCode nvarchar(50) not null,
+ CheckDate datetime,
+ CheckMainType nvarchar(2),
+ CheckType nvarchar(50),
+ ProjectId nvarchar(50)
+ constraint FK_UnitHazardRegister_Project
+ references dbo.Base_Project,
+ UnitId nvarchar(50)
+ constraint FK_UnitHazardRegister_Unit
+ references dbo.Base_Unit,
+ CheckObjectId nvarchar(200),
+ CheckUnitId nvarchar(50)
+ constraint FK_UnitHazardRegister_CheckUnit
+ references dbo.Base_Unit,
+ CheckTeam nvarchar(200),
+ CheckManIds nvarchar(max),
+ CheckManNames nvarchar(max),
+ EvaluationResult nvarchar(max),
+ AttachUrl nvarchar(2000),
+ States int default 0,
+ CompileMan nvarchar(50),
+ CreateDate datetime,
+ UpdateDate datetime,
+ IsUpdate bit
+)
+go
+
+create index IX_UnitHazardRegister_CheckDate
+ on dbo.Supervise_UnitHazardRegister (CheckDate desc)
+go
+
+create index IX_UnitHazardRegister_CheckMainType
+ on dbo.Supervise_UnitHazardRegister (CheckMainType)
+go
+
+create index IX_UnitHazardRegister_ProjectId
+ on dbo.Supervise_UnitHazardRegister (ProjectId)
+go
+
+-- auto-generated definition
+create table dbo.Supervise_UnitHazardRegisterItem
+(
+ UnitHazardRegisterItemId nvarchar(50) not null
+ primary key,
+ UnitHazardRegisterId nvarchar(50) not null
+ constraint FK_UnitHazardRegisterItem_Register
+ references dbo.Supervise_UnitHazardRegister
+ on delete cascade,
+ ProblemDescription nvarchar(max),
+ ProblemType nvarchar(50),
+ RiskLevel nvarchar(50),
+ RectifyRequirement nvarchar(max),
+ CompleteStatus int default 0,
+ CompletedDate datetime,
+ SortIndex int default 0,
+ RectificationMeasures nvarchar(100),
+ IsUpdate bit
+)
+go
+
+create index IX_UnitHazardRegisterItem_RegisterId
+ on dbo.Supervise_UnitHazardRegisterItem (UnitHazardRegisterId)
+go
+
+
+INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
+VALUES (N'C46C007E-A100-4A52-9317-3B885442E130', N'ҵȫ', null, N'ZHGL/Supervise/UnitHazardRegister.aspx?type=0', 40, N'CD9FC4C8-4B02-4619-8B02-50DA6AE6146E', N'Menu_HSSE', 1, 1, 1);
+go
+ INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'D15F74F2-CD1A-4F45-9501-DF00ED845730', N'C46C007E-A100-4A52-9317-3B885442E130', N'', 2);
+ go
+ INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'A2CCDFF7-9593-4BCB-9425-769C99F8EFEE', N'C46C007E-A100-4A52-9317-3B885442E130', N'ɾ', 3);
+ go
+ INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'435F26E9-232F-4CAA-835F-CAF41DA2B175', N'C46C007E-A100-4A52-9317-3B885442E130', N'', 4);
+ go
+ INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) VALUES (N'B822D703-CFE3-422A-88F3-67B26B0A255A', N'C46C007E-A100-4A52-9317-3B885442E130', N'', 1);
+
+go
+INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
+VALUES (N'73283863-CF67-44CA-9DF8-67071734A528', N'ҵȫ¼', null, N'ZHGL/Supervise/UnitHazardRegisterRecord.aspx?type=0', 45, N'CD9FC4C8-4B02-4619-8B02-50DA6AE6146E', N'Menu_HSSE', 1, 1, 1);
+
+INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
+VALUES (N'6DA1F87C-C980-4A1D-8512-9F20718C77E5', N'ҵȫ¼', null, N'ZHGL/Supervise/UnitHazardRegisterRecord.aspx?type=0', 10, N'467A0CB9-737D-4451-965E-869EBC3A4BD6', N'Menu_HSSE_P', 1, 1, 1);
+
+INSERT INTO dbo.Sys_Menu (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
+VALUES (N'15511354-9822-4A21-AB24-2483D889FDB8', N'ҵ¼', null, N'ZHGL/Supervise/UnitHazardRegisterRecord.aspx?type=1', 10, N'A54EC449-5F77-4068-83B9-AA305B721A0B', N'Menu_CQMS_P', 1, 1, 1);
+go
\ No newline at end of file
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-06-geh.sql b/DataBase/版本日志/SUBQHSE_V2026-02-06-geh.sql
new file mode 100644
index 0000000..6e506b4
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-06-geh.sql
@@ -0,0 +1,17 @@
+
+
+-- 总包单位
+alter table Base_Project add SubjectUnit nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL;
+-- 总包单位下项目id
+alter table Base_Project add SubjectProject nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL;
+GO
+
+--数据来源
+alter table HSSE_Hazard_HazardRegister add DataSource char(1) COLLATE Chinese_PRC_CI_AS NULL;
+EXEC sp_addextendedproperty
+'MS_Description', N'数据来源(1总包,0本单位)',
+'SCHEMA', N'dbo',
+'TABLE', N'HSSE_Hazard_HazardRegister',
+'COLUMN', N'DataSource'
+GO
+
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-09-lpf.sql b/DataBase/版本日志/SUBQHSE_V2026-02-09-lpf.sql
new file mode 100644
index 0000000..4ce60bb
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-09-lpf.sql
@@ -0,0 +1,17 @@
+alter table dbo.Supervise_UnitHazardRegister
+ add InsResponsibleUserId nvarchar(50)
+go
+
+exec sp_addextendedproperty 'MS_Description', N'受检责任人', 'SCHEMA', 'dbo', 'TABLE', 'Supervise_UnitHazardRegister',
+ 'COLUMN', 'InsResponsibleUserId'
+go
+alter table dbo.Supervise_UnitHazardRegister
+ drop constraint FK_UnitHazardRegister_Unit
+go
+alter table dbo.Supervise_UnitHazardRegister
+ drop column UnitId
+go
+
+alter table dbo.Supervise_UnitHazardRegister
+ drop column CheckObjectId
+go
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-09-xiaj(DataIdMove).sql b/DataBase/版本日志/SUBQHSE_V2026-02-09-xiaj(DataIdMove).sql
new file mode 100644
index 0000000..2fe54de
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-09-xiaj(DataIdMove).sql
@@ -0,0 +1,21 @@
+
+
+IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'DataIdMove') AND type = N'U')
+BEGIN
+CREATE TABLE [dbo].[DataIdMove](
+ [OldId] [nvarchar](50) NOT NULL,
+ [NewIds] [nvarchar](50) NULL,
+ [ColumType] [nvarchar](50) NULL,
+ CONSTRAINT [PK_DataIdMove] PRIMARY KEY CLUSTERED
+(
+ [OldId] ASC
+)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
+) ON [PRIMARY]
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'OldId' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataIdMove', @level2type=N'COLUMN',@level2name=N'OldId'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'NewIds' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataIdMove', @level2type=N'COLUMN',@level2name=N'NewIds'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ColumType' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataIdMove', @level2type=N'COLUMN',@level2name=N'ColumType'
+
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'滻ݱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataIdMove'
+END
+
+GO
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-10-xiaj(SP_DataIdMove).sql b/DataBase/版本日志/SUBQHSE_V2026-02-10-xiaj(SP_DataIdMove).sql
new file mode 100644
index 0000000..2ea0d69
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-10-xiaj(SP_DataIdMove).sql
@@ -0,0 +1,42 @@
+CREATE PROC [dbo].[SP_DataIdMove]
+ @exTable NVARCHAR(50) = NULL ,
+ @colums NVARCHAR(50) = NULL ,
+ @trueId NVARCHAR(50) = NULL
+ --,@returnVal int output
+AS
+
+BEGIN
+--DECLARE @returnVal int =0
+--SET @returnVal = 0
+DECLARE @OldId nvarchar(50),@NewId nvarchar(50)
+DECLARE @tablename nvarchar(1000),@columnname nvarchar(1000)
+DECLARE @sql nvarchar(2000)
+DECLARE cursor_Id CURSOR FOR -- 定义游标
+ SELECT OldId ,NewIds FROM DataIdMove WHERE ColumType = @colums and NewIds = @trueId
+ OPEN cursor_Id
+ FETCH NEXT FROM cursor_Id INTO @OldId, @NewId -- 抓取下一行游标数据
+ WHILE @@FETCH_STATUS = 0 --(-1 语句失败, -2 被提取行不存在)
+ BEGIN
+ --SET @returnVal=@returnVal+1
+ --print @OldId
+ DECLARE cursor_name CURSOR FOR -- 定义游标
+ SELECT DISTINCT TABLE_NAME,COLUMN_NAME
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE COLUMN_NAME like '%'+@colums+'%' and TABLE_NAME in (SELECT distinct TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE') and TABLE_NAME <> @exTable
+ OPEN cursor_name -- 打开游标
+ FETCH NEXT FROM cursor_name INTO @tablename ,@columnname -- 抓取下一行游标数据
+ WHILE @@FETCH_STATUS = 0 --(-1 语句失败, -2 被提取行不存在)
+ BEGIN
+ SET @sql = 'update ' + @tablename + ' set ' + @columnname + ' =REPLACE('+@columnname+', '''+@OldId+''', '''+@NewId+''') where '+ @columnname + ' like '+'''%'+@OldId+'%'';' ;
+ --print @sql
+ EXEC sp_executesql @sql
+ FETCH NEXT FROM cursor_name INTO @tablename,@columnname;
+ END
+ CLOSE cursor_name -- 关闭游标
+ DEALLOCATE cursor_name -- 释放游标
+ FETCH NEXT FROM cursor_Id INTO @OldId, @NewId
+ END
+CLOSE cursor_Id -- 关闭游标
+DEALLOCATE cursor_Id -- 释放游标
+--SELECT @returnVal
+END
\ No newline at end of file
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-13-xiaj.sql b/DataBase/版本日志/SUBQHSE_V2026-02-13-xiaj.sql
new file mode 100644
index 0000000..90c9a74
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-13-xiaj.sql
@@ -0,0 +1,86 @@
+
+
+--ǰᲹֶ
+IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Meeting_ClassMeeting' AND COLUMN_NAME = 'Remark')
+BEGIN
+ ALTER TABLE Meeting_ClassMeeting ADD Remark nvarchar(500);
+END
+GO
+
+
+--˵ȫ-ʱõ緽
+--ע⣺˵λøݶƵλṹá廷ʩ(Menu_HSSE)桿
+ IF NOT EXISTS (SELECT * FROM Sys_Menu WHERE MenuId = '09B2A0A6-A693-4F1D-A4F5-D5DEA803D771')
+BEGIN
+INSERT INTO dbo.Sys_Menu (MenuId, MenuName,Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
+VALUES (N'09B2A0A6-A693-4F1D-A4F5-D5DEA803D771', N'ʱõ緽', N'HSSE/Solution/TemporaryElectricity.aspx', 40, 'c8a9911c-94a2-4b18-a411-327408619812', 'Menu_HSSE_P', 0,1, 1);
+INSERT INTO dbo.Sys_Menu (MenuId, MenuName,Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed)
+VALUES (N'B04483D5-4421-4046-8B1A-E97589952150', N'ʱõ緽', N'HSSE/Solution/TemporaryElectricity.aspx', 40, '5FF7BBD8-3E0A-4C90-8976-AFF5CE7E17A5', 'Menu_HSSE', 0,1, 1);
+END
+
+--ȫ-ʱõ緽
+IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Solution_TemporaryElectricity') AND type = N'U')
+BEGIN
+
+CREATE TABLE [dbo].[Solution_TemporaryElectricity](
+ [TemporaryElectricityId] [nvarchar](50) NOT NULL,
+ [ProjectId] [nvarchar](50) NULL,
+ [Code] [nvarchar](100) NULL,
+ [Name] [nvarchar](200) NULL,
+ [Content] [nvarchar](2000) NULL,
+ [Remark] [nvarchar](500) NULL,
+ [CompileMan] [nvarchar](50) NULL,
+ [CompileDate] [datetime] NULL,
+ CONSTRAINT [PK_Solution_TemporaryElectricity] PRIMARY KEY CLUSTERED
+(
+ [TemporaryElectricityId] ASC
+)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
+) ON [PRIMARY]
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'TemporaryElectricityId'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ŀid' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'ProjectId'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'Code'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'Name'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'Content'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'Remark'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'CompileMan'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'CompileDate'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʱõ緽' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity'
+
+END
+
+GO
+
+update Sys_Menu set MenuName='ʱõ緽'
+WHERE MenuId = '09B2A0A6-A693-4F1D-A4F5-D5DEA803D771'
+update Sys_Menu set MenuName='ʱõ緽'
+WHERE MenuId = 'B04483D5-4421-4046-8B1A-E97589952150'
+
+GO
+
+--ʱõ緽ֶ
+IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Solution_TemporaryElectricity' AND COLUMN_NAME = 'Remark')
+BEGIN
+ ALTER TABLE Solution_TemporaryElectricity ADD Content nvarchar(2000);
+ ALTER TABLE Solution_TemporaryElectricity ADD Remark nvarchar(500);
+ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'Content'
+ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Solution_TemporaryElectricity', @level2type=N'COLUMN',@level2name=N'Remark'
+END
+GO
+
+--ȫ-ʱõť
+IF NOT EXISTS (SELECT * FROM Sys_ButtonToMenu WHERE MenuId = '09B2A0A6-A693-4F1D-A4F5-D5DEA803D771')
+BEGIN
+INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
+VALUES (N'A633C879-BE46-4D2B-BAC3-9A656396AD53', N'09B2A0A6-A693-4F1D-A4F5-D5DEA803D771', N'', 1);
+INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
+VALUES (N'3C001F6B-428B-4BDC-8913-FD00CAC63C64', N'09B2A0A6-A693-4F1D-A4F5-D5DEA803D771', N'', 2);
+INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
+VALUES (N'E510ABD6-50B2-4685-8DB8-E362B88E8F9E', N'09B2A0A6-A693-4F1D-A4F5-D5DEA803D771', N'ɾ', 3);
+INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex])
+VALUES (N'9552542D-879F-49A7-BB33-7F1B54D9658F', N'09B2A0A6-A693-4F1D-A4F5-D5DEA803D771', N'', 4);
+END
+GO
+
+
+
+
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-26-gf.sql b/DataBase/版本日志/SUBQHSE_V2026-02-26-gf.sql
new file mode 100644
index 0000000..a01ab06
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-26-gf.sql
@@ -0,0 +1,6 @@
+alter table SitePerson_Person add IsSyncWelder bit null
+GO
+alter table BS_Welder add PersonId nvarchar(50) null
+GO
+alter table Base_WorkPost add IsCQMSCheck bit null
+GO
\ No newline at end of file
diff --git a/DataBase/版本日志/SUBQHSE_V2026-02-27-geh.sql b/DataBase/版本日志/SUBQHSE_V2026-02-27-geh.sql
new file mode 100644
index 0000000..33b96d7
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-02-27-geh.sql
@@ -0,0 +1,78 @@
+
+
+---修改安全检查视图(添加数据来源字段Registration.DataSource)
+ALTER VIEW [dbo].[View_Hazard_HazardRegister] AS SELECT Registration.HazardRegisterId,
+ Registration.HazardCode,
+ Registration.RegisterDate,
+ Registration.RegisterDef,
+ Registration.Rectification,
+ Registration.Place,
+ Registration.ResponsibleUnit,
+ Registration.Observer,
+ Registration.Risk_Level,
+ Registration.RectifiedDate,
+ Registration.ProjectId,
+ Project.UnitId AS PUnitId,
+ Project.ProjectState as ProjectState,
+ Project.isDelete as isDelete,
+ ProjectUnit.UnitName AS PUnitName,
+ ProjectUnit.IsThisUnit as IsThisUnit,
+ ProjectUnit.IsBranch as IsBranch,
+ Project.ProjectAddress,
+ Registration.states,
+ Registration.IsEffective,
+ Registration.ResponsibleMan,
+ Registration.CheckManId,
+ Registration.CheckTime,
+ Registration.RectificationPeriod,
+ Registration.ImageUrl,
+ Registration.RectificationImageUrl,
+ Registration.RectificationTime,
+ Registration.ConfirmMan,
+ Registration.ConfirmDate,
+ Registration.HandleIdea,
+ Registration.CutPayment,
+ Registration.ProblemTypes,
+ Registration.CheckSpecialId,
+ Registration.CheckItemDetailId,
+ Registration.SupCheckItemSetId,
+ Registration.CheckItemSetId,
+ Registration.SafeSupervisionId,
+ Registration.SafeSupervisionIsOK,
+ Registration.IsUpdate,
+ Project.ProjectName,
+ Registration.CheckCycle,
+ ISNULL(WorkArea.UnitWorkName,'') AS WorkAreaName,
+ Unit.UnitName as ResponsibilityUnitName,
+ Unit.CollCropCode as ResponsibilityUnitCollCropCode,
+ User1.UserName AS ResponsibilityManName,
+ ISNULL(User1.Telephone,'') AS ResponsibilityManTel,
+ User2.UserName AS CheckManName,
+ ISNULL(User2.Telephone,'') AS CheckManTel,
+ User2.UnitId AS SendUnitId,
+ User3.UserName AS ConfirmManName,
+ ISNULL(User3.Telephone,'') AS ConfirmManTel,
+ User4.UserName AS ResponsibilityManName2,
+ ISNULL(User4.Telephone,'') AS ResponsibilityMan2Tel,
+ (CASE WHEN Registration.states='1' and (Registration.SafeSupervisionIsOK is null OR Registration.SafeSupervisionIsOK=0) THEN '待整改'
+ WHEN Registration.states='1' and Registration.SafeSupervisionIsOK=1 THEN '合格'
+ WHEN Registration.states='2' THEN '已整改-待复查验收'
+ WHEN Registration.states='3' THEN '已闭环'
+ ELSE '已作废' END ) AS StatesStr,
+ RegisterTypes.RegisterTypesId,
+ RegisterTypes.RegisterTypesName,
+ Registration.DIC_ID,
+ Registration.CCManIds,
+ Registration.DataSource,
+ Registration.Requirements
+FROM dbo.HSSE_Hazard_HazardRegister AS Registration
+LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = Registration.ProjectId
+LEFT JOIN dbo.Base_Unit AS ProjectUnit ON Project.UnitId = ProjectUnit.UnitId
+LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = Registration.Place
+LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes ON RegisterTypes.RegisterTypesId = Registration.RegisterTypesId
+LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = Registration.ResponsibleUnit
+LEFT JOIN dbo.Sys_User AS User1 ON User1.UserId = Registration.ResponsibleMan
+LEFT JOIN dbo.Sys_User AS User2 ON User2.UserId = Registration.CheckManId
+LEFT JOIN dbo.Sys_User AS User3 ON User3.UserId = Registration.ConfirmMan
+LEFT JOIN dbo.Sys_User AS User4 ON User4.UserId = Registration.ResponsibleMan2
+go
diff --git a/DataBase/版本日志/SUBQHSE_V2026-03-01-xiaj(View_CheckSpecialDetail).sql b/DataBase/版本日志/SUBQHSE_V2026-03-01-xiaj(View_CheckSpecialDetail).sql
new file mode 100644
index 0000000..7094f10
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-03-01-xiaj(View_CheckSpecialDetail).sql
@@ -0,0 +1,86 @@
+
+update Check_CheckSpecialDetail
+set riskLevel=1
+where riskLevel='0' or riskLevel='' or riskLevel='һ' or riskLevel='' or riskLevel is null
+
+go
+update Check_CheckSpecialDetail
+set riskLevel=2
+where riskLevel='ϴ' or riskLevel='ϸ'
+
+go
+update Check_CheckSpecialDetail
+set riskLevel=3
+where riskLevel='' or riskLevel='ش'
+
+go
+
+
+
+ALTER VIEW [dbo].[View_CheckSpecialDetail]
+ AS
+/*רϸбͼ*/
+SELECT detail.CheckSpecialDetailId,
+ detail.CheckSpecialId,
+ detail.CheckItem,
+ checkItemSet.RegisterTypesName as CheckItemName,
+ --detail.CheckItemType,
+ detail.Unqualified,
+ detail.SortIndex,
+ detail.UnitId,
+ detail.HandleStep,
+ detail.CompleteStatus,
+ (case when detail.CompleteStatus =1 then '' else '' end) as CompleteStatusName,
+ detail.LimitedDate,
+ detail.CompletedDate,
+ --detail.Suggestions,
+ detail.CheckContent,
+ detail.CheckArea,
+ detail.HandleWay,
+ detail.Suggestions,
+ detail.RectifyOpinion,
+ detail.ProposeUnitId,
+ workArea.UnitWorkName + (CASE WHEN workArea.ProjectType ='1' THEN '()'
+ WHEN workArea.ProjectType ='2' THEN '(װ)' ELSE '' END)AS CheckAreaName,
+ detail.DataId,
+ detail.DataType,
+ unit.UnitName,
+ dbo.GetConstTextByIds(detail.HandleStep) as HandleStepStr,
+ --const.ConstText as HandleStepStr,
+ (CASE WHEN detail.DataType like '%1%'
+ THEN '·ĵ:'+(SELECT RectifyNoticesCode FROM Check_RectifyNotices WHERE detail.DataId like '%'+RectifyNoticesId+'%')
+ else '' end)+
+ (CASE WHEN detail.DataType like '%2%'
+ THEN '·:'+(SELECT PunishNoticeCode FROM Check_PunishNotice WHERE detail.DataId like '%'+PunishNoticeId+'%')
+ else '' end)+
+ (CASE WHEN detail.DataType = '3'
+ THEN '·ͣ:'+(SELECT PauseNoticeCode FROM Check_PauseNotice WHERE detail.DataId like '%'+ PauseNoticeId+'%')
+ else '' end) AS HandleStepLink
+ ,
+ --(case when detail.riskLevel ='0' then ''
+ -- when detail.riskLevel = '1' then 'һ'
+ -- when detail.riskLevel = '2' then 'ϸ'
+ -- when detail.riskLevel = '3' then ''
+ -- else detail.riskLevel end) as riskLevel,
+ (case when detail.riskLevel = '1' then 'һ'
+ when detail.riskLevel = '2' then 'ϸ'
+ when detail.riskLevel = '3' then ''
+ else 'һ' end) as riskLevel,
+ sysuser.userName as HSEManage
+
+FROM dbo.Check_CheckSpecialDetail AS detail
+LEFT JOIN dbo. HSSE_Hazard_HazardRegisterTypes AS checkItemSet ON checkItemSet.RegisterTypesId=detail.CheckItem
+LEFT JOIN dbo.Base_Unit AS unit ON unit.UnitId=detail.UnitId
+LEFT JOIN dbo.WBS_UnitWork AS workArea ON detail.CheckArea=workArea.UnitWorkId
+LEFT JOIN dbo.Sys_User AS sysuser ON sysuser.userid=detail.HSEManage
+--LEFT JOIN Sys_Const AS const ON const.ConstValue = detail.HandleStep and const.GroupId='HandleStep'
+
+
+
+
+
+
+
+GO
+
+
diff --git a/DataBase/版本日志/SUBQHSE_V2026-03-03-xiaj(View_License_LicenseManager).sql b/DataBase/版本日志/SUBQHSE_V2026-03-03-xiaj(View_License_LicenseManager).sql
new file mode 100644
index 0000000..02366b4
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-03-03-xiaj(View_License_LicenseManager).sql
@@ -0,0 +1,57 @@
+
+
+--ҵƱ岹ֶΣԴ˵
+IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'License_LicenseManager' AND COLUMN_NAME = 'SourceDes')
+BEGIN
+ ALTER TABLE License_LicenseManager ADD SourceDes nvarchar(500);
+END
+GO
+
+-- ͼ
+ALTER VIEW [dbo].[View_License_LicenseManager] AS SELECT LicenseManager.LicenseManagerId,
+ LicenseManager.ProjectId,
+ LicenseManager.LicenseTypeId,
+ LicenseManager.LicenseManagerCode,
+ LicenseManager.LicenseManageName,
+ LicenseManager.UnitId,
+ LicenseManager.LicenseManageContents,
+ LicenseManager.CompileMan,
+ LicenseManager.CompileDate,
+ LicenseManager.States,
+ Project.ProjectCode,
+ Project.ProjectName,
+ LicenseType.LicenseTypeName,
+ Unit.UnitName,
+ UnitType.UnitTypeId,
+ UnitType.UnitTypeName,
+ Users.UserName,
+ LicenseManager.WorkAreaId,
+ --WorkArea.WorkAreaName,
+ LicenseManager.StartDate,
+ LicenseManager.EndDate,
+ LicenseManager.ApplicantMan,
+ LicenseManager.IsHighRisk,
+ LicenseManager.WorkStates,
+ LicenseManager.IsUpdate,
+ LicenseManager.SourceDes,
+ LicenseManager.LicenseCodes,
+ case LicenseManager.WorkStates when '1' then ''
+ when '2' then 'ҵ'
+ when '3' then 'ѹر'
+ when '-1' then 'ȡ'
+ else '' end as WorkStatesStr,
+ WorkAreaName = STUFF(( SELECT ',' + UnitWorkName FROM WBS_UnitWork
+ where PATINDEX('%,' + RTRIM(WBS_UnitWork.UnitWorkId) + ',%',',' + LicenseManager.WorkAreaId + ',')>0
+ ORDER BY PATINDEX('%,' + RTRIM(LicenseManager.WorkAreaId) + ',%',',' + LicenseManager.WorkAreaId + ',')
+ FOR XML PATH('')), 1, 1,'')
+FROM dbo.License_LicenseManager AS LicenseManager
+LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = LicenseManager.ProjectId
+LEFT JOIN dbo.Base_LicenseType AS LicenseType ON LicenseType.LicenseTypeId = LicenseManager.LicenseTypeId
+LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = LicenseManager.UnitId
+LEFT JOIN dbo.Sys_User AS Users ON Users.UserId = LicenseManager.CompileMan
+LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = LicenseManager.WorkAreaId
+LEFT JOIN dbo.Base_UnitType as UnitType ON UnitType.UnitTypeId=Unit.UnitTypeId
+
+GO
+
+
diff --git a/DataBase/版本日志/SUBQHSE_V2026-03-04-geh.sql b/DataBase/版本日志/SUBQHSE_V2026-03-04-geh.sql
new file mode 100644
index 0000000..e180f8b
--- /dev/null
+++ b/DataBase/版本日志/SUBQHSE_V2026-03-04-geh.sql
@@ -0,0 +1,19 @@
+
+
+
+
+--定制版需要根据具体的菜单名称进行修改为"安全健康检查"
+update [dbo].[Sys_Menu] set MenuName = '安全健康检查' WHERE MenuName = 'HSE日常巡检' and IsUsed = '1'
+
+
+
+--隐藏掉原来的安全监督检查报告
+update Sys_Menu set IsUsed = '0' where MenuId ='40387C48-95A0-435C-82FB-57AF0A81B9D4' ;
+
+--隐藏原来的安全监督检查整改
+update Sys_Menu set IsUsed = '0' where MenuId ='A02E0365-383C-49A0-BF1A-B3E42052959B' ;
+
+
+
+update Sys_Menu set IsUsed = '0' where MenuName = '项目HSE数据汇总'
+
diff --git a/SUBQHSE/BLL/BLL.csproj b/SUBQHSE/BLL/BLL.csproj
index a734b3f..b5f37e8 100644
--- a/SUBQHSE/BLL/BLL.csproj
+++ b/SUBQHSE/BLL/BLL.csproj
@@ -291,6 +291,7 @@
+
@@ -449,6 +450,12 @@
+
+
+
+
+
+
@@ -765,6 +772,7 @@
+
@@ -1004,6 +1012,8 @@
+
+
diff --git a/SUBQHSE/BLL/BaseInfo/SuperviseCheckTypeService.cs b/SUBQHSE/BLL/BaseInfo/SuperviseCheckTypeService.cs
index 2fd0e9f..06ea01e 100644
--- a/SUBQHSE/BLL/BaseInfo/SuperviseCheckTypeService.cs
+++ b/SUBQHSE/BLL/BaseInfo/SuperviseCheckTypeService.cs
@@ -103,5 +103,24 @@ namespace BLL
Funs.FineUIPleaseSelect(dropName);
}
}
+
+ ///
+ /// 根据检查大类和检查类别代码获取检查类别名称
+ ///
+ /// 检查大类(0=安全,1=质量)
+ /// 检查类别代码
+ /// 检查类别名称
+ public static string GetCheckTypeName(string checkMainType, string checkTypeCode)
+ {
+ if (string.IsNullOrEmpty(checkMainType) || string.IsNullOrEmpty(checkTypeCode))
+ {
+ return string.Empty;
+ }
+
+ var checkType = Funs.DB.Base_SuperviseCheckType
+ .FirstOrDefault(x => x.CheckMainType == checkMainType && x.CheckTypeCode == checkTypeCode);
+
+ return checkType?.CheckTypeName ?? string.Empty;
+ }
}
}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/Common/Const.cs b/SUBQHSE/BLL/Common/Const.cs
index 1c9a317..89a8076 100644
--- a/SUBQHSE/BLL/Common/Const.cs
+++ b/SUBQHSE/BLL/Common/Const.cs
@@ -2149,7 +2149,15 @@ namespace BLL
///
public const string SuperviseCheckRectifyMenuId = "A02E0365-383C-49A0-BF1A-B3E42052959B";
+ ///
+ /// 企业安全检查菜单ID
+ ///
+ public const string UnitHazardRegisterMenu_Safety = "C46C007E-A100-4A52-9317-3B885442E130";
+ ///
+ /// 企业质量检查菜单ID
+ ///
+ public const string UnitHazardRegisterMenu_Quality = "FDA7722C-383E-4BB1-B29D-BB0BF87AA942";
///
/// 安全监督检查
///
@@ -2589,7 +2597,10 @@ namespace BLL
/// 危险性较大的工程清单
///
public const string ProjectLargerHazardListMenuId = "5B3D3F7B-9B50-4927-B131-11D13D4D1C19";
-
+ ///
+ /// 临时用电
+ ///
+ public const string ProjectTemporaryElectricityListMenuId = "09B2A0A6-A693-4F1D-A4F5-D5DEA803D771";
///
/// 专家论证清单
///
@@ -4004,6 +4015,11 @@ namespace BLL
/// 专项检查导入模板
///
public const string CheckSpecialTemplateUrl = "File\\Excel\\DataIn\\专项检查导入模板.xls";
+
+ ///
+ /// 专项检查明细导入模板
+ ///
+ public const string CheckSpecialDetailTemplateUrl = "File\\Excel\\DataIn\\专项检查明细导入模板.xls";
///
/// 综合检查导入模板
///
diff --git a/SUBQHSE/BLL/Common/DataCleanupMergeHelper.cs b/SUBQHSE/BLL/Common/DataCleanupMergeHelper.cs
new file mode 100644
index 0000000..3eead83
--- /dev/null
+++ b/SUBQHSE/BLL/Common/DataCleanupMergeHelper.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace BLL
+{
+ ///
+ /// 数据合并清理
+ ///
+ public class DataCleanupMergeHelper
+ {
+ ///
+ /// 数据合并清理
+ ///
+ /// 排除操作数据表
+ /// 替换字段(模糊匹配)
+ /// 需要替换的数据值
+ /// 新的字段数据值
+ ///
+ public static bool DataCleanupMerge(string exTable, string columType, List mergeDataIds, string dataId, ref string msg)
+ {
+ bool result = false;
+ try
+ {
+ Model.SUBQHSEDB db = Funs.DB;
+ var clist = db.DataIdMove.Where(x => x.ColumType == columType && x.NewIds == dataId).ToList();
+ db.DataIdMove.DeleteAllOnSubmit(clist);
+ db.SubmitChanges();
+ List list = new List();
+ foreach (var mergeId in mergeDataIds)
+ {
+ list.Add(new Model.DataIdMove { OldId = mergeId.Trim(), NewIds = dataId.Trim(), ColumType = columType });
+ }
+
+ db.DataIdMove.InsertAllOnSubmit(list);
+ db.SubmitChanges();
+
+
+ //SP_DataIdMove[排除操作数据表,替换字段(模糊匹配),字段数据值]
+ string strSql = $"exec SP_DataIdMove '{exTable}','{columType}','{dataId}'";
+ result = BLL.SQLHelper.ExecuteSql(strSql);
+
+ //SqlParameter[] parameters = {
+ // new SqlParameter("@exTable", exTable),
+ // new SqlParameter("@colums", columType),
+ // new SqlParameter("@trueId", dataId),
+ // new SqlParameter("@returnVal", SqlDbType.Int)
+ //};
+ //BLL.SQLHelper.ExecuteNonQueryStoredProcedure("SP_DataIdMove", parameters);
+ //int succ = BLL.SQLHelper.ExecuteProcedure("SP_DataIdMove", parameters);
+ //Thread.Sleep(30000); // 等待30秒,30000毫秒等于30秒
+ if (result)
+ {
+ db.DataIdMove.DeleteAllOnSubmit(list);
+ db.SubmitChanges();
+ msg = "数据合并成功!";
+ }
+ else
+ {
+ msg = "数据合并失败,请稍后再试!";
+ }
+ }
+ catch (Exception ex)
+ {
+ msg = ex.Message;
+ result = false;
+ }
+ return result;
+ }
+ }
+}
diff --git a/SUBQHSE/BLL/Common/UploadAttachmentService.cs b/SUBQHSE/BLL/Common/UploadAttachmentService.cs
index da9df13..6a033af 100644
--- a/SUBQHSE/BLL/Common/UploadAttachmentService.cs
+++ b/SUBQHSE/BLL/Common/UploadAttachmentService.cs
@@ -567,5 +567,19 @@ namespace BLL
F_Stream.Close();
return rx;
}
+
+ public static string ConvertImageUrlByImage(object ToeyId)
+ {
+ string url = string.Empty;
+ if (ToeyId != null)
+ {
+ var imhurl = BLL.AttachFileService.getFileUrl(ToeyId.ToString());
+ if (imhurl != null)
+ {
+ url = ShowImage(Funs.SGGLUrl, imhurl);
+ }
+ }
+ return url;
+ }
}
}
diff --git a/SUBQHSE/BLL/DataShare/APIDataShareSyncService.cs b/SUBQHSE/BLL/DataShare/APIDataShareSyncService.cs
new file mode 100644
index 0000000..1b01ae7
--- /dev/null
+++ b/SUBQHSE/BLL/DataShare/APIDataShareSyncService.cs
@@ -0,0 +1,615 @@
+using System.Linq;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.IO;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+
+namespace BLL
+{
+ ///
+ /// 数据共享互通辅助服务
+ ///
+ public class APIDataShareSyncService
+ {
+ #region 班组
+
+ ///
+ /// 获取班组Id
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string GetTeamGroupId(string TeamGroupName, string projectId, string unitId)
+ {
+ string TeamGroupId = null;
+ if (!string.IsNullOrEmpty(TeamGroupName))
+ {
+ var tg = Funs.DB.ProjectData_TeamGroup.Where(x =>
+ x.TeamGroupName == TeamGroupName && x.ProjectId == projectId && x.UnitId == unitId).ToList();
+ if (tg.Count == 0)
+ {
+ Model.ProjectData_TeamGroup newTeamGroup = new Model.ProjectData_TeamGroup
+ {
+ TeamGroupId = SQLHelper.GetNewID(typeof(Model.ProjectData_TeamGroup)),
+ ProjectId = projectId,
+ UnitId = unitId,
+ TeamGroupName = TeamGroupName,
+ Remark = "分包数据同步导入"
+ };
+ TeamGroupService.AddTeamGroup(newTeamGroup);
+ TeamGroupId = newTeamGroup.TeamGroupId;
+ }
+ else
+ {
+ TeamGroupId = tg.FirstOrDefault().TeamGroupId;
+ }
+ }
+
+ return TeamGroupId;
+ }
+
+ #endregion
+
+ #region 作业票许可证类型
+
+ ///
+ /// 获取作业票许可证类型Id
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string GetLicenseTypeId(string LicenseTypeId, string LicenseTypeCode, string LicenseTypeName)
+ {
+ string Id = null;
+ if (!string.IsNullOrEmpty(LicenseTypeName))
+ {
+ var obj = Funs.DB.Base_LicenseType.Where(x => x.LicenseTypeName == LicenseTypeName).ToList();
+ if (obj.Count == 0)
+ {
+ string newId = LicenseTypeId;
+ var type = Funs.DB.Base_LicenseType.Where(x => x.LicenseTypeId == LicenseTypeId).FirstOrDefault();
+ if (type == null)
+ {
+ newId = SQLHelper.GetNewID(typeof(Model.Base_LicenseType));
+ }
+ Model.Base_LicenseType newModel = new Model.Base_LicenseType
+ {
+ LicenseTypeId = newId,
+ LicenseTypeCode = LicenseTypeCode,
+ LicenseTypeName = LicenseTypeName,
+ Remark = "分包数据同步导入"
+ };
+ LicenseTypeService.AddLicenseType(newModel);
+ Id = newId;
+ }
+ else
+ {
+ Id = obj.FirstOrDefault().LicenseTypeId;
+ }
+ }
+ return Id;
+ }
+
+ #endregion
+
+
+ #region 获取作业区域
+
+ ///
+ /// 作业区域
+ ///
+ ///
+ ///
+ ///
+ public static string getUnitWorkId(string UnitWorkName, string projectId)
+ {
+ string UnitWorkId = null;
+ if (!string.IsNullOrEmpty(UnitWorkName))
+ {
+ var uw = Funs.DB.WBS_UnitWork.Where(x =>
+ x.UnitWorkName == UnitWorkName && x.ProjectId == projectId && x.SuperUnitWork == null).ToList();
+ if (uw.Count == 0)
+ {
+ Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork
+ {
+ UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)),
+ ProjectId = projectId,
+ UnitWorkName = UnitWorkName,
+ };
+ UnitWorkService.AddUnitWork(newUnitWork);
+ UnitWorkId = newUnitWork.UnitWorkId;
+ }
+ else
+ {
+ UnitWorkId = uw.FirstOrDefault().UnitWorkId;
+ }
+ }
+ return UnitWorkId;
+ }
+
+
+ #endregion
+
+ #region 获取系统用户
+
+ ///
+ /// 获取系统用户
+ ///
+ ///
+ ///
+ public static string getUserId(string userName)
+ {
+ string UserId = null;
+ if (!string.IsNullOrEmpty(userName))
+ {
+ var u = Funs.DB.Sys_User.Where(x =>
+ x.UserName == userName).ToList();
+ if (u.Count == 0)
+ {
+ Model.Sys_User newUser = new Model.Sys_User
+ {
+ UserId = SQLHelper.GetNewID(typeof(Model.Sys_User)),
+ UserName = userName,
+ // Remark = "导入",
+ };
+ UserService.AddUser(newUser);
+ UserId = newUser.UserId;
+ }
+ else
+ {
+ UserId = u.FirstOrDefault().UserId;
+ }
+ }
+
+ return UserId;
+ }
+
+
+ #endregion
+
+
+ #region 获取检查类别
+
+ ///
+ /// 获取检查类别
+ ///
+ ///
+ ///
+ public static string getCheckItemSetId(string checkItemName)
+ {
+ string CheckItemSetId = null;
+ if (!string.IsNullOrEmpty(checkItemName))
+ {
+ var cis = Funs.DB.Technique_CheckItemSet.Where(x =>
+ x.CheckItemName == checkItemName && x.CheckType == "2").ToList();
+ if (cis.Count == 0)
+ {
+ Model.Technique_CheckItemSet newCheckItemSet = new Model.Technique_CheckItemSet
+ {
+ CheckItemSetId = SQLHelper.GetNewID(typeof(Model.Technique_CheckItemSet)),
+ CheckItemName = checkItemName,
+ SupCheckItem = "0",
+ CheckType = "2",
+ };
+ Technique_CheckItemSetService.AddCheckItemSet(newCheckItemSet);
+ CheckItemSetId = newCheckItemSet.CheckItemSetId;
+ }
+ else
+ {
+ CheckItemSetId = cis.FirstOrDefault().CheckItemSetId;
+ }
+ }
+
+ return CheckItemSetId;
+ }
+
+
+ #endregion
+
+
+ #region 获取巡检问题类型
+
+ ///
+ /// 获取巡检问题类型
+ ///
+ ///
+ ///
+ public static string getRegisterTypesId(string RegisterTypesName)
+ {
+
+ string RegisterTypesId = null;
+ if (!string.IsNullOrEmpty(RegisterTypesName))
+ {
+ var ht = Funs.DB.HSSE_Hazard_HazardRegisterTypes.Where(x =>
+ x.RegisterTypesName == RegisterTypesName && x.HazardRegisterType == "1").ToList();
+ if (ht.Count == 0)
+ {
+ Model.HSSE_Hazard_HazardRegisterTypes newHazardRegisterTypes = new Model.HSSE_Hazard_HazardRegisterTypes
+ {
+ RegisterTypesId = SQLHelper.GetNewID(typeof(Model.HSSE_Hazard_HazardRegisterTypes)),
+ RegisterTypesName = RegisterTypesName,
+ HazardRegisterType = "1",
+ Remark = "导入",
+ };
+ HSSE_Hazard_HazardRegisterTypesService.AddHazardRegisterTypes(newHazardRegisterTypes);
+ RegisterTypesId = newHazardRegisterTypes.RegisterTypesId;
+ }
+ else
+ {
+ RegisterTypesId = ht.FirstOrDefault().RegisterTypesId;
+ }
+ }
+ return RegisterTypesId;
+ }
+
+
+ #endregion
+
+
+ #region 获取特岗证书
+
+ ///
+ /// 特岗证书
+ ///
+ ///
+ ///
+ public static Model.CertificateItem GetPersonQualityByPersonId(string personId)
+ {
+
+ Model.CertificateItem item = new Model.CertificateItem();
+ var personQuality = PersonQualityService.GetPersonQualityByPersonId(personId);
+ if (personQuality != null)
+ {
+ item.PersonQualityId = personQuality.PersonQualityId;//主键
+ item.CertificateId = personQuality.CertificateId;
+ item.CertificateName = personQuality.CertificateName;
+ item.CertificateNo = personQuality.CertificateNo;
+ item.CertificateLimitDate = personQuality.LimitDate;
+ }
+ return item;
+ }
+
+ #endregion
+
+
+ #region 保存或修改特岗证书数据
+
+ public static void ProcessPersonQualityData(Model.CertificateItem item, string personId)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ if (item == null)
+ {
+ return;
+ }
+ if (!string.IsNullOrEmpty(item.CertificateId))
+ {
+ var personQuality = BLL.PersonQualityService.GetPersonQualityByPersonId(personId);
+ var certificate =
+ db.Base_Certificate.FirstOrDefault(e => e.CertificateId == item.CertificateId);
+ var CertificateId = string.Empty;
+ if (certificate != null)
+ {
+ CertificateId = certificate.CertificateId;
+ }
+ else
+ {
+ Model.Base_Certificate newCertificate = new Model.Base_Certificate
+ {
+ CertificateId = SQLHelper.GetNewID(typeof(Model.Base_Certificate)),
+ CertificateName = item.CertificateName,
+ Remark = "导入"
+ };
+ db.Base_Certificate.InsertOnSubmit(newCertificate);
+ db.SubmitChanges();
+ // BLL.CertificateService.AddCertificate(newCertificate);
+ CertificateId = newCertificate.CertificateId;
+ }
+
+ if (personQuality != null)
+ {
+ personQuality.CertificateId = CertificateId;
+ personQuality.CertificateName = item.CertificateName;
+ personQuality.CertificateNo = item.CertificateNo;
+ personQuality.LimitDate = item.CertificateLimitDate;
+
+ BLL.PersonQualityService.UpdatePersonQuality(personQuality);
+ }
+ else
+ {
+ Model.QualityAudit_PersonQuality newPersonQuality = new Model.QualityAudit_PersonQuality
+ {
+ PersonQualityId = SQLHelper.GetNewID(typeof(Model.QualityAudit_PersonQuality)),
+ PersonId = personId,
+ };
+ newPersonQuality.CertificateId = CertificateId;
+ newPersonQuality.CertificateName = item.CertificateName;
+ newPersonQuality.CertificateNo = item.CertificateNo;
+ newPersonQuality.LimitDate = item.CertificateLimitDate;
+ BLL.PersonQualityService.AddPersonQuality(newPersonQuality);
+ }
+ }
+ }
+ }
+
+ #endregion
+
+
+ #region 岗位
+
+ ///
+ /// 岗位
+ ///
+ ///
+ ///
+ public static string getWorkPostId(string WorkPostName, string PostType, string IsHsse, string IsCQMS)
+ {
+ string WorkPostId = null;
+ if (!string.IsNullOrEmpty(WorkPostName))
+ {
+ var wp = Funs.DB.Base_WorkPost.Where(x => x.WorkPostName == WorkPostName).ToList();
+ if (wp.Count == 0)
+ {
+ Model.Base_WorkPost newWorkPost = new Model.Base_WorkPost
+ {
+ WorkPostId = SQLHelper.GetNewID(typeof(Model.Base_WorkPost)),
+ WorkPostName = WorkPostName,
+ PostType = PostType,
+ IsHsse = Convert.ToBoolean(IsHsse),
+ IsCQMS = Convert.ToBoolean(IsCQMS),
+ Remark = "导入"
+ };
+ WorkPostService.AddWorkPost(newWorkPost);
+ WorkPostId = newWorkPost.WorkPostId;
+ }
+ else
+ {
+ WorkPostId = wp.FirstOrDefault().WorkPostId;
+ }
+ }
+
+ return WorkPostId;
+ }
+
+ #endregion
+
+ #region 单位工程
+
+ ///
+ /// 单位工程
+ ///
+ ///
+ ///
+ ///
+ public static string getWorkAreaId(string WorkAreaName, string projectId)
+ {
+ string WorkAreaId = null;
+ if (!string.IsNullOrEmpty(WorkAreaName))
+ {
+ var names = WorkAreaName.Split(',');
+ List workAreaIdList = new List();
+ foreach (var name in names)
+ {
+ var uw = Funs.DB.WBS_UnitWork.Where(x =>
+ x.UnitWorkName == name && x.ProjectId == projectId).ToList();
+ if (uw.Count == 0)
+ {
+ Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork
+ {
+ UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)),
+ ProjectId = projectId,
+ UnitWorkName = name,
+ };
+ UnitWorkService.AddUnitWork(newUnitWork);
+ workAreaIdList.Add(newUnitWork.UnitWorkId);
+ }
+ else
+ {
+ workAreaIdList.Add(uw.FirstOrDefault().UnitWorkId);
+ }
+ }
+
+ WorkAreaId = string.Join(",", workAreaIdList);
+ }
+
+ return WorkAreaId;
+ }
+
+ #endregion
+
+ #region 获取根据id获取单位工程名称
+
+ ///
+ /// 获取根据id获取单位工程名称
+ ///
+ ///
+ ///
+ ///
+ public static string GetWorkAreaNames(string WorkAreaId, string projectId)
+ {
+ string WorkAreaNames = string.Empty;
+ if (!string.IsNullOrEmpty(WorkAreaId))
+ {
+ var workAreas = WorkAreaId.Split(',');
+ //创建一个数组集合
+ List workAreaNameList = new List();
+ foreach (var workArea in workAreas)
+ {
+ var WorkAreaName = Funs.DB.WBS_UnitWork
+ .First(x => x.UnitWorkId == workArea && x.ProjectId == projectId)
+ .UnitWorkName;
+ workAreaNameList.Add(WorkAreaName);
+ }
+
+ WorkAreaNames = string.Join(",", workAreaNameList);
+ }
+
+ return WorkAreaNames;
+ }
+
+ #endregion
+
+ #region 根据地址获取base64的文件
+
+ public static async Task DownloadHeadImageAsync(string webUrl, string photoUrl)
+ {
+ byte[] b = null;
+ try
+ {
+ if (!string.IsNullOrEmpty(photoUrl))
+ {
+ string localRoot = ConfigurationManager.AppSettings["localRoot"]; // 物理路径
+ // 先下载到本地(异步等待完成)
+ DownloadAndSaveFileWithRetryAsync(webUrl, photoUrl, localRoot);
+ b = AttachFileService.SetImageToByteArray(localRoot + photoUrl.Split(',')[0]);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ return b;
+ }
+
+ #endregion
+
+ #region 向AttachFile文件表中添加或修改数据
+
+ public static async Task OperationAttachFile(string webUrl, string tokeyId, string menuId, string attachFileUrl)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ if (!string.IsNullOrEmpty(attachFileUrl))
+ {
+ string localRoot = ConfigurationManager.AppSettings["localRoot"]; //物理路径
+ //attachFileUrl可能是多个
+ string[] attachFileUrls = attachFileUrl.Split(',');
+
+ var attachFile = db.AttachFile.FirstOrDefault(x => x.ToKeyId == tokeyId && x.MenuId == menuId);
+ if (attachFile != null)
+ {
+ if (attachFile.AttachUrl != attachFileUrl)
+ {
+ string[] oldAttachFileUrls = attachFile.AttachUrl.Split(',');
+ foreach (var oldFileUrl in oldAttachFileUrls)
+ {
+ //删除之前的
+ UploadFileService.DeleteFile(localRoot, oldFileUrl);
+ }
+ foreach (var fileUrl in attachFileUrls)
+ {
+ DownloadAndSaveFileWithRetryAsync(webUrl, fileUrl, localRoot);
+ }
+ UploadFileService.SaveAttachUrl(
+ UploadFileService.GetSourceByAttachUrl(attachFileUrl, 10, null),
+ attachFileUrl, menuId, tokeyId);
+ }
+ }
+ else
+ {
+ foreach (var fileUrl in attachFileUrls)
+ {
+ DownloadAndSaveFileWithRetryAsync(webUrl, fileUrl, localRoot);
+ }
+ UploadFileService.SaveAttachUrl(
+ UploadFileService.GetSourceByAttachUrl(attachFileUrl, 10, null),
+ attachFileUrl, menuId, tokeyId);
+ }
+ }
+ }
+ }
+
+
+ public static async Task DownloadAndSaveFileAsync(string webUrl, string attachFileUrl, string localPath)
+ {
+ // 验证输入参数
+ if (string.IsNullOrEmpty(webUrl) || string.IsNullOrEmpty(attachFileUrl) || string.IsNullOrEmpty(localPath))
+ {
+ BLL.ErrLogInfo.WriteLog(
+ $"下载文件参数无效: webUrl={webUrl}, attachFileUrl={attachFileUrl}, localPath={localPath}");
+ return;
+ }
+ try
+ {
+ // 构造完整的远程文件 URL
+ string fullRemoteUrl = $"{webUrl.TrimEnd('/')}/{attachFileUrl.TrimStart('/')}";
+
+ // 构造本地文件路径
+ string localFilePath = Path.Combine(localPath, attachFileUrl);
+
+ // 确保本地目录存在
+ string directoryPath = Path.GetDirectoryName(localFilePath);
+ if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
+ {
+ Directory.CreateDirectory(directoryPath);
+ }
+
+ // 使用独立的HttpClient实例并配置不捕获同步上下文
+ using (var httpClient = new HttpClient())
+ {
+ // 设置合理的超时时间
+ httpClient.Timeout = TimeSpan.FromMinutes(3);
+
+ // 下载文件字节(使用ConfigureAwait(false)避免上下文问题)
+ byte[] fileBytes = await httpClient.GetByteArrayAsync(fullRemoteUrl).ConfigureAwait(false);
+
+ // 写入文件(同样使用ConfigureAwait(false))
+ await Task.Run(() => File.WriteAllBytes(localFilePath, fileBytes)).ConfigureAwait(false);
+ }
+
+ }
+ catch (HttpRequestException httpEx)
+ {
+ BLL.ErrLogInfo.WriteLog($"HTTP请求失败 - URL: {webUrl}/{attachFileUrl}", httpEx);
+ // 不抛出异常,让调用方继续处理
+ }
+ catch (DirectoryNotFoundException dirEx)
+ {
+ BLL.ErrLogInfo.WriteLog($"目录创建失败 - 路径: {localPath}", dirEx);
+ }
+ catch (UnauthorizedAccessException authEx)
+ {
+ BLL.ErrLogInfo.WriteLog($"文件访问权限不足 - 路径: {Path.Combine(localPath, attachFileUrl)}", authEx);
+ }
+ catch (Exception ex)
+ {
+ BLL.ErrLogInfo.WriteLog($"下载文件失败 - URL: {webUrl}/{attachFileUrl}", ex);
+ // 不重新抛出异常,避免中断整个流程
+ }
+ }
+
+ // 添加重试机制的下载方法
+ public static async Task DownloadAndSaveFileWithRetryAsync(string webUrl, string attachFileUrl,
+ string localPath, int maxRetries = 3)
+ {
+ for (int attempt = 0; attempt < maxRetries; attempt++)
+ {
+ try
+ {
+ await DownloadAndSaveFileAsync(webUrl, attachFileUrl, localPath);
+ return true; // 成功下载
+ }
+ catch (HttpRequestException)
+ {
+ if (attempt == maxRetries - 1)
+ {
+ BLL.ErrLogInfo.WriteLog($"下载失败,已重试{maxRetries}次 - URL: {webUrl}/{attachFileUrl}");
+ return false;
+ }
+
+ // 等待后重试
+ await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, attempt)));
+ }
+ }
+ return false;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs b/SUBQHSE/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs
new file mode 100644
index 0000000..03b712a
--- /dev/null
+++ b/SUBQHSE/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs
@@ -0,0 +1,531 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Configuration;
+using System.IO;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Model;
+using Newtonsoft.Json;
+using RestSharp;
+using System.Net;
+
+
+namespace BLL;
+
+public class APICheckSpecialSyncService
+{
+ #region 根据项目、单位获取专项检查列表
+
+ public static List GetCheckSpecialLitsByprojectIdUnitId(string projectId,
+ string unitId, string dataId = "")
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ var list = from x in db.Check_CheckSpecial where x.ProjectId == projectId select x;
+ if (!string.IsNullOrEmpty(unitId))
+ {
+ // 通过关联明细表来筛选包含指定单位的主表数据
+ var specialIdsWithUnit = (from detail in db.Check_CheckSpecialDetail
+ where detail.UnitId == unitId
+ select detail.CheckSpecialId).Distinct();
+
+ list = list.Where(x => specialIdsWithUnit.Contains(x.CheckSpecialId));
+ }
+
+ if (!string.IsNullOrEmpty(dataId))
+ {
+ list = list.Where(x => x.CheckSpecialId == dataId);
+ }
+
+ var dataList = (from x in list
+ join cis in db.Technique_CheckItemSet on x.CheckItemSetId equals cis.CheckItemSetId into cisTemp
+ from cis in cisTemp.DefaultIfEmpty()
+ join att in db.AttachFile on x.CheckSpecialId equals att.ToKeyId into attTemp
+ from att in attTemp.DefaultIfEmpty()
+ select new CheckSpecialSyncItem
+ {
+ CheckSpecialId = x.CheckSpecialId,
+ CheckSpecialCode = x.CheckSpecialCode,
+ ProjectId = x.ProjectId,
+ CheckPerson = x.CheckPerson,
+ CheckTime = x.CheckTime,
+ ScanUrl = x.ScanUrl,
+ DaySummary = x.DaySummary,
+ PartInUnits = x.PartInUnits,
+ PartInPersons = x.PartInPersons,
+ CheckAreas = x.CheckAreas,
+ States = x.States,
+ CompileMan = x.CompileMan,
+ CheckType = x.CheckType,
+ PartInPersonIds = x.PartInPersonIds,
+ PartInPersonNames = x.PartInPersonNames,
+ CheckItemSetId = x.CheckItemSetId,
+ CheckItemName = cis.CheckItemName,
+ AttachFileId1 = att.AttachFileId,
+ ToKeyId1 = att.ToKeyId,
+ AttachSource1 = att.AttachSource,
+ AttachUrl1 = att.AttachUrl,
+ CheckSpecialDetails = GetCheckSpecialDetailLists(x.CheckSpecialId),
+ }).ToList();
+
+ return dataList;
+ }
+ }
+
+
+ //根据专项检查id获取专项检查明细数据
+ public static List GetCheckSpecialDetailLists(string checkSpecialId)
+ {
+ var detailLists = (from x in Funs.DB.Check_CheckSpecialDetail
+ join ht in Funs.DB.HSSE_Hazard_HazardRegisterTypes on x.CheckItem equals ht.RegisterTypesId into htTemp
+ from ht in htTemp.DefaultIfEmpty()
+ join uw in Funs.DB.WBS_UnitWork on x.CheckArea equals uw.UnitWorkId into uwTemp
+ from uw in uwTemp.DefaultIfEmpty()
+ join u1 in Funs.DB.Sys_User on x.HSEManage equals u1.UserId into u1Temp
+ from u1 in u1Temp.DefaultIfEmpty()
+ join att in Funs.DB.AttachFile on x.CheckSpecialDetailId equals att.ToKeyId into attTemp
+ from att in attTemp.DefaultIfEmpty()
+ where x.CheckSpecialId == checkSpecialId
+ select new CheckSpecialDetailSyncItem
+ {
+ CheckSpecialDetailId = x.CheckSpecialDetailId,
+ CheckSpecialId = x.CheckSpecialId,
+ CheckItem = x.CheckItem,
+ CheckItemName = ht.RegisterTypesName,
+ CheckItemType = x.CheckItemType,
+ Unqualified = x.Unqualified,
+ CheckArea = x.CheckArea,
+ CheckAreaName = uw.UnitWorkName,
+ UnitId = x.UnitId,
+ CompleteStatus = x.CompleteStatus,
+ LimitedDate = x.LimitedDate,
+ CompletedDate = x.CompletedDate,
+ Suggestions = x.Suggestions,
+ HandleStep = x.HandleStep,
+ RectifyNoticeId = x.RectifyNoticeId,
+ CheckContent = x.CheckContent,
+ WorkArea = x.WorkArea,
+ DataId = x.DataId,
+ DataType = x.DataType,
+ SortIndex = x.SortIndex,
+ HiddenHazardType = x.HiddenHazardType,
+ HSEManage = x.HSEManage,
+ HSEManageName = u1.UserName,
+ RiskLevel = x.RiskLevel,
+ LimitDate = x.LimitDate,
+ AttachUrl = x.AttachUrl,
+ HandleWay = x.HandleWay,
+ RectifyOpinion = x.RectifyOpinion,
+ RectifyDate = x.RectifyDate,
+ ReAttachUrl = x.ReAttachUrl,
+ State = x.State,
+ ProposeUnitId = x.ProposeUnitId,
+ SaveHandleMan = x.SaveHandleMan,
+ AttachFileId1 = att.AttachFileId,
+ ToKeyId1 = att.ToKeyId,
+ AttachSource1 = att.AttachSource,
+ AttachUrl1 = att.AttachUrl,
+ })
+ .ToList();
+
+ return detailLists;
+ }
+
+ #endregion
+
+ #region 拉取项目专项检查数据
+
+ public static async Task getCheckSpecialLists(string projectId = "")
+ {
+ int code = 0;
+ string message = "";
+ try
+ {
+ string CollCropCode = string.Empty;
+ string unitId = string.Empty;
+ var thisUnit = CommonService.GetIsThisUnit(); //当前单位
+ if (thisUnit != null)
+ {
+ CollCropCode = thisUnit.CollCropCode; //社会统一信用代码
+ unitId = thisUnit.UnitId;
+ }
+
+ var ProjectList = (from x in Funs.DB.Base_Project
+ where (x.IsDelete == null || x.IsDelete == false) && x.SubjectUnit != null &&
+ x.SubjectProject != null
+ select x).ToList();
+
+ if (!string.IsNullOrEmpty(projectId))
+ {
+ ProjectList = ProjectList.Where(x => x.ProjectId == projectId).ToList();
+ }
+
+ if (ProjectList.Count > 0)
+ {
+ foreach (var project in ProjectList)
+ {
+ string SubjectUnitId = project.SubjectUnit; //集团的单位id
+ string SubjectProjectId = project.SubjectProject; //集团的单位id
+ //获取对应单位的apiurl地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
+ var ApiUrl = "";
+ var WebUrl = "";
+ if (!string.IsNullOrEmpty(Url))
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+
+ // CollCropCode = "913404001520228377Y"; //三化建 测试使用
+ // SubjectProjectId = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
+
+ string url = "/api/CheckSpecialSync/getCheckSpecialListByProjectIdAndCollCropCode?projectId=" +
+ SubjectProjectId + "&collCropCode=" + CollCropCode;
+ string baseurl = ApiUrl + url;
+
+ string contenttype = "application/json;charset=unicode";
+ var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, null, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ code = Funs.GetNewIntOrZero(obj["code"].ToString());
+ message = obj["message"].ToString();
+ if (code == 1)
+ {
+ var getData =
+ JsonConvert.DeserializeObject>(obj["data"].ToString());
+ if (getData.Count() > 0)
+ {
+ ProcessCheckSpecialData(getData, project.ProjectId, unitId, WebUrl);
+ }
+
+ message = "获取成功:同步专项检查数" + getData.Count().ToString() + "条";
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ message = "获取失败:" + ex.Message;
+ ErrLogInfo.WriteLog("专项检查获取!", ex);
+ }
+
+ return message;
+ }
+
+ #endregion
+
+ #region 推送专项检查数据
+
+ public static ReturnData pushCheckSpecialLists(string projectId, string dataId = "")
+ {
+ Model.ReturnData responeData = new Model.ReturnData();
+ responeData.code = 0;
+ responeData.message = string.Empty;
+ try
+ {
+ var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
+ if (project != null)
+ {
+ //获取专项检查数据
+ var items = GetCheckSpecialLitsByprojectIdUnitId(projectId, "", dataId);
+ //总包地址推送
+ if (items.Count() > 0)
+ {
+ var thisUnit = CommonService.GetIsThisUnit(); //当前单位
+ var apiurl = "/api/CheckSpecialSync/SaveCheckSpecialSyncData";
+ //总包单位接口地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
+ var ApiUrl = "";
+ var WebUrl = "";
+ if (!string.IsNullOrEmpty(Url))
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+
+ // thisUnit.CollCropCode = "913404001520228377Y";//测试使用
+ // project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
+
+ var pushData = new CheckSpecialSyncData
+ {
+ CollCropCode = thisUnit.CollCropCode, //分包单位社会统一信用码
+ ProjectId = project.SubjectProject, //主包项目Id
+ UnitDomain = Funs.SGGLUrl, //分包单位域名地址【文件存储地址】
+ Items = items //专项检查数据
+ };
+ var pushContent = JsonConvert.SerializeObject(pushData);
+ string baseurl = ApiUrl + apiurl;
+ string contenttype = "application/json;charset=unicode";
+ var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ JObject obj = JObject.Parse(returndata);
+ string code = obj["code"].ToString();
+ string message = obj["message"].ToString();
+ responeData.code = int.Parse(code);
+ responeData.message = message;
+ }
+ }
+ else
+ {
+ responeData.code = 0;
+ responeData.message = "当前没有项目专项检查数据";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.message = "同步到总包单位失败!";
+ ErrLogInfo.WriteLog("【项目专项检查】同步到总包单位失败!", ex);
+ }
+
+ return responeData;
+ }
+
+ #endregion
+
+ #region 接收保存项目专项检查数据
+
+ public static async Task SaveCheckSpecialSyncData(Model.CheckSpecialSyncData items)
+ {
+ int code = 0;
+ string message = "";
+ try
+ {
+ if (items.Items.Count > 0 || items.Items.Count > 0)
+ {
+ //获取CollCropCode
+ var CollCropCode = items.CollCropCode;
+ var ProjectId = items.ProjectId;
+ var UnitDomain = items.UnitDomain; //分包单位域名地址【文件存储地址】
+ //根据CollCropCode获取单位id
+ var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.CollCropCode == CollCropCode);
+ if (unit == null)
+ {
+ message = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
+ }
+ else
+ {
+ //2、判断主包项目是否存在
+ var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId);
+ if (porject == null)
+ {
+ message = "总包单位不存在本项目,请检查总包项目关联是否正确!";
+ }
+ else
+ {
+ ProcessCheckSpecialData(items.Items, ProjectId, unit.UnitId, UnitDomain);
+ message = "数据推送成功!";
+ }
+ }
+ }
+ else
+ {
+ message = "暂无项目专项检查数据!";
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ return message;
+ }
+
+ #endregion
+
+ #region 处理单项目专项检查数据的新增或更新逻辑
+
+ ///
+ /// 处理单项目专项检查数据的新增或更新逻辑
+ ///
+ /// 专项检查数据项
+ /// 项目id
+ /// 单位ID
+ /// Web地址
+ private static void ProcessCheckSpecialData(List getData, string projectId,
+ string unitId, string WebUrl)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ foreach (var item in getData)
+ {
+ var model = db.Check_CheckSpecial.FirstOrDefault(e => e.CheckSpecialId == item.CheckSpecialId);
+ if (model == null)
+ {
+ Model.Check_CheckSpecial newModel = new Model.Check_CheckSpecial
+ {
+ CheckSpecialId = item.CheckSpecialId,
+ CheckSpecialCode = item.CheckSpecialCode,
+ ProjectId = projectId,
+ CheckPerson = item.CheckPerson,
+ CheckTime = item.CheckTime,
+ ScanUrl = item.ScanUrl,
+ DaySummary = item.DaySummary,
+ PartInUnits = item.PartInUnits,
+ PartInPersons = item.PartInPersons,
+ CheckAreas = item.CheckAreas,
+ States = item.States,
+ CompileMan = item.CompileMan,
+ CheckType = item.CheckType,
+ PartInPersonIds = item.PartInPersonIds,
+ PartInPersonNames = item.PartInPersonNames,
+ CheckItemSetId = APIDataShareSyncService.getCheckItemSetId(item.CheckItemName),
+ };
+
+ db.Check_CheckSpecial.InsertOnSubmit(newModel);
+ db.SubmitChanges();
+ }
+ else
+ {
+ model.CheckSpecialId = item.CheckSpecialId;
+ model.CheckSpecialCode = item.CheckSpecialCode;
+ model.ProjectId = projectId;
+ model.CheckPerson = item.CheckPerson;
+ model.CheckTime = item.CheckTime;
+ model.ScanUrl = item.ScanUrl;
+ model.DaySummary = item.DaySummary;
+ model.PartInUnits = item.PartInUnits;
+ model.PartInPersons = item.PartInPersons;
+ model.CheckAreas = item.CheckAreas;
+ model.States = item.States;
+ model.CompileMan = item.CompileMan;
+ model.CheckType = item.CheckType;
+ model.PartInPersonIds = item.PartInPersonIds;
+ model.PartInPersonNames = item.PartInPersonNames;
+ model.CheckItemSetId = APIDataShareSyncService.getCheckItemSetId(item.CheckItemName);
+ db.SubmitChanges();
+ }
+
+ if (!string.IsNullOrEmpty(item.AttachUrl1)) //主表附件
+ {
+ APIDataShareSyncService.OperationAttachFile(WebUrl, item.CheckSpecialId,
+ BLL.Const.ProjectCheckSpecialMenuId, item.AttachUrl1);
+ }
+
+ //处理专项检查明细数据
+ ProcessCheckSpecialDetailData(item.CheckSpecialDetails, projectId, unitId, WebUrl);
+ }
+ }
+ }
+
+ #endregion
+
+ #region 处理单项目专项检查明细数据的新增或更新逻辑
+
+ ///
+ /// 处理单项目专项检查明细数据的新增或更新逻辑
+ ///
+ /// 专项检查数据项
+ /// 项目id
+ /// 单位ID
+ /// Web地址
+ private static void ProcessCheckSpecialDetailData(List getData,
+ string projectId,
+ string unitId, string WebUrl)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ foreach (var item in getData)
+ {
+ var model = db.Check_CheckSpecialDetail.FirstOrDefault(e =>
+ e.CheckSpecialDetailId == item.CheckSpecialDetailId);
+ if (model == null)
+ {
+ Model.Check_CheckSpecialDetail newModel = new Model.Check_CheckSpecialDetail
+ {
+ CheckSpecialDetailId = item.CheckSpecialDetailId,
+ CheckSpecialId = item.CheckSpecialId,
+ CheckItem = APIDataShareSyncService.getRegisterTypesId(item.CheckItemName),
+ CheckItemType = item.CheckItemType,
+ Unqualified = item.Unqualified,
+ CheckArea = APIDataShareSyncService.getUnitWorkId(item.CheckAreaName, projectId),
+ UnitId = unitId,
+ CompleteStatus = item.CompleteStatus,
+ LimitedDate = item.LimitedDate,
+ CompletedDate = item.CompletedDate,
+ Suggestions = item.Suggestions,
+ HandleStep = item.HandleStep,
+ RectifyNoticeId = item.RectifyNoticeId,
+ CheckContent = item.CheckContent,
+ WorkArea = item.WorkArea,
+ DataId = item.DataId,
+ DataType = item.DataType,
+ SortIndex = item.SortIndex,
+ HiddenHazardType = item.HiddenHazardType,
+ HSEManage = APIDataShareSyncService.getUserId(item.HSEManageName),
+ RiskLevel = item.RiskLevel,
+ LimitDate = item.LimitDate,
+ AttachUrl = item.AttachUrl,
+ HandleWay = item.HandleWay,
+ RectifyOpinion = item.RectifyOpinion,
+ RectifyDate = item.RectifyDate,
+ ReAttachUrl = item.ReAttachUrl,
+ State = item.State,
+ ProposeUnitId = item.ProposeUnitId,
+ SaveHandleMan = item.SaveHandleMan,
+ };
+
+ db.Check_CheckSpecialDetail.InsertOnSubmit(newModel);
+ db.SubmitChanges();
+ }
+ else
+ {
+ // model.CheckSpecialDetailId = item.CheckSpecialDetailId;
+ model.CheckSpecialId = item.CheckSpecialId;
+ model.CheckItem = APIDataShareSyncService.getRegisterTypesId(item.CheckItemName);
+ model.CheckItemType = item.CheckItemType;
+ model.Unqualified = item.Unqualified;
+ model.CheckArea = APIDataShareSyncService.getUnitWorkId(item.CheckAreaName, projectId);
+ model.UnitId = unitId;
+ model.CompleteStatus = item.CompleteStatus;
+ model.LimitedDate = item.LimitedDate;
+ model.CompletedDate = item.CompletedDate;
+ model.Suggestions = item.Suggestions;
+ model.HandleStep = item.HandleStep;
+ model.RectifyNoticeId = item.RectifyNoticeId;
+ model.CheckContent = item.CheckContent;
+ model.WorkArea = item.WorkArea;
+ model.DataId = item.DataId;
+ model.DataType = item.DataType;
+ model.SortIndex = item.SortIndex;
+ model.HiddenHazardType = item.HiddenHazardType;
+ model.HSEManage = APIDataShareSyncService.getUserId(item.HSEManageName);
+ model.RiskLevel = item.RiskLevel;
+ model.LimitDate = item.LimitDate;
+ model.AttachUrl = item.AttachUrl;
+ model.HandleWay = item.HandleWay;
+ model.RectifyOpinion = item.RectifyOpinion;
+ model.RectifyDate = item.RectifyDate;
+ model.ReAttachUrl = item.ReAttachUrl;
+ model.State = item.State;
+ model.ProposeUnitId = item.ProposeUnitId;
+ model.SaveHandleMan = item.SaveHandleMan;
+
+ db.SubmitChanges();
+ }
+
+ if (!string.IsNullOrEmpty(item.AttachUrl1)) //整改前图片
+ {
+ APIDataShareSyncService.OperationAttachFile(WebUrl, item.CheckSpecialDetailId,
+ BLL.Const.ProjectCheckSpecialMenuId, item.AttachUrl1);
+ }
+ }
+ }
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs b/SUBQHSE/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs
new file mode 100644
index 0000000..74fbddc
--- /dev/null
+++ b/SUBQHSE/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs
@@ -0,0 +1,467 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Configuration;
+using System.IO;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Model;
+using Newtonsoft.Json;
+using RestSharp;
+using System.Net;
+
+
+namespace BLL;
+
+public class APIHazardRegisterSyncService
+{
+ #region 根据项目、单位获取安全检查列表分页
+
+ public static List GetHazardRegisterLitsByprojectIdUnitIdPage(string projectId,
+ string unitId, string dataId = "")
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ var list = from x in db.HSSE_Hazard_HazardRegister where x.ProjectId == projectId select x;
+ if (!string.IsNullOrEmpty(unitId))
+ {
+ list = list.Where(x => x.ResponsibleUnit == unitId);
+ }
+
+ if (!string.IsNullOrEmpty(dataId))
+ {
+ list = list.Where(x => x.HazardRegisterId == dataId);
+ }
+
+ var dataList = (from x in list
+ join ht in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals ht.RegisterTypesId into htTemp
+ from ht in htTemp.DefaultIfEmpty()
+ join uw in db.WBS_UnitWork on x.Place equals uw.UnitWorkId into uwTemp
+ from uw in uwTemp.DefaultIfEmpty()
+ join u1 in db.Sys_User on x.ResponsibleMan equals u1.UserId into u1Temp
+ from u1 in u1Temp.DefaultIfEmpty()
+ join u2 in db.Sys_User on x.CheckManId equals u2.UserId into u2Temp
+ from u2 in u2Temp.DefaultIfEmpty()
+ join u3 in db.Sys_User on x.ConfirmMan equals u3.UserId into u3Temp
+ from u3 in u3Temp.DefaultIfEmpty()
+ join u4 in db.Sys_User on x.ResponsibleMan2 equals u4.UserId into u4Temp
+ from u4 in u4Temp.DefaultIfEmpty()
+ select new HazardRegisterSyncItem
+ {
+ HazardRegisterId = x.HazardRegisterId,
+ HazardCode = x.HazardCode,
+ RegisterDate = x.RegisterDate,
+ RegisterDef = x.RegisterDef,
+ Rectification = x.Rectification,
+ Place = x.Place,
+ PlaceName = uw.UnitWorkName,
+ ResponsibleUnit = x.ResponsibleUnit,
+ Observer = x.Observer,
+ RectifiedDate = x.RectifiedDate,
+ AttachUrl = x.AttachUrl,
+ ProjectId = x.ProjectId,
+ States = x.States,
+ IsEffective = x.IsEffective,
+ ResponsibleMan = x.ResponsibleMan,
+ ResponsibleManName = u1.UserName,
+ CheckManId = x.CheckManId,
+ CheckManName = u2.UserName,
+ CheckTime = x.CheckTime,
+ RectificationPeriod = x.RectificationPeriod,
+ ImageUrl = x.ImageUrl,
+ RectificationImageUrl = x.RectificationImageUrl,
+ RectificationTime = x.RectificationTime,
+ ConfirmMan = x.ConfirmMan,
+ ConfirmManName = u3.UserName,
+ ConfirmDate = x.ConfirmDate,
+ HandleIdea = x.HandleIdea,
+ CutPayment = x.CutPayment,
+ ProblemTypes = x.ProblemTypes,
+ RegisterTypesId = x.RegisterTypesId,
+ RegisterTypesName = ht.RegisterTypesName,
+ CheckCycle = x.CheckCycle,
+ CheckItemDetailId = x.CheckItemDetailId,
+ SupCheckItemSetId = x.SupCheckItemSetId,
+ CheckItemSetId = x.CheckItemSetId,
+ CheckSpecialId = x.CheckSpecialId,
+ InstallationId = x.InstallationId,
+ SafeSupervisionId = x.SafeSupervisionId,
+ ResponsibleMan2 = x.ResponsibleMan2,
+ ResponsibleMan2Name = u4.UserName,
+ SafeSupervisionIsOK = x.SafeSupervisionIsOK,
+ GpsLocation = x.GpsLocation,
+ IsWx = x.IsWx,
+ DIC_ID = x.DIC_ID,
+ CCManIds = x.CCManIds,
+ ResultType = x.ResultType,
+ ResultId = x.ResultId,
+ Requirements = x.Requirements,
+ Risk_Level = x.Risk_Level,
+ ControlId = x.ControlId,
+ DataSource = "1",
+ }).ToList();
+
+ return dataList;
+ }
+ }
+
+ #endregion
+
+
+ #region 拉取项目安全检查数据
+
+ public static string getHazardRegisterLists(string projectId = "")
+ {
+ int code = 0;
+ string message = "";
+ try
+ {
+ string CollCropCode = string.Empty;
+ string unitId = string.Empty;
+ var thisUnit = CommonService.GetIsThisUnit(); //当前单位
+ if (thisUnit != null)
+ {
+ CollCropCode = thisUnit.CollCropCode; //社会统一信用代码
+ unitId = thisUnit.UnitId;
+ }
+
+ var ProjectList = (from x in Funs.DB.Base_Project
+ where (x.IsDelete == null || x.IsDelete == false) && x.SubjectUnit != null &&
+ x.SubjectProject != null
+ select x).ToList();
+
+ if (!string.IsNullOrEmpty(projectId))
+ {
+ ProjectList = ProjectList.Where(x => x.ProjectId == projectId).ToList();
+ }
+
+ if (ProjectList.Count > 0)
+ {
+ foreach (var project in ProjectList)
+ {
+ string SubjectUnitId = project.SubjectUnit; //集团的单位id
+ string SubjectProjectId = project.SubjectProject; //集团的项目id
+ //获取对应单位的apiurl地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
+ var ApiUrl = "";
+ var WebUrl = "";
+ if (!string.IsNullOrEmpty(Url))
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+
+ // CollCropCode = "91420000177570439L"; //三化建 测试使用
+ // SubjectProjectId = "c7ade79e-7646-4c59-a8fd-020a7e3138c6";//测试使用
+
+ string url =
+ "/api/HazardRegisterSync/getHazardRegisterListByProjectIdAndCollCropCode?projectId=" +
+ SubjectProjectId + "&collCropCode=" + CollCropCode;
+ string baseurl = ApiUrl + url;
+ string contenttype = "application/json;charset=unicode";
+ var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, null, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ code = Funs.GetNewIntOrZero(obj["code"].ToString());
+ message = obj["message"].ToString();
+ if (code == 1)
+ {
+ var getData =
+ JsonConvert.DeserializeObject>(obj["data"].ToString());
+ if (getData.Count() > 0)
+ {
+ ProcessHazardRegisterData(getData, project.ProjectId, unitId, WebUrl,"pull");
+ }
+ message = "获取成功:同步安全检查数" + getData.Count().ToString() + "条";
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ message = "获取失败:" + ex.Message;
+ ErrLogInfo.WriteLog("安全检查获取!", ex);
+ }
+
+ return message;
+ }
+
+ #endregion
+
+
+ #region 推送安全检查数据
+
+ public static ReturnData pushHazardRegisterLists(string projectId, string dataId = "")
+ {
+ Model.ReturnData responeData = new Model.ReturnData();
+ responeData.code = 0;
+ responeData.message = string.Empty;
+ var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
+ try
+ {
+ if (project != null)
+ {
+ //获取安全检查数据
+ var items = GetHazardRegisterLitsByprojectIdUnitIdPage(projectId, "", dataId);
+ //总包地址推送
+ if (items.Count() > 0)
+ {
+ var thisUnit = CommonService.GetIsThisUnit(); //当前单位
+ var apiurl = "/api/HazardRegisterSync/SaveHazardRegisterSyncData";
+ //总包单位接口地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
+ var ApiUrl = "";
+ var WebUrl = "";
+ if (!string.IsNullOrEmpty(Url))
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+ // thisUnit.CollCropCode = "913404001520228377Y";//测试使用
+ // project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
+
+ var pushData = new HazardRegisterSyncData
+ {
+ CollCropCode = thisUnit.CollCropCode, //分包单位社会统一信用码
+ // CollCropCode = "91420000177570439L", //分包单位社会统一信用码
+ // ProjectId = "c7ade79e-7646-4c59-a8fd-020a7e3138c6", //主包项目Id
+ ProjectId = project.SubjectProject, //主包项目Id
+ UnitDomain = Funs.SGGLUrl, //分包单位域名地址【文件存储地址】
+ Items = items //安全检查数据
+ };
+ var pushContent = JsonConvert.SerializeObject(pushData);
+ string baseurl = ApiUrl + apiurl;
+ string contenttype = "application/json;charset=unicode";
+ var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ JObject obj = JObject.Parse(returndata);
+ string code = obj["code"].ToString();
+ string message = obj["message"].ToString();
+ responeData.code = int.Parse(code);
+ responeData.message = message;
+ }
+ }
+ else
+ {
+ responeData.code = 0;
+ responeData.message = "当前没有项目安全检查数据";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.message = "同步到总包单位失败!";
+ ErrLogInfo.WriteLog("【安全检查】同步到总包单位失败!", ex);
+ }
+
+ return responeData;
+ }
+
+ #endregion
+
+
+ #region 接收保存项目安全检查数据
+
+ public static string SaveHazardRegisterSyncData(Model.HazardRegisterSyncData items)
+ {
+ int code = 0;
+ string message = "";
+ try
+ {
+ if (items.Items.Count > 0 || items.Items.Count > 0)
+ {
+ var CollCropCode = items.CollCropCode; //分包单位社会统一信用码
+ var ProjectId = items.ProjectId; //总包项目Id
+ var UnitDomain = items.UnitDomain; //分包单位域名地址【文件存储地址】
+ var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.CollCropCode == CollCropCode); //根据CollCropCode获取单位id
+ if (unit == null)
+ {
+ message = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
+ }
+ else
+ {
+ //2、判断主包项目是否存在
+ var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId);
+ if (porject == null)
+ {
+ message = "总包单位不存在本项目,请检查总包项目关联是否正确!";
+ }
+ else
+ {
+ ProcessHazardRegisterData(items.Items, ProjectId, unit.UnitId, UnitDomain, "push");
+ message = "数据推送成功!";
+ }
+ }
+ }
+ else
+ {
+ message = "暂无项目安全检查数据!";
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ return message;
+ }
+
+ #endregion
+
+
+ #region 处理单个安全检查数据的新增或更新逻辑
+
+ ///
+ /// 处理单个安全检查数据的新增或更新逻辑
+ ///
+ /// 安全检查数据项
+ /// 项目id
+ /// 单位ID
+ /// Web地址
+ private static void ProcessHazardRegisterData(List getData, string projectId,
+ string unitId, string WebUrl, string type)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ foreach (var item in getData)
+ {
+ Model.HSSE_Hazard_HazardRegister model =
+ db.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == item.HazardRegisterId);
+ if (model == null)
+ {
+ Model.HSSE_Hazard_HazardRegister newModel = new Model.HSSE_Hazard_HazardRegister
+ {
+ HazardRegisterId = item.HazardRegisterId,
+ HazardCode = item.HazardCode,
+ RegisterDate = item.RegisterDate,
+ RegisterDef = item.RegisterDef,
+ Rectification = item.Rectification,
+ Place = APIDataShareSyncService.getUnitWorkId(item.PlaceName, projectId),
+ ResponsibleUnit = unitId,
+ Observer = item.Observer,
+ AttachUrl = item.AttachUrl,
+ ProjectId = projectId,
+ States = item.States,
+ IsEffective = item.IsEffective,
+ ResponsibleMan = APIDataShareSyncService.getUserId(item.ResponsibleManName),
+ CheckManId = APIDataShareSyncService.getUserId(item.CheckManName),
+ CheckTime = item.CheckTime,
+ RectificationPeriod = item.RectificationPeriod,
+ ImageUrl = item.ImageUrl,
+ RectificationImageUrl = item.RectificationImageUrl,
+ RectificationTime = item.RectificationTime,
+ ConfirmMan = APIDataShareSyncService.getUserId(item.ConfirmManName),
+ ConfirmDate = item.ConfirmDate,
+ HandleIdea = item.HandleIdea,
+ CutPayment = item.CutPayment,
+ ProblemTypes = item.ProblemTypes,
+ RegisterTypesId = APIDataShareSyncService.getRegisterTypesId(item.RegisterTypesName),
+ CheckCycle = item.CheckCycle,
+ CheckItemDetailId = item.CheckItemDetailId,
+ SupCheckItemSetId = item.SupCheckItemSetId,
+ CheckItemSetId = item.CheckItemSetId,
+ CheckSpecialId = item.CheckSpecialId,
+ InstallationId = item.InstallationId,
+ SafeSupervisionId = item.SafeSupervisionId,
+ ResponsibleMan2 = APIDataShareSyncService.getUserId(item.ResponsibleMan2Name),
+ SafeSupervisionIsOK = item.SafeSupervisionIsOK,
+ GpsLocation = item.GpsLocation,
+ IsWx = item.IsWx,
+ DIC_ID = item.DIC_ID,
+ CCManIds = item.CCManIds,
+ ResultType = item.ResultType,
+ ResultId = item.ResultId,
+ Requirements = item.Requirements,
+ Risk_Level = item.Risk_Level,
+ ControlId = item.ControlId,
+ };
+ if (type == "pull")
+ {
+ newModel.DataSource = item.DataSource;
+ }
+ db.HSSE_Hazard_HazardRegister.InsertOnSubmit(newModel);
+ db.SubmitChanges();
+ }
+ else
+ {
+ // model.HazardRegisterId = item.HazardRegisterId;
+ model.HazardCode = item.HazardCode;
+ model.RegisterDate = item.RegisterDate;
+ model.RegisterDef = item.RegisterDef;
+ model.Rectification = item.Rectification;
+ model.Place = APIDataShareSyncService.getUnitWorkId(item.PlaceName, projectId);
+ model.ResponsibleUnit = unitId;
+ model.Observer = item.Observer;
+ model.AttachUrl = item.AttachUrl;
+ model.ProjectId = projectId;
+ model.States = item.States;
+ model.IsEffective = item.IsEffective;
+ model.ResponsibleMan = APIDataShareSyncService.getUserId(item.ResponsibleManName);
+ model.CheckManId = APIDataShareSyncService.getUserId(item.CheckManName);
+ model.CheckTime = item.CheckTime;
+ model.RectificationPeriod = item.RectificationPeriod;
+ model.ImageUrl = item.ImageUrl;
+ model.RectificationImageUrl = item.RectificationImageUrl;
+ model.RectificationTime = item.RectificationTime;
+ model.ConfirmMan = APIDataShareSyncService.getUserId(item.ConfirmManName);
+ model.ConfirmDate = item.ConfirmDate;
+ model.HandleIdea = item.HandleIdea;
+ model.CutPayment = item.CutPayment;
+ model.ProblemTypes = item.ProblemTypes;
+ model.RegisterTypesId = APIDataShareSyncService.getRegisterTypesId(item.RegisterTypesName);
+ model.CheckCycle = item.CheckCycle;
+ model.CheckItemDetailId = item.CheckItemDetailId;
+ model.SupCheckItemSetId = item.SupCheckItemSetId;
+ model.CheckItemSetId = item.CheckItemSetId;
+ model.CheckSpecialId = item.CheckSpecialId;
+ model.InstallationId = item.InstallationId;
+ model.SafeSupervisionId = item.SafeSupervisionId;
+ model.ResponsibleMan2 = APIDataShareSyncService.getUserId(item.ResponsibleMan2Name);
+ model.SafeSupervisionIsOK = item.SafeSupervisionIsOK;
+ model.GpsLocation = item.GpsLocation;
+ model.IsWx = item.IsWx;
+ model.DIC_ID = item.DIC_ID;
+ model.CCManIds = item.CCManIds;
+ model.ResultType = item.ResultType;
+ model.ResultId = item.ResultId;
+ model.Requirements = item.Requirements;
+ model.Risk_Level = item.Risk_Level;
+ model.ControlId = item.ControlId;
+ if (type == "pull")
+ {
+ model.DataSource = item.DataSource;
+ }
+
+ db.SubmitChanges();
+ }
+
+ if (!string.IsNullOrEmpty(item.ImageUrl))
+ {
+ APIDataShareSyncService.OperationAttachFile(WebUrl, item.HazardRegisterId,
+ BLL.Const.HSSE_HiddenRectificationListMenuId, item.ImageUrl);
+ }
+
+ if (!string.IsNullOrEmpty(item.RectificationImageUrl))
+ {
+ APIDataShareSyncService.OperationAttachFile(WebUrl, item.HazardRegisterId+"-R",
+ BLL.Const.HSSE_HiddenRectificationListMenuId, item.RectificationImageUrl);
+ }
+ }
+ }
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/DataShare/HSSE/APILicenseSyncService.cs b/SUBQHSE/BLL/DataShare/HSSE/APILicenseSyncService.cs
new file mode 100644
index 0000000..d08b1c2
--- /dev/null
+++ b/SUBQHSE/BLL/DataShare/HSSE/APILicenseSyncService.cs
@@ -0,0 +1,265 @@
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections;
+using System.Linq;
+using System.Runtime.InteropServices.ComTypes;
+
+namespace BLL
+{
+ ///
+ /// 作业票数据共享互通
+ ///
+ public class APILicenseSyncService
+ {
+ #region 分包单位推送数据到总包单位
+
+ ///
+ /// 推送分包作业票定稿数据
+ ///
+ /// 项目Id
+ /// 作业票定稿数据Id(为空的时候推送全部)
+ ///
+ public static ReturnData PushLicenseManagerLists(string projectId, string dataId = "")
+ {
+ Model.ReturnData responeData = new Model.ReturnData();
+ responeData.code = 0;
+ responeData.message = string.Empty;
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ try
+ {
+ var list = from x in db.View_License_LicenseManager where x.ProjectId == projectId select x;
+ if (!string.IsNullOrWhiteSpace(dataId))
+ {
+ list = list.Where(x => x.LicenseManagerId == dataId);
+ }
+ var dataList = (from x in list
+ join blt in db.Base_LicenseType on x.LicenseTypeId equals blt.LicenseTypeId into bltGroup
+ from blt in bltGroup.DefaultIfEmpty()
+ join su in db.Sys_User on x.CompileMan equals su.UserId into sUser
+ from su in sUser.DefaultIfEmpty()
+ //join uw in db.WBS_UnitWork on x.WorkAreaId equals uw.UnitWorkId into uwGroup
+ //from uw in uwGroup.DefaultIfEmpty()
+ join att in db.AttachFile on x.LicenseManagerId equals att.ToKeyId into attTemp
+ from att in attTemp.DefaultIfEmpty()
+ join att1 in db.AttachFile on (x.LicenseManagerId + "_GB") equals att1.ToKeyId into att1Temp
+ from att1 in att1Temp.DefaultIfEmpty()
+ orderby x.CompileDate descending
+ select new LicenseManagerItem
+ {
+ ProjectId = x.ProjectId,
+ UnitId = x.UnitId,
+ LicenseManagerId = x.LicenseManagerId,
+ LicenseManagerCode = x.LicenseManagerCode,
+ LicenseManageName = x.LicenseManageName,
+ LicenseTypeId = x.LicenseTypeId,
+ LicenseTypeCode = blt.LicenseTypeCode,
+ LicenseTypeName = blt.LicenseTypeName,
+ LicenseManageContents = x.LicenseManageContents,
+ CompileMan = x.CompileMan,
+ CompileManName = su.UserName,
+ CompileDate = x.CompileDate,
+ States = x.States,
+ WorkAreaId = x.WorkAreaId,
+ //UnitWorkCode = uw.UnitWorkCode,
+ //UnitWorkName = uw.UnitWorkName,
+ UnitWorkName = x.WorkAreaName,
+ StartDate = x.StartDate,
+ EndDate = x.EndDate,
+ ApplicantMan = x.ApplicantMan,
+ WorkStates = x.WorkStates,
+ IsHighRisk = x.IsHighRisk,
+ LicenseCodes = x.LicenseCodes,
+ SourceDes = x.SourceDes,
+ //AttachUrl = AttachFileService.getFileUrl(x.LicenseManagerId),//附件
+ //AttachUrl1 = AttachFileService.getFileUrl(x.LicenseManagerId + "_GB"),//关闭附件
+ AttachFileId = att.AttachFileId,
+ ToKeyId = att.ToKeyId,
+ AttachSource = att.AttachSource,
+ AttachUrl = att.AttachUrl,
+ AttachFileId1 = att1.AttachFileId,
+ ToKeyId1 = att1.ToKeyId,
+ AttachSource1 = att1.AttachSource,
+ AttachUrl1 = att1.AttachUrl,
+ }).ToList();
+
+ if (dataList.Count() > 0)
+ {
+ var thisUnit = CommonService.GetIsThisUnit();
+ var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
+ var pushData = new LicenseManagerData
+ {
+ CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
+ UnitId = thisUnit.UnitId,//分包单位Id
+ UnitName = thisUnit.UnitName,//分包单位名称
+ ShortUnitName = thisUnit.ShortUnitName,//分包单位简称
+ UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】
+ SubjectUnit = porject.SubjectUnit,//主包单位Id
+ SubjectProject = porject.SubjectProject,//主包项目Id
+ Items = dataList//数据
+ };
+ var pushContent = JsonConvert.SerializeObject(pushData);
+
+ //获取总包单位接口apiurl地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(porject.SubjectUnit);
+ var ApiUrl = string.Empty;
+ var WebUrl = string.Empty;
+ if (Url != null)
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+ var baseurl = $"{ApiUrl}/api/LicenseSync/ReceiveSaveProjectLicenseManagerData";
+ string contenttype = "application/json;charset=unicode";
+ //Hashtable newToken = new Hashtable
+ //{
+ // { "token", ServerService.GetToken().Token }
+ //};
+
+ //ErrLogInfo.WriteLog($"【班前会推送数据】接口地址:{baseurl};{pushContent}");
+ var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ ErrLogInfo.WriteLog($"【作业票返回结果】接口地址:{baseurl};{returndata}");
+ JObject obj = JObject.Parse(returndata);
+ string mess = obj["message"].ToString();
+ string code = obj["code"].ToString();
+ }
+ }
+ else
+ {
+ responeData.message = "当前项目没有作业票定稿数据";
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.message = "同步到总包单位失败!";
+ ErrLogInfo.WriteLog("【作业票定稿】同步到总包单位失败!", ex);
+ }
+ }
+ return responeData;
+ }
+
+ #endregion
+
+ #region 总包单位接收分包单位推送数据
+
+ ///
+ /// 总包单位接收保存分包单位推送的作业票定稿数据
+ ///
+ ///
+ ///
+ public static string ReceiveSaveProjectLicenseManagerData(LicenseManagerData data)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ string result = string.Empty;
+ if (data.Items.Count() > 0)
+ {
+ //var jsonData = JsonConvert.SerializeObject(data);
+ //ErrLogInfo.WriteLog($"【作业票定稿接收数据】{jsonData}");
+ //1、判断分包单位是否存在
+ var unit = UnitService.getUnitByCollCropCodeUnitName(data.CollCropCode, data.UnitName);
+ if (unit == null)
+ {
+ result = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
+ }
+ else
+ {
+ //2、判断主包项目是否存在
+ var porject = BLL.ProjectService.GetProjectByProjectId(data.SubjectProject);
+ if (porject == null)
+ {
+ result = "总包单位不存在本项目,请检查总包项目关联是否正确!";
+ }
+ else
+ {
+ int succ = 0;
+ //3、保存数据
+ foreach (var item in data.Items)
+ {
+ try
+ {
+ var model = db.License_LicenseManager.FirstOrDefault(e => e.LicenseManagerId == item.LicenseManagerId);
+ if (model != null)
+ {//编辑
+ model.ProjectId = data.SubjectProject;
+ model.UnitId = unit.UnitId;
+ model.LicenseManagerCode = item.LicenseManagerCode;
+ model.LicenseManageName = item.LicenseManageName;
+ //model.LicenseTypeId = item.LicenseTypeId;
+ model.LicenseTypeId = APIDataShareSyncService.GetLicenseTypeId(item.LicenseTypeId, item.LicenseTypeCode, item.LicenseTypeName);
+ //model.LicenseManageContents = HttpUtility.HtmlEncode(item.LicenseManageContents);
+ model.LicenseManageContents = item.LicenseManageContents;
+ model.States = item.States;
+ model.StartDate = item.StartDate;
+ model.EndDate = item.EndDate;
+ model.ApplicantMan = item.ApplicantMan;
+ model.IsHighRisk = item.IsHighRisk;
+ model.WorkStates = item.WorkStates;
+ model.SourceDes = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}#单位工程:{item.UnitWorkName}";
+ model.CompileDate = item.CompileDate;
+ //model.CompileMan = item.CompileMan;
+
+ db.SubmitChanges();
+ }
+ else
+ {//新增
+ Model.License_LicenseManager newModel = new Model.License_LicenseManager();
+ newModel.LicenseManagerId = item.LicenseManagerId;
+ newModel.ProjectId = data.SubjectProject;
+ newModel.UnitId = unit.UnitId;
+ newModel.LicenseManagerCode = item.LicenseManagerCode;
+ newModel.LicenseManageName = item.LicenseManageName;
+ //newModel.LicenseTypeId = item.LicenseTypeId;
+ newModel.LicenseTypeId = APIDataShareSyncService.GetLicenseTypeId(item.LicenseTypeId, item.LicenseTypeCode, item.LicenseTypeName);
+ //newModel.LicenseManageContents = HttpUtility.HtmlEncode(item.LicenseManageContents);
+ newModel.LicenseManageContents = item.LicenseManageContents;
+ newModel.States = item.States;
+ newModel.StartDate = item.StartDate;
+ newModel.EndDate = item.EndDate;
+ newModel.ApplicantMan = item.ApplicantMan;
+ newModel.IsHighRisk = item.IsHighRisk;
+ newModel.WorkStates = item.WorkStates;
+ newModel.SourceDes = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}#单位工程:{item.UnitWorkName}";
+ newModel.CompileDate = item.CompileDate;
+ //newModel.CompileMan = item.CompileMan;
+
+ db.License_LicenseManager.InsertOnSubmit(newModel);
+ db.SubmitChanges();
+ }
+ succ++;
+
+ //ErrLogInfo.WriteLog($"【作业票定稿接收数据——内容附件】UnitDomain:{data.UnitDomain};AttachFileId:{item.AttachFileId};ToKeyId:{item.ToKeyId};AttachSource:{item.AttachSource};AttachUrl:{item.AttachUrl}");
+ //附件处理:附件
+ BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId, item.ToKeyId, item.AttachSource, item.AttachUrl);
+ //附件处理:关闭附件
+ BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId1, item.ToKeyId1, item.AttachSource1, item.AttachUrl1);
+ }
+ catch (Exception ex)
+ {
+ BLL.ErrLogInfo.WriteLog($"【{porject.ProjectName}】作业票定稿数据推送总包失败", ex.Message);
+ continue;
+ }
+ }
+ result = $"推送成功:总数{data.Items.Count()}条,成功{succ}条";
+ }
+ }
+ }
+ else
+ {
+ result = "推送数据对象为空!";
+ }
+ return result;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/DataShare/HSSE/APIMeetingSyncService.cs b/SUBQHSE/BLL/DataShare/HSSE/APIMeetingSyncService.cs
new file mode 100644
index 0000000..18eb348
--- /dev/null
+++ b/SUBQHSE/BLL/DataShare/HSSE/APIMeetingSyncService.cs
@@ -0,0 +1,275 @@
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections;
+using System.Linq;
+
+namespace BLL
+{
+ ///
+ /// 安全会议数据共享互通
+ ///
+ public class APIMeetingSyncService
+ {
+ #region 分包单位推送数据到总包单位
+
+ ///
+ /// 推送分包班前会数据
+ ///
+ /// 项目Id
+ /// 班前会数据Id(为空的时候推送全部)
+ ///
+ public static ReturnData PushClassMeetingLists(string projectId, string dataId = "")
+ {
+ Model.ReturnData responeData = new Model.ReturnData();
+ responeData.code = 0;
+ responeData.message = string.Empty;
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ try
+ {
+ var list = from x in db.Meeting_ClassMeeting where x.ProjectId == projectId select x;
+ if (!string.IsNullOrWhiteSpace(dataId))
+ {
+ list = list.Where(x => x.ClassMeetingId == dataId);
+ }
+ var dataList = (from x in list
+ join ptg in db.ProjectData_TeamGroup on x.TeamGroupId equals ptg.TeamGroupId into ptGroup
+ from ptg in ptGroup.DefaultIfEmpty()
+ join su in db.Sys_User on x.CompileMan equals su.UserId into sUser
+ from su in sUser.DefaultIfEmpty()
+ join att in db.AttachFile on x.ClassMeetingId equals att.ToKeyId into attTemp
+ from att in attTemp.DefaultIfEmpty()
+ join att1 in db.AttachFile on (x.ClassMeetingId + "#1") equals att1.ToKeyId into att1Temp
+ from att1 in att1Temp.DefaultIfEmpty()
+ join att2 in db.AttachFile on (x.ClassMeetingId + "#2") equals att2.ToKeyId into att2Temp
+ from att2 in att2Temp.DefaultIfEmpty()
+ orderby x.CompileDate descending
+ select new ClassMeetingItem
+ {
+ ProjectId = x.ProjectId,
+ UnitId = x.UnitId,
+ ClassMeetingId = x.ClassMeetingId,
+ ClassMeetingCode = x.ClassMeetingCode,
+ ClassMeetingName = x.ClassMeetingName,
+ ClassMeetingDate = x.ClassMeetingDate,
+ ClassMeetingContents = x.ClassMeetingContents,
+ CompileMan = x.CompileMan,
+ CompileManName = su.UserName,
+ TeamGroupId = x.TeamGroupId,
+ TeamGroupName = ptg.TeamGroupName,
+ CompileDate = x.CompileDate,
+ States = x.States,
+ MeetingPlace = x.MeetingPlace,
+ MeetingHours = x.MeetingHours,
+ MeetingHostMan = x.MeetingHostMan,
+ AttentPerson = x.AttentPerson,
+ AttentPersonNum = x.AttentPersonNum,
+ MeetingHostManOther = x.MeetingHostManOther,
+ Remark = x.Remark,
+ //AttachUrl = AttachFileService.getFileUrl(x.ClassMeetingId),//内容
+ //AttachUrl1 = AttachFileService.getFileUrl(x.ClassMeetingId + "#1"),//签到表
+ //AttachUrl2 = AttachFileService.getFileUrl(x.ClassMeetingId + "#2"),//会议过程
+ AttachFileId = att.AttachFileId,
+ ToKeyId = att.ToKeyId,
+ AttachSource = att.AttachSource,
+ AttachUrl = att.AttachUrl,
+ AttachFileId1 = att1.AttachFileId,
+ ToKeyId1 = att1.ToKeyId,
+ AttachSource1 = att1.AttachSource,
+ AttachUrl1 = att1.AttachUrl,
+ AttachFileId2 = att2.AttachFileId,
+ ToKeyId2 = att2.ToKeyId,
+ AttachSource2 = att2.AttachSource,
+ AttachUrl2 = att2.AttachUrl,
+ }).ToList();
+
+ if (dataList.Count() > 0)
+ {
+ var thisUnit = CommonService.GetIsThisUnit();
+ var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
+ var pushData = new ClassMeetingData
+ {
+ CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码
+ UnitId = thisUnit.UnitId,//分包单位Id
+ UnitName = thisUnit.UnitName,//分包单位名称
+ ShortUnitName = thisUnit.ShortUnitName,//分包单位简称
+ UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】
+ SubjectUnit = porject.SubjectUnit,//主包单位Id
+ SubjectProject = porject.SubjectProject,//主包项目Id
+ Items = dataList//会议数据
+ };
+ var pushContent = JsonConvert.SerializeObject(pushData);
+
+ //获取总包单位接口apiurl地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(porject.SubjectUnit);
+ var ApiUrl = string.Empty;
+ var WebUrl = string.Empty;
+ if (Url != null)
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+ var baseurl = $"{ApiUrl}/api/MeetingSync/ReceiveSaveProjectClassMeetingData";
+ string contenttype = "application/json;charset=unicode";
+ //Hashtable newToken = new Hashtable
+ //{
+ // { "token", ServerService.GetToken().Token }
+ //};
+ var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ ErrLogInfo.WriteLog($"【班前会返回结果】接口地址:{baseurl};{returndata}");
+ JObject obj = JObject.Parse(returndata);
+ string code = obj["code"].ToString();
+ string message = obj["message"].ToString();
+ responeData.code = int.Parse(code);
+ responeData.message = message;
+ }
+ }
+ else
+ {
+ responeData.message = "当前项目没有班前会数据";
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.message = "同步到总包单位失败!";
+ ErrLogInfo.WriteLog("【班前会】同步到总包单位失败!", ex);
+ }
+ }
+ return responeData;
+ }
+
+ #endregion
+
+ #region 总包单位接收分包单位推送数据
+
+ ///
+ /// 总包单位接收保存分包单位推送的班前会数据
+ ///
+ ///
+ ///
+ public static string ReceiveSaveProjectClassMeetingData(ClassMeetingData data)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ string result = string.Empty;
+ if (data.Items.Count() > 0)
+ {
+ //1、判断分包单位是否存在
+ var unit = UnitService.getUnitByCollCropCodeUnitName(data.CollCropCode, data.UnitName);
+ if (unit == null)
+ {
+ result = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
+ }
+ else
+ {
+ //2、判断主包项目是否存在
+ var porject = BLL.ProjectService.GetProjectByProjectId(data.SubjectProject);
+ if (porject == null)
+ {
+ result = "总包单位不存在本项目,请检查总包项目关联是否正确!";
+ }
+ else
+ {
+ int succ = 0;
+ //3、保存数据
+ foreach (var item in data.Items)
+ {
+ try
+ {
+ var model = db.Meeting_ClassMeeting.FirstOrDefault(e => e.ClassMeetingId == item.ClassMeetingId);
+ if (model != null)
+ {//编辑
+ model.ProjectId = data.SubjectProject;
+ model.UnitId = unit.UnitId;
+ model.ClassMeetingCode = item.ClassMeetingCode;
+ model.ClassMeetingName = item.ClassMeetingName;
+ model.ClassMeetingDate = item.ClassMeetingDate;
+ model.AttentPersonNum = item.AttentPersonNum;
+ //model.TeamGroupId = item.TeamGroupId;
+ model.TeamGroupId = APIDataShareSyncService.GetTeamGroupId(item.TeamGroupName, data.SubjectProject, unit.UnitId);
+ model.AttentPersonNum = item.AttentPersonNum;
+ //model.ClassMeetingContents = HttpUtility.HtmlEncode(item.ClassMeetingContents);
+ model.ClassMeetingContents = item.ClassMeetingContents;
+ //model.States = item.States;
+ model.States = BLL.Const.State_2; ;//分包推送过来的班前会数据默认已完成
+ model.MeetingPlace = item.MeetingPlace;
+ model.MeetingHours = item.MeetingHours;
+ model.MeetingHostMan = item.MeetingHostMan;
+ model.AttentPerson = item.AttentPerson;
+ model.AttentPersonNum = item.AttentPersonNum;
+ model.MeetingHostManOther = item.MeetingHostManOther;
+ //model.Remark = item.Remark;
+ model.Remark = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}";
+ model.CompileDate = item.CompileDate;
+ model.CompileMan = item.CompileMan;
+
+ db.SubmitChanges();
+ }
+ else
+ {//新增
+ Model.Meeting_ClassMeeting newModel = new Model.Meeting_ClassMeeting();
+ newModel.ClassMeetingId = item.ClassMeetingId;
+ newModel.ProjectId = data.SubjectProject;
+ newModel.UnitId = unit.UnitId;
+ newModel.ClassMeetingCode = item.ClassMeetingCode;
+ newModel.ClassMeetingName = item.ClassMeetingName;
+ newModel.ClassMeetingDate = item.ClassMeetingDate;
+ newModel.AttentPersonNum = item.AttentPersonNum;
+ //newModel.TeamGroupId = item.TeamGroupId;
+ newModel.TeamGroupId = APIDataShareSyncService.GetTeamGroupId(item.TeamGroupName, data.SubjectProject, unit.UnitId);
+ newModel.AttentPersonNum = item.AttentPersonNum;
+ //newModel.ClassMeetingContents = HttpUtility.HtmlEncode(item.ClassMeetingContents);
+ newModel.ClassMeetingContents = item.ClassMeetingContents;
+ //newModel.States = item.States;
+ newModel.States = BLL.Const.State_2; ;//分包推送过来的班前会数据默认已完成
+ newModel.MeetingPlace = item.MeetingPlace;
+ newModel.MeetingHours = item.MeetingHours;
+ newModel.MeetingHostMan = item.MeetingHostMan;
+ newModel.AttentPerson = item.AttentPerson;
+ newModel.AttentPersonNum = item.AttentPersonNum;
+ newModel.MeetingHostManOther = item.MeetingHostManOther;
+ //newModel.Remark = item.Remark;
+ newModel.Remark = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}";
+ newModel.CompileDate = item.CompileDate;
+ newModel.CompileMan = item.CompileMan;
+
+ db.Meeting_ClassMeeting.InsertOnSubmit(newModel);
+ db.SubmitChanges();
+ }
+ succ++;
+ //附件处理:内容附件
+ BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId, item.ToKeyId, item.AttachSource, item.AttachUrl);
+ //附件处理:签到表
+ BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId1, item.ToKeyId1, item.AttachSource1, item.AttachUrl1);
+ //附件处理:会议过程
+ BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId2, item.ToKeyId2, item.AttachSource2, item.AttachUrl2);
+ }
+ catch (Exception ex)
+ {
+ BLL.ErrLogInfo.WriteLog($"【{porject.ProjectName}】班前会数据推送总包失败", ex.Message);
+ continue;
+ }
+ }
+ result = $"推送成功:总数{data.Items.Count()}条,成功{succ}条";
+ }
+ }
+ }
+ else
+ {
+ result = "推送数据对象为空!";
+ }
+ return result;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/DataShare/HSSE/APIPersonSyncService.cs b/SUBQHSE/BLL/DataShare/HSSE/APIPersonSyncService.cs
new file mode 100644
index 0000000..a365112
--- /dev/null
+++ b/SUBQHSE/BLL/DataShare/HSSE/APIPersonSyncService.cs
@@ -0,0 +1,574 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Configuration;
+using System.IO;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Model;
+using Newtonsoft.Json;
+using RestSharp;
+using System.Net;
+
+namespace BLL;
+
+public class APIPersonSyncService
+{
+ #region 根据项目、单位获取人员列表分页
+
+ public static List GetPersonLitsByProjectIdAndUnitId(string projectId, string unitId,
+ string dataId = "")
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ var list = from x in db.SitePerson_Person where x.ProjectId == projectId select x;
+ if (!string.IsNullOrEmpty(unitId))
+ {
+ list = list.Where(x => x.UnitId == unitId);
+ }
+
+ if (!string.IsNullOrEmpty(dataId))
+ {
+ list = list.Where(x => x.PersonId == dataId);
+ }
+
+ var personList = (from x in list
+ join wp in db.Base_WorkPost on x.WorkPostId equals wp.WorkPostId into wpTemp
+ from wp in wpTemp.DefaultIfEmpty()
+ join tg in db.ProjectData_TeamGroup on x.TeamGroupId equals tg.TeamGroupId into tgTemp
+ from tg in tgTemp.DefaultIfEmpty()
+ join c in db.Base_Certificate on x.CertificateId equals c.CertificateId into cTemp
+ from c in cTemp.DefaultIfEmpty()
+ join att1 in db.AttachFile on (x.PersonId + "#1") equals att1.ToKeyId into att1Temp
+ from att1 in att1Temp.DefaultIfEmpty()
+ join att2 in db.AttachFile on (x.PersonId + "#2") equals att2.ToKeyId into att2Temp
+ from att2 in att2Temp.DefaultIfEmpty()
+ join att3 in db.AttachFile on (x.PersonId + "#3") equals att3.ToKeyId into att3Temp
+ from att3 in att3Temp.DefaultIfEmpty()
+ join att4 in db.AttachFile on (x.PersonId + "#4") equals att4.ToKeyId into att4Temp
+ from att4 in att4Temp.DefaultIfEmpty()
+ join att5 in db.AttachFile on (x.PersonId + "#5") equals att5.ToKeyId into att5Temp
+ from att5 in att5Temp.DefaultIfEmpty()
+ select new Model.PersonSyncItem
+ {
+ PersonId = x.PersonId,
+ CardNo = x.CardNo,
+ PersonName = x.PersonName,
+ Sex = x.Sex,
+ IdentityCard = x.IdentityCard,
+ Address = x.Address,
+ ProjectId = x.ProjectId,
+ UnitId = x.UnitId,
+ TeamGroupId = x.TeamGroupId,
+ WorkAreaId = x.WorkAreaId,
+ WorkPostId = x.WorkPostId,
+ InTime = x.InTime,
+ OutTime = x.OutTime,
+ OutResult = x.OutResult,
+ Telephone = x.Telephone,
+ // x.PositionId,//职务
+ // x.PostTitleId,//职称
+ PhotoUrl = x.PhotoUrl,
+ IsUsed = x.IsUsed,
+ IsCardUsed = x.IsCardUsed,
+ PersonIndex = x.PersonIndex,
+ // x.DepartId,//部门
+ CertificateId = x.CertificateId,
+ CertificateItem = APIDataShareSyncService.GetPersonQualityByPersonId(x.PersonId), //特岗证书
+ CertificateCode = x.CertificateCode,
+ CertificateName = c.CertificateName,
+ CertificateLimitTime = x.CertificateLimitTime,
+ QualificationCertificateUrl = x.QualificationCertificateUrl,
+ TrainingCertificateUrl = x.TrainingCertificateUrl,
+ QRCodeAttachUrl = x.QRCodeAttachUrl,
+ Password = x.Password,
+ FromPersonId = x.FromPersonId,
+ // x.AuditorId,审核人
+ AuditorDate = x.AuditorDate,
+ ExchangeTime = x.ExchangeTime,
+ ExchangeTime2 = x.ExchangeTime2,
+ IDCardUrl = x.IDCardUrl,
+ IsForeign = x.IsForeign,
+ IsOutside = x.IsOutside,
+ EduLevel = x.EduLevel,
+ MaritalStatus = x.MaritalStatus,
+ Isprint = x.Isprint,
+ MainCNProfessionalId = x.MainCNProfessionalId,
+ ViceCNProfessionalId = x.ViceCNProfessionalId,
+ Birthday = x.Birthday,
+ IdcardType = x.IdcardType,
+ IdcardStartDate = x.IdcardStartDate,
+ IdcardEndDate = x.IdcardEndDate,
+ IdcardForever = x.IdcardForever,
+ PoliticsStatus = x.PoliticsStatus,
+ IdcardAddress = x.IdcardAddress,
+ Nation = x.Nation,
+ CountryCode = x.CountryCode,
+ IsSafetyMonitoring = x.IsSafetyMonitoring,
+ ProvinceCode = x.ProvinceCode,
+ IsCardNoOK = x.IsCardNoOK,
+ // AttachUrl1 = AttachFileService.getFileUrl(x.PersonId + "#1"),
+ // AttachUrl2 = AttachFileService.getFileUrl(x.PersonId + "#2"),
+ // AttachUrl3 = AttachFileService.getFileUrl(x.PersonId + "#3"),
+ // AttachUrl4 = AttachFileService.getFileUrl(x.PersonId + "#4"),
+ // AttachUrl5 = AttachFileService.getFileUrl(x.PersonId + "#5"),
+ AttachUrl1 = att1.AttachUrl,
+ AttachUrl2 = att2.AttachUrl,
+ AttachUrl3 = att3.AttachUrl,
+ AttachUrl4 = att4.AttachUrl,
+ AttachUrl5 = att5.AttachUrl,
+ WorkPostName = wp.WorkPostName, //岗位名称
+ PostType = wp.PostType, //岗位诶类型
+ IsHsse = wp.IsHsse, //岗位是否是安管人员
+ IsCQMS = wp.IsCQMS, //岗位是否是质量管理
+ TeamGroupName = tg.TeamGroupName,
+ WorkAreaName = APIDataShareSyncService.GetWorkAreaNames(x.WorkAreaId, projectId)
+ }).ToList();
+
+ return personList;
+ }
+ }
+
+ #endregion
+
+ #region 拉取项目人员数据
+
+ public static async Task getPersonLists()
+ {
+ int code = 0;
+ string message = "";
+ try
+ {
+ string CollCropCode = string.Empty;
+ string unitId = string.Empty;
+ var thisUnit = CommonService.GetIsThisUnit(); //当前单位
+ if (thisUnit != null)
+ {
+ CollCropCode = thisUnit.CollCropCode; //社会统一信用代码
+ unitId = thisUnit.UnitId;
+ }
+
+ var ProjectList = (from x in Funs.DB.Base_Project
+ where (x.IsDelete == null || x.IsDelete == false) && x.SubjectUnit != null &&
+ x.SubjectProject != null
+ select x).ToList();
+ if (ProjectList.Count > 0)
+ {
+ foreach (var project in ProjectList)
+ {
+ string SubjectUnitId = project.SubjectUnit; //集团的单位id
+ string SubjectProjectId = project.SubjectProject; //集团的单位id
+ //获取对应单位的apiurl地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(SubjectUnitId);
+ var ApiUrl = "";
+ var WebUrl = "";
+ if (!string.IsNullOrEmpty(Url))
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+
+ // CollCropCode = "913404001520228377Y";//测试使用
+ // SubjectProjectId = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
+ // unitId = "aaa9e72b-e3a6-441e-a7bb-afc008adebc9";//测试使用
+
+ string url = "/api/PersonSync/getPersonListByProjectIdAndCollCropCode?projectId=" +
+ SubjectProjectId + "&collCropCode=" + CollCropCode;
+ string baseurl = ApiUrl + url;
+
+ string contenttype = "application/json;charset=unicode";
+ var strJosn = "";
+ using (HttpClient client = new HttpClient())
+ {
+ client.Timeout = TimeSpan.FromMinutes(5); // 设置超时时间为5分钟
+ client.DefaultRequestHeaders.Add("token",
+ "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"); // 前提是所有二级单位都有sysGLY账号且id是AF17168B-87BD-4GLY-1111-F0A0A1158F9B可作为token
+ strJosn = await client.GetStringAsync(baseurl);
+ }
+ // var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, null, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ code = Funs.GetNewIntOrZero(obj["code"].ToString());
+ message = obj["message"].ToString();
+ if (code == 1)
+ {
+ var getData =
+ JsonConvert.DeserializeObject>(obj["data"].ToString());
+ if (getData.Count() > 0)
+ {
+ ProcessPersonData(getData, project.ProjectId, unitId, WebUrl);
+ }
+
+ message = "获取成功:同步人员数" + getData.Count().ToString() + "条";
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ message = "获取失败:" + ex.Message;
+ ErrLogInfo.WriteLog("人员获取!", ex);
+ }
+
+ return message;
+ }
+
+ #endregion
+
+ #region 推送人员数据
+
+ public static ReturnData pushPersonLists(string projectId, string dataId)
+ {
+ Model.ReturnData responeData = new Model.ReturnData();
+ responeData.code = 0;
+ responeData.message = string.Empty;
+ try
+ {
+ var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
+ if (project != null)
+ {
+ //获取人员数据
+ var items = GetPersonLitsByProjectIdAndUnitId(projectId, "", dataId);
+ //总包地址推送
+ if (items.Count() > 0)
+ {
+ var thisUnit = CommonService.GetIsThisUnit(); //当前单位
+ var apiurl = "/api/PersonSync/SavePersonSyncData";
+ //总包单位接口地址
+ var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit);
+ var ApiUrl = "";
+ var WebUrl = "";
+ if (!string.IsNullOrEmpty(Url))
+ {
+ var urls = Url.Split(',');
+ ApiUrl = urls[0];
+ if (urls.Length > 1)
+ {
+ WebUrl = urls[1];
+ }
+ }
+
+ // thisUnit.CollCropCode = "913404001520228377Y"; //分包单位社会统一信用码 测试使用
+ // project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用
+
+ var pushData = new PersonSyncData
+ {
+ CollCropCode = thisUnit.CollCropCode, //分包单位社会统一信用码
+ ProjectId = project.SubjectProject, //主包项目Id
+ UnitDomain = Funs.SGGLUrl, //分包单位域名地址【文件存储地址】
+ Items = items //人员数据
+ };
+ var pushContent = JsonConvert.SerializeObject(pushData);
+ string baseurl = ApiUrl + apiurl;
+ string contenttype = "application/json;charset=unicode";
+ var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ JObject obj = JObject.Parse(returndata);
+ string code = obj["code"].ToString();
+ string message = obj["message"].ToString();
+ responeData.code = int.Parse(code);
+ responeData.message = message;
+ }
+ }
+ else
+ {
+ responeData.code = 0;
+ responeData.message = "当前没有项目人员数据";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.message = "同步到总包单位失败!";
+ ErrLogInfo.WriteLog("【项目人员】同步到总包单位失败!", ex);
+ }
+
+ return responeData;
+ }
+
+ #endregion
+
+ #region 接收保存项目人员数据
+
+ public static async Task SavePersonSyncData(Model.PersonSyncData items)
+ {
+ int code = 0;
+ string message = "";
+ try
+ {
+ if (items.Items.Count > 0)
+ {
+ //获取分包单位CollCropCode
+ var CollCropCode = items.CollCropCode;
+ var ProjectId = items.ProjectId;
+ var UnitDomain = items.UnitDomain; //分包单位域名地址【文件存储地址】
+ //1、判断分包单位是否存在
+ //根据分包单位CollCropCode获取单位id
+ var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.CollCropCode == CollCropCode);
+ if (unit == null)
+ {
+ message = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!";
+ }
+ else
+ {
+ //2、判断主包项目是否存在
+ var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId);
+ if (porject == null)
+ {
+ message = "总包单位不存在本项目,请检查总包项目关联是否正确!";
+ }
+ else
+ {
+ ProcessPersonData(items.Items, ProjectId, unit.UnitId, UnitDomain);
+ message = "数据推送成功!";
+ }
+ }
+ }
+ else
+ {
+ message = "暂无项目人员数据!";
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ return message;
+ }
+
+ #endregion
+
+ #region 处理单项目人员数据的新增或更新逻辑
+
+ ///
+ /// 处理单项目人员数据的新增或更新逻辑
+ ///
+ /// 人员数据项
+ /// 项目id
+ /// 单位ID
+ /// Web地址
+ private static async void ProcessPersonData(List getData, string projectId, string unitId,
+ string WebUrl)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ foreach (var item in getData)
+ {
+ try
+ {
+ string IdentityCard = item.IdentityCard;
+ var model = db.SitePerson_Person.FirstOrDefault(e => e.IdentityCard == IdentityCard && e.ProjectId == projectId);
+ if (model == null)
+ {
+ Model.SitePerson_Person newModel = new Model.SitePerson_Person
+ {
+ PersonId = item.PersonId,
+ CardNo = item.CardNo,
+ PersonName = item.PersonName,
+ Sex = item.Sex,
+ IdentityCard = item.IdentityCard,
+ Address = item.Address,
+ ProjectId = projectId,
+ UnitId = unitId,
+ TeamGroupId = APIDataShareSyncService.GetTeamGroupId(item.TeamGroupName, projectId, unitId),
+ WorkAreaId = APIDataShareSyncService.getWorkAreaId(item.WorkAreaName, projectId),
+ WorkPostId = APIDataShareSyncService.getWorkPostId(item.WorkPostName, item.PostType,
+ item.IsHsse.ToString(), item.IsCQMS.ToString()),
+ InTime = item.InTime,
+ OutTime = item.OutTime,
+ OutResult = item.OutResult,
+ Telephone = item.Telephone,
+ PhotoUrl = item.PhotoUrl,
+ // 异步安全的头像下载
+ HeadImage = await SafeDownloadHeadImageAsync(WebUrl, item.PhotoUrl),
+ IsUsed = item.IsUsed,
+ IsCardUsed = item.IsCardUsed,
+ PersonIndex = item.PersonIndex,
+ CertificateId = item.CertificateId,
+ CertificateCode = item.CertificateCode,
+ CertificateLimitTime = item.CertificateLimitTime,
+ QualificationCertificateUrl = item.QualificationCertificateUrl,
+ TrainingCertificateUrl = item.TrainingCertificateUrl,
+ QRCodeAttachUrl = item.QRCodeAttachUrl,
+ Password = item.Password,
+ FromPersonId = item.FromPersonId,
+ AuditorDate = item.AuditorDate,
+ ExchangeTime = item.ExchangeTime,
+ ExchangeTime2 = item.ExchangeTime2,
+ IDCardUrl = item.IDCardUrl,
+ IsForeign = item.IsForeign,
+ IsOutside = item.IsOutside,
+ EduLevel = item.EduLevel,
+ MaritalStatus = item.MaritalStatus,
+ Isprint = item.Isprint,
+ MainCNProfessionalId = item.MainCNProfessionalId,
+ ViceCNProfessionalId = item.ViceCNProfessionalId,
+ Birthday = item.Birthday,
+ IdcardType = item.IdcardType,
+ IdcardStartDate = item.IdcardStartDate,
+ IdcardEndDate = item.IdcardEndDate,
+ IdcardForever = item.IdcardForever,
+ PoliticsStatus = item.PoliticsStatus,
+ IdcardAddress = item.IdcardAddress,
+ Nation = item.Nation,
+ CountryCode = item.CountryCode,
+ IsSafetyMonitoring = item.IsSafetyMonitoring,
+ ProvinceCode = item.ProvinceCode,
+ IsCardNoOK = item.IsCardNoOK
+ };
+
+ db.SitePerson_Person.InsertOnSubmit(newModel);
+ db.SubmitChanges();
+ }
+ else
+ {
+ // 更新现有记录
+ UpdatePersonModel(model, item, projectId, unitId, WebUrl);
+ db.SubmitChanges();
+ }
+
+
+ // 异步安全的附件处理
+ await ProcessPersonAttachmentsAsync(WebUrl, item);
+
+ if (item.CertificateItem != null)
+ {
+ APIDataShareSyncService.ProcessPersonQualityData(item.CertificateItem, item.PersonId);
+ }
+ }
+ catch (Exception ex)
+ {
+ // 记录异常但不中断整个批处理
+ BLL.ErrLogInfo.WriteLog($"处理人员数据时出错 PersonId: {item?.PersonId}, 错误: {ex.Message}");
+ continue; // 继续处理下一个记录
+ }
+ }
+ }
+ }
+
+ // 安全的头像下载方法
+ public static async Task SafeDownloadHeadImageAsync(string webUrl, string photoUrl)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(photoUrl))
+ return null;
+ return await APIDataShareSyncService.DownloadHeadImageAsync(webUrl, photoUrl);
+ }
+ catch (Exception ex)
+ {
+ BLL.ErrLogInfo.WriteLog($"下载头像失败: {photoUrl}, 错误: {ex.Message}");
+ return null;
+ }
+ }
+
+ // 更新人员模型的辅助方法
+ private static void UpdatePersonModel(Model.SitePerson_Person model, PersonSyncItem item, string projectId,
+ string unitId, string webUrl)
+ {
+ // model.PersonId = item.PersonId;
+ model.CardNo = item.CardNo;
+ model.PersonName = item.PersonName;
+ model.Sex = item.Sex;
+ model.IdentityCard = item.IdentityCard;
+ model.Address = item.Address;
+ model.ProjectId = projectId;
+ model.UnitId = unitId;
+ model.TeamGroupId = APIDataShareSyncService.GetTeamGroupId(item.TeamGroupName, projectId, unitId);
+ model.WorkAreaId = APIDataShareSyncService.getWorkAreaId(item.WorkAreaName, projectId);
+ model.WorkPostId = APIDataShareSyncService.getWorkPostId(item.WorkPostName, item.PostType,
+ item.IsHsse.ToString(), item.IsCQMS.ToString());
+ model.InTime = item.InTime;
+ model.OutTime = item.OutTime;
+ model.OutResult = item.OutResult;
+ model.Telephone = item.Telephone;
+ model.PhotoUrl = item.PhotoUrl;
+
+ // 异步操作需要特殊处理
+ Task.Run(async () =>
+ {
+ try
+ {
+ model.HeadImage = await APIDataShareSyncService.DownloadHeadImageAsync(webUrl, item.PhotoUrl);
+ }
+ catch (Exception ex)
+ {
+ BLL.ErrLogInfo.WriteLog($"更新头像失败: {ex.Message}");
+ }
+ });
+
+ model.IsUsed = item.IsUsed;
+ model.IsCardUsed = item.IsCardUsed;
+ model.PersonIndex = item.PersonIndex;
+ model.CertificateId = item.CertificateId;
+ model.CertificateCode = item.CertificateCode;
+ model.CertificateLimitTime = item.CertificateLimitTime;
+ model.QualificationCertificateUrl = item.QualificationCertificateUrl;
+ model.TrainingCertificateUrl = item.TrainingCertificateUrl;
+ model.QRCodeAttachUrl = item.QRCodeAttachUrl;
+ model.Password = item.Password;
+ model.FromPersonId = item.FromPersonId;
+ model.AuditorDate = item.AuditorDate;
+ model.ExchangeTime = item.ExchangeTime;
+ model.ExchangeTime2 = item.ExchangeTime2;
+ model.IDCardUrl = item.IDCardUrl;
+ model.IsForeign = item.IsForeign;
+ model.IsOutside = item.IsOutside;
+ model.EduLevel = item.EduLevel;
+ model.MaritalStatus = item.MaritalStatus;
+ model.Isprint = item.Isprint;
+ model.MainCNProfessionalId = item.MainCNProfessionalId;
+ model.ViceCNProfessionalId = item.ViceCNProfessionalId;
+ model.Birthday = item.Birthday;
+ model.IdcardType = item.IdcardType;
+ model.IdcardStartDate = item.IdcardStartDate;
+ model.IdcardEndDate = item.IdcardEndDate;
+ model.IdcardForever = item.IdcardForever;
+ model.PoliticsStatus = item.PoliticsStatus;
+ model.IdcardAddress = item.IdcardAddress;
+ model.Nation = item.Nation;
+ model.CountryCode = item.CountryCode;
+ model.IsSafetyMonitoring = item.IsSafetyMonitoring;
+ model.ProvinceCode = item.ProvinceCode;
+ model.IsCardNoOK = item.IsCardNoOK;
+ }
+
+ // 异步安全的附件处理
+ private static async Task ProcessPersonAttachmentsAsync(string webUrl, PersonSyncItem item)
+ {
+ try
+ {
+ var attachmentTasks = new List
+ {
+ APIDataShareSyncService.OperationAttachFile(webUrl, item.PersonId + "#1", BLL.Const.PersonListMenuId,
+ item.AttachUrl1),
+ APIDataShareSyncService.OperationAttachFile(webUrl, item.PersonId + "#2", BLL.Const.PersonListMenuId,
+ item.AttachUrl2),
+ APIDataShareSyncService.OperationAttachFile(webUrl, item.PersonId + "#3", BLL.Const.PersonListMenuId,
+ item.AttachUrl3),
+ APIDataShareSyncService.OperationAttachFile(webUrl, item.PersonId + "#4", BLL.Const.PersonListMenuId,
+ item.AttachUrl4),
+ APIDataShareSyncService.OperationAttachFile(webUrl, item.PersonId + "#5", BLL.Const.PersonListMenuId,
+ item.AttachUrl5)
+ };
+
+ await Task.WhenAll(attachmentTasks);
+ }
+ catch (Exception ex)
+ {
+ BLL.ErrLogInfo.WriteLog($"处理人员附件失败 PersonId: {item.PersonId}, 错误: {ex.Message}");
+ }
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/HSSE/Check/Check_CheckSpecialService.cs b/SUBQHSE/BLL/HSSE/Check/Check_CheckSpecialService.cs
index d5418b5..75de8fe 100644
--- a/SUBQHSE/BLL/HSSE/Check/Check_CheckSpecialService.cs
+++ b/SUBQHSE/BLL/HSSE/Check/Check_CheckSpecialService.cs
@@ -252,12 +252,21 @@ namespace BLL
register.CheckTime = checkSpecial.CheckTime;
register.ResponsibleUnit = item.UnitId;
- register.Place = item.WorkArea;
+ // register.Place = item.WorkArea;
+ register.Place = item.CheckArea;
register.RegisterDef = item.Unqualified;
// register.HandleIdea = item.Suggestions;
register.ResponsibleMan = item.HSEManage;
- register.Risk_Level = item.RiskLevel;
+ // register.Risk_Level = item.RiskLevel;
+ switch (item.RiskLevel)
+ {
+ //case "0": register.Risk_Level = "一般"; break;
+ case "1": register.Risk_Level = "一般"; break;
+ case "2": register.Risk_Level = "较大"; break;
+ case "3": register.Risk_Level = "重大"; break;
+ default: register.Risk_Level = "一般"; break;
+ }
register.Requirements = item.Suggestions;
register.CheckSpecialId = item.CheckSpecialId;
register.RectificationPeriod = item.LimitedDate;
diff --git a/SUBQHSE/BLL/HSSE/Solution/TemporaryElectricityService.cs b/SUBQHSE/BLL/HSSE/Solution/TemporaryElectricityService.cs
new file mode 100644
index 0000000..7af3473
--- /dev/null
+++ b/SUBQHSE/BLL/HSSE/Solution/TemporaryElectricityService.cs
@@ -0,0 +1,72 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Web.UI.WebControls;
+
+namespace BLL
+{
+ public class TemporaryElectricityService
+ {
+ ///
+ /// 获取临时用电方案信息
+ ///
+ ///
+ ///
+ public static Model.Solution_TemporaryElectricity GetTemporaryElectricityByTemporaryElectricityId(string TemporaryElectricityId)
+ {
+ return Funs.DB.Solution_TemporaryElectricity.FirstOrDefault(e => e.TemporaryElectricityId == TemporaryElectricityId);
+ }
+ ///
+ /// 添加临时用电方案信息
+ ///
+ ///
+ public static void AddTemporaryElectricity(Model.Solution_TemporaryElectricity TemporaryElectricity)
+ {
+ Model.SUBQHSEDB db = Funs.DB;
+ Model.Solution_TemporaryElectricity newTemporaryElectricity = new Model.Solution_TemporaryElectricity();
+ newTemporaryElectricity.TemporaryElectricityId = TemporaryElectricity.TemporaryElectricityId;
+ newTemporaryElectricity.ProjectId = TemporaryElectricity.ProjectId;
+ newTemporaryElectricity.Code = TemporaryElectricity.Code;
+ newTemporaryElectricity.Name = TemporaryElectricity.Name;
+ newTemporaryElectricity.Content = TemporaryElectricity.Content;
+ newTemporaryElectricity.Remark = TemporaryElectricity.Remark;
+ newTemporaryElectricity.CompileMan = TemporaryElectricity.CompileMan;
+ newTemporaryElectricity.CompileDate = TemporaryElectricity.CompileDate;
+ db.Solution_TemporaryElectricity.InsertOnSubmit(newTemporaryElectricity);
+ db.SubmitChanges();
+ }
+
+ ///
+ /// 修改临时用电方案信息
+ ///
+ ///
+ public static void UpdateTemporaryElectricity(Model.Solution_TemporaryElectricity TemporaryElectricity)
+ {
+ Model.SUBQHSEDB db = Funs.DB;
+ Model.Solution_TemporaryElectricity newTemporaryElectricity = db.Solution_TemporaryElectricity.FirstOrDefault(e => e.TemporaryElectricityId == TemporaryElectricity.TemporaryElectricityId);
+ if (newTemporaryElectricity != null)
+ {
+ newTemporaryElectricity.Code = TemporaryElectricity.Code;
+ newTemporaryElectricity.Name = TemporaryElectricity.Name;
+ newTemporaryElectricity.Content = TemporaryElectricity.Content;
+ newTemporaryElectricity.Remark = TemporaryElectricity.Remark;
+ newTemporaryElectricity.CompileMan = TemporaryElectricity.CompileMan;
+ newTemporaryElectricity.CompileDate = TemporaryElectricity.CompileDate;
+ db.SubmitChanges();
+ }
+ }
+ ///
+ /// 根据主键删除临时用电方案信息
+ ///
+ ///
+ public static void DeleteTemporaryElectricityById(string TemporaryElectricityId)
+ {
+ Model.SUBQHSEDB db = Funs.DB;
+ Model.Solution_TemporaryElectricity TemporaryElectricity = db.Solution_TemporaryElectricity.FirstOrDefault(e => e.TemporaryElectricityId == TemporaryElectricityId);
+ if (TemporaryElectricity != null)
+ {
+ db.Solution_TemporaryElectricity.DeleteOnSubmit(TemporaryElectricity);
+ db.SubmitChanges();
+ }
+ }
+ }
+}
diff --git a/SUBQHSE/BLL/OpenService/FileInsertService.cs b/SUBQHSE/BLL/OpenService/FileInsertService.cs
index 2594188..62c2a92 100644
--- a/SUBQHSE/BLL/OpenService/FileInsertService.cs
+++ b/SUBQHSE/BLL/OpenService/FileInsertService.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
+using System.Configuration;
using System.IO;
using System.Web;
using System.Text.RegularExpressions;
@@ -22,35 +23,45 @@ namespace BLL
{
List bytes = new List();
var strs = attachUrl.Trim().Split(',');
-
try
{
foreach (var fileUrl in strs)
{
- string filepath = $"{fileHost}{fileUrl}";
- // 创建WebClient实例
- using (WebClient webClient = new WebClient())
+ string path = ConfigurationManager.AppSettings["localRoot"] + fileUrl;
+ if (!File.Exists(path))
{
- // 下载图片并保存到内存流
- using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath)))
+ //BLL.ErrLogInfo.WriteLog($"不存在则新增,附件地址:{path}");
+ string filepath = $"{fileHost}{fileUrl}";
+ //BLL.ErrLogInfo.WriteLog($"不存在则新增,责任单位附件地址:{filepath}");
+ // 创建WebClient实例
+ using (WebClient webClient = new WebClient())
{
- // 将MemoryStream转换为byte数组
- byte[] imageBytes = ms.ToArray();
- bytes.Add(imageBytes);
- //// 使用byte数组(例如,保存到文件或进行其他处理)
- //File.WriteAllBytes("localImage.jpg", imageBytes);
+ // 下载图片并保存到内存流
+ using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath)))
+ {
+ // 将MemoryStream转换为byte数组
+ byte[] imageBytes = ms.ToArray();
+ bytes.Add(imageBytes);
+ //// 使用byte数组(例如,保存到文件或进行其他处理)
+ //File.WriteAllBytes("localImage.jpg", imageBytes);
+ }
}
}
+ //else
+ //{
+ // BLL.ErrLogInfo.WriteLog($"已存在附件地址:{path}");
+ //}
}
}
catch (Exception ex)
{
- Console.WriteLine("Error: " + ex.Message);
+ BLL.ErrLogInfo.WriteLog($"服务器图片转换异常:{fileHost};图片地址:{attachUrl}", ex.Message);
}
return bytes;
}
+
///
/// 获取附件数据流类
///
@@ -92,59 +103,43 @@ namespace BLL
///
public static void FileMoreInsert(List fileContextList, string attachUrl)
{
- if (fileContextList != null && fileContextList.Count() > 0)
+ if (fileContextList.Count > 0)
{
- if (fileContextList.Count > 0)
+ string[] strs = attachUrl.Trim().Split(',');
+ int i = 0;
+ string physicalpath = ConfigurationManager.AppSettings["localRoot"];
+ foreach (var item in fileContextList)
{
- string[] strs = attachUrl.Trim().Split(',');
- int i = 0;
- foreach (var item in fileContextList)
+ //HttpContext.Current.Request.PhysicalApplicationPath;
+ string fullPath = (physicalpath + strs[i]).Replace('/', '\\');
+ if (!File.Exists(fullPath))
{
- if (strs.Count() > i)
+ byte[] fileContext = item;
+ int index = fullPath.LastIndexOf("\\");
+ string filePath = fullPath.Substring(0, index);
+
+ if (!Directory.Exists(filePath))
{
- string physicalpath = Funs.RootPath;
- string fpath = strs[i];
- string fullPath = physicalpath + fpath;
- if (!File.Exists(fullPath))
- {
- byte[] fileContext = item;
- string fileName = Regex.Match(fullPath, @"[^/\\?]+(\?.*)?$").Value;
- string filePath = fullPath.Replace(fileName, "");
- //int index = fullPath.LastIndexOf("\\");
- //string filePath = fullPath.Substring(0, index) ;
- //string filePath = index > 0 ? fullPath.Substring(0, index) : fullPath;
+ Directory.CreateDirectory(filePath);
+ }
+ //string savePath = fullPath + fileName;
- try
- {
- if (!Directory.Exists(filePath))
- {
- Directory.CreateDirectory(filePath);
- }
- }
- catch (Exception ex)
- {
- ErrLogInfo.WriteLog($"附件【{filePath}】获取异常!");
- //continue;
- }
- //string savePath = fullPath + fileName;
+ //文件读写模式
+ System.IO.FileMode fileMode = System.IO.FileMode.Create;
- //文件读写模式
- System.IO.FileMode fileMode = System.IO.FileMode.Create;
-
- //写入文件
- using (System.IO.FileStream fs = new System.IO.FileStream(fullPath, fileMode, System.IO.FileAccess.Write))
- {
- fs.Write(fileContext, 0, fileContext.Length);
- }
- }
-
- i++;
+ //写入文件
+ using (System.IO.FileStream fs = new System.IO.FileStream(fullPath, fileMode, System.IO.FileAccess.Write))
+ {
+ fs.Write(fileContext, 0, fileContext.Length);
}
}
+
+ i++;
}
}
}
+
///
/// 数据和附件插入到多附件表
///
@@ -225,6 +220,69 @@ namespace BLL
}
}
}
+
+ ///
+ /// 保存其他单位附件同步处理
+ ///
+ /// 单位域名地址
+ /// 附件id
+ /// 附件keyid
+ /// 附件json信息
+ /// 附件地址
+ public static void SaveAttachFileRecords(string domain, string attachFileId, string tokeyId, string attachSource, string attachUrl)
+ {
+ if (!string.IsNullOrEmpty(attachFileId) && !string.IsNullOrEmpty(attachSource) && !string.IsNullOrEmpty(attachUrl))
+ {
+ List FileContext = new List();
+ if (!string.IsNullOrWhiteSpace(domain) && !string.IsNullOrWhiteSpace(attachUrl))
+ {
+ FileContext = FilePathTransStream(domain, attachUrl);
+ }
+ InsertAttachFilesRecord(attachFileId, tokeyId, attachSource, attachUrl, FileContext);
+ }
+ }
+
+ ///
+ /// 数据和附件插入到多附件表
+ ///
+ public static void InsertAttachFilesRecord(string attachFileId, string dataId, string attachSource, string attachUrl, List fileContext)
+ {
+ if (!string.IsNullOrEmpty(attachFileId))
+ {
+ //多附件
+ var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);
+ if (attachFile == null)
+ {
+ ////插入附件文件
+ BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
+
+ Model.AttachFile newAttachFile = new Model.AttachFile
+ {
+ AttachFileId = attachFileId,
+ ToKeyId = dataId,
+ AttachSource = attachSource,
+ AttachUrl = attachUrl
+ };
+ Funs.DB.AttachFile.InsertOnSubmit(newAttachFile);
+ Funs.DB.SubmitChanges();
+ }
+ else
+ {
+ if (attachFile.AttachUrl != attachUrl)
+ {
+ /////删除附件文件
+ //BLL.UploadAttachmentService.DeleteFile(ConfigurationManager.AppSettings["localRoot"], attachFile.AttachUrl);
+ ////插入附件文件
+ BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
+ attachFile.AttachSource = attachSource;
+ attachFile.AttachUrl = attachUrl;
+ Funs.DB.SubmitChanges();
+ }
+ }
+ }
+ }
+
+
}
}
diff --git a/SUBQHSE/BLL/ProjectData/ProjectService.cs b/SUBQHSE/BLL/ProjectData/ProjectService.cs
index 55ecc38..64cc038 100644
--- a/SUBQHSE/BLL/ProjectData/ProjectService.cs
+++ b/SUBQHSE/BLL/ProjectData/ProjectService.cs
@@ -193,6 +193,8 @@
ProjectAttribute = project.ProjectAttribute,
ProjectNature = project.ProjectNature,
ProjectInsurance = project.ProjectInsurance,
+ SubjectUnit = project.SubjectUnit,
+ SubjectProject = project.SubjectProject,
};
db.Base_Project.InsertOnSubmit(newProject);
db.SubmitChanges();
@@ -243,6 +245,8 @@
newProject.ProjectAttribute = project.ProjectAttribute;
newProject.ProjectNature = project.ProjectNature;
newProject.ProjectInsurance = project.ProjectInsurance;
+ newProject.SubjectUnit = project.SubjectUnit;
+ newProject.SubjectProject = project.SubjectProject;
db.SubmitChanges();
//Project_HSSEData_HSSEService.StatisticalData(project.ProjectId, Project_HSSEData_HSSEService.HSSEDateType.ProjectInformation);
HSEDataCollectService.ProjectHSEDataCollectSubmission(newProject);
diff --git a/SUBQHSE/BLL/SQLHelper.cs b/SUBQHSE/BLL/SQLHelper.cs
index 3a2f592..1098f6a 100644
--- a/SUBQHSE/BLL/SQLHelper.cs
+++ b/SUBQHSE/BLL/SQLHelper.cs
@@ -995,5 +995,42 @@ namespace BLL
maxId = GetIntValue(str);
return maxId;
}
+
+ ///
+ /// ִSQL
+ ///
+ /// sql
+ public static bool ExecuteSql(string sql)
+ {
+ bool result = false;
+ using (SqlConnection Connection = new SqlConnection(connectionString))
+ {
+ try
+ {
+ result = true;
+ Connection.Open();
+ SqlCommand command = new SqlCommand(sql, Connection)
+ {
+ CommandTimeout = 0,
+ CommandType = CommandType.Text
+ };
+ command.ExecuteNonQuery();
+ }
+ catch (Exception ex)
+ {
+ result = false;
+ ErrLogInfo.WriteLog($"ִSQL䱨{sql}Ϣ{ex.Message}");
+ }
+ finally
+ {
+ Connection.Close();
+ }
+ return result;
+ }
+ }
+
+
+
+
}
}
diff --git a/SUBQHSE/BLL/SysManage/UnitService.cs b/SUBQHSE/BLL/SysManage/UnitService.cs
index 8e590b6..4b99f8e 100644
--- a/SUBQHSE/BLL/SysManage/UnitService.cs
+++ b/SUBQHSE/BLL/SysManage/UnitService.cs
@@ -3,7 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
-
+using Newtonsoft.Json.Linq;
+using System.Collections;
namespace BLL
{
///
@@ -962,5 +963,160 @@ namespace BLL
Funs.FineUIPleaseSelect(dropName);
}
}
+
+
+ #region 获取集团单位列表
+
+ ///
+ /// 获取集团单位列表
+ ///
+ ///
+ public static List getUnitLists()
+ {
+ var responeData = new Model.ResponeData();
+ List list = new List();
+ try
+ {
+ string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitLists";
+ string contenttype = "application/json;charset=unicode";
+ Hashtable newToken = new Hashtable
+ {
+ { "token", ServerService.GetToken().Token }
+ };
+ var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
+ responeData.message = obj["message"].ToString();
+ if (responeData.code == 1)
+ {
+ JArray getData = JArray.Parse(obj["data"].ToString());
+ if (getData.Count() > 0)
+ {
+ foreach (var item in getData)
+ {
+ var q = new Model.BaseInfoItem();
+ q.BaseInfoId = item["BaseInfoId"].ToString();
+ q.BaseInfoName = item["BaseInfoName"].ToString();
+ q.BaseInfoCode = item["BaseInfoCode"].ToString();
+ list.Add(q);
+ }
+ }
+ responeData.message = "获取成功:集团单位数" + getData.Count().ToString() + "条";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = "获取失败:" + ex.Message;
+ ErrLogInfo.WriteLog("获取集团单位列表!", ex);
+ }
+
+ return list;
+ }
+
+ #endregion
+
+
+ #region 根据单位获取项目列表
+
+ ///
+ /// 获取集团单位列表
+ ///
+ ///
+ public static List getProjectListByUnitId(string userId)
+ {
+ var responeData = new Model.ResponeData();
+ List list = new List();
+ try
+ {
+ string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getProjectListByUnitId?unitId=" + userId + "&projectName=" + "&pageIndex=0" ;
+ string contenttype = "application/json;charset=unicode";
+ Hashtable newToken = new Hashtable
+ {
+ { "token", ServerService.GetToken().Token }
+ };
+ var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
+ responeData.message = obj["message"].ToString();
+ if (responeData.code == 1)
+ {
+ JArray getData = JArray.Parse(obj["data"].ToString());
+ if (getData.Count() > 0)
+ {
+ foreach (var item in getData)
+ {
+ var q = new Model.BaseInfoItem();
+ q.BaseInfoId = item["BaseInfoId"].ToString();
+ q.BaseInfoName = item["BaseInfoName"].ToString();
+ q.BaseInfoCode = item["BaseInfoCode"].ToString();
+ list.Add(q);
+ }
+ }
+ responeData.message = "获取成功:集团项目数" + getData.Count().ToString() + "条";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = "获取失败:" + ex.Message;
+ ErrLogInfo.WriteLog("获取集团项目数!", ex);
+ }
+
+ return list;
+ }
+
+ #endregion
+
+
+ #region 根据单位id获取单位信息列表
+
+ ///
+ /// 获取集团单位列表
+ ///
+ ///
+ public static string getUnitApiUrlByUnitId(string userId)
+ {
+ string url = "";
+ try
+ {
+ string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitApiUrlByUnitId?unitId=" + userId;
+ string contenttype = "application/json;charset=unicode";
+ Hashtable newToken = new Hashtable
+ {
+ { "token", ServerService.GetToken().Token }
+ };
+ var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ if (Funs.GetNewIntOrZero(obj["code"].ToString()) == 1)
+ {
+ if (obj["data"] != null)
+ {
+ JObject dataObj = obj["data"] as JObject;
+ if (dataObj != null && dataObj["BaseInfoCode"] != null)
+ {
+ url = dataObj["BaseInfoCode"].ToString();
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ErrLogInfo.WriteLog("获取失败!", ex);
+ }
+
+ return url;
+ }
+
+ #endregion
}
}
diff --git a/SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs b/SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs
new file mode 100644
index 0000000..2e20656
--- /dev/null
+++ b/SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs
@@ -0,0 +1,338 @@
+using System;
+using Model;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace BLL
+{
+ ///
+ /// 企业级检查明细服务
+ ///
+ public static class UnitHazardRegisterItemService
+ {
+ #region Methods
+
+ ///
+ /// 添加明细记录
+ ///
+ /// 明细记录
+ public static void AddUnitHazardRegisterItem(Model.Supervise_UnitHazardRegisterItem item)
+ {
+ Funs.DB.Supervise_UnitHazardRegisterItem.InsertOnSubmit(item);
+ Funs.DB.SubmitChanges();
+ }
+
+ ///
+ /// 根据主表ID删除所有明细
+ ///
+ /// 主表ID
+ public static void DeleteItemsByRegisterId(string registerId)
+ {
+ var items = (from x in Funs.DB.Supervise_UnitHazardRegisterItem
+ where x.UnitHazardRegisterId == registerId
+ select x).ToList();
+ if (items.Count > 0)
+ {
+ Funs.DB.Supervise_UnitHazardRegisterItem.DeleteAllOnSubmit(items);
+ Funs.DB.SubmitChanges();
+ }
+ }
+
+ ///
+ /// 删除明细记录
+ ///
+ /// 明细ID
+ public static void DeleteUnitHazardRegisterItemById(string itemId)
+ {
+ Model.Supervise_UnitHazardRegisterItem item =
+ Funs.DB.Supervise_UnitHazardRegisterItem.FirstOrDefault(e => e.UnitHazardRegisterItemId == itemId);
+ if (item != null)
+ {
+ Funs.DB.Supervise_UnitHazardRegisterItem.DeleteOnSubmit(item);
+ Funs.DB.SubmitChanges();
+ }
+ }
+
+ ///
+ /// 根据风险级别获取明细数量
+ ///
+ /// 主表ID
+ /// 风险级别
+ /// 明细数量
+ public static int GetCountByRiskLevel(string registerId, string riskLevel)
+ {
+ return (from x in Funs.DB.Supervise_UnitHazardRegisterItem
+ where x.UnitHazardRegisterId == registerId && x.RiskLevel == riskLevel
+ select x).Count();
+ }
+
+ ///
+ /// 获取已完成的明细数量
+ ///
+ /// 主表ID
+ /// 已完成数量
+ public static int GetFinishedCount(string registerId)
+ {
+ return (from x in Funs.DB.Supervise_UnitHazardRegisterItem
+ where x.UnitHazardRegisterId == registerId && x.CompleteStatus == 1
+ select x).Count();
+ }
+
+ ///
+ /// 根据主表ID获取明细列表
+ ///
+ /// 主表ID
+ /// 明细列表
+ public static List GetItemsByRegisterId(string registerId)
+ {
+ return (from x in Funs.DB.Supervise_UnitHazardRegisterItem
+ where x.UnitHazardRegisterId == registerId
+ orderby x.SortIndex
+ select x).ToList();
+ }
+
+ ///
+ /// 获取主单的整改状态
+ ///
+ /// 主单ID
+ /// 整改状态:0=全部未整改,1=部分整改,2=全部整改
+ public static int GetRectifyStatus(string registerId)
+ {
+ var items = GetItemsByRegisterId(registerId);
+
+ if (items.Count == 0)
+ {
+ return 0; // 无明细,视为全部未整改
+ }
+
+ int finishedCount = items.Count(x => x.CompleteStatus == 1);
+ int totalCount = items.Count;
+
+ if (finishedCount == 0)
+ {
+ return 0; // 全部未整改
+ }
+ else if (finishedCount < totalCount)
+ {
+ return 1; // 部分整改
+ }
+ else
+ {
+ return 2; // 全部整改
+ }
+ }
+
+ ///
+ /// 获取整改状态文本
+ ///
+ /// 主单ID
+ /// 状态文本
+ public static string GetRectifyStatusText(string registerId)
+ {
+ int status = GetRectifyStatus(registerId);
+ switch (status)
+ {
+ case 0:
+ return "全部未整改";
+
+ case 1:
+ return "部分整改";
+
+ case 2:
+ return "全部整改";
+
+ default:
+ return "未知";
+ }
+ }
+
+ ///
+ /// 获取未完成的明细数量
+ ///
+ /// 主表ID
+ /// 未完成数量
+ public static int GetUnfinishedCount(string registerId)
+ {
+ return (from x in Funs.DB.Supervise_UnitHazardRegisterItem
+ where x.UnitHazardRegisterId == registerId && (x.CompleteStatus == null || x.CompleteStatus == 0)
+ select x).Count();
+ }
+
+ ///
+ /// 根据明细ID获取明细记录
+ ///
+ /// 明细ID
+ /// 明细记录
+ public static Model.Supervise_UnitHazardRegisterItem GetUnitHazardRegisterItemById(string itemId)
+ {
+ return Funs.DB.Supervise_UnitHazardRegisterItem.FirstOrDefault(e => e.UnitHazardRegisterItemId == itemId);
+ }
+
+
+ ///
+ /// 获取企业级检查明细列表(使用input对象,返回总数)
+ ///
+ /// 查询条件
+ /// 页码(从0开始)
+ /// 每页大小
+ /// 是否返回所有数据(不分页)
+ /// 总记录数
+ /// 检查明细列表
+ public static List GetUnitHazardRegisterItems(
+ UnitHazardRegisterItemInput input,
+ int pageIndex,
+ int pageSize,
+ bool returnAll,
+ out int totalCount)
+ {
+ var db = Funs.DB;
+ var query = from i in db.Supervise_UnitHazardRegisterItem
+ join r in db.Supervise_UnitHazardRegister
+ on i.UnitHazardRegisterId equals r.UnitHazardRegisterId
+ join ct in db.Base_SuperviseCheckType
+ on new { MainType = r.CheckMainType, TypeCode = r.CheckType }
+ equals new { MainType = ct.CheckMainType, TypeCode = ct.CheckTypeCode } into ctGroup
+ from ct in ctGroup.DefaultIfEmpty()
+ join u in db.Base_Unit
+ on r.CheckUnitId equals u.UnitId into uGroup
+ from u in uGroup.DefaultIfEmpty()
+ join user in db.Sys_User on r.InsResponsibleUserId equals user.UserId into userGroup
+ from user in userGroup.DefaultIfEmpty()
+ select new UnitHazardRegisterItemOutput
+ {
+ UnitHazardRegisterItemId = i.UnitHazardRegisterItemId,
+ UnitHazardRegisterCode = r.UnitHazardRegisterCode,
+ CheckDate = r.CheckDate,
+ CheckMainTypeName = r.CheckMainType == "0" ? "安全" : "质量",
+ CheckTypeName = ct.CheckTypeName,
+ ProblemDescription = i.ProblemDescription,
+ ProblemType = i.ProblemType,
+ RiskLevel = i.RiskLevel,
+ RectifyRequirement = i.RectifyRequirement,
+ StatesName = UnitHazardRegisterService.ConvertState(r.States.Value),
+ CheckTeam = r.CheckTeam,
+ ProjectId = r.ProjectId,
+ CheckUnitName = u.UnitName,
+ States = r.States,
+ ProblemStatesName = i.CompleteStatus==1 ? "已整改":"未整改",
+ ProblemStates = i.CompleteStatus,
+ InsResponsibleUserId = r.InsResponsibleUserId,
+ InsResponsibleUserName= user.UserName
+ };
+
+ // 应用检查大类过滤
+ if (input != null && !string.IsNullOrEmpty(input.CheckMainType))
+ {
+ query = query.Where(x => x.CheckMainTypeName.Contains(input.CheckMainType == "0" ? "安全" : "质量"));
+ }
+ // 项目id过滤
+ if (input != null && !string.IsNullOrEmpty(input.ProjectId))
+ {
+ query = query.Where(x => x.ProjectId.Contains(input.ProjectId));
+ }
+ // 检查组/人搜索
+ if (input != null && !string.IsNullOrEmpty(input.CheckTeam))
+ {
+ query = query.Where(x => x.CheckTeam.Contains(input.CheckTeam));
+ }
+
+ // 检查类别搜索
+ if (input != null && !string.IsNullOrEmpty(input.CheckType))
+ {
+ query = query.Where(x => x.CheckTypeName != null && x.CheckTypeName.Contains(input.CheckType));
+ }
+
+ // 问题描述搜索
+ if (input != null && !string.IsNullOrEmpty(input.Problem))
+ {
+ query = query.Where(x => x.ProblemDescription.Contains(input.Problem));
+ }
+
+ // 检查时间范围
+ if (input != null && input.StartTime.HasValue)
+ {
+ query = query.Where(x => x.CheckDate >= input.StartTime.Value);
+ }
+
+ if (input != null && input.EndTime.HasValue)
+ {
+ query = query.Where(x => x.CheckDate <= input.EndTime.Value);
+ }
+
+ // 风险级别过滤
+ if (input != null && !string.IsNullOrEmpty(input.RiskLevel) && input.RiskLevel != "null")
+ {
+ query = query.Where(x => x.RiskLevel == input.RiskLevel);
+ }
+
+ // 状态过滤
+ if (input != null && input.States != null)
+ {
+ query = query.Where(x => x.States == input.States);
+ }
+ // 问题整改状态过滤
+ if (input != null && input.ProblemStates != null)
+ {
+ query = query.Where(x => x.ProblemStates == input.ProblemStates);
+ }
+ // 单位权限过滤
+ if (input != null && !string.IsNullOrEmpty(input.UnitId))
+ {
+ var thisUnit = BLL.CommonService.GetIsThisUnit();
+ if (thisUnit.UnitId != input.UnitId)
+ {
+ // 先获取用户有权限的项目ID列表
+ var projectIds = (from p in Funs.DB.Base_Project
+ where p.UnitId == input.UnitId
+ select p.ProjectId).ToList();
+
+ // 过滤查询结果
+ query = query.Where(x => Funs.DB.Supervise_UnitHazardRegister
+ .Any(r => Funs.DB.Supervise_UnitHazardRegisterItem
+ .Any(i => i.UnitHazardRegisterItemId == x.UnitHazardRegisterItemId &&
+ i.UnitHazardRegisterId == r.UnitHazardRegisterId &&
+ projectIds.Contains(r.ProjectId))));
+ }
+ }
+
+ // 获取总数
+ totalCount = query.Count();
+
+ // 排序和分页
+ var orderedQuery = query.OrderByDescending(x => x.CheckDate);
+
+ if (returnAll)
+ {
+ return orderedQuery.ToList();
+ }
+
+ return orderedQuery
+ .Skip(pageIndex * pageSize)
+ .Take(pageSize)
+ .ToList();
+ }
+
+ ///
+ /// 更新明细记录
+ ///
+ /// 明细记录
+ public static void UpdateUnitHazardRegisterItem(Model.Supervise_UnitHazardRegisterItem item)
+ {
+ Model.Supervise_UnitHazardRegisterItem oldItem =
+ Funs.DB.Supervise_UnitHazardRegisterItem.FirstOrDefault(e => e.UnitHazardRegisterItemId == item.UnitHazardRegisterItemId);
+ if (oldItem != null)
+ {
+ oldItem.ProblemDescription = item.ProblemDescription;
+ oldItem.ProblemType = item.ProblemType;
+ oldItem.RiskLevel = item.RiskLevel;
+ oldItem.RectifyRequirement = item.RectifyRequirement;
+ oldItem.CompleteStatus = item.CompleteStatus;
+ oldItem.CompletedDate = item.CompletedDate;
+ oldItem.SortIndex = item.SortIndex;
+ Funs.DB.SubmitChanges();
+ }
+ }
+
+ #endregion Methods
+ }
+}
\ No newline at end of file
diff --git a/SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs b/SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs
new file mode 100644
index 0000000..deb6376
--- /dev/null
+++ b/SUBQHSE/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs
@@ -0,0 +1,301 @@
+using System;
+using Model;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace BLL
+{
+ ///
+ /// 企业级检查主表服务
+ ///
+ public static class UnitHazardRegisterService
+ {
+ #region Fields
+
+ public static Dictionary StateMap = new Dictionary
+ {
+ { "待提交" ,(int)StateInt.待提交},
+ { "待整改" ,(int)StateInt.待整改},
+ { "部分整改" ,(int)StateInt.部分整改},
+ { "已闭环" ,(int)StateInt.已闭环},
+ };
+
+ #endregion Fields
+
+ #region Enums
+
+ public enum StateInt : int
+ {
+ 待提交 = 0,
+ 待整改= 1,
+ 部分整改 = 2,
+ 已闭环 = 3,
+ }
+
+ #endregion Enums
+
+ #region Methods
+
+ ///
+ /// 添加企业级检查记录
+ ///
+ /// 企业级检查记录
+ public static void AddUnitHazardRegister(Model.Supervise_UnitHazardRegister register)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ Model.Supervise_UnitHazardRegister newRegister = new Model.Supervise_UnitHazardRegister
+ {
+ UnitHazardRegisterId = register.UnitHazardRegisterId,
+ UnitHazardRegisterCode = register.UnitHazardRegisterCode,
+ CheckDate = register.CheckDate,
+ CheckMainType = register.CheckMainType,
+ CheckType = register.CheckType,
+ ProjectId = register.ProjectId,
+ CheckUnitId = register.CheckUnitId,
+ CheckTeam = register.CheckTeam,
+ CheckManIds = register.CheckManIds,
+ CheckManNames = register.CheckManNames,
+ InsResponsibleUserId = register.InsResponsibleUserId,
+ EvaluationResult = register.EvaluationResult,
+ AttachUrl = register.AttachUrl,
+ States = register.States??0,
+ CompileMan = register.CompileMan,
+ CreateDate = DateTime.Now
+ };
+ db.Supervise_UnitHazardRegister.InsertOnSubmit(newRegister);
+ db.SubmitChanges();
+ }
+ }
+
+ public static string ConvertState(int state)
+ {
+ string result = string.Empty;
+ result = StateMap.First(c => c.Value == state).Key;
+ return result;
+ }
+ ///
+ /// 删除企业级检查记录
+ ///
+ /// 检查记录ID
+ public static void DeleteUnitHazardRegisterById(string registerId)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ var register = db.Supervise_UnitHazardRegister.FirstOrDefault(e => e.UnitHazardRegisterId == registerId);
+ if (register != null)
+ {
+ // 删除附件
+ if (!string.IsNullOrEmpty(register.AttachUrl))
+ {
+ BLL.UploadFileService.DeleteFile(Funs.RootPath, register.AttachUrl);
+ }
+ // 删除编码记录
+ BLL.CodeRecordsService.DeleteCodeRecordsByDataId(registerId);
+ // 删除附件
+ BLL.CommonService.DeleteAttachFileById(registerId);
+ // 删除流程
+ BLL.CommonService.DeleteFlowOperateByID(registerId);
+
+ db.Supervise_UnitHazardRegister.DeleteOnSubmit(register);
+ db.SubmitChanges();
+ }
+ }
+ }
+
+ ///
+ /// 根据项目和时间段获取检查数量
+ ///
+ /// 项目ID
+ /// 开始时间
+ /// 结束时间
+ /// 检查数量
+ public static int GetCount(string projectId, DateTime startTime, DateTime endTime)
+ {
+ return (from x in Funs.DB.Supervise_UnitHazardRegister
+ where x.ProjectId == projectId && x.CheckDate >= startTime && x.CheckDate <= endTime
+ select x).Count();
+ }
+ public static int GetCount(string checkMainType)
+ {
+ return (from x in Funs.DB.Supervise_UnitHazardRegister
+ where x.CheckMainType ==checkMainType
+ select x.UnitHazardRegisterId).Count();
+ }
+ ///
+ /// 根据ID获取企业级检查记录
+ ///
+ /// 检查记录ID
+ /// 企业级检查记录
+ public static Model.Supervise_UnitHazardRegister GetUnitHazardRegisterById(string registerId)
+ {
+ return Funs.DB.Supervise_UnitHazardRegister.FirstOrDefault(e => e.UnitHazardRegisterId == registerId);
+ }
+
+ ///
+ /// 判断是否可以删除检查记录
+ ///
+ /// 检查记录ID
+ /// true=可以删除,false=不能删除
+ public static bool CanDeleteRegister(string registerId)
+ {
+ var register = GetUnitHazardRegisterById(registerId);
+ if (register == null)
+ {
+ return false;
+ }
+ // 只有"待提交"状态可以删除,其他状态不能删除
+ return register.States <= (int)StateInt.待提交;
+ }
+
+ ///
+ /// 获取企业级检查列表(使用input对象,返回总数)
+ ///
+ /// 查询条件
+ /// 页码(从0开始)
+ /// 每页大小
+ /// 是否返回所有数据(不分页)
+ /// 总记录数
+ /// 检查记录列表
+ public static List GetUnitHazardRegisters(
+ UnitHazardRegisterInput input,
+ int pageIndex,
+ int pageSize,
+ bool returnAll,
+ out int totalCount)
+ {
+ var db = Funs.DB;
+ // 使用JOIN一次性获取所有数据,解决N+1查询问题
+ var query = from x in db.Supervise_UnitHazardRegister
+ join ct in db.Base_SuperviseCheckType
+ on new { MainType = x.CheckMainType, TypeCode = x.CheckType }
+ equals new { MainType = ct.CheckMainType, TypeCode = ct.CheckTypeCode } into ctGroup
+ from ct in ctGroup.DefaultIfEmpty()
+ join u in db.Base_Unit
+ on x.CheckUnitId equals u.UnitId into uGroup
+ from u in uGroup.DefaultIfEmpty()
+ join p in db.Base_Project on x.ProjectId equals p.ProjectId into pGroup
+ from p in pGroup.DefaultIfEmpty()
+ select new UnitHazardRegisterOutput
+ {
+ UnitHazardRegisterId = x.UnitHazardRegisterId,
+ UnitHazardRegisterCode = x.UnitHazardRegisterCode,
+ CheckDate = x.CheckDate,
+ ProjectId = x.ProjectId,
+ CheckMainTypeName = x.CheckMainType == "0" ? "安全" : "质量",
+ CheckType = x.CheckType,
+ CheckTypeName = ct.CheckTypeName,
+ CheckObjectText = p.ProjectName,
+ CheckUnitName = u.UnitName,
+ CheckTeam = x.CheckTeam,
+ EvaluationResult = x.EvaluationResult,
+ StatesName = ConvertState(x.States.Value),
+ AttachUrl = x.AttachUrl,
+ };
+
+ // 应用检查大类过滤
+ if (input != null && !string.IsNullOrEmpty(input.CheckMainType))
+ {
+ query = query.Where(x => x.CheckMainTypeName.Contains(input.CheckMainType == "0" ? "安全" : "质量"));
+ }
+
+ // 应用文本搜索
+ if (input != null && !string.IsNullOrEmpty(input.SearchText))
+ {
+ query = query.Where(x => x.UnitHazardRegisterCode.Contains(input.SearchText) ||
+ x.CheckObjectText.Contains(input.SearchText) ||
+ x.CheckTeam.Contains(input.SearchText) ||
+ x.EvaluationResult.Contains(input.SearchText));
+ }
+
+ // 应用检查类别过滤
+ if (input != null && !string.IsNullOrEmpty(input.CheckType) && input.CheckType != BLL.Const._Null)
+ {
+ query = query.Where(x => x.CheckType == input.CheckType);
+ }
+
+ // 项目权限过滤
+ if (input != null && !string.IsNullOrEmpty(input.ProjectId))
+ {
+ query = query.Where(x => x.ProjectId != null && x.ProjectId == input.ProjectId);
+ }
+
+ // 获取总数
+ totalCount = query.Count();
+
+ // 排序和分页
+ var orderedQuery = query.OrderByDescending(x => x.CheckDate);
+
+ if (returnAll)
+ {
+ return orderedQuery.ToList();
+ }
+
+ return orderedQuery
+ .Skip(pageIndex * pageSize)
+ .Take(pageSize)
+ .ToList();
+ }
+
+ ///
+ /// 更新企业级检查记录
+ ///
+ /// 企业级检查记录
+ public static void UpdateUnitHazardRegister(Model.Supervise_UnitHazardRegister register)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ Model.Supervise_UnitHazardRegister newRegister =
+ db.Supervise_UnitHazardRegister.FirstOrDefault(e => e.UnitHazardRegisterId == register.UnitHazardRegisterId);
+ if (newRegister != null)
+ {
+ newRegister.UnitHazardRegisterCode = register.UnitHazardRegisterCode;
+ newRegister.CheckDate = register.CheckDate;
+ newRegister.CheckMainType = register.CheckMainType;
+ newRegister.CheckType = register.CheckType;
+ newRegister.ProjectId = register.ProjectId;
+ newRegister.CheckUnitId = register.CheckUnitId;
+ newRegister.CheckTeam = register.CheckTeam;
+ newRegister.CheckManIds = register.CheckManIds;
+ newRegister.CheckManNames = register.CheckManNames;
+ newRegister.EvaluationResult = register.EvaluationResult;
+ newRegister.AttachUrl = register.AttachUrl;
+ newRegister.States = register.States;
+ newRegister.InsResponsibleUserId = register.InsResponsibleUserId;
+ newRegister.UpdateDate = DateTime.Now;
+ db.SubmitChanges();
+ }
+ }
+ }
+
+ ///
+ /// 更新主单状态(根据明细的整改情况)
+ ///
+ public static void UpdateRegisterStatus(string registerId)
+ {
+ // 获取主单的所有明细的整改状态
+ int rectifyStatus = BLL.UnitHazardRegisterItemService.GetRectifyStatus(registerId);
+
+ var register = BLL.UnitHazardRegisterService.GetUnitHazardRegisterById(registerId);
+ if (register != null)
+ {
+ // 根据整改状态更新主单状态
+ switch (rectifyStatus)
+ {
+ case 0: // 全部未整改
+ register.States = (int)UnitHazardRegisterService.StateInt.待整改; // 待整改
+ break;
+ case 1: // 部分整改
+ register.States = (int)UnitHazardRegisterService.StateInt.部分整改; ; // 待整改
+ break;
+ case 2: // 全部整改
+ register.States = (int)UnitHazardRegisterService.StateInt.已闭环; ; // 已完成
+ break;
+ }
+
+ BLL.UnitHazardRegisterService.UpdateUnitHazardRegister(register);
+ }
+ }
+ #endregion Methods
+ }
+}
diff --git a/SUBQHSE/FineUIPro.Web/BaseInfo/WorkPost.aspx b/SUBQHSE/FineUIPro.Web/BaseInfo/WorkPost.aspx
index 25d2822..343bd6e 100644
--- a/SUBQHSE/FineUIPro.Web/BaseInfo/WorkPost.aspx
+++ b/SUBQHSE/FineUIPro.Web/BaseInfo/WorkPost.aspx
@@ -30,6 +30,8 @@
+
+
@@ -153,6 +155,10 @@
+
+
@@ -18336,7 +18407,7 @@
-
+