diff --git a/DataBase/版本日志/SGGLDB_V2026-02-27-gf.sql b/DataBase/版本日志/SGGLDB_V2026-02-27-gf.sql new file mode 100644 index 00000000..543fd6a5 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-02-27-gf.sql @@ -0,0 +1,106 @@ +-- -豸 +INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +VALUES + ( N'B01EC58D-8E89-4433-A7B7-0D792D13E1A5', N'豸', NULL, '', 65, N'0', N'Menu_System_Qwms_P_Cqms', '0', '0', '0' ); + INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +VALUES + ( N'24A5D009-4972-43F8-BE87-6F392D000FDC', N'䱸ƻ', '','CQMS/Comprehensive/InspectionMachinePlan.aspx', 10, N'B01EC58D-8E89-4433-A7B7-0D792D13E1A5', N'Menu_System_Qwms_P_Cqms', '0', '1', '0' ); + INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) + VALUES('505E3016-1459-44ED-A1C2-299EC82D64C0','24A5D009-4972-43F8-BE87-6F392D000FDC','',1) + INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) + VALUES('B2966530-03FE-4E77-BA31-AF3EF5335711','24A5D009-4972-43F8-BE87-6F392D000FDC','޸',2) + INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) + VALUES('C7898E06-53E8-4D8A-8440-25C451B5CFAE','24A5D009-4972-43F8-BE87-6F392D000FDC','ɾ',3) + INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) + VALUES('23659438-D8CA-4451-810C-BD0130BE1ED4','24A5D009-4972-43F8-BE87-6F392D000FDC','',4) + GO + +INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +VALUES + ( N'2C0E4E25-DB0D-441A-ABAB-3F0A68C5A6CB', N'豸', NULL, '', 65, N'0', N'Menu_System_Qwms_S_Cqms', '1', '0', '1' ); + INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +VALUES + ( N'7FDC5937-226B-4C96-9854-D7CD77507479', N'䱸ƻ', '','CQMS/Comprehensive/InspectionMachinePlan.aspx', 10, N'2C0E4E25-DB0D-441A-ABAB-3F0A68C5A6CB', N'Menu_System_Qwms_S_Cqms', '1', '1', '0' ); + +CREATE TABLE [dbo].[Comprehensive_InspectionMachinePlan]( + [InspectionMachinePlanId] [nvarchar](50) NOT NULL, + [ProjectId] [nvarchar](50) NULL, + [UnitId] [nvarchar](50) NULL, + [InspectionMachineCode] [nvarchar](50) NULL, + [InspectionMachineName] [nvarchar](200) NULL, + [SpecificationModel] [nvarchar](50) NULL, + [Precision] [nvarchar](50) NULL, + [Unit] [nvarchar](50) NULL, + [UnitsCount] [int] NULL, + [NeedTime] [datetime] NULL, + [NeedRef] [nvarchar](500) NULL, + [CompileMan] [nvarchar](50) NULL, + [CompileDate] [datetime] NULL, + CONSTRAINT [PK_Comprehensive_InspectionMachinePlan] PRIMARY KEY CLUSTERED +( + [InspectionMachinePlanId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] + +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'InspectionMachinePlanId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ŀid' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'ProjectId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'λid' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'UnitId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'InspectionMachineCode' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'豸' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'InspectionMachineName' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ͺ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'SpecificationModel' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'Precision' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'λ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'Unit' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'UnitsCount' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ҫʱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'NeedTime' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ҫ˵ʹó' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'NeedRef' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'CompileMan' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan', @level2type=N'COLUMN',@level2name=N'CompileDate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'䱸ƻ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Comprehensive_InspectionMachinePlan' +GO + +update Sys_Menu set MenuName='ߵǼDZ',SuperMenu='B01EC58D-8E89-4433-A7B7-0D792D13E1A5',SortIndex=20 where MenuId='70194C2C-0DD8-4B96-A80A-59AE818A0007' +GO + +alter table Comprehensive_InspectionMachine add MeasurementRange nvarchar(50) null +alter table Comprehensive_InspectionMachine add Precision nvarchar(50) null +alter table Comprehensive_InspectionMachine add FactoryNumber nvarchar(50) null +alter table Comprehensive_InspectionMachine add FactoryDate datetime null +alter table Comprehensive_InspectionMachine add ManagementLevel nvarchar(50) null +alter table Comprehensive_InspectionMachine add UseDate datetime null +alter table Comprehensive_InspectionMachine add IsSpecialCycle bit null +alter table Comprehensive_InspectionMachine add CalibrationCycle int null +alter table Comprehensive_InspectionMachine add SpecialCalibrationCycle nvarchar(50) null +alter table Comprehensive_InspectionMachine add CalibrationDate datetime null +alter table Comprehensive_InspectionMachine add NextCalibrationDate datetime null +alter table Comprehensive_InspectionMachine add CalibrationWarning datetime null +alter table Comprehensive_InspectionMachine add Remark nvarchar(500) null +GO + diff --git a/DataBase/版本日志/SGGLDB_V2026-03-09-geh.sql b/DataBase/版本日志/SGGLDB_V2026-03-09-geh.sql new file mode 100644 index 00000000..50ed1606 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-03-09-geh.sql @@ -0,0 +1,12 @@ + + +-- 总包单位接口地址 +alter table Base_Project add SubjectUnitApiUrl nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL; +-- 总包单位服务地址 +alter table Base_Project add SubjectUnitWebUrl nvarchar(100) COLLATE Chinese_PRC_CI_AS NULL; +go + + + + + diff --git a/DataBase/版本日志/SGGLDB_V2026-03-10-geh(View_Hazard_HazardRegister).sql b/DataBase/版本日志/SGGLDB_V2026-03-10-geh(View_Hazard_HazardRegister).sql new file mode 100644 index 00000000..b2fdea6c --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-03-10-geh(View_Hazard_HazardRegister).sql @@ -0,0 +1,97 @@ + +---修改安全检查视图(添加数据来源字段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.HazardValue, + case when Registration.HazardValue='3' then '重大' else '一般' end as Risk_Level, + Registration.RectifiedDate, + Registration.ProjectId, + Project.UnitId AS PUnitId, + Project.ProjectState as ProjectState, + null as isDelete, + ProjectUnit.UnitName AS PUnitName, + case when ProjectUnit.UnitId='d72a27c9-4ba9-41c5-ab0b-c010409f20f2' then 1 else 0 end 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.WorkPackageId, + Registration.WorkPackageName, + Registration.IsUpdate, + Project.ProjectName, + Registration.CheckCycle, + ISNULL(WorkArea.UnitWorkName,'') AS WorkAreaName, + Unit.UnitName as ResponsibilityUnitName, + Unit.CollCropCode as ResponsibilityUnitCollCropCode, + User1.PersonName AS ResponsibilityManName, + ISNULL(User1.Telephone,'') AS ResponsibilityManTel, + User2.PersonName AS CheckManName, + ISNULL(User2.Telephone,'') AS CheckManTel, + User2.UnitId AS SendUnitId, + User3.PersonName AS ConfirmManName, + ISNULL(User3.Telephone,'') AS ConfirmManTel, + User4.PersonName AS ResponsibilityManName2, + CCManNames = STUFF(( SELECT ',' + PersonName FROM Person_Persons + where PATINDEX('%,' + RTRIM(Person_Persons.PersonId) + ',%',',' + Registration.CCManIds + ',')>0 + ORDER BY PATINDEX('%,' + RTRIM(Registration.CCManIds) + ',%',',' + Registration.CCManIds + ',') + FOR XML PATH('')), 1, 1,''), + 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.RegisterTypes2Id , + RegisterTypes2.RegisterTypesName as RegisterTypes2Name, + Registration.RegisterTypes3Id , + RegisterTypes3.RegisterTypesName as RegisterTypes3Name, + Registration.RegisterTypes4Id , + RegisterTypes4.RegisterTypesName as RegisterTypes4Name, + 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.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes2 ON RegisterTypes2.RegisterTypesId = Registration.RegisterTypes2Id +LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes3 ON RegisterTypes3.RegisterTypesId = Registration.RegisterTypes3Id +LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes4 ON RegisterTypes4.RegisterTypesId = Registration.RegisterTypes4Id +LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = Registration.ResponsibleUnit +LEFT JOIN dbo.Person_Persons AS User1 ON User1.PersonId = Registration.ResponsibleMan +LEFT JOIN dbo.Person_Persons AS User2 ON User2.PersonId = Registration.CheckManId +LEFT JOIN dbo.Person_Persons AS User3 ON User3.PersonId = Registration.ConfirmMan +LEFT JOIN dbo.Person_Persons AS User4 ON User4.PersonId = Registration.ResponsibleMan2 + +GO + + diff --git a/DataBase/版本日志/SGGLDB_V2026-03-10-gf.sql b/DataBase/版本日志/SGGLDB_V2026-03-10-gf.sql new file mode 100644 index 00000000..dacf9c68 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-03-10-gf.sql @@ -0,0 +1,7 @@ +alter table Check_CheckControl add DataSource char(1) COLLATE Chinese_PRC_CI_AS NULL; +EXEC sp_addextendedproperty +'MS_Description', N'Դ(1ܰ,0λ)', +'SCHEMA', N'dbo', +'TABLE', N'Check_CheckControl', +'COLUMN', N'DataSource' +GO \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_V2026-03-12-xiaj.sql b/DataBase/版本日志/SGGLDB_V2026-03-12-xiaj.sql new file mode 100644 index 00000000..4307d6c7 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-03-12-xiaj.sql @@ -0,0 +1,88 @@ + +--Σ󹤳̷ֶΡ״̬ 0ˡ1С2ɡ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Solution_LargerHazard' AND COLUMN_NAME = 'ApprovalState') +BEGIN + ALTER TABLE Solution_LargerHazard ADD ApprovalState char(1); + EXEC sp_addextendedproperty 'MS_Description', N'״̬(0ˡ1С2)','SCHEMA', N'dbo','TABLE', N'Solution_LargerHazard','COLUMN', N'ApprovalState' +END +GO + +--Σ󹤳̷ʷݡ״̬߼ +--ҵ״̬Ϊδʼ״̬ĬΪˣҵ״̬Ϊҵк깤״̬ĬΪ +update Solution_LargerHazard set ApprovalState='0' where ApprovalState is null and States = '1' +GO +update Solution_LargerHazard set ApprovalState='2' where ApprovalState is null and States in ('2','3') +GO + + +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'HSSEData_HSSE' AND COLUMN_NAME = 'AwaitApprovalNum') +BEGIN + ALTER TABLE HSSEData_HSSE ADD AwaitApprovalNum int; + ALTER TABLE HSSEData_HSSE ADD PendingApprovalNum int; + ALTER TABLE HSSEData_HSSE ADD CompletedApprovalNum int; + ALTER TABLE HSSEData_HSSE ADD SuperAwaitApprovalNum int; + ALTER TABLE HSSEData_HSSE ADD SuperPendingApprovalNum int; + ALTER TABLE HSSEData_HSSE ADD SuperCompletedApprovalNum int; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳̴˸','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'AwaitApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳и','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'PendingApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳ɸ','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'CompletedApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳̴˸','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'SuperAwaitApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳и','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'SuperPendingApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳ɸ','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'SuperCompletedApprovalNum'; +END +GO + +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_HSSEData_HSSE' AND COLUMN_NAME = 'AwaitApprovalNum') +BEGIN + ALTER TABLE Project_HSSEData_HSSE ADD AwaitApprovalNum int; + ALTER TABLE Project_HSSEData_HSSE ADD PendingApprovalNum int; + ALTER TABLE Project_HSSEData_HSSE ADD CompletedApprovalNum int; + ALTER TABLE Project_HSSEData_HSSE ADD SuperAwaitApprovalNum int; + ALTER TABLE Project_HSSEData_HSSE ADD SuperPendingApprovalNum int; + ALTER TABLE Project_HSSEData_HSSE ADD SuperCompletedApprovalNum int; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳̴˸','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'AwaitApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳и','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'PendingApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳ɸ','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'CompletedApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳̴˸','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'SuperAwaitApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳и','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'SuperPendingApprovalNum'; + EXEC sp_addextendedproperty 'MS_Description', N'Σ󹤳ɸ','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'SuperCompletedApprovalNum'; +END +GO + + + + + + +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'HSSEData_HSSE' AND COLUMN_NAME = 'LargerClosedNum') +BEGIN + ALTER TABLE HSSEData_HSSE ADD LargerClosedNum int; + ALTER TABLE HSSEData_HSSE ADD LargerNotClosedNum int; + EXEC sp_addextendedproperty 'MS_Description', N'ϴıջ','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'LargerClosedNum'; + EXEC sp_addextendedproperty 'MS_Description', N'ϴδ','SCHEMA', N'dbo','TABLE', N'HSSEData_HSSE','COLUMN', N'LargerNotClosedNum'; +END +GO + +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Project_HSSEData_HSSE' AND COLUMN_NAME = 'LargerClosedNum') +BEGIN + ALTER TABLE Project_HSSEData_HSSE ADD LargerClosedNum int; + ALTER TABLE Project_HSSEData_HSSE ADD LargerNotClosedNum int; + EXEC sp_addextendedproperty 'MS_Description', N'ϴıջ','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'LargerClosedNum'; + EXEC sp_addextendedproperty 'MS_Description', N'ϴδ','SCHEMA', N'dbo','TABLE', N'Project_HSSEData_HSSE','COLUMN', N'LargerNotClosedNum'; +END +GO + + + +--ȥҵĿ +ALTER TABLE [Supervise_UnitHazardRegister] +DROP CONSTRAINT [FK_UnitHazardRegister_Project]; +GO +--ҵ鲹ֶΡ鵥λ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Supervise_UnitHazardRegister' AND COLUMN_NAME = 'InspectionUnit') +BEGIN + ALTER TABLE Supervise_UnitHazardRegister ADD InspectionUnit nvarchar(50); + EXEC sp_addextendedproperty 'MS_Description', N'鵥λ','SCHEMA', N'dbo','TABLE', N'Supervise_UnitHazardRegister','COLUMN', N'InspectionUnit' +END +GO + diff --git a/DataBase/版本日志/SGGLDB_V2026-03-16-geh.sql b/DataBase/版本日志/SGGLDB_V2026-03-16-geh.sql new file mode 100644 index 00000000..2d2e1a34 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-03-16-geh.sql @@ -0,0 +1,68 @@ + +-----定制版根据菜单id进行删除 +----删除奖励通知单菜单 +--delete Sys_Menu where MenuId ='96F21A83-6871-4CC4-8901-1B99C376395C' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='E20357C9-F43A-4ACC-8A50-C735A3A6B438' and MenuType ='Menu_System_Hsse_S_Hsse' +--go +----删除奖励统计菜单 +--delete Sys_Menu where MenuId ='C13F1CE7-DAEF-4604-A13F-192621D28DF5' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='2DFAF96D-92B5-47E1-9138-EEE4595D9DEE' and MenuType ='Menu_System_Hsse_S_Hsse' +--go +----删除处罚通知单菜单 +--delete Sys_Menu where MenuId ='755F1C1D-2178-47D8-9F82-A501B53A2436' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='4EA8BBE5-B9BC-414E-961E-77CEA9E485F0' and MenuType ='Menu_System_Hsse_S_Hsse' +--go +----删除处罚统计菜单 +--delete Sys_Menu where MenuId ='CCD0E55B-300A-454B-8559-155ADAD386AE' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='C1093C81-F231-405B-9E40-8C409D84024A' and MenuType ='Menu_System_Hsse_S_Hsse' +--go +----删除违规人员记录菜单 +--delete Sys_Menu where MenuId ='06958288-96F4-4291-909A-FFC2FC76814D' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='D6DB64E8-1FE8-47BB-81D7-70AEFB05E7A9' and MenuType ='Menu_System_Hsse_S_Hsse' +--go +----删除评优评奖加分项菜单 +--delete Sys_Menu where MenuId ='9682053F-597E-4E10-B130-93624541387A' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='1590207E-8C5C-4D82-AF34-BFB832FB526E' and MenuType ='Menu_System_Hsse_S_Hsse' +--go +----删除安全隐患报告数据菜单 +--delete Sys_Menu where MenuId ='04B0774F-FEEF-421D-8964-D9CF6582AEAF' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='167B9D7C-BD96-4F19-9035-D98527C2DCF5' and MenuType ='Menu_System_Hsse_S_Hsse' +--go + +----删除获奖证书或奖杯、安全质量环保奖项菜单 +--delete Sys_Menu where MenuId ='9A034CAD-C7D5-4DE4-9FF5-828D35FFEE28' and MenuType ='Menu_System_Hsse_P_Hsse' +--delete Sys_Menu where MenuId ='13DDC402-D72E-49C0-A170-41B75E43D9F3' and MenuType ='Menu_System_Hsse_P_Hsse' +--go + + + + + + + +--这个菜单放到质量的人员报验下 +--IF NOT EXISTS (SELECT * FROM Sys_Menu WHERE MenuId = '67C53963-91E5-4892-8286-B646A6E339CC' and MenuType = 'Menu_System_Qwms_P_Cqms') +--BEGIN +--INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +--VALUES +-- ( N'67C53963-91E5-4892-8286-B646A6E339CC', N'质量人员报验(通用)', NULL, N'CQMS/Comprehensive/CqmsPerson.aspx', 50, N'672F4FE4-7E6A-4D47-8DD9-1FA4535C835C', N'Menu_System_Qwms_P_Cqms', '0', '1', '1' ); +--END +--GO +--IF NOT EXISTS (SELECT * FROM Sys_Menu WHERE MenuId = '0908A5FD-0865-4747-AA2D-4186B5EEC9F8' and MenuType = 'Menu_System_Qwms_S_Cqms') +--BEGIN +--INSERT INTO [dbo].[Sys_Menu] ( [MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed] ) +--VALUES +-- ( N'0908A5FD-0865-4747-AA2D-4186B5EEC9F8', N'质量人员报验(通用)', NULL, N'CQMS/Comprehensive/CqmsPerson.aspx', 50, N'53C28E81-09F7-4F26-B17D-12DDA1764A74', N'Menu_System_Qwms_S_Cqms', '0', '1', '1' ); +--END +--GO + + + + +--alter table SitePerson_Person add [IsTrain] bit NULL; +--EXEC sp_addextendedproperty +--'MS_Description', N'质量是否培训', +--'SCHEMA', N'dbo', +--'TABLE', N'SitePerson_Person', +--'COLUMN', N'IsTrain' +--GO \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_V2026-03-21-xiaj.sql b/DataBase/版本日志/SGGLDB_V2026-03-21-xiaj.sql new file mode 100644 index 00000000..f6d4ed9d --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-03-21-xiaj.sql @@ -0,0 +1,130 @@ +alter table Base_WorkPost add IsCQMSCheck bit null +GO +alter table SitePerson_Person add Major nvarchar(50) null +GO +--Ϣ⣺ΣռΪݴ +update Hazard_HazardSelectedItem +set HazardLevel='84e1d680-5bfe-48d2-a255-59f43aa3615a' +where HazardLevel is null and HazardJudge_D<=120 +GO +update Hazard_HazardSelectedItem +set HazardLevel='01537cc5-e8d2-497c-ba53-1faca1faf495' +where HazardLevel is null and HazardJudge_D<=170 and HazardJudge_D>120 +GO +update Hazard_HazardSelectedItem +set HazardLevel='6baaf2bb-ee7c-410c-9a32-13208626c467' +where HazardLevel is null and HazardJudge_D<=320 and HazardJudge_D>170 +GO +update Hazard_HazardSelectedItem +set HazardLevel='c9e6285c-2da3-4997-8dc9-fb6ab404346e' +where HazardLevel is null and HazardJudge_D>320 +GO + + + + +--ֶ߲ΣԴ˵ +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Comprehensive_InspectionMachine' AND COLUMN_NAME = 'SourceDes') +BEGIN + ALTER TABLE Comprehensive_InspectionMachine ADD SourceDes nvarchar(500); +END +GO + + + + + + +CREATE TABLE [dbo].[Base_MaterialUnit]( + [MaterialUnitId] [nvarchar](50) NOT NULL, + [MaterialUnitName] [nvarchar](100) NULL, + [MaterialUnitCode] [nvarchar](50) NULL, + [Remark] [nvarchar](200) NULL, + CONSTRAINT [PK_Base_MaterialUnit] PRIMARY KEY CLUSTERED +( + [MaterialUnitId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'λid' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_MaterialUnit', @level2type=N'COLUMN',@level2name=N'MaterialUnitId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'λ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_MaterialUnit', @level2type=N'COLUMN',@level2name=N'MaterialUnitName' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_MaterialUnit', @level2type=N'COLUMN',@level2name=N'MaterialUnitCode' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_MaterialUnit', @level2type=N'COLUMN',@level2name=N'Remark' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʵλ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_MaterialUnit' +GO + + + + + + +CREATE TABLE [dbo].[MaterialInAndOutRecord]( + [Id] [nvarchar](50) NOT NULL, + [ProjectId] [nvarchar](50) NULL, + [GoodsCategoryId] [nvarchar](50) NULL, + [GoodsCategoryName] [nvarchar](100) NULL, + [MaterialModel] [nvarchar](100) NULL, + [InOutDate] [datetime] NULL, + [UnitId] [nvarchar](50) NULL, + [InOrOut] [nvarchar](10) NULL, + [Number] [decimal](18, 2) NULL, + [MaterialUnitId] [nvarchar](50) NULL, + [Remark] [nvarchar](200) NULL, + [CompileMan] [nvarchar](50) NULL, + [CompileDate] [datetime] NULL, + CONSTRAINT [PK_MaterialInAndOutRecord] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'Id' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'GoodsCategoryId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'GoodsCategoryName' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ͺ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'MaterialModel' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'InOutDate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'λ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'UnitId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'/' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'InOrOut' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'Number' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʵλ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'MaterialUnitId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'Remark' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'CompileMan' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord', @level2type=N'COLUMN',@level2name=N'CompileDate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʵλ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MaterialInAndOutRecord' +GO + + diff --git a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs index aa4b3702..b52417bb 100644 --- a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs +++ b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs @@ -386,6 +386,117 @@ namespace BLL } } } - #endregion + #endregion + + #region 新保存Check_CheckSpecial + + /// + /// 新保存Check_CheckSpecial + /// + /// 处罚通知单 + /// + public static string SaveCheckSpecialNew(Model.CheckSpecialItem newItem) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string message = string.Empty; + Model.Check_CheckSpecial newCheckSpecial = new Model.Check_CheckSpecial + { + CheckSpecialId = newItem.CheckSpecialId, + CheckSpecialCode = newItem.CheckSpecialCode, + CheckType = newItem.CheckType, + ProjectId = newItem.ProjectId, + CheckPerson = newItem.CheckPersonId, + CheckTime = Funs.GetNewDateTime(newItem.CheckTime), + DaySummary = System.Web.HttpUtility.HtmlEncode(newItem.DaySummary), + PartInUnits = newItem.PartInUnitIds, + PartInPersonIds = newItem.PartInPersonIds, + PartInPersons = Person_PersonsService.getPersonsNamesPersonIds(newItem.PartInPersonIds), + PartInPersonNames = newItem.PartInPersonNames2, + CompileMan = newItem.CompileManId, + States = Const.State_0, + }; + if (newItem.CheckType == "0") + { + newCheckSpecial.CheckItemSetId = newItem.CheckItemSetId; + } + + if (!string.IsNullOrEmpty(newItem.States)) + { + newCheckSpecial.States = newItem.States; + } + if (newItem.CheckSpecialDetailItems == null || newItem.CheckSpecialDetailItems.Count() == 0) + { + if (newItem.States == Const.State_1) + { + newCheckSpecial.States = Const.State_2; + } + } + var updateCheckSpecial = + db.Check_CheckSpecial.FirstOrDefault(x => x.CheckSpecialId == newItem.CheckSpecialId); + if (updateCheckSpecial == null) + { + newCheckSpecial.CheckSpecialId = SQLHelper.GetNewID(); + newCheckSpecial.CheckSpecialCode = + CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectCheckSpecialMenuId, + newCheckSpecial.ProjectId, string.Empty); + db.Check_CheckSpecial.InsertOnSubmit(newCheckSpecial); + db.SubmitChanges(); + ////增加一条编码记录 + BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckSpecialMenuId, + newCheckSpecial.ProjectId, null, newCheckSpecial.CheckSpecialId, newCheckSpecial.CheckTime); + } + else + { + Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial); + } + + ////保存附件 + if (!string.IsNullOrEmpty(newItem.AttachUrl1)) + { + UploadFileService.SaveAttachUrl( + UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1, + Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); + } + else + { + CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); + } + + ///// 新增检查项 + if (newItem.CheckSpecialDetailItems != null && newItem.CheckSpecialDetailItems.Count() > 0) + { + foreach (var item in newItem.CheckSpecialDetailItems) + { + item.CheckSpecialId = newCheckSpecial.CheckSpecialId; + SaveCheckSpecialDetail(item); + } + + //// 单据完成后 系统自动按照单位 整改要求生成隐患整改单 + if (newItem.States == Const.State_1) + { + var getC = newItem.CheckSpecialDetailItems.FirstOrDefault(x => x.CompleteStatus == false); + if (getC == null) + { + newCheckSpecial.States = Const.State_2; + Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial); + } + else + { + var detailLists = db.Check_CheckSpecialDetail.Where(x => + x.CheckSpecialId == newCheckSpecial.CheckSpecialId && x.CompleteStatus == false); + if (detailLists.Count() > 0) + { + message = Check_CheckSpecialService.IssueRectification(detailLists.ToList(), + newCheckSpecial); + } + } + } + } + + return message; + } + } + #endregion } } diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index a94b7f11..61a179c5 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -279,6 +279,8 @@ + + diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 70637d27..7cd3157b 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -5314,5 +5314,45 @@ namespace BLL public const string UnitHazardRegisterMenuRecord_Quality = "15511354-9822-4A21-AB24-2483D889FDB8"; #endregion + + /// + /// 现场车辆管理导入模板 + /// + public const string CarManagerTemplateUrl = "File\\Excel\\DataIn\\现场车辆管理导入模板.xls"; + + /// + /// 企业大检查明细导入模板 + /// + public const string UnitHazardRegisterDetailTemplateUrl = "File\\Excel\\DataIn\\企业大检查明细导入模板.xls"; + + /// + /// 活动类型 + /// + public const string ActivityTypeMenuId = "79116536-BE80-4323-A46F-10222601D5B5"; + + /// + /// 货物单位类型 + /// + public const string MaterialUnitMenuId = "3DD3F0E8-D3EA-41AA-BA1F-CA3168657D67"; + + + /// + /// 物资进出记录 + /// + public const string MaterialInAndOutRecordMenuId = "5DAB5F9A-097A-46D4-8EB1-F60D1D65E812"; + + + /// + /// 奖励与惩罚 + /// + public const string RewardAndPunishManagerMenuId = "621A9295-DD82-425A-863D-310AD319752B"; + + + /// + /// 质量会议 + /// + public const string CQMS_MeetingMenuId = "30754DF1-CB18-4F53-BB66-2B2A398D7180"; + + } } \ No newline at end of file diff --git a/SGGL/BLL/DataShare/APIDataShareSyncService.cs b/SGGL/BLL/DataShare/APIDataShareSyncService.cs index 50aaa97a..b35386cb 100644 --- a/SGGL/BLL/DataShare/APIDataShareSyncService.cs +++ b/SGGL/BLL/DataShare/APIDataShareSyncService.cs @@ -5,7 +5,7 @@ using System.Configuration; using System.IO; using System.Net.Http; using System.Threading.Tasks; - +using System.Net; namespace BLL { @@ -611,5 +611,46 @@ namespace BLL } #endregion + + /// + /// 下载并保存文件 + /// + /// + /// + /// + public static byte[] SafeDownloadHeadImageAsync(string webUrl, string fileUrl) + { + try + { + if (string.IsNullOrEmpty(fileUrl)) + return null; + + // 构造完整的远程文件 URL + string fullRemoteUrl = $"{webUrl.TrimEnd('/')}/{fileUrl.TrimStart('/')}"; + + // 构造本地文件路径 + string localFilePath = Path.Combine(ConfigurationManager.AppSettings["localRoot"], fileUrl); + + // 确保本地目录存在 + string directoryPath = Path.GetDirectoryName(localFilePath); + if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath)) + { + Directory.CreateDirectory(directoryPath); + } + //下载文件到本地 + using (WebClient client = new WebClient()) + { + byte[] fileData = client.DownloadData(fullRemoteUrl); + // 将文件数据写入本地文件 + File.WriteAllBytes(localFilePath, fileData); + return fileData; + } + } + catch (Exception ex) + { + BLL.ErrLogInfo.WriteLog($"下载头像失败: {fileUrl}, 错误: {ex.Message}"); + return null; + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/DataShare/CQMS/APICheckControlSyncService.cs b/SGGL/BLL/DataShare/CQMS/APICheckControlSyncService.cs new file mode 100644 index 00000000..ce5812d8 --- /dev/null +++ b/SGGL/BLL/DataShare/CQMS/APICheckControlSyncService.cs @@ -0,0 +1,543 @@ +using Newtonsoft.Json.Linq; +using System; +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 APICheckControlSyncService + { + #region 根据项目、单位获取质量巡检列表 + + /// + /// 根据项目、单位获取质量巡检列表 + /// + /// 项目ID + /// 单位ID + /// 数据ID(可选,用于单条数据同步) + /// 质量巡检数据列表 + public static List GetCheckControlListsByProjectIdUnitIdPage( + string projectId, string unitId, string dataId = "") + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var list = from x in db.Check_CheckControl + 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.CheckControlCode == dataId); + } + + var dataList = (from x in list + join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitTemp + from unit in unitTemp.DefaultIfEmpty() + join pro in db.Base_CNProfessional on x.CNProfessionalCode equals pro.CNProfessionalId into proTemp + from pro in proTemp.DefaultIfEmpty() + join uw in db.WBS_UnitWork on x.UnitWorkId equals uw.UnitWorkId into uwTemp + from uw in uwTemp.DefaultIfEmpty() + join qqt in db.Base_QualityQuestionType on x.QuestionType equals qqt.QualityQuestionTypeId into qqtTemp + from qqt in qqtTemp.DefaultIfEmpty() + join u1 in db.Person_Persons on x.CheckMan equals u1.PersonId into u1Temp + from u1 in u1Temp.DefaultIfEmpty() + join u2 in db.Person_Persons on x.SubmitMan equals u2.PersonId into u2Temp + from u2 in u2Temp.DefaultIfEmpty() + join pu in db.Base_Unit on x.ProposeUnitId equals pu.UnitId into puTemp + from pu in puTemp.DefaultIfEmpty() + join att in db.AttachFile on x.CheckControlCode equals att.ToKeyId into attTemp + from att in attTemp.DefaultIfEmpty() + join attRe in db.AttachFile on x.CheckControlCode+"r" equals attRe.ToKeyId into attReTemp + from attRe in attReTemp.DefaultIfEmpty() + select new CheckControlSyncItem + { + CheckControlCode = x.CheckControlCode, + ProjectId = x.ProjectId, + UnitWorkId = x.UnitWorkId, + UnitWorkName = uw.UnitWorkName, + UnitId = x.UnitId, + UnitName = unit.UnitName, + CheckDate = x.CheckDate, + CheckMan = x.CheckMan, + CheckManName = u1.PersonName, + CheckSite = x.CheckSite, + DocCode = x.DocCode, + CNProfessionalCode = x.CNProfessionalCode, + CNProfessionalName = pro.ProfessionalName, + QuestionType = x.QuestionType, + QuestionTypeName = qqt.QualityQuestionType, + QuestionDef = x.QuestionDef, + RectifyOpinion = x.RectifyOpinion, + LimitDate = x.LimitDate, + AttachUrl = att.AttachUrl, + HandleWay = x.HandleWay, + RectifyDate = x.RectifyDate, + ReAttachUrl = attRe.AttachUrl, + State = x.State, + IsSubmit = x.IsSubmit, + SubmitMan = x.SubmitMan, + SubmitManName = u2.PersonName, + IsOK = x.IsOK, + ProposeUnitId = x.ProposeUnitId, + ProposeUnitName = pu.UnitName, + SaveHandleMan = x.SaveHandleMan, + DataSource = "1" + }).ToList(); + + return dataList; + } + } + + #endregion + + + #region 拉取质量巡检数据 + + /// + /// 拉取质量巡检数据 + /// + /// 处理结果消息 + public static string getCheckControlLists(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.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 Url = "http://localhost:14957/,http://localhost:8579/"; + + var ApiUrl = ""; + var WebUrl = ""; + if (!string.IsNullOrEmpty(Url)) + { + var urls = Url.Split(','); + ApiUrl = urls[0]; + if (urls.Length > 1) + { + WebUrl = urls[1]; + } + } + + string url = "/api/CheckControlSync/getCheckControlListByProjectIdAndCollCropCode?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) + { + ProcessCheckControlData(getData, project.ProjectId, unitId, WebUrl, "pull"); + } + message = "获取成功:同步质量巡检数" + getData.Count().ToString() + "条"; + } + } + } + } + } + catch (Exception ex) + { + message = "获取失败:" + ex.Message; + ErrLogInfo.WriteLog("质量巡检获取!", ex); + } + + return message; + } + + #endregion + + + #region 推送质量巡检数据 + + /// + /// 推送质量巡检数据 + /// + /// 项目ID + /// 数据ID(可选,用于单条数据推送) + /// 推送结果 + public static ReturnData pushCheckControlLists(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 = GetCheckControlListsByProjectIdUnitIdPage(projectId, "", dataId); + + if (items.Count() > 0) + { + var thisUnit = CommonService.GetIsThisUnit(); //当前单位 + var apiurl = "/api/CheckControlSync/SaveCheckControlSyncData"; + + //总包单位接口地址 + var Url = BLL.UnitService.getUnitApiUrlByUnitId(project.SubjectUnit); + //var Url = "http://localhost:14957/"; + var ApiUrl = ""; + var WebUrl = ""; + + if (!string.IsNullOrEmpty(Url)) + { + var urls = Url.Split(','); + ApiUrl = urls[0]; + if (urls.Length > 1) + { + WebUrl = urls[1]; + } + } + + var pushData = new CheckControlSyncData + { + 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 string SaveCheckControlSyncData(Model.CheckControlSyncData 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 + { + //判断主包项目是否存在 + var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId); + if (porject == null) + { + message = "总包单位不存在本项目,请检查总包项目关联是否正确!"; + } + else + { + ProcessCheckControlData(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 ProcessCheckControlData( + List getData, + string projectId, + string unitId, + string WebUrl, string type) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + foreach (var item in getData) + { + Model.Check_CheckControl model = db.Check_CheckControl.FirstOrDefault(x => x.CheckControlCode == item.CheckControlCode); + + if (model == null) + { + //新增 + Model.Check_CheckControl newModel = new Model.Check_CheckControl + { + CheckControlCode = item.CheckControlCode, + ProjectId = projectId, + UnitWorkId = APIDataShareSyncService.getUnitWorkId(item.UnitWorkName, projectId), + UnitId = getUnitIdByUnitName(item.UnitName) ?? unitId, + CheckDate = item.CheckDate, + CheckMan = APIDataShareSyncService.getUserId(item.CheckManName), + CheckSite = item.CheckSite, + DocCode = item.DocCode, + CNProfessionalCode = getCNProfessionalId(item.CNProfessionalName), + QuestionType = getQualityQuestionTypeId(item.QuestionTypeName, projectId), + QuestionDef = item.QuestionDef, + RectifyOpinion = item.RectifyOpinion, + LimitDate = item.LimitDate, + AttachUrl = item.AttachUrl, + HandleWay = item.HandleWay, + RectifyDate = item.RectifyDate, + ReAttachUrl = item.ReAttachUrl, + State = item.State, + IsSubmit = item.IsSubmit, + SubmitMan = APIDataShareSyncService.getUserId(item.SubmitManName), + IsOK = item.IsOK, + ProposeUnitId = getUnitIdByUnitName(item.ProposeUnitName), + SaveHandleMan = item.SaveHandleMan + }; + if (type == "pull") + { + newModel.DataSource = item.DataSource; + } + db.Check_CheckControl.InsertOnSubmit(newModel); + db.SubmitChanges(); + } + else + { + //更新 + model.ProjectId = projectId; + model.UnitWorkId = APIDataShareSyncService.getUnitWorkId(item.UnitWorkName, projectId); + model.UnitId = getUnitIdByUnitName(item.UnitName) ?? unitId; + model.CheckDate = item.CheckDate; + model.CheckMan = APIDataShareSyncService.getUserId(item.CheckManName); + model.CheckSite = item.CheckSite; + model.DocCode = item.DocCode; + model.CNProfessionalCode = getCNProfessionalId(item.CNProfessionalName); + model.QuestionType = getQualityQuestionTypeId(item.QuestionTypeName, projectId); + model.QuestionDef = item.QuestionDef; + model.RectifyOpinion = item.RectifyOpinion; + model.LimitDate = item.LimitDate; + model.AttachUrl = item.AttachUrl; + model.HandleWay = item.HandleWay; + model.RectifyDate = item.RectifyDate; + model.ReAttachUrl = item.ReAttachUrl; + model.State = item.State; + model.IsSubmit = item.IsSubmit; + model.SubmitMan = APIDataShareSyncService.getUserId(item.SubmitManName); + model.IsOK = item.IsOK; + model.ProposeUnitId = getUnitIdByUnitName(item.ProposeUnitName); + model.SaveHandleMan = item.SaveHandleMan; + if (type == "pull") + { + model.DataSource = item.DataSource; + } + db.SubmitChanges(); + } + + //处理整改前附件 + if (!string.IsNullOrEmpty(item.AttachUrl)) + { + APIDataShareSyncService.OperationAttachFile(WebUrl, item.CheckControlCode, + BLL.Const.CheckListMenuId, item.AttachUrl); + } + + //处理整改后附件 + if (!string.IsNullOrEmpty(item.ReAttachUrl)) + { + APIDataShareSyncService.OperationAttachFile(WebUrl, item.CheckControlCode + "R", + BLL.Const.CheckListMenuId, item.ReAttachUrl); + } + } + } + } + + #endregion + + + #region 辅助映射方法 + + /// + /// 获取质量问题类型ID(不存在则创建) + /// + /// 问题类型名称 + /// 项目ID + /// 问题类型ID + private static string getQualityQuestionTypeId(string questionTypeName, string projectId) + { + string questionTypeId = null; + if (!string.IsNullOrEmpty(questionTypeName)) + { + var qqt = Funs.DB.Base_QualityQuestionType.FirstOrDefault(x => x.QualityQuestionType == questionTypeName); + if (qqt == null) + { + //不存在则创建 + Model.Base_QualityQuestionType newQqt = new Model.Base_QualityQuestionType + { + QualityQuestionTypeId = SQLHelper.GetNewID(typeof(Model.Base_QualityQuestionType)), + QualityQuestionType = questionTypeName + }; + QualityQuestionTypeService.AddQualityQuestionType(newQqt); + questionTypeId = newQqt.QualityQuestionTypeId; + } + else + { + questionTypeId = qqt.QualityQuestionTypeId; + } + } + return questionTypeId; + } + + + + /// + /// 获取专业ID(不存在则创建) + /// + /// + /// + /// + private static string getCNProfessionalId(string ProfessionalName) + { + string Id = null; + if (!string.IsNullOrEmpty(ProfessionalName)) + { + var names = ProfessionalName.Split(','); + List IdList = new List(); + foreach (var name in names) + { + var cnProfessional = Funs.DB.Base_CNProfessional.Where(x => + x.ProfessionalName == name).ToList(); + if (cnProfessional.Count == 0) + { + Model.Base_CNProfessional newCnProfessional = new Model.Base_CNProfessional + { + CNProfessionalId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork)), + ProfessionalName = name, + }; + CNProfessionalService.AddCNProfessional(newCnProfessional); + IdList.Add(newCnProfessional.CNProfessionalId); + } + else + { + IdList.Add(cnProfessional.FirstOrDefault().CNProfessionalId); + } + } + + Id = string.Join(",", IdList); + } + + return Id; + } + + /// + /// 获取单位ID(根据名称) + /// + /// 单位名称 + /// 单位ID + private static string getUnitIdByUnitName(string unitName) + { + string unitId = null; + if (!string.IsNullOrEmpty(unitName)) + { + var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == unitName); + if (unit != null) + { + unitId = unit.UnitId; + } + } + return unitId; + } + + #endregion + } +} diff --git a/SGGL/BLL/DataShare/CQMS/APIInspectionMachineSyncService.cs b/SGGL/BLL/DataShare/CQMS/APIInspectionMachineSyncService.cs new file mode 100644 index 00000000..1c765e4c --- /dev/null +++ b/SGGL/BLL/DataShare/CQMS/APIInspectionMachineSyncService.cs @@ -0,0 +1,313 @@ +using Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Linq; + +namespace BLL +{ + /// + /// 质量计量器具同步服务 + /// + public class APIInspectionMachineSyncService + { + #region 分包单位推送数据到总包单位 + + /// + /// 分包单位推送数据到总包单位 + /// + /// 项目ID + /// 数据ID(可选,用于单条数据推送) + /// 推送结果 + public static ReturnData PushInspectionMachineLists(string projectId, string dataId = "") + { + Model.ReturnData responeData = new Model.ReturnData(); + responeData.code = 0; + responeData.message = string.Empty; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + try + { + var project = db.Base_Project.FirstOrDefault(x => x.ProjectId == projectId); + if (project != null) + { + //获取质量计量器具数据 + var list = from x in db.Comprehensive_InspectionMachine where x.ProjectId == projectId select x; + + if (!string.IsNullOrEmpty(dataId)) + { + list = list.Where(x => x.InspectionMachineId == dataId); + } + + var dataList = (from x in list + join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitTemp + from unit in unitTemp.DefaultIfEmpty() + join pro in db.Base_CNProfessional on x.CNProfessionalId equals pro.CNProfessionalId into proTemp + from pro in proTemp.DefaultIfEmpty() + join u1 in db.Person_Persons on x.CompileMan equals u1.PersonId into u1Temp + from u1 in u1Temp.DefaultIfEmpty() + join att in db.AttachFile on x.InspectionMachineId equals att.ToKeyId into attTemp + from att in attTemp.DefaultIfEmpty() + select new InspectionMachineSyncItem + { + InspectionMachineId = x.InspectionMachineId, + InspectionMachineCode = x.InspectionMachineCode, + InspectionMachineName = x.InspectionMachineName, + SpecificationModel = x.SpecificationModel, + UnitsCount = x.UnitsCount, + SType = x.SType, + InspectionType = x.InspectionType, + InspectionDate = x.InspectionDate, + NextTestDate = x.NextTestDate, + TestCycle = x.TestCycle, + IsCheckOK = x.IsCheckOK, + IsVerification = x.IsVerification, + Status = x.Status, + IsOnSite = x.IsOnSite, + LeaveDate = x.LeaveDate, + UnitId = x.UnitId, + UnitName = unit.UnitName, + CNProfessionalId = x.CNProfessionalId, + CNProfessionalName = pro.ProfessionalName, + CompileMan = x.CompileMan, + CompileManName = u1.PersonName, + CompileDate = x.CompileDate, + ProjectId = x.ProjectId, + AttachFileId = att.AttachFileId, + ToKeyId = att.ToKeyId, + AttachSource = att.AttachSource, + AttachUrl = att.AttachUrl, + }).ToList(); + + if (dataList.Count() > 0) + { + var thisUnit = CommonService.GetIsThisUnit(); //当前单位 + var apiurl = "/api/InspectionMachineSync/SaveInspectionMachineSyncData"; + + //总包单位接口地址 + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; + var pushData = new InspectionMachineSyncData + { + CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码 + UnitId = thisUnit.UnitId,//分包单位Id + UnitName = thisUnit.UnitName,//分包单位名称 + ShortUnitName = thisUnit.ShortUnitName,//分包单位简称 + UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】 + SubjectUnit = project.SubjectUnit,//主包单位Id + SubjectProject = project.SubjectProject,//主包项目Id + Items = dataList//质量计量器具数据 + }; + + 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 SaveInspectionMachineSyncData(Model.InspectionMachineSyncData data) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string result = string.Empty; + + if (data.Items.Count > 0 || data.Items.Count > 0) + { + var CollCropCode = data.CollCropCode; //分包单位社会统一信用码 + var ProjectId = data.SubjectProject; //总包项目Id + var UnitDomain = data.UnitDomain; //分包单位域名地址【文件存储地址】 + + //1、判断分包单位是否存在 + var unit = UnitService.getUnitByCollCropCodeUnitName(CollCropCode, data.UnitName); + if (unit == null) + { + result = "总包单位不存在本单位,请登录总包系统检查维护本单位信息!"; + } + else + { + //判断主包项目是否存在 + var porject = BLL.ProjectService.GetProjectByProjectId(ProjectId); + if (porject == null) + { + result = "总包单位不存在本项目,请检查总包项目关联是否正确!"; + } + else + { + int succ = 0; + foreach (var item in data.Items) + { + try + { + Model.Comprehensive_InspectionMachine model = db.Comprehensive_InspectionMachine.FirstOrDefault(x => x.InspectionMachineId == item.InspectionMachineId); + if (model == null) + { + //新增 + Model.Comprehensive_InspectionMachine newModel = new Model.Comprehensive_InspectionMachine + { + ProjectId = ProjectId, + UnitId = unit.UnitId, + InspectionMachineId = item.InspectionMachineId, + InspectionMachineCode = item.InspectionMachineCode, + InspectionMachineName = item.InspectionMachineName, + SpecificationModel = item.SpecificationModel, + NextTestDate = item.NextTestDate, + TestCycle = item.TestCycle, + IsVerification = item.IsVerification, + InspectionDate = item.InspectionDate, + AttachUrl = item.AttachUrl, + CNProfessionalId = getCNProfessionalId(item.CNProfessionalName), + //CompileMan = APIDataShareSyncService.getUserId(item.CompileManName), + CompileDate = item.CompileDate, + IsOnSite = item.IsOnSite, + InspectionType = item.InspectionType, + LeaveDate = item.LeaveDate, + UnitsCount = item.UnitsCount, + //AuditMan = item.AuditMan, + Status = item.Status, + IsCheckOK = item.IsCheckOK, + SType = item.SType, + SourceDes = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}#专业名称:{item.CNProfessionalName}", + }; + + db.Comprehensive_InspectionMachine.InsertOnSubmit(newModel); + db.SubmitChanges(); + + //保存编码 + if (!string.IsNullOrEmpty(item.InspectionMachineCode)) + { + Model.Sys_CodeRecords codeRecords = new Model.Sys_CodeRecords + { + CodeRecordId = SQLHelper.GetNewID(typeof(Model.Sys_CodeRecords)), + DataId = item.InspectionMachineId, + Code = item.InspectionMachineCode + }; + db.Sys_CodeRecords.InsertOnSubmit(codeRecords); + db.SubmitChanges(); + } + } + else + { + //更新 + model.ProjectId = ProjectId; + model.UnitId = unit.UnitId; + model.InspectionMachineCode = item.InspectionMachineCode; + model.InspectionMachineName = item.InspectionMachineName; + model.SpecificationModel = item.SpecificationModel; + model.NextTestDate = item.NextTestDate; + model.TestCycle = item.TestCycle; + model.IsVerification = item.IsVerification; + model.InspectionDate = item.InspectionDate; + model.AttachUrl = item.AttachUrl; + model.CNProfessionalId = getCNProfessionalId(item.CNProfessionalName); + //model.CompileMan = APIDataShareSyncService.getUserId(item.CompileManName); + model.CompileDate = item.CompileDate; + model.IsOnSite = item.IsOnSite; + model.InspectionType = item.InspectionType; + model.LeaveDate = item.LeaveDate; + model.UnitsCount = item.UnitsCount; + //model.AuditMan = item.AuditMan; + model.Status = item.Status; + model.IsCheckOK = item.IsCheckOK; + model.SType = item.SType; + model.SourceDes = $"{(!string.IsNullOrWhiteSpace(data.ShortUnitName) ? data.ShortUnitName : data.UnitName)}#{item.CompileManName}#专业名称:{item.CNProfessionalName}"; + + db.SubmitChanges(); + //更新编码 + if (!string.IsNullOrEmpty(item.InspectionMachineCode)) + { + var codeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == item.InspectionMachineId); + if (codeRecords != null) + { + codeRecords.Code = item.InspectionMachineCode; + db.SubmitChanges(); + } + } + } + + succ++; + //附件处理:附件 + BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId, item.ToKeyId, item.AttachSource, item.AttachUrl); + } + catch (Exception ex) + { + BLL.ErrLogInfo.WriteLog($"【{porject.ProjectName}】计量器具数据推送总包失败", ex.Message); + continue; + } + } + result = "数据推送成功!"; + } + } + } + else + { + result = "暂无质量计量器具数据!"; + } + + return result; + } + } + + #endregion + + + #region 辅助映射方法 + + /// + /// 获取专业ID(根据名称) + /// + /// 专业名称 + /// 专业ID + private static string getCNProfessionalId(string professionalName) + { + string professionalId = null; + if (!string.IsNullOrEmpty(professionalName)) + { + var pro = Funs.DB.Base_CNProfessional.FirstOrDefault(x => x.ProfessionalName == professionalName); + if (pro != null) + { + professionalId = pro.CNProfessionalId; + } + } + return professionalId; + } + + + + #endregion + } +} diff --git a/SGGL/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs b/SGGL/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs index 728cc9ef..971806d6 100644 --- a/SGGL/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs +++ b/SGGL/BLL/DataShare/HSSE/APICheckSpecialSyncService.cs @@ -173,19 +173,20 @@ namespace BLL 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]; - } - } - + //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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; // CollCropCode = "913404001520228377Y"; //三化建 测试使用 // SubjectProjectId = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用 @@ -246,19 +247,20 @@ namespace BLL 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]; - } - } - + //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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; // thisUnit.CollCropCode = "913404001520228377Y";//测试使用 // project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用 diff --git a/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs b/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs index 480f73a5..e270f7f8 100644 --- a/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs +++ b/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs @@ -144,19 +144,20 @@ namespace BLL 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]; - } - } - + //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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; // CollCropCode = "91420000177570439L"; //三化建 测试使用 // SubjectProjectId = "c7ade79e-7646-4c59-a8fd-020a7e3138c6";//测试使用 @@ -217,18 +218,20 @@ namespace BLL 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]; - } - } + //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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; // thisUnit.CollCropCode = "913404001520228377Y";//测试使用 // project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用 diff --git a/SGGL/BLL/DataShare/HSSE/APILicenseSyncService.cs b/SGGL/BLL/DataShare/HSSE/APILicenseSyncService.cs index bc441298..a9fa87f9 100644 --- a/SGGL/BLL/DataShare/HSSE/APILicenseSyncService.cs +++ b/SGGL/BLL/DataShare/HSSE/APILicenseSyncService.cs @@ -88,7 +88,7 @@ namespace BLL if (dataList.Count() > 0) { var thisUnit = CommonService.GetIsThisUnit(); - var porject = BLL.ProjectService.GetProjectByProjectId(projectId); + var project = BLL.ProjectService.GetProjectByProjectId(projectId); var pushData = new LicenseManagerData { CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码 @@ -96,25 +96,27 @@ namespace BLL UnitName = thisUnit.UnitName,//分包单位名称 ShortUnitName = thisUnit.ShortUnitName,//分包单位简称 UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】 - SubjectUnit = porject.SubjectUnit,//主包单位Id - SubjectProject = porject.SubjectProject,//主包项目Id + SubjectUnit = project.SubjectUnit,//主包单位Id + SubjectProject = project.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 Url = BLL.UnitService.getUnitApiUrlByUnitId(project.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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; var baseurl = $"{ApiUrl}/api/LicenseSync/ReceiveSaveProjectLicenseManagerData"; string contenttype = "application/json;charset=unicode"; //Hashtable newToken = new Hashtable @@ -126,7 +128,7 @@ namespace BLL var returndata = APIGetHttpService.Http(baseurl, "Post", contenttype, null, pushContent); if (!string.IsNullOrEmpty(returndata)) { - ErrLogInfo.WriteLog($"【作业票返回结果】接口地址:{baseurl};{returndata}"); + //ErrLogInfo.WriteLog($"【作业票返回结果】接口地址:{baseurl};{returndata}"); JObject obj = JObject.Parse(returndata); string mess = obj["message"].ToString(); string code = obj["code"].ToString(); diff --git a/SGGL/BLL/DataShare/HSSE/APIMeetingSyncService.cs b/SGGL/BLL/DataShare/HSSE/APIMeetingSyncService.cs index d01b5059..e7bb95a7 100644 --- a/SGGL/BLL/DataShare/HSSE/APIMeetingSyncService.cs +++ b/SGGL/BLL/DataShare/HSSE/APIMeetingSyncService.cs @@ -89,7 +89,7 @@ namespace BLL if (dataList.Count() > 0) { var thisUnit = CommonService.GetIsThisUnit(); - var porject = BLL.ProjectService.GetProjectByProjectId(projectId); + var project = BLL.ProjectService.GetProjectByProjectId(projectId); var pushData = new ClassMeetingData { CollCropCode = thisUnit.CollCropCode,//分包单位社会统一信用码 @@ -97,25 +97,27 @@ namespace BLL UnitName = thisUnit.UnitName,//分包单位名称 ShortUnitName = thisUnit.ShortUnitName,//分包单位简称 UnitDomain = Funs.SGGLUrl,//分包单位域名地址【文件存储地址】 - SubjectUnit = porject.SubjectUnit,//主包单位Id - SubjectProject = porject.SubjectProject,//主包项目Id + SubjectUnit = project.SubjectUnit,//主包单位Id + SubjectProject = project.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 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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; var baseurl = $"{ApiUrl}/api/MeetingSync/ReceiveSaveProjectClassMeetingData"; string contenttype = "application/json;charset=unicode"; //Hashtable newToken = new Hashtable diff --git a/SGGL/BLL/DataShare/HSSE/APIPersonSyncService.cs b/SGGL/BLL/DataShare/HSSE/APIPersonSyncService.cs index 9b57a64d..689c93a4 100644 --- a/SGGL/BLL/DataShare/HSSE/APIPersonSyncService.cs +++ b/SGGL/BLL/DataShare/HSSE/APIPersonSyncService.cs @@ -161,19 +161,20 @@ namespace BLL 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]; - } - } - + //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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; // CollCropCode = "913404001520228377Y";//测试使用 // SubjectProjectId = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用 // unitId = "aaa9e72b-e3a6-441e-a7bb-afc008adebc9";//测试使用 @@ -243,19 +244,20 @@ namespace BLL 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]; - } - } - + //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]; + // } + //} + string ApiUrl = project.SubjectUnitApiUrl; + string WebUrl = project.SubjectUnitWebUrl; // thisUnit.CollCropCode = "913404001520228377Y"; //分包单位社会统一信用码 测试使用 // project.SubjectProject = "B409A8D7-48C7-486E-84C7-E3E7B2C0E5B7";//测试使用 diff --git a/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs b/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs index b800d5ff..6c23875f 100644 --- a/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs +++ b/SGGL/BLL/HSSE/HiddenInspection/HSSE_Hazard_HazardRegisterService.cs @@ -321,5 +321,28 @@ namespace BLL handleSteps.Add(handleStep4); return handleSteps; } + + /// + /// 根据危险观察登记主键删除一个危险观察登记信息 + /// + /// 危险观察登记主键 + public static void DeleteHazardRegisterByCheckSpecialId(string checkSpecialId) + { + Model.SGGLDB db = Funs.DB; + List hazardRegisters = db.HSSE_Hazard_HazardRegister.Where(e => e.CheckSpecialId == checkSpecialId).ToList(); + if (hazardRegisters.Count > 0) + { + foreach (var hazardRegister in hazardRegisters) + { + if (hazardRegister.IsUpdate != true) + { + BLL.UploadFileService.DeleteFile(Funs.RootPath, hazardRegister.ImageUrl);//删除整改前图片 + BLL.UploadFileService.DeleteFile(Funs.RootPath, hazardRegister.RectificationImageUrl);//删除整改后图片 + db.HSSE_Hazard_HazardRegister.DeleteOnSubmit(hazardRegister); + db.SubmitChanges(); + } + } + } + } } } diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs index 29608a06..ba9236e3 100644 --- a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs +++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs @@ -1390,5 +1390,26 @@ namespace BLL return str; } #endregion + + /// + /// 根据UserId主键获取人员信息 + /// + /// + /// + public static void UpdatePersonTypeByProjectIdAndIdentityCard(string projectId, string identityCard) + { + + var persons = Funs.DB.SitePerson_Person.Where(x => x.IdentityCard == identityCard).ToList(); + + foreach (var item in persons) + { + if (item.ProjectId != projectId && item.States == Const.ProjectPersonStates_1) + { + item.States = Const.ProjectPersonStates_2; + item.OutTime = DateTime.Now; + Funs.DB.SubmitChanges(); + } + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/HSSE/Solution/LargerHazardService.cs b/SGGL/BLL/HSSE/Solution/LargerHazardService.cs index 0f1ef864..c678a07e 100644 --- a/SGGL/BLL/HSSE/Solution/LargerHazardService.cs +++ b/SGGL/BLL/HSSE/Solution/LargerHazardService.cs @@ -41,6 +41,7 @@ namespace BLL TrainPersonNum = largerHazard.TrainPersonNum, IsSuperLargerHazard = largerHazard.IsSuperLargerHazard, Descriptions = largerHazard.Descriptions, + ApprovalState = largerHazard.ApprovalState, OperativesNum = largerHazard.OperativesNum }; @@ -73,6 +74,7 @@ namespace BLL newLargerHazard.IsSuperLargerHazard = largerHazard.IsSuperLargerHazard; newLargerHazard.Descriptions = largerHazard.Descriptions; newLargerHazard.RecordTime = largerHazard.RecordTime; + newLargerHazard.ApprovalState = largerHazard.ApprovalState; newLargerHazard.IsUpdate = null; newLargerHazard.OperativesNum = largerHazard.OperativesNum; db.SubmitChanges(); diff --git a/SGGL/BLL/Person/Person_PersonsService.cs b/SGGL/BLL/Person/Person_PersonsService.cs index ed165f4b..94b24388 100644 --- a/SGGL/BLL/Person/Person_PersonsService.cs +++ b/SGGL/BLL/Person/Person_PersonsService.cs @@ -1567,5 +1567,56 @@ namespace BLL return users; } } + + /// + /// 根据单位Id获取用户下拉选项【单位本部在职人员】 + /// + /// + public static List GetIsOfficeUserListByUnitId(string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List list = new List(); + list = (from x in db.Person_Persons + where x.UnitId == unitId && x.IsOffice == true && x.IsPost == true + orderby x.PersonName + select x).ToList(); + return list; + } + } + + /// + /// 用户下拉框 + /// + /// 下拉框名字 + /// 是否显示请选择 + public static void InitIsOfficeUserUnitIdDropDownList(FineUIPro.DropDownList dropName, string unitId, bool isShowPlease) + { + dropName.DataValueField = "PersonId"; + dropName.DataTextField = "PersonName"; + dropName.DataSource = GetIsOfficeUserListByUnitId(unitId); + dropName.DataBind(); + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } + + /// + /// 根据用户获取用户名称 + /// + /// + /// + public static string GetUserNameByUserId(string userId) + { + string userName = string.Empty; + Model.Person_Persons user = Funs.DB.Person_Persons.FirstOrDefault(e => e.PersonId == userId); + if (user != null) + { + userName = user.PersonName; + } + + return userName; + } } } \ No newline at end of file diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs index da99e6db..9222869e 100644 --- a/SGGL/BLL/ProjectData/ProjectService.cs +++ b/SGGL/BLL/ProjectData/ProjectService.cs @@ -126,6 +126,8 @@ EnglishRemark = project.EnglishRemark, ProjectRealCode = project.ProjectRealCode, IsCNCECShow = project.IsCNCECShow, + SubjectUnitApiUrl = project.SubjectUnitApiUrl, + SubjectUnitWebUrl = project.SubjectUnitWebUrl, MasterSysId = project.MasterSysId, SubjectUnit = project.SubjectUnit, SubjectProject = project.SubjectProject, @@ -177,6 +179,8 @@ newProject.ProjectRealCode = project.ProjectRealCode; newProject.IsCNCECShow = project.IsCNCECShow; newProject.MasterSysId = project.MasterSysId; + newProject.SubjectUnitApiUrl = project.SubjectUnitApiUrl; + newProject.SubjectUnitWebUrl = project.SubjectUnitWebUrl; newProject.SubjectUnit = project.SubjectUnit; newProject.SubjectProject = project.SubjectProject; diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index a7aef494..8665b5d0 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -43,6 +43,15 @@ namespace BLL NewWaterConsumption = newtable.NewWaterConsumption, HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum, HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum, + LargerClosedNum = newtable.LargerClosedNum, + LargerNotClosedNum = newtable.LargerNotClosedNum, + + AwaitApprovalNum = newtable.AwaitApprovalNum, + PendingApprovalNum = newtable.PendingApprovalNum, + CompletedApprovalNum = newtable.CompletedApprovalNum, + SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum, + SuperPendingApprovalNum = newtable.SuperPendingApprovalNum, + SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum, BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum, BranchFullTimeNum = newtable.BranchFullTimeNum, ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum, @@ -182,6 +191,17 @@ namespace BLL item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum; item.FinishedNum = dataHsse.FinishedNum; item.ArgumentNum = dataHsse.ArgumentNum; + item.LargerClosedNum = dataHsse.LargerClosedNum; + item.LargerNotClosedNum = dataHsse.LargerNotClosedNum; + item.LargerRate = ""; + + item.AwaitApprovalNum = dataHsse.AwaitApprovalNum; + item.PendingApprovalNum = dataHsse.PendingApprovalNum; + item.CompletedApprovalNum = dataHsse.CompletedApprovalNum; + item.SuperAwaitApprovalNum = dataHsse.SuperAwaitApprovalNum; + item.SuperPendingApprovalNum = dataHsse.SuperPendingApprovalNum; + item.SuperCompletedApprovalNum = dataHsse.SuperCompletedApprovalNum; + item.GeneralAccidentNum = dataHsse.GeneralAccidentNum; item.GeneralClosedNum = dataHsse.GeneralClosedNum; item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum; @@ -492,6 +512,15 @@ namespace BLL CertificateANum = projectData.Sum(x => x.CertificateANum), CertificateBNum = projectData.Sum(x => x.CertificateBNum), CertificateCNum = projectData.Sum(x => x.CertificateCNum), + LargerClosedNum = projectData.Sum(x => x.LargerClosedNum), + LargerNotClosedNum = projectData.Sum(x => x.LargerNotClosedNum), + + AwaitApprovalNum = projectData.Sum(x => x.AwaitApprovalNum), + PendingApprovalNum = projectData.Sum(x => x.PendingApprovalNum), + CompletedApprovalNum = projectData.Sum(x => x.CompletedApprovalNum), + SuperAwaitApprovalNum = projectData.Sum(x => x.SuperAwaitApprovalNum), + SuperPendingApprovalNum = projectData.Sum(x => x.SuperPendingApprovalNum), + SuperCompletedApprovalNum = projectData.Sum(x => x.SuperCompletedApprovalNum), SafetyCommitteeMeetingNum = GetSafetyCommitteeMeeting().Count, EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(), ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum), @@ -668,7 +697,7 @@ namespace BLL var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync(); var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync(); - + var largerHiddenRectificationOutputsTask = HSSEData_HSSEService.GetLargerHiddenRectificationOutputsAsync(); var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync(); var certificateATask = HSSEData_HSSEService.GetCertificateAAsync(); var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync(); @@ -742,6 +771,7 @@ namespace BLL certificateATask, certificateBTask, certificateCTask, + largerHiddenRectificationOutputsTask, qualityPersonNumTask, beUnderConstructionTask, shutdownTask, @@ -810,6 +840,7 @@ namespace BLL var certificateAList = await certificateATask; var certificateBList = await certificateBTask; var certificateCList = await certificateCTask; + var largerHiddenRectificationOutputsList = await largerHiddenRectificationOutputsTask; var qualityPersonList = await qualityPersonNumTask; var beUnderConstructionList = await beUnderConstructionTask; var shutdownList = await shutdownTask; @@ -890,6 +921,16 @@ namespace BLL TotalWorkingHour = totalWorkingHour, LostWorkingHour = lostWorkingHour, SafeWorkingHour = safeWorkingHour, + LargerClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.RecNum), + LargerNotClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.NoRecNum), + + AwaitApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.AwaitApprovalNum), + PendingApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.PendingApprovalNum), + CompletedApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedApprovalNum), + SuperAwaitApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperAwaitApprovalNum), + SuperPendingApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperPendingApprovalNum), + SuperCompletedApprovalNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedApprovalNum), + SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum), SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum), SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum), @@ -978,6 +1019,12 @@ namespace BLL g => g.Key, g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) } ); + var largerHiddenRectificationOutputsDict = largerHiddenRectificationOutputsList + .GroupBy(x => x.ProjectId) + .ToDictionary( + g => g.Key, + g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) } + ); var majorHiddenRectificationOutputsDict = majorHiddenRectificationOutputsList .GroupBy(x => x.ProjectId) .ToDictionary( @@ -1015,12 +1062,19 @@ namespace BLL SuperOperativesNum = g.Sum(x => x.SuperOperativesNum), SuperConstructionNum = g.Sum(x => x.SuperConstructionNum), SuperFinishedNum = g.Sum(x => x.SuperFinishedNum), + AwaitApprovalNum = g.Sum(x => x.AwaitApprovalNum), + PendingApprovalNum = g.Sum(x => x.PendingApprovalNum), + CompletedApprovalNum = g.Sum(x => x.CompletedApprovalNum), + SuperAwaitApprovalNum = g.Sum(x => x.SuperAwaitApprovalNum), + SuperPendingApprovalNum = g.Sum(x => x.SuperPendingApprovalNum), + SuperCompletedApprovalNum = g.Sum(x => x.SuperCompletedApprovalNum), SuperArgumentNum = g.Sum(x => x.SuperArgumentNum) } ); foreach (var projectid in BeUnderConstructionList) { generalHiddenRectificationOutputsDict.TryGetValue(projectid, out var generalHiddenRectificationOutputs); + largerHiddenRectificationOutputsDict.TryGetValue(projectid, out var largerHiddenRectificationOutputs); majorHiddenRectificationOutputsDict.TryGetValue(projectid, out var majorHiddenRectificationOutputs); securityRiskOutputDict.TryGetValue(projectid, out var securityRiskOutputs); largeEngineeringOutputsDict.TryGetValue(projectid, out var largeEngineeringOutputs); @@ -1042,6 +1096,14 @@ namespace BLL SpecialOperationTrainNum = specialOperationTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), HseTechnicalNum = hseTechnicalList.Count(x => x.ProjectId == projectid), EnvironmentalTrainNum = 0, + LargerClosedNum = largerHiddenRectificationOutputs?.ClosedNum ?? 0, + LargerNotClosedNum = largerHiddenRectificationOutputs?.NotClosedNum ?? 0, + AwaitApprovalNum = largeEngineeringOutputs?.AwaitApprovalNum ?? 0, + PendingApprovalNum = largeEngineeringOutputs?.PendingApprovalNum ?? 0, + CompletedApprovalNum = largeEngineeringOutputs?.CompletedApprovalNum ?? 0, + SuperAwaitApprovalNum = largeEngineeringOutputs?.SuperAwaitApprovalNum ?? 0, + SuperPendingApprovalNum = largeEngineeringOutputs?.SuperPendingApprovalNum ?? 0, + SuperCompletedApprovalNum = largeEngineeringOutputs?.SuperCompletedApprovalNum ?? 0, TotalEnergyConsumption = 0, IncomeComprehensiveEnergyConsumption = 0, NewWaterConsumption = 0, @@ -1277,6 +1339,14 @@ namespace BLL table.SafeWorkingHour = newtable.SafeWorkingHour; table.SafeTrainNum = newtable.SafeTrainNum; table.SpecialTrainNum = newtable.SpecialTrainNum; + table.LargerClosedNum = newtable.LargerClosedNum; + table.LargerNotClosedNum = newtable.LargerNotClosedNum; + table.AwaitApprovalNum = newtable.AwaitApprovalNum; + table.PendingApprovalNum = newtable.PendingApprovalNum; + table.CompletedApprovalNum = newtable.CompletedApprovalNum; + table.SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum; + table.SuperPendingApprovalNum = newtable.SuperPendingApprovalNum; + table.SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum; table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum; table.HseTechnicalNum = newtable.HseTechnicalNum; table.EnvironmentalTrainNum = newtable.EnvironmentalTrainNum; @@ -3937,24 +4007,24 @@ namespace BLL { List result = new List(); var result1 = (from x in Funs.DB.View_License_LicenseManager - where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true && - x.CompileDate > Const.DtmarkTime - select new Model.LicenseOutput - { - Id = x.LicenseManagerId, - ProjectId = x.ProjectId, - ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), - UnitId = x.UnitId, - UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), - LicenseTypeName = x.LicenseTypeName, - UnitTypeName = "", - IsHighRisk = x.IsHighRisk, - WorkAreaName = "", - CompileDate = x.CompileDate, - StartDate = x.StartDate, - EndDate = x.EndDate, - WorkStatesStr = "" - }).ToList(); + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true && + x.CompileDate > Const.DtmarkTime + select new Model.LicenseOutput + { + Id = x.LicenseManagerId, + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + LicenseTypeName = x.LicenseTypeName, + UnitTypeName = "", + IsHighRisk = x.IsHighRisk, + WorkAreaName = "", + CompileDate = x.CompileDate, + StartDate = x.StartDate, + EndDate = x.EndDate, + WorkStatesStr = "" + }).ToList(); var result2 = (from x in Funs.DB.License_FireWork where BeUnderConstructionList.Contains(x.ProjectId) select new Model.LicenseOutput @@ -4162,7 +4232,7 @@ namespace BLL var query = (from x in Funs.DB.Base_Project join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup from y in yGroup.DefaultIfEmpty() - where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && (y.HazardValue == "0.3" || y.HazardValue == "1" || y.HazardValue == null) && y.CheckTime > Const.DtmarkTime + where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && (y.HazardValue == "0.3" || y.HazardValue == null) && y.CheckTime > Const.DtmarkTime group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg select new HiddenRectificationOutput { @@ -4188,6 +4258,42 @@ namespace BLL return await Task.Run(GetGeneralHiddenRectificationOutputs); } + /// + /// 获取较大隐患数据 + /// + /// + public static List GetLargerHiddenRectificationOutputs() + { + var query = (from x in Funs.DB.Base_Project + join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup + from y in yGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.HazardValue == "1" && y.CheckTime > Const.DtmarkTime + group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg + select new HiddenRectificationOutput + { + ProjectId = gg.Key.ProjectId, + ProjectName = gg.Key.ProjectName, + ProjectCode = gg.Key.ProjectCode, + ProNum = gg.Count(y => y.States != "4" && y.States != "-1"), + RecNum = gg.Count(y => y.States == "3"), + NoRecNum = gg.Count(y => y.States != "3" && y.States != "4" && y.States != "-1"), + RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" : + Math.Round(Convert.ToDecimal(gg.Count(y => y.States == "3") / + gg.Count(y => y.States != "4" && y.States != "-1") * 100), 2, MidpointRounding.AwayFromZero).ToString() + }).ToList(); + + foreach (var item in query) + { + item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数 + } + return query; + } + public static async Task> GetLargerHiddenRectificationOutputsAsync() + { + return await Task.Run(GetLargerHiddenRectificationOutputs); + } + + /// /// 获取重大隐患数据 /// @@ -4285,6 +4391,12 @@ namespace BLL SuperArgumentNum = gg.Count(x => x.IsArgument == true && x.IsSuperLargerHazard == true), OperativesNum = gg.Where(x => x.IsSuperLargerHazard == false).Sum(x => x.OperativesNum) ?? 0, SuperOperativesNum = gg.Where(x => x.IsSuperLargerHazard == true).Sum(x => x.OperativesNum) ?? 0, + AwaitApprovalNum = gg.Count(x => x.ApprovalState == "0" && x.IsSuperLargerHazard == false), + PendingApprovalNum = gg.Count(x => x.ApprovalState == "1" && x.IsSuperLargerHazard == false), + CompletedApprovalNum = gg.Count(x => x.ApprovalState == "2" && x.IsSuperLargerHazard == false), + SuperAwaitApprovalNum = gg.Count(x => x.ApprovalState == "0" && x.IsSuperLargerHazard == true), + SuperPendingApprovalNum = gg.Count(x => x.ApprovalState == "1" && x.IsSuperLargerHazard == true), + SuperCompletedApprovalNum = gg.Count(x => x.ApprovalState == "2" && x.IsSuperLargerHazard == true), }).ToList(); return query; @@ -4531,6 +4643,14 @@ namespace BLL x.SpecialTrainNum, x.SpecialOperationTrainNum, x.HseTechnicalNum, + x.LargerClosedNum, + x.LargerNotClosedNum, + x.AwaitApprovalNum, + x.PendingApprovalNum, + x.CompletedApprovalNum, + x.SuperAwaitApprovalNum, + x.SuperPendingApprovalNum, + x.SuperCompletedApprovalNum, x.EnvironmentalTrainNum, x.TotalEnergyConsumption, x.IncomeComprehensiveEnergyConsumption, diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs index e5b69beb..4df61e16 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs @@ -127,6 +127,16 @@ namespace BLL LostWorkingHour = newtable.LostWorkingHour, SafeWorkingHour = newtable.SafeWorkingHour, SafeTrainNum = newtable.SafeTrainNum, + LargerClosedNum = newtable.LargerClosedNum, + LargerNotClosedNum = newtable.LargerNotClosedNum, + + AwaitApprovalNum = newtable.AwaitApprovalNum, + PendingApprovalNum = newtable.PendingApprovalNum, + CompletedApprovalNum = newtable.CompletedApprovalNum, + SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum, + SuperPendingApprovalNum = newtable.SuperPendingApprovalNum, + SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum, + SpecialTrainNum = newtable.SpecialTrainNum, SpecialOperationTrainNum = newtable.SpecialOperationTrainNum, HseTechnicalNum = newtable.HseTechnicalNum, @@ -275,6 +285,18 @@ namespace BLL table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; table.NewWaterConsumption = newtable.NewWaterConsumption; + table.LargerClosedNum = newtable.LargerClosedNum; + table.LargerNotClosedNum = newtable.LargerNotClosedNum; + + table.ArgumentNum = newtable.ArgumentNum; + table.SuperArgumentNum = newtable.SuperArgumentNum; + table.AwaitApprovalNum = newtable.AwaitApprovalNum; + table.PendingApprovalNum = newtable.PendingApprovalNum; + table.CompletedApprovalNum = newtable.CompletedApprovalNum; + table.SuperAwaitApprovalNum = newtable.SuperAwaitApprovalNum; + table.SuperPendingApprovalNum = newtable.SuperPendingApprovalNum; + table.SuperCompletedApprovalNum = newtable.SuperCompletedApprovalNum; + table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum; table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum; table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum; @@ -552,6 +574,9 @@ namespace BLL table.GeneralNotClosedNum = GetGeneralNotClosedNum(projectid); table.MajorClosedNum = GetMajorClosedNum(projectid); table.MajorNotClosedNum = GetMajorNotClosedNum(projectid); + table.LargerClosedNum = GetLargerClosedNum(projectid); + table.LargerNotClosedNum = GetLargerNotClosedNum(projectid); + } if (hSseDateType == HSSEDateType.SecurityRisk || hSseDateType == HSSEDateType.All) @@ -616,6 +641,14 @@ namespace BLL table.SuperOperativesNum = GetSuperOperativesNum(projectid); table.SuperConstructionNum = GetSuperConstructionNum(projectid); table.SuperFinishedNum = GetSuperFinishedNum(projectid); + table.ArgumentNum = GetArgumentNum(projectid); + table.SuperArgumentNum = GetSuperArgumentNum(projectid); + table.AwaitApprovalNum = GetAwaitApprovalNum(projectid); + table.PendingApprovalNum = GetPendingApprovalNum(projectid); + table.CompletedApprovalNum = GetCompletedApprovalNum(projectid); + table.SuperAwaitApprovalNum = GetSuperAwaitApprovalNum(projectid); + table.SuperPendingApprovalNum = GetSuperPendingApprovalNum(projectid); + table.SuperCompletedApprovalNum = GetSuperCompletedApprovalNum(projectid); } if (IsReportByToday(projectid)) @@ -1389,7 +1422,7 @@ namespace BLL public static int GetGeneralClosedNum(string projectid) { var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" && + where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == null) && x.States == "3" && x.CheckTime > Const.DtmarkTime select x).Count(); return result; @@ -1402,7 +1435,33 @@ namespace BLL public static int GetGeneralNotClosedNum(string projectid) { var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" && x.States != "-1" && + where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == null) && x.States != "3" && x.States != "-1" && + x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取较大隐患整改闭环项 + /// + /// + public static int GetLargerClosedNum(string projectid) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.HazardValue == "1" && x.States == "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取较大隐患未整改完成项 + /// + /// + public static int GetLargerNotClosedNum(string projectid) + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.HazardValue == "1" && x.States != "3" && x.States != "-1" && x.CheckTime > Const.DtmarkTime select x).Count(); return result; @@ -1537,6 +1596,105 @@ namespace BLL return result; } + /// + /// 获取危大工程论证个数 + /// + /// + public static int GetArgumentNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.IsArgument == true && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程论证个数 + /// + /// + public static int GetSuperArgumentNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.IsArgument == true && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取危大工程待审核个数 + /// + /// + public static int GetAwaitApprovalNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.ApprovalState == "0" && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程待审核个数 + /// + /// + public static int GetSuperAwaitApprovalNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.ApprovalState == "0" && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取危大工程审核中个数 + /// + /// + public static int GetPendingApprovalNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.ApprovalState == "1" && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程审核中个数 + /// + /// + public static int GetSuperPendingApprovalNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.ApprovalState == "1" && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取危大工程已完成个数 + /// + /// + public static int GetCompletedApprovalNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.ApprovalState == "2" && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程已完成个数 + /// + /// + public static int GetSuperCompletedApprovalNum(string projectid) + { + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.ApprovalState == "2" && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// /// 获取超危大工程审批完成数 /// @@ -1639,6 +1797,18 @@ namespace BLL x.SafeWorkingHour, x.SafeTrainNum, x.SpecialTrainNum, + x.LargerClosedNum, + x.LargerNotClosedNum, + + x.ArgumentNum, + x.SuperArgumentNum, + x.AwaitApprovalNum, + x.PendingApprovalNum, + x.CompletedApprovalNum, + x.SuperAwaitApprovalNum, + x.SuperPendingApprovalNum, + x.SuperCompletedApprovalNum, + x.SpecialOperationTrainNum, x.TotalEnergyConsumption, x.IncomeComprehensiveEnergyConsumption, diff --git a/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs b/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs index 79d81776..9edaf837 100644 --- a/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs +++ b/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterItemService.cs @@ -214,10 +214,10 @@ namespace BLL ProjectId = r.ProjectId, CheckUnitName = u.UnitName, States = r.States, - ProblemStatesName = i.CompleteStatus==1 ? "已整改":"未整改", + ProblemStatesName = i.CompleteStatus == 1 ? "已整改" : "未整改", ProblemStates = i.CompleteStatus, InsResponsibleUserId = r.InsResponsibleUserId, - InsResponsibleUserName= user.PersonName + InsResponsibleUserName = user.PersonName }; // 应用检查大类过滤 @@ -281,17 +281,24 @@ namespace BLL 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(); + //// 先获取用户有权限的项目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)))); // 过滤查询结果 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)))); + input.UnitId == r.CheckUnitId))); } } diff --git a/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs b/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs index e9178e85..efa98801 100644 --- a/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs +++ b/SGGL/BLL/ZHGL/Supervise/UnitHazardRegisterService.cs @@ -26,10 +26,10 @@ namespace BLL public enum StateInt : int { - 待提交 = 0, - 待整改= 1, - 部分整改 = 2, - 已闭环 = 3, + 待提交 = 0, + 待整改 = 1, + 部分整改 = 2, + 已闭环 = 3, } #endregion Enums @@ -51,6 +51,7 @@ namespace BLL CheckDate = register.CheckDate, CheckMainType = register.CheckMainType, CheckType = register.CheckType, + InspectionUnit = register.InspectionUnit, ProjectId = register.ProjectId, CheckUnitId = register.CheckUnitId, CheckTeam = register.CheckTeam, @@ -59,7 +60,7 @@ namespace BLL InsResponsibleUserId = register.InsResponsibleUserId, EvaluationResult = register.EvaluationResult, AttachUrl = register.AttachUrl, - States = register.States??0, + States = register.States ?? 0, CompileMan = register.CompileMan, CreateDate = DateTime.Now }; @@ -118,8 +119,8 @@ namespace BLL } public static int GetCount(string checkMainType) { - return (from x in Funs.DB.Supervise_UnitHazardRegister - where x.CheckMainType ==checkMainType + return (from x in Funs.DB.Supervise_UnitHazardRegister + where x.CheckMainType == checkMainType select x.UnitHazardRegisterId).Count(); } /// @@ -143,7 +144,7 @@ namespace BLL if (register == null) { return false; - } + } // 只有"待提交"状态可以删除,其他状态不能删除 return register.States <= (int)StateInt.待提交; } @@ -171,6 +172,9 @@ namespace BLL on new { MainType = x.CheckMainType, TypeCode = x.CheckType } equals new { MainType = ct.CheckMainType, TypeCode = ct.CheckTypeCode } into ctGroup from ct in ctGroup.DefaultIfEmpty() + join inu in db.Base_Unit + on x.InspectionUnit equals inu.UnitId into inuGroup + from inu in inuGroup.DefaultIfEmpty() join u in db.Base_Unit on x.CheckUnitId equals u.UnitId into uGroup from u in uGroup.DefaultIfEmpty() @@ -185,7 +189,9 @@ namespace BLL CheckMainTypeName = x.CheckMainType == "0" ? "安全" : "质量", CheckType = x.CheckType, CheckTypeName = ct.CheckTypeName, + InspectionUnitName = inu.UnitName, CheckObjectText = p.ProjectName, + CheckUnitId = x.CheckUnitId, CheckUnitName = u.UnitName, CheckTeam = x.CheckTeam, EvaluationResult = x.EvaluationResult, @@ -219,6 +225,10 @@ namespace BLL { query = query.Where(x => x.ProjectId != null && x.ProjectId == input.ProjectId); } + if (input != null && !string.IsNullOrEmpty(input.CheckUnitId) && input.CheckUnitId != BLL.Const.UnitId_SEDIN) + { + query = query.Where(x => x.CheckUnitId != null && x.CheckUnitId == input.CheckUnitId); + } // 获取总数 totalCount = query.Count(); @@ -235,7 +245,7 @@ namespace BLL .Skip(pageIndex * pageSize) .Take(pageSize) .ToList(); - } + } /// /// 更新企业级检查记录 @@ -253,6 +263,7 @@ namespace BLL newRegister.CheckDate = register.CheckDate; newRegister.CheckMainType = register.CheckMainType; newRegister.CheckType = register.CheckType; + newRegister.InspectionUnit = register.InspectionUnit; newRegister.ProjectId = register.ProjectId; newRegister.CheckUnitId = register.CheckUnitId; newRegister.CheckTeam = register.CheckTeam; diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/企业大检查明细导入模板.xls b/SGGL/FineUIPro.Web/File/Excel/DataIn/企业大检查明细导入模板.xls new file mode 100644 index 00000000..e4add055 Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Excel/DataIn/企业大检查明细导入模板.xls differ diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/现场车辆管理导入模板.xls b/SGGL/FineUIPro.Web/File/Excel/DataIn/现场车辆管理导入模板.xls new file mode 100644 index 00000000..5aa8c669 Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Excel/DataIn/现场车辆管理导入模板.xls differ diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index d3b307a5..223f44ea 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -3536,6 +3536,7 @@ + @@ -3653,6 +3654,9 @@ + + + @@ -16902,6 +16906,13 @@ UnitHazardRegister.aspx + + UnitHazardRegisterDetailIn.aspx + ASPXCodeBehind + + + UnitHazardRegisterDetailIn.aspx + UnitHazardRegisterEdit.aspx ASPXCodeBehind @@ -17006,7 +17017,7 @@ - + diff --git a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx index b80f3c44..ad64de91 100644 --- a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx @@ -48,7 +48,7 @@ - + @@ -59,7 +59,11 @@ - + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.cs index 979864b9..ce4ac6fe 100644 --- a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.cs @@ -82,6 +82,7 @@ namespace FineUIPro.Web.HSSE.Solution { this.rblIsArgument.SelectedValue = "False"; } + this.drpApprovalState.SelectedValue = largerHazard.ApprovalState; if (largerHazard.IsSuperLargerHazard == true) { this.rblIsSuperLargerHazard.SelectedValue = "True"; @@ -151,6 +152,7 @@ namespace FineUIPro.Web.HSSE.Solution OperativesNum = Funs.GetNewIntOrZero(this.txtOperativesNum.Text.Trim()), Remark = HttpUtility.HtmlEncode(this.txtRemark.Text.Trim()), Descriptions = this.txtDescriptions.Text.Trim(), + ApprovalState = this.drpApprovalState.SelectedValue, RecordTime = Funs.GetNewDateTime(this.txtRecordTime.Text.Trim()), ProjectId = this.ProjectId, States = this.drpStates.SelectedValue, diff --git a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.designer.cs index 143d080e..f7d2420b 100644 --- a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardEdit.aspx.designer.cs @@ -7,13 +7,11 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.HSSE.Solution -{ - - - public partial class LargerHazardEdit - { - +namespace FineUIPro.Web.HSSE.Solution { + + + public partial class LargerHazardEdit { + /// /// form1 控件。 /// @@ -22,7 +20,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -31,7 +29,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// SimpleForm1 控件。 /// @@ -40,7 +38,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm1; - + /// /// txtHazardName 控件。 /// @@ -49,7 +47,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtHazardName; - + /// /// txtLargerHazardCode 控件。 /// @@ -58,7 +56,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtLargerHazardCode; - + /// /// drpHazardType 控件。 /// @@ -67,7 +65,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpHazardType; - + /// /// txtExpectedTime 控件。 /// @@ -76,7 +74,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtExpectedTime; - + /// /// rblIsArgument 控件。 /// @@ -85,7 +83,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rblIsArgument; - + /// /// txtRecordTime 控件。 /// @@ -94,7 +92,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtRecordTime; - + /// /// txtAddress 控件。 /// @@ -103,7 +101,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtAddress; - + /// /// rblIsSuperLargerHazard 控件。 /// @@ -112,7 +110,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rblIsSuperLargerHazard; - + /// /// txtTrainPersonNum 控件。 /// @@ -121,7 +119,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtTrainPersonNum; - + /// /// drpStates 控件。 /// @@ -130,7 +128,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpStates; - + /// /// txtOperativesNum 控件。 /// @@ -139,16 +137,16 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtOperativesNum; - + /// - /// txtOperativesNum1 控件。 + /// drpApprovalState 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Label txtOperativesNum1; - + protected global::FineUIPro.DropDownList drpApprovalState; + /// /// txtOperativesNum2 控件。 /// @@ -157,7 +155,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label txtOperativesNum2; - + /// /// txtDescriptions 控件。 /// @@ -166,7 +164,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextArea txtDescriptions; - + /// /// txtRemark 控件。 /// @@ -175,7 +173,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.HtmlEditor txtRemark; - + /// /// Toolbar1 控件。 /// @@ -184,7 +182,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar1; - + /// /// lbTemp 控件。 /// @@ -193,7 +191,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTemp; - + /// /// btnAttachUrl1 控件。 /// @@ -202,7 +200,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl1; - + /// /// btnAttachUrl2 控件。 /// @@ -211,7 +209,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl2; - + /// /// btnAttachUrl3 控件。 /// @@ -220,7 +218,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl3; - + /// /// btnAttachUrl4 控件。 /// @@ -229,7 +227,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl4; - + /// /// btnAttachUrl5 控件。 /// @@ -238,7 +236,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl5; - + /// /// btnAttachUrl6 控件。 /// @@ -247,7 +245,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl6; - + /// /// btnAttachUrl7 控件。 /// @@ -256,7 +254,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl7; - + /// /// btnAttachUrl8 控件。 /// @@ -265,7 +263,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl8; - + /// /// btnAttachUrl9 控件。 /// @@ -274,7 +272,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnAttachUrl9; - + /// /// ToolbarFill1 控件。 /// @@ -283,7 +281,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnSave 控件。 /// @@ -292,7 +290,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnSave; - + /// /// btnClose 控件。 /// @@ -301,7 +299,7 @@ namespace FineUIPro.Web.HSSE.Solution /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnClose; - + /// /// WindowAtt 控件。 /// diff --git a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx index 88d12363..31f65495 100644 --- a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx @@ -80,6 +80,10 @@ + + diff --git a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx.cs index 032713aa..5b222da0 100644 --- a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardList.aspx.cs @@ -36,6 +36,10 @@ namespace FineUIPro.Web.HSSE.Solution { string strSql = @"SELECT LargerHazard.HazardId,LargerHazard.ProjectId,CodeRecords.Code AS HazardCode,LargerHazard.Address,Users.PersonName,LargerHazard.ExpectedTime,LargerHazard.RecordTime " + @" ,(CASE WHEN LargerHazard.States = " + BLL.Const.State_0 + " OR LargerHazard.States IS NULL THEN '待['+OperateUser.PersonName+']提交' WHEN LargerHazard.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperateUser.PersonName+']办理' END) AS FlowOperateName" + + @" ,case LargerHazard.ApprovalState when '0' then '待审核' + when '1' then '审核中' + when '2' then '已完成' + else '' end as ApprovalStateStr" + @", case when LargerHazard.IsArgument=1 then '是' else '否' end as IsArgumentStr,Const.ConstText as TypeName" + @" FROM Solution_LargerHazard AS LargerHazard " + @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON LargerHazard.HazardId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1" diff --git a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardView.aspx b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardView.aspx index c5fb72e1..4722c534 100644 --- a/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardView.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Solution/LargerHazardView.aspx @@ -33,6 +33,17 @@ + + + + + + + + + + + protected global::FineUIPro.TextBox txtAddress; + /// + /// drpApprovalState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpApprovalState; + + /// + /// txtOperativesNum2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label txtOperativesNum2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + /// /// txtDescriptions 控件。 /// diff --git a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx index e509b1c7..4f204f32 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx +++ b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegister.aspx @@ -30,22 +30,18 @@ + Width="300px" AutoPostBack="true" OnTextChanged="txtSearch_TextChanged" LabelWidth="50px" LabelAlign="right"> - - - - - - - + - - - - + + + + + @@ -81,6 +83,9 @@ + + @@ -161,6 +166,10 @@ Target="Self" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true" Width="600px" Height="400px"> + diff --git a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.cs index 13b0888f..f44ad147 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.cs @@ -1,12 +1,10 @@ using BLL; -using FineUIPro.Web.BaseInfo; -using FineUIPro.Web.SysManage; -using Microsoft.Win32; using Model; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace FineUIPro.Web.ZHGL.Supervise { @@ -42,13 +40,14 @@ namespace FineUIPro.Web.ZHGL.Supervise btnClose.OnClientClick = ActiveWindow.GetHideReference(); InitDropList(); - + var unitModel = UnitService.GetUnitByUnitId(this.CurrUser.UnitId); + var thisUnitId = BLL.Const.UnitId_SEDIN; + this.UnitHazardRegisterId = Request.Params["UnitHazardRegisterId"]; var register = BLL.UnitHazardRegisterService.GetUnitHazardRegisterById(this.UnitHazardRegisterId); if (register != null) - { - // 编辑模式 - 加载数据 + {// 编辑模式 - 加载数据 this.txtUnitHazardRegisterCode.Text = register.UnitHazardRegisterCode; if (register.CheckDate != null) { @@ -58,11 +57,23 @@ namespace FineUIPro.Web.ZHGL.Supervise if (!string.IsNullOrWhiteSpace(register.CheckType)) { - BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType( - this.drpCheckType, register.CheckMainType, false); + BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(this.drpCheckType, register.CheckMainType, false); this.drpCheckType.SelectedValue = register.CheckType; } + if (!string.IsNullOrWhiteSpace(register.CheckUnitId)) + { + this.ddlCheckUnitId.SelectedValue = register.CheckUnitId; + } + if (!string.IsNullOrWhiteSpace(register.InspectionUnit)) + { + this.ddlInspectionUnit.SelectedValue = register.InspectionUnit; + if (register.InspectionUnit != thisUnitId) + { + this.ddlCheckUnitId.Readonly = true; + } + } + if (!string.IsNullOrWhiteSpace(register.ProjectId)) { this.ddlProjectId.SelectedValue = register.ProjectId; @@ -73,71 +84,93 @@ namespace FineUIPro.Web.ZHGL.Supervise this.ddlInsResponsibleUserId.SelectedValue = register.InsResponsibleUserId; } } - - if (!string.IsNullOrWhiteSpace(register.CheckUnitId)) + else { - this.ddlCheckUnitId.SelectedValue = register.CheckUnitId; + Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true); + if (!string.IsNullOrWhiteSpace(register.InsResponsibleUserId)) + { + this.ddlInsResponsibleUserId.SelectedValue = register.InsResponsibleUserId; + } } this.txtCheckTeam.Text = register.CheckTeam; - // 加载明细 - items = BLL.UnitHazardRegisterItemService.GetItemsByRegisterId(this.UnitHazardRegisterId) - .Select(x => new View_UnitHazardRegisterItem - { - UnitHazardRegisterItemId = x.UnitHazardRegisterItemId, - ProblemDescription = x.ProblemDescription, - ProblemType = x.ProblemType, - RiskLevel = x.RiskLevel, - RectifyRequirement = x.RectifyRequirement, - CompleteStatus = x.CompleteStatus, - CompletedDate = x.CompletedDate - }).ToList(); + BindDetailGrid(); - if (register.States> (int)UnitHazardRegisterService.StateInt.待提交) + if (register.States > (int)UnitHazardRegisterService.StateInt.待提交) { + btnImport.Hidden = true; btnAdd.Hidden = true; btnSave.Hidden = true; - btnSubmit.Hidden = true; + btnSubmit.Hidden = true; } } else - { - // 新增模式 - var unitModel = UnitService.GetUnitByUnitId(this.CurrUser.UnitId); + {// 新增模式 if (unitModel?.IsBranch == true) { + this.ddlInspectionUnit.SelectedValue = this.CurrUser.UnitId; this.ddlCheckUnitId.SelectedValue = this.CurrUser.UnitId; } else { - var thisUnit = BLL.CommonService.GetIsThisUnit(); - this.ddlCheckUnitId.SelectedValue = thisUnit.UnitId; + this.ddlCheckUnitId.SelectedValue = thisUnitId; } + BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, null, true, this.ddlCheckUnitId.SelectedValue); + BLL.Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true); + BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, this.ddlCheckUnitId.SelectedValue, true);//检查项目 this.txtCheckTeam.Text = BLL.UnitService.GetUnitNameByUnitId(this.CurrUser.UnitId) + " " + this.CurrUser.PersonName; this.dpkCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); // 自动生成编号 - int newCount= UnitHazardRegisterService.GetCount(type)+1; - this.txtUnitHazardRegisterCode.Text = newCount.ToString().PadLeft(5,'0'); + int newCount = UnitHazardRegisterService.GetCount(type) + 1; + this.txtUnitHazardRegisterCode.Text = newCount.ToString().PadLeft(5, '0'); + } + if (unitModel?.IsBranch == true) + { + this.ddlInspectionUnit.Readonly = true; + this.ddlCheckUnitId.Readonly = true; } - - Grid1.DataSource = items; - Grid1.DataBind(); } } + + /// + /// 绑定数据 + /// + private void BindDetailGrid() + { + if (string.IsNullOrEmpty(this.UnitHazardRegisterId)) + { + return; + } + // 加载明细 + items = BLL.UnitHazardRegisterItemService.GetItemsByRegisterId(this.UnitHazardRegisterId) + .Select(x => new View_UnitHazardRegisterItem + { + UnitHazardRegisterItemId = x.UnitHazardRegisterItemId, + ProblemDescription = x.ProblemDescription, + ProblemType = x.ProblemType, + RiskLevel = x.RiskLevel, + RectifyRequirement = x.RectifyRequirement, + CompleteStatus = x.CompleteStatus, + CompletedDate = x.CompletedDate + }).ToList(); + Grid1.DataSource = items; + Grid1.DataBind(); + } + + protected void InitDropList() { drpCheckMainType.SelectedValue = type; // 初始化下拉框 - BLL.UnitService.InitBranchUnitDropDownList(this.ddlCheckUnitId, false); - BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, ddlCheckUnitId.SelectedValue, true); - BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null); - BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType( - this.drpCheckType, type, false); - - if (type=="0") + BLL.UnitService.InitBranchUnitDropDownList(this.ddlInspectionUnit, false);//检查单位 + BLL.UnitService.InitBranchUnitDropDownList(this.ddlCheckUnitId, false);//受检单位 + BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, ddlCheckUnitId.SelectedValue, true);//检查项目 + //BLL.UserService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null); + BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(this.drpCheckType, type, false); + if (type == "0") { this.drpProblemType.DataTextField = "RegisterTypesName"; this.drpProblemType.DataValueField = "RegisterTypesName"; @@ -148,9 +181,6 @@ namespace FineUIPro.Web.ZHGL.Supervise { QualityQuestionTypeService.InitQualityQuestionType(drpProblemType, false); } - - - } protected void btnAdd_Click(object sender, EventArgs e) { @@ -187,20 +217,25 @@ namespace FineUIPro.Web.ZHGL.Supervise Alert.ShowInTop("请选择检查类别!", MessageBoxIcon.Warning); return; } - if (this.ddlProjectId.SelectedValue == BLL.Const._Null) - { - Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning); - return; - } - if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null) + if (this.ddlInspectionUnit.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择检查单位!", MessageBoxIcon.Warning); return; } + if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null) + { + Alert.ShowInTop("请选择受检单位!", MessageBoxIcon.Warning); + return; + } + //if (this.ddlProjectId.SelectedValue == BLL.Const._Null) + //{ + // Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning); + // return; + //} SaveNew(); SaveItem(); - ShowNotify("保存成功!", MessageBoxIcon.Success); + ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } protected void btnSubmit_Click(object sender, EventArgs e) @@ -215,56 +250,96 @@ namespace FineUIPro.Web.ZHGL.Supervise Alert.ShowInTop("请选择检查类别!", MessageBoxIcon.Warning); return; } - if (this.ddlProjectId.SelectedValue == BLL.Const._Null) - { - Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning); - return; - } - if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null) + if (this.ddlInspectionUnit.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择检查单位!", MessageBoxIcon.Warning); return; } + if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null) + { + Alert.ShowInTop("请选择受检单位!", MessageBoxIcon.Warning); + return; + } + //if (this.ddlProjectId.SelectedValue == BLL.Const._Null) + //{ + // Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning); + // return; + //} SaveNew(Const.BtnSubmit); SaveItem(); ShowNotify("提交成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } + /// + /// 检查单位下拉触发事件 + /// + /// + /// + protected void ddlInspectionUnit_SelectedIndexChanged(object sender, EventArgs e) + { + this.ddlProjectId.Items.Clear(); + this.ddlInsResponsibleUserId.Items.Clear(); + var inspectionUnit = this.ddlInspectionUnit.SelectedValue; + this.ddlCheckUnitId.SelectedValue = inspectionUnit; + BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, this.ddlCheckUnitId.SelectedValue, true); + Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true); + if (inspectionUnit == CommonService.GetIsThisUnit().UnitId) + { + this.ddlCheckUnitId.Readonly = false; + } + else + { + this.ddlCheckUnitId.Readonly = true; + } + } + /// + /// 受检单位下拉触发事件 + /// + /// + /// protected void ddlCheckUnitId_SelectedIndexChanged(object sender, EventArgs e) { this.ddlProjectId.Items.Clear(); this.ddlInsResponsibleUserId.Items.Clear(); - BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId,ddlCheckUnitId.SelectedValue, true); - - } - protected void ddlProjectId_SelectedIndexChanged(object sender, EventArgs e) - { - this.ddlInsResponsibleUserId.Items.Clear(); - //BLL.UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.ddlUnitId, this.ddlProjectId.SelectedValue, Const.ProjectUnitType_1, true); - BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null); - - } - - protected void drpCheckMainType_SelectedIndexChanged(object sender, EventArgs e) - { - BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType( - this.drpCheckType, this.drpCheckMainType.SelectedValue, false); + BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, this.ddlCheckUnitId.SelectedValue, true); + Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true); } /// - /// + /// 受检项目下拉触发事件 + /// + /// + /// + protected void ddlProjectId_SelectedIndexChanged(object sender, EventArgs e) + { + this.ddlInsResponsibleUserId.Items.Clear(); + //BLL.UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.ddlUnitId, this.ddlProjectId.SelectedValue, Const.ProjectUnitType_1, true); + BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null); + } + /// + /// 检查大类下拉触发事件 + /// + /// + /// + protected void drpCheckMainType_SelectedIndexChanged(object sender, EventArgs e) + { + BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(this.drpCheckType, this.drpCheckMainType.SelectedValue, false); + } + + /// + ///设置LinkButtonField的点击客户端事件 /// /// /// protected void Grid1_PreDataBound(object sender, EventArgs e) - { + { // 设置LinkButtonField的点击客户端事件 LinkButtonField deleteField = Grid1.FindColumn("Delete") as LinkButtonField; deleteField.OnClientClick = GetDeleteScript(); var register = BLL.UnitHazardRegisterService.GetUnitHazardRegisterById(this.UnitHazardRegisterId); - if (register!=null&& register.States > (int)UnitHazardRegisterService.StateInt.待提交) + if (register != null && register.States > (int)UnitHazardRegisterService.StateInt.待提交) { LinkButtonField lbUpload = Grid1.FindColumn(6) as LinkButtonField; LinkButtonField lbDelete = Grid1.FindColumn(7) as LinkButtonField; @@ -272,8 +347,6 @@ namespace FineUIPro.Web.ZHGL.Supervise lbUpload.Enabled = false; lbDelete.Enabled = false; } - - } protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) @@ -303,8 +376,8 @@ namespace FineUIPro.Web.ZHGL.Supervise ProblemType = values.Value("ProblemType"), RiskLevel = values.Value("RiskLevel"), RectifyRequirement = values.Value("RectifyRequirement"), - CompleteStatus = 0 - }; + CompleteStatus = 0 + }; if (UnitHazardRegisterItemService.GetUnitHazardRegisterItemById(registerItem.UnitHazardRegisterItemId) != null) { UnitHazardRegisterItemService.UpdateUnitHazardRegisterItem(registerItem); @@ -313,10 +386,10 @@ namespace FineUIPro.Web.ZHGL.Supervise { BLL.UnitHazardRegisterItemService.AddUnitHazardRegisterItem(registerItem); } - } + } } - protected void SaveNew(string type="") + protected void SaveNew(string type = "") { Supervise_UnitHazardRegister register = new Supervise_UnitHazardRegister { @@ -324,16 +397,20 @@ namespace FineUIPro.Web.ZHGL.Supervise CheckDate = Funs.GetNewDateTime(this.dpkCheckDate.Text.Trim()), CheckMainType = this.drpCheckMainType.SelectedValue, CheckType = this.drpCheckType.SelectedValue, - ProjectId = this.ddlProjectId.SelectedValue, + InspectionUnit = this.ddlInspectionUnit.SelectedValue, + //ProjectId = this.ddlProjectId.SelectedValue, CheckUnitId = this.ddlCheckUnitId.SelectedValue, InsResponsibleUserId = this.ddlInsResponsibleUserId.SelectedValue, CheckTeam = this.txtCheckTeam.Text.Trim(), CompileMan = this.CurrUser.PersonId, States = (int)UnitHazardRegisterService.StateInt.待提交 }; + if (!string.IsNullOrEmpty(this.ddlProjectId.SelectedValue) && this.ddlProjectId.SelectedValue != Const._Null) + { + register.ProjectId = this.ddlProjectId.SelectedValue; + } if (!string.IsNullOrEmpty(type)) { - register.States = (int)UnitHazardRegisterService.StateInt.待整改; } if (string.IsNullOrWhiteSpace(this.UnitHazardRegisterId)) @@ -363,7 +440,7 @@ namespace FineUIPro.Web.ZHGL.Supervise .Select(x => new View_UnitHazardRegisterItem { UnitHazardRegisterItemId = x.UnitHazardRegisterItemId, - ProblemDescription = x.ProblemDescription, + ProblemDescription = x.ProblemDescription, ProblemType = x.ProblemType, RiskLevel = x.RiskLevel, RectifyRequirement = x.RectifyRequirement, @@ -374,7 +451,7 @@ namespace FineUIPro.Web.ZHGL.Supervise Grid1.DataSource = items; Grid1.DataBind(); } - + protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { // 刷新Grid数据 @@ -402,24 +479,52 @@ namespace FineUIPro.Web.ZHGL.Supervise #endregion Methods + #region 导入 + /// + /// 导入按钮 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.UnitHazardRegisterId)) + { + SaveNew(); + } + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("UnitHazardRegisterDetailIn.aspx?Type={0}&UnitHazardRegisterId={1}", type, this.UnitHazardRegisterId, "导入 - "))); + } + + /// + /// 关闭导入弹出窗口 + /// + /// + /// + protected void Window2_Close(object sender, WindowCloseEventArgs e) + { + BindDetailGrid(); + } + #endregion + } /// /// 企业级检查明细视图类 /// public class View_UnitHazardRegisterItem - { - #region Properties + { + #region Properties + + public DateTime? CompletedDate { get; set; } + public int? CompleteStatus { get; set; } + public string ProblemDescription { get; set; } + public string ProblemImageUrl { get; set; } + public string ProblemType { get; set; } + public string RectifyRequirement { get; set; } + public string RiskLevel { get; set; } + public string UnitHazardRegisterItemId { get; set; } + + #endregion Properties + } - public DateTime? CompletedDate { get; set; } - public int? CompleteStatus { get; set; } - public string ProblemDescription { get; set; } - public string ProblemImageUrl { get; set; } - public string ProblemType { get; set; } - public string RectifyRequirement { get; set; } - public string RiskLevel { get; set; } - public string UnitHazardRegisterItemId { get; set; } - #endregion Properties - } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.designer.cs index e07a75c0..b6242c76 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterEdit.aspx.designer.cs @@ -77,6 +77,15 @@ namespace FineUIPro.Web.ZHGL.Supervise /// protected global::FineUIPro.DropDownList drpCheckType; + /// + /// ddlInspectionUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlInspectionUnit; + /// /// ddlCheckUnitId 控件。 /// @@ -149,6 +158,15 @@ namespace FineUIPro.Web.ZHGL.Supervise /// protected global::FineUIPro.Button btnAdd; + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + /// /// txtProblemDescription 控件。 /// @@ -275,6 +293,15 @@ namespace FineUIPro.Web.ZHGL.Supervise /// protected global::FineUIPro.Window Window1; + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + /// /// WindowAtt 控件。 /// diff --git a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx index e222ae0b..8e2d2da1 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx +++ b/SGGL/FineUIPro.Web/ZHGL/Supervise/UnitHazardRegisterRecord.aspx @@ -83,7 +83,7 @@ + OnSelectedIndexChanged="TextBox_TextChanged" LabelWidth="120px" LabelAlign="Right" Width="220px"> @@ -178,7 +178,7 @@ public string ProjectName { get; set; } /// + /// 项目简称 + /// + public string ShortName { get; set; } + /// /// 单位id /// public string UnitId { get; set; } diff --git a/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs b/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs index 3e2a0f10..ef9f41cd 100644 --- a/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs +++ b/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs @@ -57,6 +57,9 @@ namespace Model public int? GeneralNotClosedNum { get; set; } public string GeneralRate { get; set; } public int? GeneralRiskNum { get; set; } + public int? LargerClosedNum { get; set; } + public int? LargerNotClosedNum { get; set; } + public string LargerRate { get; set; } public int? HeadOfficeFullTimeNum { get; set; } public int? HeadOfficeInspectorGeneralNum { get; set; } public int? HighRiskNum { get; set; } @@ -109,13 +112,19 @@ namespace Model public int? SuperConstructionNum { get; set; } public int? SuperFinishedNum { get; set; } public int? SuperTrainPersonNum { get; set; } + public int? OperativesNum { get; set; } + public int? SuperOperativesNum { get; set; } + public int? AwaitApprovalNum { get; set; } + public int? PendingApprovalNum { get; set; } + public int? CompletedApprovalNum { get; set; } + public int? SuperAwaitApprovalNum { get; set; } + public int? SuperPendingApprovalNum { get; set; } + public int? SuperCompletedApprovalNum { get; set; } public decimal? TotalEnergyConsumption { get; set; } public int? TotalWorkingHour { get; set; } public int? TrainPersonNum { get; set; } public string UnitId { get; set; } public int? UseEquipmentNum { get; set; } - public int? OperativesNum { get; set; } - public int? SuperOperativesNum { get; set; } public List HiddenDangerDetailItems { get; set; } } diff --git a/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs b/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs index 4bd1df4c..fd911f47 100644 --- a/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs +++ b/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs @@ -50,5 +50,29 @@ /// 超危大工程作业人员数 /// public int SuperOperativesNum { get; set; } + /// + /// 危大工程待审核个数 + /// + public int AwaitApprovalNum { get; set; } + /// + /// 危大工程审核中个数 + /// + public int PendingApprovalNum { get; set; } + /// + /// 危大工程已完成个数 + /// + public int CompletedApprovalNum { get; set; } + /// + /// 超危大工程待审核个数 + /// + public int SuperAwaitApprovalNum { get; set; } + /// + /// 超危大工程审核中个数 + /// + public int SuperPendingApprovalNum { get; set; } + /// + /// 超危大工程已完成个数 + /// + public int SuperCompletedApprovalNum { get; set; } } } \ No newline at end of file diff --git a/SGGL/Model/ZHGL/UnitHazardRegisterInput.cs b/SGGL/Model/ZHGL/UnitHazardRegisterInput.cs index 28677c19..6ec3a9f2 100644 --- a/SGGL/Model/ZHGL/UnitHazardRegisterInput.cs +++ b/SGGL/Model/ZHGL/UnitHazardRegisterInput.cs @@ -26,5 +26,10 @@ namespace Model /// 项目ID(权限过滤) /// public string ProjectId { get; set; } + /// + /// 受检单位Id + /// + public string CheckUnitId { get; set; } + } } diff --git a/SGGL/Model/ZHGL/UnitHazardRegisterOutput.cs b/SGGL/Model/ZHGL/UnitHazardRegisterOutput.cs index a3bc92bf..8a7d3bfa 100644 --- a/SGGL/Model/ZHGL/UnitHazardRegisterOutput.cs +++ b/SGGL/Model/ZHGL/UnitHazardRegisterOutput.cs @@ -48,10 +48,19 @@ namespace Model public string CheckObjectText { get; set; } /// - /// 检查单位名称 + /// 受检单位名称 /// public string CheckUnitName { get; set; } - + /// + /// 受检单位Id + /// + public string CheckUnitId { get; set; } + + /// + /// 检查单位名称 + /// + public string InspectionUnitName { get; set; } + /// /// 检查组/人 /// diff --git a/SGGL/WebAPI/Controllers/CQMS/CheckControlSyncController.cs b/SGGL/WebAPI/Controllers/CQMS/CheckControlSyncController.cs new file mode 100644 index 00000000..a9ef8191 --- /dev/null +++ b/SGGL/WebAPI/Controllers/CQMS/CheckControlSyncController.cs @@ -0,0 +1,136 @@ +using BLL; +using System; +using System.Linq; +using System.Web.Http; +using System.Threading.Tasks; + +namespace WebAPI.Controllers +{ + /// + /// 质量巡检同步控制器 + /// + public class CheckControlSyncController : ApiController + { + #region 拉取质量巡检数据 + + /// + /// 拉取质量巡检数据 + /// + /// 响应数据 + [HttpGet] + public Model.ResponeData getCheckControlLists() + { + var responeData = new Model.ResponeData(); + try + { + responeData.code = 1; + responeData.data = APICheckControlSyncService.getCheckControlLists(); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion + + + #region 获取质量巡检数据根据项目id和单位统一社会代码 + + /// + /// 获取质量巡检数据根据项目id和单位统一社会代码 + /// + /// 项目ID + /// 单位社会统一信用代码 + /// 响应数据 + [HttpGet] + public Model.ResponeData getCheckControlListByProjectIdAndCollCropCode(string projectId, string collCropCode) + { + var responeData = new Model.ResponeData(); + try + { + responeData.code = 1; + var unit = BLL.Funs.DB.Base_Unit.FirstOrDefault(x => x.CollCropCode == collCropCode); + if (unit != null) + { + responeData.data = APICheckControlSyncService.GetCheckControlListsByProjectIdUnitIdPage(projectId, unit.UnitId); + } + else + { + responeData.code = 0; + responeData.message = "未找到对应单位"; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion + + + #region 推送质量巡检数据 + + /// + /// 推送质量巡检数据 + /// + /// 项目ID + /// 数据ID(可选) + /// 响应数据 + [HttpPost] + public Model.ResponeData pushCheckControlLists(string projectId, string dataId) + { + var responeData = new Model.ResponeData(); + try + { + var returndata = APICheckControlSyncService.pushCheckControlLists(projectId, dataId); + responeData.code = returndata.code; + responeData.message = returndata.message; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion + + + #region 接收保存质量巡检数据 + + /// + /// 接收保存质量巡检数据 + /// + /// 质量巡检同步数据 + /// 响应数据 + [HttpPost] + public Model.ResponeData SaveCheckControlSyncData([FromBody] Model.CheckControlSyncData newItem) + { + var responeData = new Model.ResponeData(); + try + { + responeData.code = 1; + responeData.message = APICheckControlSyncService.SaveCheckControlSyncData(newItem); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion + } +} diff --git a/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs b/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs index 695582a7..f8000bec 100644 --- a/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs @@ -133,5 +133,60 @@ namespace WebAPI.Controllers return responeData; } #endregion + + #region 根据id删除专项检查明细 + + /// + /// 根据id删除专项检查明细 + /// + /// 专项检查 + /// + [HttpGet] + public Model.ResponeData deleteCheckSpecialDetailById(string checkSpecialDetailId) + { + var responeData = new Model.ResponeData(); + try + { + Check_CheckSpecialDetailService.DeleteCheckSpecialDetailById(checkSpecialDetailId); + responeData.message = "删除成功!"; + responeData.code = 1; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion + + + #region 保存专项检查 Check_CheckSpecial + + /// + /// 保存专项检查 Check_CheckSpecial + /// + /// 专项检查 + /// + [HttpPost] + public Model.ResponeData SaveCheckSpecialNew([FromBody] Model.CheckSpecialItem newItem) + { + var responeData = new Model.ResponeData(); + try + { + responeData.message = APICheckSpecialService.SaveCheckSpecialNew(newItem); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + + #endregion } } diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index f692c6b5..1e294520 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -77,12 +77,16 @@ namespace WebAPI.Controllers /// /// /// - public Model.ResponeData getPersonByProjectIdUnitId(string projectId, string unitId, int pageIndex) + public Model.ResponeData getPersonByProjectIdUnitId(string projectId, string unitId, int pageIndex, string personName = "") { var responeData = new Model.ResponeData(); try { var getDataList = APIPersonService.getPersonByProjectIdUnitId(projectId, unitId); + if (!string.IsNullOrEmpty(personName)) + { + getDataList = getDataList.Where(x => x.PersonName.Contains(personName)).ToList(); + } int pageCount = getDataList.Count; if (pageCount > 0 && pageIndex > 0) { diff --git a/SGGL/WebAPI/Filter/TestPermissionAttribute.cs b/SGGL/WebAPI/Filter/TestPermissionAttribute.cs index f0baa379..e45d854d 100644 --- a/SGGL/WebAPI/Filter/TestPermissionAttribute.cs +++ b/SGGL/WebAPI/Filter/TestPermissionAttribute.cs @@ -88,7 +88,11 @@ namespace WebAPI.Filter ,"HazardRegisterSync*getHazardRegisterListByProjectIdAndCollCropCode" ,"HazardRegisterSync*SaveHazardRegisterSyncData" ,"PersonSync*getPersonListByProjectIdAndCollCropCode" - ,"PersonSync*SavePersonSyncData" + ,"PersonSync*SavePersonSyncData", + "InspectionMachineSync*SaveInspectionMachineSyncData", + "CqmsMeetingSync*SaveCqmsMeetingSyncData", + "MeetingSync*ReceiveSaveProjectClassMeetingData", + "LicenseSync*ReceiveSaveProjectLicenseManagerData" ,"CheckSpecialSync*getCheckSpecialListByProjectIdAndCollCropCode" ,"CheckSpecialSync*SaveCheckSpecialSyncData" }; diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index beb894ed..9bef5ab5 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -177,6 +177,7 @@ +