From 11e9ff62b12ba4233112ee7605745f6d0409a10f Mon Sep 17 00:00:00 2001 From: wendy <408182087@qq.com> Date: Mon, 17 Aug 2026 10:43:21 +0800 Subject: [PATCH] =?UTF-8?q?20260817=20=E7=A7=AF=E5=88=86=E3=80=81=E6=89=A3?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataBase/版本日志/SGGLDB_V2026-08-12-bwj.sql | 160 ++ DataBase/版本日志/SGGLDB_V2026-08-14-bwj.sql | 136 ++ SGGL/BLL/API/HSSE/APITestRecordService.cs | 1 - SGGL/BLL/BLL.csproj | 3 + SGGL/BLL/BaseInfo/EnergySettingsService.cs | 99 + SGGL/BLL/Common/Const.cs | 37 + .../EnergyReport/EnergyStatisticsService.cs | 90 + .../EnergyWaterConservationService.cs | 95 + SGGL/BLL/HSSE/EduTrain/TrainingTaskService.cs | 3 +- .../ConstructionLogNewService.cs | 1 - SGGL/BLL/Score/ScoreFlowLogService.cs | 56 +- SGGL/BLL/Score/ScoreUserService.cs | 49 +- .../BaseInfo/EnergySettings.aspx | 146 ++ .../BaseInfo/EnergySettings.aspx.cs | 274 +++ .../BaseInfo/EnergySettings.aspx.designer.cs | 197 ++ .../Check/HSE/CheckProblem.aspx.cs | 29 + .../Check/HSE/CheckProblemEdit.aspx.cs | 141 +- .../Check/HSE/CheckProblemIn.aspx.cs | 76 + .../EnergyReport/EnergyStatistics.aspx | 140 ++ .../EnergyReport/EnergyStatistics.aspx.cs | 326 +++ .../EnergyStatistics.aspx.designer.cs | 215 ++ .../EnergyReport/EnergyStatisticsEdit.aspx | 69 + .../EnergyReport/EnergyStatisticsEdit.aspx.cs | 313 +++ .../EnergyStatisticsEdit.aspx.designer.cs | 170 ++ .../EnergyReport/EnergyWaterConservation.aspx | 150 ++ .../EnergyWaterConservation.aspx.cs | 332 +++ .../EnergyWaterConservation.aspx.designer.cs | 179 ++ .../EnergyWaterConservationEdit.aspx | 86 + .../EnergyWaterConservationEdit.aspx.cs | 227 +++ ...ergyWaterConservationEdit.aspx.designer.cs | 188 ++ SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 56 +- SGGL/FineUIPro.Web/Global.asax.cs | 498 ++++- SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx | 117 ++ SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.cs | 256 +++ .../Score/ScoreFlowLog.aspx.designer.cs | 179 ++ SGGL/Model/Model.cs | 1790 +++++++++++++++++ SGGL/WebAPI/WebAPI.csproj | 164 ++ 37 files changed, 7022 insertions(+), 26 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2026-08-12-bwj.sql create mode 100644 DataBase/版本日志/SGGLDB_V2026-08-14-bwj.sql create mode 100644 SGGL/BLL/BaseInfo/EnergySettingsService.cs create mode 100644 SGGL/BLL/EnergyReport/EnergyStatisticsService.cs create mode 100644 SGGL/BLL/EnergyReport/EnergyWaterConservationService.cs create mode 100644 SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx create mode 100644 SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.cs create mode 100644 SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx create mode 100644 SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.cs create mode 100644 SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.designer.cs diff --git a/DataBase/版本日志/SGGLDB_V2026-08-12-bwj.sql b/DataBase/版本日志/SGGLDB_V2026-08-12-bwj.sql new file mode 100644 index 00000000..cb9cf128 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-08-12-bwj.sql @@ -0,0 +1,160 @@ + +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('49DE1534-20FF-44B0-846F-FF057E836DEC','÷ֿ۷ּ¼ˮ־','Score/ScoreFlowLog.aspx',30,'416F0A73-FB3D-4AAC-BC76-3820F52382D9','Menu_S_HSSE',1,1,1) +go +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('10A3CCFE-E445-4832-A9BF-129D89828278','÷ֿ۷ּ¼ˮ־','Score/ScoreFlowLog.aspx',30,'EE260447-028F-46AF-8864-9A5DC9DAA5BD','Menu_HSSE',0,1,1) +go + +alter table ScoreFlowLog add DataSourceId nvarchar(50) +go +alter table ScoreUser add DataSourceId nvarchar(50) +go +alter table ScoreFlowLog add CheckDate datetime +go +alter table ScoreUser add CheckDate datetime +go + +CREATE VIEW View_Training_TestRecord +as +/************Լ¼Ϣ****************/ +select testRecord.TestRecordId, +testRecord.ProjectId, +project.ProjectName, +Person.UnitId,--λid +Unit.UnitName,--λ +testRecord.TestStartTime,--Կʼʱ +testRecord.TestEndTime,--Խʱ +testRecord.TestManId,--id +Person.PersonName,-- +Person.IdentityCard,--֤ +testRecord.TestScores,--Գɼ +testRecord.CompanyTrainingItemId,--̲ϸid +TCItem.CompanyTrainingItemName,--̲ϸ +TC.CompanyTrainingId,--̲id +TC.CompanyTrainingName,--̲ +Person.WorkPostId,--λid +workPost.WorkPostName,--λ +const.ConstText as WorkPostType--λ +from Training_TestRecord as testRecord +LEFT JOIN dbo.Training_CompanyTrainingItem AS TCItem ON TCItem.CompanyTrainingItemId = TestRecord.CompanyTrainingItemId +LEFT JOIN dbo.Training_CompanyTraining AS TC ON TC.CompanyTrainingId = TCItem.CompanyTrainingId +LEFT JOIN dbo.SitePerson_Person AS Person ON Person.PersonId = TestRecord.TestManId +LEFT JOIN dbo.Base_Unit AS Unit ON Person.UnitId=Unit.UnitId +LEFT JOIN Base_WorkPost as workPost on workPost.WorkPostId = Person.WorkPostId +LEFT JOIN Sys_Const AS const ON const.ConstValue = workPost.PostType and const.GroupId ='PostType' +LEFT JOIN Base_Project as project on project.ProjectId = testRecord.ProjectId +GO + +update Sys_Menu set Url='EnergyReport/EnergyWaterConservation.aspx' where MenuId='CCA0E136-9AC7-4A14-BC1F-20758A99E88E' +update Sys_Menu set Url='EnergyReport/EnergyWaterConservation.aspx' where MenuId='D4541B37-7876-40D8-A48B-AEF8FCDAEE9F' +update Sys_Menu set Url='EnergyReport/EnergyStatistics.aspx' where MenuId='0BB29D06-E286-45C0-BC6A-3DDF8A21D1B2' +update Sys_Menu set Url='EnergyReport/EnergyStatistics.aspx' where MenuId='C97C6A48-8FF1-4E74-BF9A-E89C0422AB67' +go +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('C6655551-21D8-4E1E-B6C9-27D4A9FF9F71','CCA0E136-9AC7-4A14-BC1F-20758A99E88E','',1) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('3EE31410-3D5D-448C-ACB9-3BF23DEE6D33','CCA0E136-9AC7-4A14-BC1F-20758A99E88E','޸',2) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('C797CA13-F7B9-4BEA-94C8-E900A351E680','CCA0E136-9AC7-4A14-BC1F-20758A99E88E','ɾ',3) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('952B1041-1E06-4557-898B-782EC892C9A8','CCA0E136-9AC7-4A14-BC1F-20758A99E88E','',4) +go +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('70D26027-BE4F-45FE-8C0B-A6CE31731E73','D4541B37-7876-40D8-A48B-AEF8FCDAEE9F','',1) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('339ACF6A-124A-410C-B8E8-47949E02C6D3','D4541B37-7876-40D8-A48B-AEF8FCDAEE9F','޸',2) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('8FE0D4AB-7208-44CE-B508-A66D01EFBF09','D4541B37-7876-40D8-A48B-AEF8FCDAEE9F','ɾ',3) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('C659818E-300A-44DA-B685-E9C42E157CF4','D4541B37-7876-40D8-A48B-AEF8FCDAEE9F','',4) +go + + +CREATE TABLE [dbo].[EnergyReport_EnergyWaterConservation]( + [EnergyWaterConservationId] [nvarchar](50) NOT NULL, + [ProjectId] [nvarchar](50) NULL, + [EnergySavingIndex] [decimal](18, 2) NULL, + [WaterSavingIndex] [decimal](18, 2) NULL, + [EnergySavingSchemes] [nvarchar](200) NULL, + [WaterSavingSchemes] [nvarchar](200) NULL, + [SelfEvaluation] [nvarchar](200) NULL, + [Summary] [nvarchar](200) NULL, + [SupportingDocuments] [nvarchar](200) NULL, + [ActualEnergySaving] [decimal](18, 2) NULL, + [ActualWaterSaving] [decimal](18, 2) NULL, + [EnergySavingCompletionRate] [decimal](18, 2) NULL, + [WaterSavingCompletionRate] [decimal](18, 2) NULL, + [CompileMan] [nvarchar](50) NULL, + [CompileDate] [datetime] NULL, + [Remarks] [nvarchar](200) NULL, + CONSTRAINT [PK_EnergyReport_EnergyWaterConservation] PRIMARY KEY CLUSTERED +( + [EnergyWaterConservationId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] +) ON [PRIMARY] +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyWaterConservation] WITH CHECK ADD CONSTRAINT [FK_EnergyReport_EnergyWaterConservation_Base_Project] FOREIGN KEY([ProjectId]) +REFERENCES [dbo].[Base_Project] ([ProjectId]) +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyWaterConservation] CHECK CONSTRAINT [FK_EnergyReport_EnergyWaterConservation_Base_Project] +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyWaterConservation] WITH CHECK ADD CONSTRAINT [FK_EnergyReport_EnergyWaterConservation_Sys_User] FOREIGN KEY([CompileMan]) +REFERENCES [dbo].[Sys_User] ([UserId]) +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyWaterConservation] CHECK CONSTRAINT [FK_EnergyReport_EnergyWaterConservation_Sys_User] +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'EnergyWaterConservationId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ĿId' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'ProjectId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ֱָ꣨ú' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'EnergySavingIndex' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ˮָ֣꣨' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'WaterSavingIndex' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ܴʩ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'EnergySavingSchemes' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ˮʩ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'WaterSavingSchemes' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ܽˮ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'SelfEvaluation' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ܽˮܽ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'Summary' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ܽˮ֤' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'SupportingDocuments' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʵʽܣֱú' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'ActualEnergySaving' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʵʽˮ֣' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'ActualWaterSaving' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'EnergySavingCompletionRate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ˮ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @level2type=N'COLUMN',@level2name=N'WaterSavingCompletionRate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyWaterConservation', @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'EnergyReport_EnergyWaterConservation', @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'EnergyReport_EnergyWaterConservation' +GO + + diff --git a/DataBase/版本日志/SGGLDB_V2026-08-14-bwj.sql b/DataBase/版本日志/SGGLDB_V2026-08-14-bwj.sql new file mode 100644 index 00000000..178da968 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-08-14-bwj.sql @@ -0,0 +1,136 @@ +insert into Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +values('3DBCA999-949F-4B6D-93AE-B785B0D3D0B5','Դ','BaseInfo/EnergySettings.aspx',200,'5196A6FD-4BF1-46B3-8D24-9A3CE5BB4760','Menu_SysSet',1,1,1) +go +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('0A68798E-FE8F-4FF1-A7E7-19E79E6B108D','3DBCA999-949F-4B6D-93AE-B785B0D3D0B5','',1) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('BAE0E08D-B705-4893-9E10-8C6B346C2820','3DBCA999-949F-4B6D-93AE-B785B0D3D0B5','޸',2) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('E35C750A-C2CF-4DE0-B8D8-6A73A2B846AB','3DBCA999-949F-4B6D-93AE-B785B0D3D0B5','ɾ',3) +insert into Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex) +values('73D0A303-5C51-4069-8E80-4CBE45B698D7','3DBCA999-949F-4B6D-93AE-B785B0D3D0B5','',4) +go + + +CREATE TABLE [dbo].[Base_Energy]( + [EnergyId] [nvarchar](50) NOT NULL, + [EnergyName] [nvarchar](50) NOT NULL, + [EnergyUnit] [nvarchar](50) NOT NULL, + [ReferenceCoefficient] [decimal](18, 4) NULL, + CONSTRAINT [PK_Base_Energy] PRIMARY KEY CLUSTERED +( + [EnergyId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) 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'Base_Energy', @level2type=N'COLUMN',@level2name=N'EnergyId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Դ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_Energy', @level2type=N'COLUMN',@level2name=N'EnergyName' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'λ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_Energy', @level2type=N'COLUMN',@level2name=N'EnergyUnit' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ο۱׼úϵ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_Energy', @level2type=N'COLUMN',@level2name=N'ReferenceCoefficient' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Դñ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Base_Energy' +GO + + + +CREATE TABLE [dbo].[EnergyReport_EnergyStatistics]( + [EnergyStatisticsId] [nvarchar](50) NOT NULL, + [ProjectId] [nvarchar](50) NULL, + [UnitId] [nvarchar](50) NULL, + [ReportDate] [datetime] NOT NULL, + [EnergyId] [nvarchar](50) NOT NULL, + [Consumption] [decimal](18, 2) NULL, + [Amount] [decimal](18, 2) NULL, + [UnitPrice] [decimal](18, 2) NULL, + [ConversionUnit] [nvarchar](50) NULL, + [ConvertedQuantity] [decimal](18, 7) NULL, + [TCE] [decimal](18, 5) NULL, + [CompileMan] [nvarchar](50) NULL, + [CompileDate] [datetime] NULL, + CONSTRAINT [PK_EnergyReport_EnergyStatistics] PRIMARY KEY CLUSTERED +( + [EnergyStatisticsId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] +) ON [PRIMARY] +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] WITH CHECK ADD CONSTRAINT [FK_EnergyReport_EnergyStatistics_Base_Energy] FOREIGN KEY([EnergyId]) +REFERENCES [dbo].[Base_Energy] ([EnergyId]) +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] CHECK CONSTRAINT [FK_EnergyReport_EnergyStatistics_Base_Energy] +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] WITH CHECK ADD CONSTRAINT [FK_EnergyReport_EnergyStatistics_Base_Project] FOREIGN KEY([ProjectId]) +REFERENCES [dbo].[Base_Project] ([ProjectId]) +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] CHECK CONSTRAINT [FK_EnergyReport_EnergyStatistics_Base_Project] +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] WITH CHECK ADD CONSTRAINT [FK_EnergyReport_EnergyStatistics_Base_Unit] FOREIGN KEY([UnitId]) +REFERENCES [dbo].[Base_Unit] ([UnitId]) +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] CHECK CONSTRAINT [FK_EnergyReport_EnergyStatistics_Base_Unit] +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] WITH CHECK ADD CONSTRAINT [FK_EnergyReport_EnergyStatistics_Sys_User] FOREIGN KEY([CompileMan]) +REFERENCES [dbo].[Sys_User] ([UserId]) +GO + +ALTER TABLE [dbo].[EnergyReport_EnergyStatistics] CHECK CONSTRAINT [FK_EnergyReport_EnergyStatistics_Sys_User] +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'EnergyStatisticsId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ĿId' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @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'EnergyReport_EnergyStatistics', @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'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'ReportDate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ԴId' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'EnergyId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'Consumption' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ѽԪ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'Amount' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'UnitPrice' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'תλ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'ConversionUnit' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ת' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'ConvertedQuantity' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ֱú' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @level2type=N'COLUMN',@level2name=N'TCE' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'EnergyReport_EnergyStatistics', @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'EnergyReport_EnergyStatistics', @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'EnergyReport_EnergyStatistics' +GO + + + diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index 41a0d72f..70fb4d17 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -1,7 +1,6 @@ using EmitMapper; using EmitMapper.MappingConfiguration; using FastReport.Data; -using Microsoft.SqlServer.Dts.Runtime; using Model; using System; using System.Collections.Generic; diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index a0b948f2..607af473 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -254,6 +254,7 @@ + @@ -455,6 +456,8 @@ + + diff --git a/SGGL/BLL/BaseInfo/EnergySettingsService.cs b/SGGL/BLL/BaseInfo/EnergySettingsService.cs new file mode 100644 index 00000000..b4f6bebc --- /dev/null +++ b/SGGL/BLL/BaseInfo/EnergySettingsService.cs @@ -0,0 +1,99 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL +{ + /// + /// 能源设置 + /// + public class EnergySettingsService + { + /// + /// 根据Id获取能源信息 + /// + /// + /// + public static Model.Base_Energy GetEnergyById(string energyId) + { + return Funs.DB.Base_Energy.FirstOrDefault(e => e.EnergyId == energyId); + } + + /// + /// 添加能源 + /// + /// + public static void AddEnergy(Model.Base_Energy energy) + { + CNPCDB db = Funs.DB; + Model.Base_Energy newEnergy = new Model.Base_Energy(); + newEnergy.EnergyId = energy.EnergyId; + newEnergy.EnergyName = energy.EnergyName; + newEnergy.EnergyUnit = energy.EnergyUnit; + newEnergy.ReferenceCoefficient = energy.ReferenceCoefficient; + db.Base_Energy.InsertOnSubmit(newEnergy); + db.SubmitChanges(); + } + + /// + /// 修改能源 + /// + /// + public static void UpdateEnergy(Model.Base_Energy energy) + { + CNPCDB db = Funs.DB; + Model.Base_Energy newEnergy = db.Base_Energy.FirstOrDefault(e => e.EnergyId == energy.EnergyId); + if (newEnergy != null) + { + newEnergy.EnergyName = energy.EnergyName; + newEnergy.EnergyUnit = energy.EnergyUnit; + newEnergy.ReferenceCoefficient = energy.ReferenceCoefficient; + db.SubmitChanges(); + } + } + + /// + /// 根据主键删除能源 + /// + /// + public static void DeleteEnergyById(string energyId) + { + CNPCDB db = Funs.DB; + Model.Base_Energy energy = db.Base_Energy.FirstOrDefault(e => e.EnergyId == energyId); + if (energy != null) + { + db.Base_Energy.DeleteOnSubmit(energy); + db.SubmitChanges(); + } + } + + /// + /// 获取能源列表信息 + /// + /// + public static List GetEnergyList() + { + return (from x in Funs.DB.Base_Energy orderby x.EnergyName select x).ToList(); + } + + /// + /// 获取能源下拉列表项 + /// + /// + /// + public static void InitEnergyDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) + { + dropName.DataValueField = "EnergyId"; + dropName.DataTextField = "EnergyName"; + dropName.DataSource = GetEnergyList(); + dropName.DataBind(); + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } + } +} \ No newline at end of file diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 71d44db7..63375ede 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -58,6 +58,10 @@ namespace BLL /// N3较大隐患Id /// public const string SafetyNatureIdN3 = "4cd15090-0fb0-4bdf-9a72-3076f90fe5c6"; + /// + /// N4一般隐患 + /// + public const string SafetyNatureIdN4 = "556bf91f-adbe-4af6-8403-a685f893af93"; #endregion @@ -88,6 +92,24 @@ namespace BLL #endregion + #region 教材库 + /// + /// 通用安全知识 + /// + public const string CompanyTrainingId1 = "68f99192-d5bd-47e9-998f-d0052c8ef39e"; + /// + /// 知识方法工具 + /// + public const string CompanyTrainingId2 = "74e3f6e6-bd28-4cf2-9b27-d62947a61775"; + /// + /// 岗位基本操作技能 + /// + public const string CompanyTrainingId3 = "c69ab677-e5eb-443b-a778-8c6b1d605dac"; + /// + /// 生产受控管理 + /// + public const string CompanyTrainingId4 = "e10a69e9-af1a-4088-8bcc-71481c59e578"; + #endregion /// /// 焊条发放回收纪录 @@ -1795,6 +1817,11 @@ namespace BLL /// 风险等级 /// public const string RiskLevelMenuId = "E4B526CC-805E-4131-8E18-2FFA6871507E"; + + /// + /// 能源设置 + /// + public const string EnergyMenuId = "3DBCA999-949F-4B6D-93AE-B785B0D3D0B5"; #endregion #region 质量基础信息 @@ -1859,6 +1886,7 @@ namespace BLL /// 项目地图 /// public const string ProjectProjectMapMenuId = "F266456A-991F-45A3-BCD6-CF2515D71E39"; + #endregion @@ -3481,6 +3509,15 @@ namespace BLL #endregion #region 报表管理 + /// + /// 节能节水 + /// + public const string EnergyWaterConservationMenuId = "CCA0E136-9AC7-4A14-BC1F-20758A99E88E"; + + /// + /// 能源统计 + /// + public const string EnergyStatisticsMenuId = "D4541B37-7876-40D8-A48B-AEF8FCDAEE9F"; /// /// diff --git a/SGGL/BLL/EnergyReport/EnergyStatisticsService.cs b/SGGL/BLL/EnergyReport/EnergyStatisticsService.cs new file mode 100644 index 00000000..5c69f368 --- /dev/null +++ b/SGGL/BLL/EnergyReport/EnergyStatisticsService.cs @@ -0,0 +1,90 @@ +using Model; +using NPOI.HSSF.EventUserModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL +{ + /// + /// 能源统计 + /// + public class EnergyStatisticsService + { + /// + /// 根据主键获取能源统计 + /// + /// + /// + public static Model.EnergyReport_EnergyStatistics GetEnergyStatisticsById(string energyStatisticsId) + { + return Funs.DB.EnergyReport_EnergyStatistics.FirstOrDefault(e => e.EnergyStatisticsId == energyStatisticsId); + } + + /// + /// 添加能源统计 + /// + /// + public static void AddEnergyStatistics(Model.EnergyReport_EnergyStatistics energyStatistics) + { + CNPCDB db = Funs.DB; + Model.EnergyReport_EnergyStatistics newEnergyStatistics = new EnergyReport_EnergyStatistics(); + newEnergyStatistics.EnergyStatisticsId = energyStatistics.EnergyStatisticsId; + newEnergyStatistics.ProjectId = energyStatistics.ProjectId; + newEnergyStatistics.UnitId = energyStatistics.UnitId; + newEnergyStatistics.ReportDate = energyStatistics.ReportDate; + newEnergyStatistics.EnergyId = energyStatistics.EnergyId; + newEnergyStatistics.Consumption = energyStatistics.Consumption; + newEnergyStatistics.Amount = energyStatistics.Amount; + newEnergyStatistics.UnitPrice = energyStatistics.UnitPrice; + newEnergyStatistics.ConversionUnit = energyStatistics.ConversionUnit; + newEnergyStatistics.ConvertedQuantity = energyStatistics.ConvertedQuantity; + newEnergyStatistics.TCE = energyStatistics.TCE; + newEnergyStatistics.CompileMan = energyStatistics.CompileMan; + newEnergyStatistics.CompileDate = energyStatistics.CompileDate; + db.EnergyReport_EnergyStatistics.InsertOnSubmit(newEnergyStatistics); + db.SubmitChanges(); + } + + /// + /// 修改 + /// + /// + public static void UpdateEnergyStatistics(Model.EnergyReport_EnergyStatistics energyStatistics) + { + CNPCDB db = Funs.DB; + Model.EnergyReport_EnergyStatistics newEnergyStatistics = db.EnergyReport_EnergyStatistics.FirstOrDefault(e => e.EnergyStatisticsId == energyStatistics.EnergyStatisticsId); + if (newEnergyStatistics != null) + { + newEnergyStatistics.ProjectId = energyStatistics.ProjectId; + newEnergyStatistics.UnitId = energyStatistics.UnitId; + newEnergyStatistics.ReportDate = energyStatistics.ReportDate; + newEnergyStatistics.EnergyId = energyStatistics.EnergyId; + newEnergyStatistics.Consumption = energyStatistics.Consumption; + newEnergyStatistics.Amount = energyStatistics.Amount; + newEnergyStatistics.UnitPrice = energyStatistics.UnitPrice; + newEnergyStatistics.ConversionUnit = energyStatistics.ConversionUnit; + newEnergyStatistics.ConvertedQuantity = energyStatistics.ConvertedQuantity; + newEnergyStatistics.TCE = energyStatistics.TCE; + db.SubmitChanges(); + } + } + + /// + /// 根据主键删除能源统计 + /// + /// + public static void DeleteEnergyStatisticsById(string energyStatisticsId) + { + CNPCDB db = Funs.DB; + Model.EnergyReport_EnergyStatistics energyStatistics = db.EnergyReport_EnergyStatistics.FirstOrDefault(e => e.EnergyStatisticsId == energyStatisticsId); + if (energyStatistics != null) + { + db.EnergyReport_EnergyStatistics.DeleteOnSubmit(energyStatistics); + db.SubmitChanges(); + } + } + } +} \ No newline at end of file diff --git a/SGGL/BLL/EnergyReport/EnergyWaterConservationService.cs b/SGGL/BLL/EnergyReport/EnergyWaterConservationService.cs new file mode 100644 index 00000000..ffdb6f61 --- /dev/null +++ b/SGGL/BLL/EnergyReport/EnergyWaterConservationService.cs @@ -0,0 +1,95 @@ +using FastReport.Wizards; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL +{ + /// + /// 节能节水目标指标 + /// + public class EnergyWaterConservationService + { + /// + /// 根据主键获取节能节水指标 + /// + /// + /// + public static Model.EnergyReport_EnergyWaterConservation GetEnergyWaterConservationById(string energyWaterConservationId) + { + return Funs.DB.EnergyReport_EnergyWaterConservation.FirstOrDefault(e => e.EnergyWaterConservationId == energyWaterConservationId); + } + + /// + /// 添加 + /// + /// + public static void AddEnergyWaterConservation(Model.EnergyReport_EnergyWaterConservation energyWaterConservation) + { + Model.CNPCDB db = Funs.DB; + Model.EnergyReport_EnergyWaterConservation newEnwa = new Model.EnergyReport_EnergyWaterConservation(); + newEnwa.EnergyWaterConservationId = energyWaterConservation.EnergyWaterConservationId; + newEnwa.ProjectId = energyWaterConservation.ProjectId; + newEnwa.EnergySavingIndex = energyWaterConservation.EnergySavingIndex; + newEnwa.WaterSavingIndex = energyWaterConservation.WaterSavingIndex; + newEnwa.EnergySavingSchemes = energyWaterConservation.EnergySavingSchemes; + newEnwa.WaterSavingSchemes = energyWaterConservation.WaterSavingSchemes; + newEnwa.SelfEvaluation = energyWaterConservation.SelfEvaluation; + newEnwa.Summary = energyWaterConservation.Summary; + newEnwa.SupportingDocuments = energyWaterConservation.SupportingDocuments; + newEnwa.ActualEnergySaving = energyWaterConservation.ActualEnergySaving; + newEnwa.ActualWaterSaving = energyWaterConservation.ActualWaterSaving; + newEnwa.EnergySavingCompletionRate = energyWaterConservation.EnergySavingCompletionRate; + newEnwa.WaterSavingCompletionRate = energyWaterConservation.WaterSavingCompletionRate; + newEnwa.CompileMan = energyWaterConservation.CompileMan; + newEnwa.CompileDate = energyWaterConservation.CompileDate; + newEnwa.Remarks = energyWaterConservation.Remarks; + db.EnergyReport_EnergyWaterConservation.InsertOnSubmit(newEnwa); + db.SubmitChanges(); + } + + /// + /// 修改 + /// + /// + public static void UpdateEnergyWaterConservation(Model.EnergyReport_EnergyWaterConservation energyWaterConservation) + { + Model.CNPCDB db = Funs.DB; + Model.EnergyReport_EnergyWaterConservation newEnwa = db.EnergyReport_EnergyWaterConservation.FirstOrDefault(e => e.EnergyWaterConservationId == energyWaterConservation.EnergyWaterConservationId); + if (newEnwa != null) + { + newEnwa.ProjectId = energyWaterConservation.ProjectId; + newEnwa.EnergySavingIndex = energyWaterConservation.EnergySavingIndex; + newEnwa.WaterSavingIndex = energyWaterConservation.WaterSavingIndex; + newEnwa.EnergySavingSchemes = energyWaterConservation.EnergySavingSchemes; + newEnwa.WaterSavingSchemes = energyWaterConservation.WaterSavingSchemes; + newEnwa.SelfEvaluation = energyWaterConservation.SelfEvaluation; + newEnwa.Summary = energyWaterConservation.Summary; + newEnwa.SupportingDocuments = energyWaterConservation.SupportingDocuments; + newEnwa.ActualEnergySaving = energyWaterConservation.ActualEnergySaving; + newEnwa.ActualWaterSaving = energyWaterConservation.ActualWaterSaving; + newEnwa.EnergySavingCompletionRate = energyWaterConservation.EnergySavingCompletionRate; + newEnwa.WaterSavingCompletionRate = energyWaterConservation.WaterSavingCompletionRate; + newEnwa.Remarks = energyWaterConservation.Remarks; + db.SubmitChanges(); + } + } + + /// + /// 根据主键删除节能节水目标指标 + /// + /// + public static void DeleteEnergyWaterConservationById(string energyWaterConservationId) + { + Model.CNPCDB db = Funs.DB; + Model.EnergyReport_EnergyWaterConservation newEnwa = db.EnergyReport_EnergyWaterConservation.FirstOrDefault(e => e.EnergyWaterConservationId == energyWaterConservationId); + if (newEnwa != null) + { + db.EnergyReport_EnergyWaterConservation.DeleteOnSubmit(newEnwa); + db.SubmitChanges(); + } + } + } +} \ No newline at end of file diff --git a/SGGL/BLL/HSSE/EduTrain/TrainingTaskService.cs b/SGGL/BLL/HSSE/EduTrain/TrainingTaskService.cs index 85465296..f53959d5 100644 --- a/SGGL/BLL/HSSE/EduTrain/TrainingTaskService.cs +++ b/SGGL/BLL/HSSE/EduTrain/TrainingTaskService.cs @@ -1,5 +1,4 @@ -using Microsoft.SqlServer.Dts.Runtime; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/SGGL/BLL/InformationProject/ConstructionLogNewService.cs b/SGGL/BLL/InformationProject/ConstructionLogNewService.cs index c829672a..a8b0b3d3 100644 --- a/SGGL/BLL/InformationProject/ConstructionLogNewService.cs +++ b/SGGL/BLL/InformationProject/ConstructionLogNewService.cs @@ -1,5 +1,4 @@ using FineUIPro; -using Microsoft.SqlServer.Dts.Runtime; using System; using System.Collections; using System.Collections.Generic; diff --git a/SGGL/BLL/Score/ScoreFlowLogService.cs b/SGGL/BLL/Score/ScoreFlowLogService.cs index 93379082..d086d9de 100644 --- a/SGGL/BLL/Score/ScoreFlowLogService.cs +++ b/SGGL/BLL/Score/ScoreFlowLogService.cs @@ -1,4 +1,5 @@ using Model; +using System; using System.Collections.Generic; using System.Linq; @@ -43,9 +44,33 @@ namespace BLL /// /// /// - public static Model.ScoreFlowLog GetScoreFlowLogByIdentityCard(string IdentityCard, int year) + public static Model.ScoreFlowLog GetScoreFlowLogByIdentityCard(string IdentityCard, int year, DateTime compileDate) { - return Funs.DB.ScoreFlowLog.Where(e => e.IdentityCard == IdentityCard && e.Year == year).OrderByDescending(x => x.CompileDate).FirstOrDefault(); + return Funs.DB.ScoreFlowLog.Where(e => e.IdentityCard == IdentityCard && e.Year == year && e.CompileDate <= compileDate).OrderByDescending(x => x.CompileDate).FirstOrDefault(); + } + + /// + /// 根据数据来源id获取人员计分流水 + /// + /// + /// + /// + /// + public static Model.ScoreFlowLog GetScoreFlowLogByDataSourceId(string IdentityCard, int year, string dataSourceId) + { + return Funs.DB.ScoreFlowLog.FirstOrDefault(e => e.IdentityCard == IdentityCard && e.Year == year && e.DataSourceId == dataSourceId); + } + + /// + /// 根据时间获取比当前年份的人员比时间后的数据 + /// + /// + /// + /// + /// + public static List GetScoreFlowLogByCompileDate(string IdentityCard, int year, DateTime compliedate) + { + return (from x in Funs.DB.ScoreFlowLog where x.IdentityCard == IdentityCard && x.Year == year && x.CompileDate > compliedate select x).ToList(); } /// @@ -74,6 +99,8 @@ namespace BLL newModel.CompileDate = model.CompileDate; newModel.CompileMan = model.CompileMan; newModel.CompileManId = model.CompileManId; + newModel.DataSourceId = model.DataSourceId; + newModel.CheckDate = model.CheckDate; Funs.DB.ScoreFlowLog.InsertOnSubmit(newModel); Funs.DB.SubmitChanges(); } @@ -88,9 +115,9 @@ namespace BLL if (newModel != null) { //newModel.Id = model.Id; - //newModel.Year = model.Year; - //newModel.IdentityCard = model.IdentityCard; - //newModel.UserName = model.UserName; + newModel.Year = model.Year; + newModel.IdentityCard = model.IdentityCard; + newModel.UserName = model.UserName; newModel.Type = model.Type; newModel.Score = model.Score; newModel.CurrentScore = model.CurrentScore; @@ -103,9 +130,11 @@ namespace BLL newModel.UnitName = model.UnitName; newModel.ProjectName = model.ProjectName; newModel.Remark = model.Remark; - newModel.CompileDate = model.CompileDate; - newModel.CompileMan = model.CompileMan; - newModel.CompileManId = model.CompileManId; + //newModel.CompileDate = model.CompileDate; + //newModel.CompileMan = model.CompileMan; + //newModel.CompileManId = model.CompileManId; + newModel.DataSourceId = model.DataSourceId; + newModel.CheckDate = model.CheckDate; Funs.DB.SubmitChanges(); } } @@ -127,5 +156,16 @@ namespace BLL //BLL.LogService.AddSys_Log(opUser, model.Id, model.Id, BLL.Const.ProjectScoreFlowLogMenuId, BLL.Const.BtnDelete); } } + + public static void DeleteScoreFlowLogByDataSourceId(string IdentityCard, int year, string dataSourceId) + { + var db = Funs.DB; + Model.ScoreFlowLog model = db.ScoreFlowLog.FirstOrDefault(x => x.IdentityCard == IdentityCard && x.Year == year && x.DataSourceId == dataSourceId); + if (model != null) + { + db.ScoreFlowLog.DeleteOnSubmit(model); + db.SubmitChanges(); + } + } } } diff --git a/SGGL/BLL/Score/ScoreUserService.cs b/SGGL/BLL/Score/ScoreUserService.cs index 9f631f62..85655bf1 100644 --- a/SGGL/BLL/Score/ScoreUserService.cs +++ b/SGGL/BLL/Score/ScoreUserService.cs @@ -1,4 +1,7 @@ using Model; +using NPOI.SS.UserModel; +using System; +using System.Collections.Generic; using System.Linq; namespace BLL @@ -29,6 +32,23 @@ namespace BLL return Funs.DB.ScoreUser.Where(e => e.IdentityCard == IdentityCard && e.Year == year).OrderByDescending(x => x.CompileDate).FirstOrDefault(); } + /// + /// 根据数据来源id获取人员计分记录 + /// + /// + /// + /// + /// + public static Model.ScoreUser GetScoreUserByDataSourceId(string IdentityCard, int year, string dataSourceId) + { + return Funs.DB.ScoreUser.FirstOrDefault(e => e.IdentityCard == IdentityCard && e.Year == year && e.DataSourceId == dataSourceId); + } + + public static List GetScoreUserByCompileDate(string IdentityCard, int year, DateTime compliedate) + { + return (from x in Funs.DB.ScoreUser where x.IdentityCard == IdentityCard && x.Year == year && x.CompileDate > compliedate select x).ToList(); + } + /// /// 增加人员得分 /// @@ -42,6 +62,8 @@ namespace BLL newModel.UserName = model.UserName; newModel.Score = model.Score; newModel.CompileDate = model.CompileDate; + newModel.DataSourceId = model.DataSourceId; + newModel.CheckDate = model.CheckDate; Funs.DB.ScoreUser.InsertOnSubmit(newModel); Funs.DB.SubmitChanges(); } @@ -56,11 +78,13 @@ namespace BLL if (newModel != null) { //newModel.Id = model.Id; - //newModel.Year = model.Year; - //newModel.IdentityCard = model.IdentityCard; - //newModel.UserName = model.UserName; + newModel.Year = model.Year; + newModel.IdentityCard = model.IdentityCard; + newModel.UserName = model.UserName; newModel.Score = model.Score; - newModel.CompileDate = model.CompileDate; + //newModel.CompileDate = model.CompileDate; + newModel.DataSourceId = model.DataSourceId; + newModel.CheckDate = model.CheckDate; Funs.DB.SubmitChanges(); } } @@ -80,5 +104,22 @@ namespace BLL db.SubmitChanges(); } } + + /// + /// 根据数据来源Id删除人员得分记录 + /// + /// + /// + /// + public static void DeleteScoreUserByDataSourceId(string IdentityCard, int year, string dataSourceId) + { + var db = Funs.DB; + Model.ScoreUser model = db.ScoreUser.FirstOrDefault(e => e.IdentityCard == IdentityCard && e.Year == year && e.DataSourceId == dataSourceId); + if (model != null) + { + db.ScoreUser.DeleteOnSubmit(model); + db.SubmitChanges(); + } + } } } diff --git a/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx b/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx new file mode 100644 index 00000000..b3b19568 --- /dev/null +++ b/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx @@ -0,0 +1,146 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnergySettings.aspx.cs" Inherits="FineUIPro.Web.BaseInfo.EnergySettings" %> + + + + + + + 能源设置 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.cs b/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.cs new file mode 100644 index 00000000..3516ef93 --- /dev/null +++ b/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.cs @@ -0,0 +1,274 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.BaseInfo +{ + public partial class EnergySettings : PageBase + { + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + ////权限按钮方法 + this.GetButtonPower(); + Funs.DropDownPageSize(this.ddlPageSize); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + var q = from x in Funs.DB.Base_Energy orderby x.EnergyName select x; + Grid1.RecordCount = q.Count(); + // 2.获取当前分页数据 + var table = GetPagedDataTable(Grid1.PageIndex, Grid1.PageSize); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + /// + /// 分页 + /// + /// + private List GetPagedDataTable(int pageIndex, int pageSize) + { + List source = (from x in Funs.DB.Base_Energy orderby x.EnergyName select x).ToList(); + List paged = new List(); + + int rowbegin = pageIndex * pageSize; + int rowend = (pageIndex + 1) * pageSize; + if (rowend > source.Count()) + { + rowend = source.Count(); + } + + for (int i = rowbegin; i < rowend; i++) + { + paged.Add(source[i]); + } + + return paged; + } + + /// + /// 改变索引事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + #endregion + + #region 分页下拉选择 + /// + /// 分页下拉选择 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + #endregion + + #region 删除 + /// + /// 删除 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + var getV = BLL.EnergySettingsService.GetEnergyById(hfFormID.Text); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.EnergyName, getV.EnergyId, BLL.Const.EnergyMenuId, BLL.Const.BtnDelete); + BLL.EnergySettingsService.DeleteEnergyById(getV.EnergyId); + // 重新绑定表格,并模拟点击[新增按钮] + BindGrid(); + PageContext.RegisterStartupScript("onNewButtonClick();"); + } + } + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + + /// + /// 删除方法 + /// + private void DeleteData() + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var getV = BLL.EnergySettingsService.GetEnergyById(hfFormID.Text); + if (getV != null) + { + BLL.LogService.AddSys_Log(this.CurrUser, getV.EnergyName, getV.EnergyId, BLL.Const.EnergyMenuId, BLL.Const.BtnDelete); + BLL.EnergySettingsService.DeleteEnergyById(rowID); + } + } + BindGrid(); + PageContext.RegisterStartupScript("onNewButtonClick();"); + } + } + #endregion + + #region 编辑 + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + string Id = Grid1.SelectedRowID; + var energy = BLL.EnergySettingsService.GetEnergyById(Id); + if (energy != null) + { + this.txtEnergyName.Text = energy.EnergyName; + this.txtEnergyUnit.Text = energy.EnergyUnit; + this.txtReferenceCoefficient.Text = energy.ReferenceCoefficient.HasValue ? energy.ReferenceCoefficient.ToString() : ""; + hfFormID.Text = Id; + this.btnDelete.Enabled = true; + } + } + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + string strRowID = hfFormID.Text; + Model.Base_Energy energy = new Model.Base_Energy + { + EnergyName = this.txtEnergyName.Text.Trim(), + EnergyUnit = this.txtEnergyUnit.Text.Trim() + }; + try + { + if (!string.IsNullOrEmpty(txtReferenceCoefficient.Text.Trim())) + { + energy.ReferenceCoefficient = Convert.ToDecimal(txtReferenceCoefficient.Text.Trim()); + } + } + catch (Exception) + { + ShowNotify("输入的格式错误!", MessageBoxIcon.Warning); + return; + } + if (string.IsNullOrEmpty(strRowID)) + { + energy.EnergyId = SQLHelper.GetNewID(typeof(Model.Base_Energy)); + BLL.EnergySettingsService.AddEnergy(energy); + BLL.LogService.AddSys_Log(this.CurrUser, energy.EnergyName, energy.EnergyId, BLL.Const.EmergencyMenuId, BLL.Const.BtnAdd); + } + else + { + energy.EnergyId = strRowID; + BLL.EnergySettingsService.UpdateEnergy(energy); + BLL.LogService.AddSys_Log(this.CurrUser, energy.EnergyName, energy.EnergyId, BLL.Const.EmergencyMenuId, BLL.Const.BtnModify); + } + this.SimpleForm1.Reset(); + // 重新绑定表格,并点击当前编辑或者新增的行 + BindGrid(); + PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, energy.EnergyId)); + } + #endregion + + #region 验证事故类型名称、编号是否存在 + /// + /// 验证事故类型名称、编号是否存在 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + var q = Funs.DB.Base_Energy.FirstOrDefault(x => x.EnergyName == this.txtEnergyName.Text.Trim() && (x.EnergyId != hfFormID.Text || (hfFormID.Text == null && x.EnergyId != null))); + if (q != null) + { + Alert.ShowInTop("输入的能源名称已存在!", MessageBoxIcon.Warning); + return; + } + } + #endregion + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.EnergyMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.designer.cs b/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.designer.cs new file mode 100644 index 00000000..9cb20e70 --- /dev/null +++ b/SGGL/FineUIPro.Web/BaseInfo/EnergySettings.aspx.designer.cs @@ -0,0 +1,197 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.BaseInfo +{ + + + public partial class EnergySettings + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm1; + + /// + /// hfFormID 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hfFormID; + + /// + /// txtEnergyName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEnergyName; + + /// + /// txtEnergyUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEnergyUnit; + + /// + /// txtReferenceCoefficient 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtReferenceCoefficient; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/Check/HSE/CheckProblem.aspx.cs b/SGGL/FineUIPro.Web/Check/HSE/CheckProblem.aspx.cs index 1354c284..78e555dd 100644 --- a/SGGL/FineUIPro.Web/Check/HSE/CheckProblem.aspx.cs +++ b/SGGL/FineUIPro.Web/Check/HSE/CheckProblem.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Model; using System; using System.Collections.Generic; using System.Data; @@ -403,6 +404,34 @@ namespace FineUIPro.Web.Check.HSE Grid1.DataBind(); BindGrid(); Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success); + + #region 删除对应的扣分流水 + var u = BLL.UserService.GetUserByUserId(model.RectificationUserId); + if (u != null) + { + var scoreFlowLog = BLL.ScoreFlowLogService.GetScoreFlowLogByDataSourceId(u.IdentityCard, model.CheckDate.Year, model.CheckId); + if (scoreFlowLog != null) + { + //删除人员记分流水 + var updateScoreFlowLogList = BLL.ScoreFlowLogService.GetScoreFlowLogByCompileDate(scoreFlowLog.IdentityCard, scoreFlowLog.Year, scoreFlowLog.CompileDate); + foreach (var item in updateScoreFlowLogList) + { + item.CurrentScore = item.CurrentScore + (-scoreFlowLog.Score); + Funs.DB.SubmitChanges(); + } + BLL.ScoreFlowLogService.DeleteScoreFlowLogByDataSourceId(scoreFlowLog.IdentityCard, scoreFlowLog.Year, scoreFlowLog.DataSourceId); + + //删除人员记分情况 + var updateScoreUserList = BLL.ScoreUserService.GetScoreUserByCompileDate(scoreFlowLog.IdentityCard, scoreFlowLog.Year, scoreFlowLog.CompileDate); + foreach (var item in updateScoreUserList) + { + item.Score = item.Score + (-scoreFlowLog.Score); + Funs.DB.SubmitChanges(); + } + BLL.ScoreUserService.DeleteScoreUserByDataSourceId(scoreFlowLog.IdentityCard, scoreFlowLog.Year, scoreFlowLog.DataSourceId); + } + } + #endregion } } } diff --git a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs index 254e8242..62d9f494 100644 --- a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemEdit.aspx.cs @@ -1,5 +1,6 @@ using BLL; using Model; +using NPOI.SS.Formula.Functions; using System; namespace FineUIPro.Web.Check.HSE @@ -55,21 +56,34 @@ namespace FineUIPro.Web.Check.HSE if (model != null) { this.drpUnit.SelectedValue = model.UnitId; + this.drpRectificationUser.Items.Clear(); + BLL.UserService.InitUserUnitIdDropDownList(this.drpRectificationUser, this.drpUnit.SelectedValue, true); + this.drpPMUser.Items.Clear(); + BLL.UserService.InitUserUnitIdDropDownList(this.drpPMUser, this.drpUnit.SelectedValue, true); + BLL.ProjectService.InitProjectDropDownList(this.drpProject, model.UnitId, true); if (!string.IsNullOrWhiteSpace(model.ProjectId)) { this.drpProject.SelectedValue = model.ProjectId; } - else if (!string.IsNullOrWhiteSpace(model.ProjectName)) + if (!string.IsNullOrWhiteSpace(model.ProjectName)) { this.drpProject.Text = model.ProjectName; } + var pro = BLL.ProjectService.GetProjectByProjectId(model.ProjectId); + if (pro != null) + { + this.txtAddress.Text = pro.ProjectAddress; + this.drpPMUser.Items.Clear(); + BLL.UserService.InitUserDropDownList(this.drpPMUser, model.ProjectId, true); + } + this.drpClassify.SelectedValue = model.ClassifyId; BLL.SafetyProblemClassifyItemService.InitClassifyItemDownList(this.drpClassifyItem, model.ClassifyId, true); if (!string.IsNullOrWhiteSpace(model.ClassifyItemId)) { this.drpClassifyItem.SelectedValue = model.ClassifyItemId; - } + } this.drpNature.SelectedValue = model.NatureId; BLL.SafetyProblemNatureItemService.InitNatureItemDownList(this.drpNatureItem, model.NatureId, true); if (!string.IsNullOrWhiteSpace(model.NatureItemId)) @@ -311,6 +325,7 @@ namespace FineUIPro.Web.Check.HSE ///
protected void SaveData() { + string saveType = string.Empty;//1-新增,2-修改 CheckProblem_Safety model = new CheckProblem_Safety(); model.UnitId = this.drpUnit.SelectedValue; model.UnitName = this.drpUnit.SelectedText; @@ -359,6 +374,7 @@ namespace FineUIPro.Web.Check.HSE model.Remark = this.txtRemark.Text.Trim(); if (string.IsNullOrWhiteSpace(this.CheckId)) { + saveType = "1";//新增 //新增 model.CheckId = SQLHelper.GetNewID(typeof(CheckProblem_Safety)); this.CheckId = model.CheckId; @@ -369,13 +385,134 @@ namespace FineUIPro.Web.Check.HSE ////增加一条编码记录 //BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.SafetyCheckProblemMenuId, model.ProjectId, null, model.CheckId, model.CheckDate); + + } else { + saveType = "2";//修改 //更新 model.CheckId = this.CheckId; BLL.CheckProblemSafetyService.UpdateCheckProblem(model); } + + #region 扣分记录 + var user = BLL.UserService.GetUserByUserId(model.RectificationUserId); + if (user != null) + { + int oldS = 0; + DateTime comdate = new DateTime(); + var scoreFlowLog = BLL.ScoreFlowLogService.GetScoreFlowLogByDataSourceId(user.IdentityCard, model.CheckDate.Year, model.CheckId); + if (scoreFlowLog != null) + { + oldS = scoreFlowLog.CurrentScore; + comdate = scoreFlowLog.CompileDate; + BLL.ScoreFlowLogService.DeleteScoreFlowLogByDataSourceId(user.IdentityCard, model.CheckDate.Year, model.CheckId); + } + var scoreUser = BLL.ScoreUserService.GetScoreUserByDataSourceId(user.IdentityCard, model.CheckDate.Year, model.CheckId); + if (scoreUser != null) + { + BLL.ScoreUserService.DeleteScoreUserByDataSourceId(user.IdentityCard, model.CheckDate.Year, model.CheckId); + } + #region 增加积分流水 + //增加人员记分流水 + ScoreFlowLog log = new ScoreFlowLog(); + log.Id = SQLHelper.GetNewID(); + if (!string.IsNullOrEmpty(txtCheckDate.Text.Trim())) + { + log.Year = Convert.ToDateTime(txtCheckDate.Text.Trim()).Year; + } + log.UserId = this.drpRectificationUser.SelectedValue; + log.UserName = this.drpRectificationUser.SelectedText; + log.IdentityCard = user.IdentityCard; + log.UnitId = this.drpUnit.SelectedValue; + log.ProjectId = this.drpProject.SelectedValue; + log.UnitName = this.drpUnit.SelectedText; + log.ProjectName = this.drpProject.SelectedText; + log.Item = "安全不符合项"; + log.LogContent = "隐患问责扣分"; + log.CheckDate = Convert.ToDateTime(this.txtCheckDate.Text.Trim()); + if (saveType == "1") + { + log.CompileDate = DateTime.Now; + } + else + { + log.CompileDate = comdate; + } + log.CompileMan = this.CurrUser.UserName; + log.CompileManId = this.CurrUser.UserId; + log.DataSourceId = this.CheckId; + log.Type = 0;//扣分 + //特别严重(管控红线)扣成0分,严重(危险作业许可)扣除100分,较大扣除50分,一般扣除20分,轻微扣除2分 + if (drpNature.SelectedValue == BLL.Const.SafetyNatureIdN1) + { + var sfl = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(log.IdentityCard, log.Year, log.CompileDate); + if (sfl != null) + { + log.Score = -sfl.CurrentScore;//上一条记录多少分扣多少分 + } + else + { + log.Score = -100; + } + } + else if (drpNature.SelectedValue == BLL.Const.SafetyNatureIdN2) + { + log.Score = -100; + } + else if (drpNature.SelectedValue == BLL.Const.SafetyNatureIdN3) + { + log.Score = -50; + } + else if (drpNature.SelectedValue == BLL.Const.SafetyNatureIdN4) + { + log.Score = -20; + } + var cs = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(log.IdentityCard, log.Year, log.CompileDate); + if (cs != null) + { + log.CurrentScore = cs.CurrentScore + log.Score;//记分后人员得分值 + } + else + { + log.CurrentScore = 100 + log.Score; + } + BLL.ScoreFlowLogService.AddScoreFlowLog(log); + + //增加人员记分情况 + ScoreUser su = new ScoreUser(); + su.Id = SQLHelper.GetNewID(); + su.Year = log.Year; + su.IdentityCard = log.IdentityCard; + su.Score = log.CurrentScore; + su.UserName = log.UserName; + su.CompileDate = log.CompileDate; + su.DataSourceId = this.CheckId; + su.CheckDate = log.CheckDate; + BLL.ScoreUserService.AddScoreUser(su); + #endregion + + var lastFlowLog = BLL.ScoreFlowLogService.GetScoreFlowLogByCompileDate(user.IdentityCard, log.Year, log.CompileDate); + if (lastFlowLog.Count > 0) + { + foreach (var item in lastFlowLog) + { + item.CurrentScore = item.CurrentScore - (oldS - log.CurrentScore); + Funs.DB.SubmitChanges(); + } + } + var lastScoreUser = BLL.ScoreUserService.GetScoreUserByCompileDate(user.IdentityCard, su.Year, su.CompileDate); + if (lastScoreUser.Count > 0) + { + foreach (var item in lastScoreUser) + { + item.Score = item.Score - (oldS - su.Score); + Funs.DB.SubmitChanges(); + } + } + } + #endregion } diff --git a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs index c3d16867..7e0b540c 100644 --- a/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs +++ b/SGGL/FineUIPro.Web/Check/HSE/CheckProblemIn.aspx.cs @@ -698,6 +698,82 @@ namespace FineUIPro.Web.Check.HSE { Funs.DB.CheckProblem_Safety.InsertAllOnSubmit(toInsert); Funs.DB.SubmitChanges(); + + #region 扣分记录 + toInsert = toInsert.OrderBy(x => x.CheckDate).ToList(); + foreach (var item in toInsert) + { + ScoreFlowLog log = new ScoreFlowLog(); + log.Id = SQLHelper.GetNewID(); + log.Year = item.CheckDate.Year; + log.UserId = item.RectificationUserId; + log.UserName = item.RectificationUserName; + var user = BLL.UserService.GetUserByUserId(item.RectificationUserId); + if (user != null) + { + log.IdentityCard = user.IdentityCard; + } + log.UnitId = item.UnitId; + log.ProjectId = item.ProjectId; + log.UnitName = item.UnitName; + log.ProjectName = item.ProjectName; + log.Item = "安全不符合项"; + log.LogContent = "隐患问责扣分"; + log.CheckDate = item.CheckDate; + log.CompileDate = DateTime.Now; + log.CompileMan = this.CurrUser.UserName; + log.CompileManId = this.CurrUser.UserId; + log.DataSourceId = item.CheckId; + log.Type = 0;//扣分 + //特别严重(管控红线)扣成0分,严重(危险作业许可)扣除100分,较大扣除50分,一般扣除20分,轻微扣除2分 + if (item.NatureId == BLL.Const.SafetyNatureIdN1) + { + var sfl = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(log.IdentityCard, log.Year, log.CompileDate); + if (sfl != null) + { + log.Score = -sfl.CurrentScore;//上一条记录多少分扣多少分 + } + else + { + log.Score = -100; + } + } + else if (item.NatureId == BLL.Const.SafetyNatureIdN2) + { + log.Score = -100; + } + else if (item.NatureId == BLL.Const.SafetyNatureIdN3) + { + log.Score = -50; + } + else if (item.NatureId == BLL.Const.SafetyNatureIdN4) + { + log.Score = -20; + } + var cs = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(log.IdentityCard, log.Year, log.CompileDate); + if (cs != null) + { + log.CurrentScore = cs.CurrentScore + log.Score;//记分后人员得分值 + } + else + { + log.CurrentScore = 100 + log.Score; + } + + BLL.ScoreFlowLogService.AddScoreFlowLog(log); + + ScoreUser su = new ScoreUser(); + su.Id = SQLHelper.GetNewID(); + su.Year = log.Year; + su.IdentityCard = log.IdentityCard; + su.Score = log.CurrentScore; + su.UserName = log.UserName; + su.CompileDate = log.CompileDate; + su.DataSourceId = log.DataSourceId; + su.CheckDate = log.CheckDate; + BLL.ScoreUserService.AddScoreUser(su); + } + #endregion } ShowNotify($"成功导入 {toInsert.Count} 条记录。", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx new file mode 100644 index 00000000..a4932667 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx @@ -0,0 +1,140 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnergyStatistics.aspx.cs" Inherits="FineUIPro.Web.EnergyReport.EnergyStatistics" %> + +<%@ Register Src="~/Controls/UnitProjectTControl.ascx" TagName="UnitProjectTControl" TagPrefix="uc1" %> + + + + + + 能源统计 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.cs new file mode 100644 index 00000000..32e7f1b2 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.cs @@ -0,0 +1,326 @@ +using BLL; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.EnergyReport +{ + public partial class EnergyStatistics : PageBase + { + #region 项目id + /// + /// 项目id + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BLL.EnergySettingsService.InitEnergyDropDownList(this.drpEnergyId, true); + Funs.DropDownPageSize(this.ddlPageSize); + this.ProjectId = this.CurrUser.LoginProjectId; + if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId) + { + this.ProjectId = Request.Params["projectId"]; + } + ////权限按钮方法 + this.ucTree.UnitId = this.CurrUser.UnitId; + this.ucTree.ProjectId = this.ProjectId; + if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) + { + this.panelLeftRegion.Hidden = true; + ////权限按钮方法 + this.GetButtonPower(); + } + else + { + this.btnNew.Hidden = true; + this.btnMenuModify.Hidden = true; + this.btnMenuDel.Hidden = true; + this.Grid1.EnableRowDoubleClickEvent = false; + } + if (this.CurrUser != null && this.CurrUser.PageSize.HasValue) + { + Grid1.PageSize = this.CurrUser.PageSize.Value; + } + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + this.BindGrid(); + btnNew.OnClientClick = Window1.GetShowReference("EnergyStatisticsEdit.aspx") + "return false;"; + } + } + + /// + /// 加载树 + /// + /// + /// + protected void changeTree(object sender, EventArgs e) + { + this.ProjectId = this.ucTree.ProjectId; + this.BindGrid(); + this.GetButtonPower(); + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + if (string.IsNullOrEmpty(this.ProjectId)) + { + return; + } + string strSql = @"select s.EnergyStatisticsId, + s.ProjectId, + s.UnitId, + s.ReportDate, + s.EnergyId, + s.Consumption, + s.Amount, + s.UnitPrice, + s.ConversionUnit, + s.ConvertedQuantity, + s.TCE, + s.CompileMan, + s.CompileDate, + y.EnergyName, + y.EnergyUnit, + y.ReferenceCoefficient, + p.ProjectName, + u.UnitName + from EnergyReport_EnergyStatistics s + left join Base_Energy y on y.EnergyId = s.EnergyId + left join Base_Project p on p.ProjectId = s.ProjectId + left join Base_Unit u on u.UnitId= s.UnitId WHERE 1=1 "; + List listStr = new List(); + + strSql += " AND s.ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); + if (!string.IsNullOrEmpty(this.drpEnergyId.SelectedValue) && this.drpEnergyId.SelectedValue != BLL.Const._Null) + { + strSql += " AND s.EnergyId = @energyId"; + listStr.Add(new SqlParameter("@energyId", this.drpEnergyId.SelectedValue)); + } + if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId)) + { + strSql += " AND s.UnitId =@unitId"; + listStr.Add(new SqlParameter("@unitId", this.CurrUser.UnitId)); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + + OutputSummaryData(tb);//求和 + } + + /// + /// 计算和 + /// + /// + private void OutputSummaryData(DataTable tb) + { + //decimal consumption = 0;//用量 + decimal amount = 0;//消费金额 + //decimal unitPrice = 0;//单价 + decimal convertedQuantity = 0; //转换吨标计量 + decimal tce = 0; //吨标煤 + foreach (DataRow row in tb.Rows) + { + //consumption += Convert.ToDecimal(row["Consumption"]); + amount += Convert.ToDecimal(row["Amount"]); + //unitPrice += Convert.ToDecimal(row["UnitPrice"]); + convertedQuantity += Convert.ToDecimal(row["ConvertedQuantity"]); + tce += Convert.ToDecimal(row["TCE"]); + } + + JObject summary = new JObject(); + summary.Add("EnergyName", "能源合计"); + //summary.Add("Consumption", consumption.ToString("F2")); + summary.Add("Amount", amount.ToString("F2")); + //summary.Add("UnitPrice", unitPrice.ToString("F2")); + summary.Add("ConvertedQuantity", convertedQuantity.ToString("G7")); + summary.Add("TCE", tce.ToString("G5")); + + Grid1.SummaryData = summary; + + } + #endregion + + #region 分页、排序 + /// + /// 改变索引事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + + /// + /// 分页下拉选择事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void drpEnergyId_SelectedIndexChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 关闭弹出窗 + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + #endregion + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (string.IsNullOrEmpty(this.ProjectId)) + { + return; + } + if (Request.Params["value"] == "0") ///文件柜时 没有操作权限 + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.EnergyStatisticsMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnMenuModify.Hidden = false; + this.Grid1.EnableRowDoubleClickEvent = true; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDel.Hidden = false; + } + } + } + #endregion + + #region 编辑 + /// + /// 编辑按钮 + /// + /// + /// + protected void btnMenuModify_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EnergyStatisticsEdit.aspx?energyStatisticsId={0}", this.Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + #region Grid双击事件 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + btnMenuModify_Click(null, null); + } + #endregion + + #region 删除 + /// + /// 批量删除 + /// + /// + /// + protected void btnMenuDel_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + var db = Funs.DB; + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + if (!string.IsNullOrEmpty(rowID)) + { + BLL.EnergyStatisticsService.DeleteEnergyStatisticsById(rowID); + BLL.LogService.AddSys_Log(this.CurrUser, rowID, rowID, BLL.Const.EnergyStatisticsMenuId, BLL.Const.BtnDelete); + } + } + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.designer.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.designer.cs new file mode 100644 index 00000000..05289470 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatistics.aspx.designer.cs @@ -0,0 +1,215 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.EnergyReport +{ + + + public partial class EnergyStatistics + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// ContentPanel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel1; + + /// + /// ucTree 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Web.Controls.UnitProjectTControl ucTree; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// drpEnergyId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpEnergyId; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// gfCurrentMonth 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.GroupField gfCurrentMonth; + + /// + /// GroupField1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.GroupField GroupField1; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuModify 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuModify; + + /// + /// btnMenuDel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDel; + } +} diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx new file mode 100644 index 00000000..0eb184cc --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx @@ -0,0 +1,69 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnergyStatisticsEdit.aspx.cs" Inherits="FineUIPro.Web.EnergyReport.EnergyStatisticsEdit" %> + + + + + + + 编辑能源统计 + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.cs new file mode 100644 index 00000000..0c87a54d --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.cs @@ -0,0 +1,313 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.EnergyReport +{ + public partial class EnergyStatisticsEdit : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string EnergyStatisticsId + { + get + { + return (string)ViewState["EnergyStatisticsId"]; + } + set + { + ViewState["EnergyStatisticsId"] = value; + } + } + /// + /// 项目主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + + + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList1(this.drpUnitId, this.CurrUser.LoginProjectId, true); + BLL.EnergySettingsService.InitEnergyDropDownList(this.drpEnergyId, true); + this.EnergyStatisticsId = Request.Params["energyStatisticsId"]; + if (!string.IsNullOrEmpty(EnergyStatisticsId)) + { + Model.EnergyReport_EnergyStatistics energyStatistics = BLL.EnergyStatisticsService.GetEnergyStatisticsById(this.EnergyStatisticsId); + if (energyStatistics != null) + { + if (!string.IsNullOrEmpty(energyStatistics.UnitId)) + { + this.drpUnitId.SelectedValue = energyStatistics.UnitId; + } + if (energyStatistics.ReportDate != null) + { + this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", energyStatistics.ReportDate); + } + if (!string.IsNullOrEmpty(energyStatistics.EnergyId)) + { + this.drpEnergyId.SelectedValue = energyStatistics.EnergyId; + var energy = BLL.EnergySettingsService.GetEnergyById(this.drpEnergyId.SelectedValue); + if (energy != null) + { + if (!string.IsNullOrEmpty(energy.EnergyUnit)) + { + this.txtEnergyUnit.Text = energy.EnergyUnit; + } + } + } + this.txtConsumption.Text = energyStatistics.Consumption.HasValue ? energyStatistics.Consumption.ToString() : ""; ; + this.txtAmount.Text = energyStatistics.Amount.HasValue ? energyStatistics.Amount.ToString() : ""; + this.txtUnitPrice.Text = energyStatistics.UnitPrice.HasValue ? energyStatistics.UnitPrice.ToString() : ""; + if (!string.IsNullOrEmpty(energyStatistics.ConversionUnit)) + { + this.drpConversionUnit.SelectedValue = energyStatistics.ConversionUnit; + } + this.txtConvertedQuantity.Text = energyStatistics.ConvertedQuantity.HasValue ? energyStatistics.ConvertedQuantity.ToString() : ""; + this.txtTCE.Text = energyStatistics.TCE.HasValue ? energyStatistics.TCE.ToString() : ""; + } + } + else + { + this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); + } + } + } + #endregion + + #region 保存按钮 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + if (this.drpUnitId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpUnitId.SelectedValue)) + { + Alert.ShowInTop("请选择单位!", MessageBoxIcon.Warning); + return; + } + if (this.drpEnergyId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpEnergyId.SelectedValue)) + { + Alert.ShowInTop("请选择能源名称!", MessageBoxIcon.Warning); + return; + } + this.SaveData(); + ShowNotify("保存成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + + } + #endregion + + #region 保存方法 + /// + /// 保存数据 + /// + /// + private void SaveData() + { + Model.EnergyReport_EnergyStatistics newData = new Model.EnergyReport_EnergyStatistics(); + newData.ProjectId = this.CurrUser.LoginProjectId; + newData.UnitId = this.drpUnitId.SelectedValue; + if (!string.IsNullOrEmpty(this.txtReportDate.Text.Trim())) + { + try + { + newData.ReportDate = Convert.ToDateTime(this.txtReportDate.Text.Trim()); + } + catch { } + } + newData.EnergyId = this.drpEnergyId.SelectedValue; + newData.Consumption = Funs.GetNewDecimalOrZero(this.txtConsumption.Text.Trim()); + newData.Amount = Funs.GetNewDecimalOrZero(this.txtAmount.Text.Trim()); + newData.UnitPrice = Funs.GetNewDecimalOrZero(this.txtUnitPrice.Text.Trim()); + if (!string.IsNullOrEmpty(this.drpConversionUnit.SelectedValue)) + { + newData.ConversionUnit = this.drpConversionUnit.SelectedValue.Trim(); + } + newData.ConvertedQuantity = Funs.GetNewDecimalOrZero(this.txtConvertedQuantity.Text.Trim()); + newData.TCE = Funs.GetNewDecimalOrZero(this.txtTCE.Text.Trim()); + + if (!string.IsNullOrEmpty(this.EnergyStatisticsId)) + { + newData.EnergyStatisticsId = this.EnergyStatisticsId; + BLL.EnergyStatisticsService.UpdateEnergyStatistics(newData); + BLL.LogService.AddSys_Log(this.CurrUser, this.drpEnergyId.SelectedText, this.EnergyStatisticsId, BLL.Const.EnergyStatisticsMenuId, Const.BtnModify); + } + else + { + newData.CompileMan = this.CurrUser.UserId; + newData.CompileDate = DateTime.Now; + newData.EnergyStatisticsId = SQLHelper.GetNewID(); + this.EnergyStatisticsId = newData.EnergyStatisticsId; + BLL.EnergyStatisticsService.AddEnergyStatistics(newData); + BLL.LogService.AddSys_Log(this.CurrUser, this.drpEnergyId.SelectedText, this.EnergyStatisticsId, BLL.Const.EnergyStatisticsMenuId, Const.BtnAdd); + } + } + #endregion + + #region 联动事件 + /// + /// 能源下拉选择事件 + /// + /// + /// + protected void drpEnergyId_SelectedIndexChanged(object sender, EventArgs e) + { + this.txtEnergyUnit.Text = string.Empty; + if (this.drpEnergyId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpEnergyId.SelectedValue)) + { + var energy = BLL.EnergySettingsService.GetEnergyById(this.drpEnergyId.SelectedValue); + if (energy != null) + { + this.txtEnergyUnit.Text = energy.EnergyUnit; + } + } + } + + /// + /// 单价=消费金额/转换量 + /// + /// + /// + protected void txtAmount_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.txtAmount.Text.Trim())) + { + decimal a = Funs.GetNewDecimalOrZero(this.txtAmount.Text.Trim()); + decimal b = Funs.GetNewDecimalOrZero(this.txtConvertedQuantity.Text.Trim()); + if (b > 0) + { + txtUnitPrice.Text = (a / b).ToString(); + } + } + else + { + txtUnitPrice.Text = "0.00"; + } + } + + /// + /// 转换吨标计量=用量*不同能源不同值 + /// 吨标煤=转换量*参考折标准煤系数 + /// + /// + /// + protected void txtConsumption_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.txtConsumption.Text.Trim()) && this.drpEnergyId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpEnergyId.SelectedValue)) + { + decimal c = Funs.GetNewDecimalOrZero(this.txtConsumption.Text.Trim()); + var energy = BLL.EnergySettingsService.GetEnergyById(this.drpEnergyId.SelectedValue); + if (energy != null) + { + if (energy.EnergyName.Trim() == "电力") + { + this.drpConversionUnit.SelectedValue = "万千瓦时"; + this.txtConvertedQuantity.Text = (c / 10000).ToString(); + this.txtTCE.Text = ((c / 10000) * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "汽油") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = (c * Convert.ToDecimal(0.73) / 1000).ToString(); + this.txtTCE.Text = ((c * Convert.ToDecimal(0.73) / 1000) * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "柴油") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = (c * Convert.ToDecimal(0.86) / 1000).ToString(); + this.txtTCE.Text = ((c * Convert.ToDecimal(0.86) / 1000) * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "煤油") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = (c * Convert.ToDecimal(0.82) / 1000).ToString(); + this.txtTCE.Text = ((c * Convert.ToDecimal(0.82) / 1000) * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "燃料油") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = (c * Convert.ToDecimal(0.91) / 1000).ToString(); + this.txtTCE.Text = ((c * Convert.ToDecimal(0.91) / 1000) * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "润滑油") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = (c * Convert.ToDecimal(0.8) / 1000).ToString(); + this.txtTCE.Text = ((c * Convert.ToDecimal(0.8) / 1000) * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "外购热力") + { + this.drpConversionUnit.SelectedValue = "百万千焦"; + this.txtConvertedQuantity.Text = (c * Convert.ToDecimal(0.81)).ToString(); + this.txtTCE.Text = (c * Convert.ToDecimal(0.81) * energy.ReferenceCoefficient / 6).ToString(); + } + else if (energy.EnergyName.Trim() == "煤炭") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = c.ToString(); + this.txtTCE.Text = (c * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "焦炭") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = c.ToString(); + this.txtTCE.Text = (c * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "管道煤气") + { + this.drpConversionUnit.SelectedValue = "立方米"; + this.txtConvertedQuantity.Text = c.ToString(); + this.txtTCE.Text = (c * energy.ReferenceCoefficient / 1000).ToString(); + } + else if (energy.EnergyName.Trim() == "天然气(气态)") + { + this.drpConversionUnit.SelectedValue = "立方米"; + this.txtConvertedQuantity.Text = c.ToString(); + this.txtTCE.Text = (c * energy.ReferenceCoefficient / 1000).ToString(); + } + else if (energy.EnergyName.Trim() == "液化天然气(液态)") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = c.ToString(); + this.txtTCE.Text = (c * energy.ReferenceCoefficient).ToString(); + } + else if (energy.EnergyName.Trim() == "液化石油气") + { + this.drpConversionUnit.SelectedValue = "吨"; + this.txtConvertedQuantity.Text = c.ToString(); + this.txtTCE.Text = (c * energy.ReferenceCoefficient).ToString(); + } + } + } + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.designer.cs new file mode 100644 index 00000000..43807e10 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyStatisticsEdit.aspx.designer.cs @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.EnergyReport +{ + + + public partial class EnergyStatisticsEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// drpUnitId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnitId; + + /// + /// txtReportDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtReportDate; + + /// + /// drpEnergyId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpEnergyId; + + /// + /// txtEnergyUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEnergyUnit; + + /// + /// txtConsumption 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtConsumption; + + /// + /// txtAmount 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtAmount; + + /// + /// txtUnitPrice 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtUnitPrice; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// drpConversionUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpConversionUnit; + + /// + /// txtConvertedQuantity 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtConvertedQuantity; + + /// + /// txtTCE 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtTCE; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + } +} diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx new file mode 100644 index 00000000..3777da3b --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx @@ -0,0 +1,150 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnergyWaterConservation.aspx.cs" Inherits="FineUIPro.Web.EnergyReport.EnergyWaterConservation" %> + + + + + + + 节能节水 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.cs new file mode 100644 index 00000000..35de6be1 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.cs @@ -0,0 +1,332 @@ +using BLL; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.EnergyReport +{ + public partial class EnergyWaterConservation : PageBase + { + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + + if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) + { + ////权限按钮方法 + this.GetButtonPower(); + this.drpProjectId.Hidden = true; + this.Grid1.Columns[1].Hidden = true; + } + else + { + BLL.ProjectService.InitAllProjectDropDownList(this.drpProjectId, true); + this.btnNew.Hidden = true; + this.btnImport.Hidden = true; + } + + btnNew.OnClientClick = Window1.GetShowReference("EnergyWaterConservationEdit.aspx") + "return false;"; + btnImport.OnClientClick = Window1.GetShowReference("EnergyWaterConservationIn.aspx") + "return false;"; + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + private DataTable tb = null; + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = @"SELECT W.EnergyWaterConservationId, + W.ProjectId, + W.EnergySavingIndex, + W.WaterSavingIndex, + W.EnergySavingSchemes, + W.WaterSavingSchemes, + W.SelfEvaluation, + W.Summary, + W.SupportingDocuments, + W.ActualEnergySaving, + W.ActualWaterSaving, + ISNULL(CAST(W.EnergySavingCompletionRate AS VARCHAR(50)),'0') + '%' AS EnergySavingCompletionRate, + ISNULL(CAST(W.WaterSavingCompletionRate AS VARCHAR(50)),'0') + '%' AS WaterSavingCompletionRate, + W.CompileMan, + W.CompileDate, + W.Remarks, + P.ProjectName + FROM EnergyReport_EnergyWaterConservation W + LEFT JOIN Base_Project P on P.ProjectId = W.ProjectId WHERE 1=1 "; + List listStr = new List(); + if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) + { + strSql += " AND W.ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); + } + else + { + if (this.drpProjectId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpProjectId.SelectedValue)) + { + strSql += " AND W.ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", this.drpProjectId.SelectedValue)); + } + } + SqlParameter[] parameter = listStr.ToArray(); + tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + + OutputSummaryData(); + } + #endregion + + private void OutputSummaryData() + { + int EnergySavingIndex = 0; + int WaterSavingIndex = 0; + int ActualEnergySaving = 0; + int ActualWaterSaving = 0; + foreach (DataRow row in tb.Rows) + { + EnergySavingIndex += Convert.ToInt32(row["EnergySavingIndex"]); + WaterSavingIndex += Convert.ToInt32(row["WaterSavingIndex"]); + ActualEnergySaving += Convert.ToInt32(row["ActualEnergySaving"]); + ActualWaterSaving += Convert.ToInt32(row["ActualWaterSaving"]); + } + JObject summary = new JObject(); + if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) + { + summary.Add("tfNumber", "合计"); + } + else + { + summary.Add("ProjectName", "合计"); + } + summary.Add("EnergySavingIndex", EnergySavingIndex.ToString()); + summary.Add("WaterSavingIndex", WaterSavingIndex.ToString()); + summary.Add("ActualEnergySaving", ActualEnergySaving.ToString()); + summary.Add("ActualWaterSaving", ActualWaterSaving.ToString()); + + if (EnergySavingIndex > 0) + { + double rate = (double)ActualEnergySaving / EnergySavingIndex * 100; + int roundRate = (int)Math.Round(rate); + summary.Add("EnergySavingCompletionRate", roundRate + "%"); + } + else + { + summary.Add("EnergySavingCompletionRate", "0%"); + } + if (WaterSavingIndex > 0) + { + double rate = (double)ActualWaterSaving / WaterSavingIndex * 100; + int roundRate = (int)Math.Round(rate); + summary.Add("WaterSavingCompletionRate", roundRate + "%"); + } + else + { + summary.Add("WaterSavingCompletionRate", "0%"); + } + Grid1.SummaryData = summary; + } + + #region 表排序、分页、关闭窗口 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + #endregion + + #region Grid双击事件 + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + btnMenuModify_Click(null, null); + } + #endregion + + #region 编辑 + /// + /// 编辑按钮 + /// + /// + /// + protected void btnMenuModify_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EnergyWaterConservationEdit.aspx?energyWaterConservationId={0}", this.Grid1.SelectedRowID, "编辑 - "))); + } + #endregion + + #region 删除 + /// + /// 批量删除 + /// + /// + /// + protected void btnMenuDel_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + var db = Funs.DB; + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + if (!string.IsNullOrEmpty(rowID)) + { + BLL.EnergyWaterConservationService.DeleteEnergyWaterConservationById(rowID); + BLL.LogService.AddSys_Log(this.CurrUser, rowID, rowID, BLL.Const.EnergyWaterConservationMenuId, BLL.Const.BtnDelete); + } + } + BindGrid(); + ShowNotify("删除数据成功!"); + } + } + #endregion + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + try + { + if (Request.Params["value"] == "0") + { + return; + } + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.EnergyWaterConservationMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnMenuModify.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDel.Hidden = false; + } + } + } + catch (Exception e) + { + + } + } + #endregion + + #region Grid行点击事件 + /// + /// Grid行点击事件 + /// + /// + /// + protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) + { + + } + #endregion + + #region 查询 + protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 附件显示 + /// + /// 附件显示 + /// + /// + /// + protected string ConvertAttachUrl(object id) + { + string url = string.Empty; + if (id != null) + { + var report = BLL.EnergyWaterConservationService.GetEnergyWaterConservationById(id.ToString()); + if (report != null) + { + Model.AttachFile file = Funs.DB.AttachFile.FirstOrDefault(e => e.ToKeyId == id.ToString()); + if (file != null && !string.IsNullOrEmpty(file.AttachUrl)) + { + url = BLL.UploadAttachmentService.ShowAttachment("../", file.AttachUrl); + } + } + } + return url; + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.designer.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.designer.cs new file mode 100644 index 00000000..5c122de5 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservation.aspx.designer.cs @@ -0,0 +1,179 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.EnergyReport +{ + + + public partial class EnergyWaterConservation + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// drpProjectId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpProjectId; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// labNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label labNumber; + + /// + /// labAttachFile 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label labAttachFile; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuModify 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuModify; + + /// + /// btnMenuDel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDel; + } +} diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx new file mode 100644 index 00000000..4849fec3 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx @@ -0,0 +1,86 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnergyWaterConservationEdit.aspx.cs" Inherits="FineUIPro.Web.EnergyReport.EnergyWaterConservationEdit" %> + + + + + + + 编辑节能节水 + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.cs new file mode 100644 index 00000000..58e4a86b --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.cs @@ -0,0 +1,227 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.EnergyReport +{ + public partial class EnergyWaterConservationEdit : PageBase + { + #region 定义变量 + /// + /// 主键 + /// + public string EnergyWaterConservationId + { + get + { + return (string)ViewState["EnergyWaterConservationId"]; + } + set + { + ViewState["EnergyWaterConservationId"] = value; + } + } + /// + /// 项目主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + + + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) + { + this.drpProjectId.Hidden = true; + this.ProjectId = this.CurrUser.LoginProjectId; + } + else + { + BLL.ProjectService.InitAllProjectDropDownList(this.drpProjectId, true); + } + this.EnergyWaterConservationId = Request.Params["energyWaterConservationId"]; + if (!string.IsNullOrEmpty(EnergyWaterConservationId)) + { + Model.EnergyReport_EnergyWaterConservation energyWaterConservation = BLL.EnergyWaterConservationService.GetEnergyWaterConservationById(this.EnergyWaterConservationId); + if (energyWaterConservation != null) + { + if (!string.IsNullOrEmpty(energyWaterConservation.ProjectId)) + { + this.drpProjectId.SelectedValue = energyWaterConservation.ProjectId; + } + txtEnergySavingIndex.Text = energyWaterConservation.EnergySavingIndex.HasValue ? energyWaterConservation.EnergySavingIndex.ToString() : ""; + txtWaterSavingIndex.Text = energyWaterConservation.WaterSavingIndex.HasValue ? energyWaterConservation.WaterSavingIndex.ToString() : ""; + txtEnergySavingSchemes.Text = energyWaterConservation.EnergySavingSchemes; + txtWaterSavingSchemes.Text = energyWaterConservation.WaterSavingSchemes; + txtSelfEvaluation.Text = energyWaterConservation.SelfEvaluation; + txtSummary.Text = energyWaterConservation.Summary; + txtActualEnergySaving.Text = energyWaterConservation.ActualEnergySaving.HasValue ? energyWaterConservation.ActualEnergySaving.ToString() : ""; + txtActualWaterSaving.Text = energyWaterConservation.ActualWaterSaving.HasValue ? energyWaterConservation.ActualWaterSaving.ToString() : ""; + txtEnergySavingCompletionRate.Text = energyWaterConservation.EnergySavingCompletionRate.HasValue ? energyWaterConservation.EnergySavingCompletionRate.ToString() + "%" : ""; + txtWaterSavingCompletionRate.Text = energyWaterConservation.WaterSavingCompletionRate.HasValue ? energyWaterConservation.WaterSavingCompletionRate.ToString() + "%" : ""; + } + } + } + } + #endregion + + #region 保存按钮 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + this.SaveData(); + ShowNotify("保存成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + + } + #endregion + + #region 保存方法 + /// + /// 保存数据 + /// + /// + private void SaveData() + { + Model.EnergyReport_EnergyWaterConservation newData = new Model.EnergyReport_EnergyWaterConservation(); + newData.ProjectId = this.CurrUser.LoginProjectId; + newData.EnergySavingIndex = Funs.GetNewIntOrZero(this.txtEnergySavingIndex.Text.Trim()); + newData.WaterSavingIndex = Funs.GetNewIntOrZero(this.txtWaterSavingIndex.Text.Trim()); + newData.EnergySavingSchemes = this.txtEnergySavingSchemes.Text; + newData.WaterSavingSchemes = this.txtWaterSavingSchemes.Text; + newData.SelfEvaluation = this.txtSelfEvaluation.Text; + newData.Summary = this.txtSummary.Text; + newData.ActualEnergySaving = Funs.GetNewIntOrZero(this.txtActualEnergySaving.Text.Trim()); + newData.ActualWaterSaving = Funs.GetNewIntOrZero(this.txtActualWaterSaving.Text.Trim()); + if (!string.IsNullOrEmpty(this.txtEnergySavingCompletionRate.Text.Trim())) + { + string ERate = this.txtEnergySavingCompletionRate.Text.TrimEnd('%').Trim(); + newData.EnergySavingCompletionRate = Funs.GetNewIntOrZero(ERate); + } + if (!string.IsNullOrEmpty(this.txtWaterSavingCompletionRate.Text.Trim())) + { + string WRate = this.txtWaterSavingCompletionRate.Text.TrimEnd('%').Trim(); + newData.WaterSavingCompletionRate = Funs.GetNewIntOrZero(WRate); + } + + if (!string.IsNullOrEmpty(this.EnergyWaterConservationId)) + { + newData.EnergyWaterConservationId = this.EnergyWaterConservationId; + BLL.EnergyWaterConservationService.UpdateEnergyWaterConservation(newData); + BLL.LogService.AddSys_Log(this.CurrUser, this.EnergyWaterConservationId, this.EnergyWaterConservationId, BLL.Const.EnergyWaterConservationMenuId, Const.BtnModify); + } + else + { + newData.CompileMan = this.CurrUser.UserId; + newData.CompileDate = DateTime.Now; + newData.EnergyWaterConservationId = SQLHelper.GetNewID(); + this.EnergyWaterConservationId = newData.EnergyWaterConservationId; + BLL.EnergyWaterConservationService.AddEnergyWaterConservation(newData); + BLL.LogService.AddSys_Log(this.CurrUser, this.EnergyWaterConservationId, this.EnergyWaterConservationId, BLL.Const.EnergyWaterConservationMenuId, Const.BtnAdd); + } + } + #endregion + + #region 计算比例 + /// + /// 计算实际节能(吨标煤) + /// + /// + /// + protected void txtEnergySavingIndex_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.txtEnergySavingIndex.Text.Trim()) && !string.IsNullOrEmpty(this.txtActualEnergySaving.Text.Trim())) + { + int a = Funs.GetNewIntOrZero(this.txtActualEnergySaving.Text.Trim()); + int b = Funs.GetNewIntOrZero(this.txtEnergySavingIndex.Text.Trim()); + if (b > 0) + { + double rate = (double)a / b * 100; + int roundRate = (int)Math.Round(rate); + this.txtEnergySavingCompletionRate.Text = roundRate + "%"; + } + else + { + this.txtEnergySavingCompletionRate.Text = "0%"; + } + } + else + { + this.txtEnergySavingCompletionRate.Text = string.Empty; + } + } + + /// + /// 计算实际节水(吨) + /// + /// + /// + protected void txtWaterSavingIndex_TextChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.txtWaterSavingIndex.Text.Trim()) && !string.IsNullOrEmpty(this.txtActualWaterSaving.Text.Trim())) + { + int a = Funs.GetNewIntOrZero(this.txtActualWaterSaving.Text.Trim()); + int b = Funs.GetNewIntOrZero(this.txtWaterSavingIndex.Text.Trim()); + if (b > 0) + { + double rate = (double)a / b * 100; + int roundRate = (int)Math.Round(rate); + this.txtWaterSavingCompletionRate.Text = roundRate + "%"; + } + else + { + this.txtWaterSavingCompletionRate.Text = "0%"; + } + } + else + { + this.txtWaterSavingCompletionRate.Text = string.Empty; + } + } + #endregion + + #region 附件上传 + /// + /// 上传附件 + /// + /// + /// + protected void btnAttachUrl_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.EnergyWaterConservationId)) + { + SaveData(); + } + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/EnergyWaterConservationAttachUrl&menuId={1}", this.EnergyWaterConservationId, BLL.Const.EnergyWaterConservationMenuId))); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.designer.cs new file mode 100644 index 00000000..04fe3217 --- /dev/null +++ b/SGGL/FineUIPro.Web/EnergyReport/EnergyWaterConservationEdit.aspx.designer.cs @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.EnergyReport +{ + + + public partial class EnergyWaterConservationEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// drpProjectId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpProjectId; + + /// + /// txtEnergySavingIndex 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtEnergySavingIndex; + + /// + /// txtWaterSavingIndex 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtWaterSavingIndex; + + /// + /// txtEnergySavingSchemes 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtEnergySavingSchemes; + + /// + /// txtWaterSavingSchemes 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtWaterSavingSchemes; + + /// + /// txtSelfEvaluation 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtSelfEvaluation; + + /// + /// txtSummary 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtSummary; + + /// + /// txtActualEnergySaving 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtActualEnergySaving; + + /// + /// txtActualWaterSaving 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtActualWaterSaving; + + /// + /// txtEnergySavingCompletionRate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtEnergySavingCompletionRate; + + /// + /// txtWaterSavingCompletionRate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtWaterSavingCompletionRate; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// WindowAtt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window WindowAtt; + } +} diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 9a501d63..645dd009 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -244,6 +244,7 @@ + @@ -338,8 +339,14 @@ + + + + + + @@ -659,6 +666,10 @@ + + + + @@ -3246,6 +3257,7 @@ + @@ -7781,6 +7793,13 @@ CNProfessionalView.aspx + + EnergySettings.aspx + ASPXCodeBehind + + + EnergySettings.aspx + QualityProblemNature.aspx ASPXCodeBehind @@ -10380,6 +10399,34 @@ InOutRecord.aspx + + EnergyStatistics.aspx + ASPXCodeBehind + + + EnergyStatistics.aspx + + + EnergyStatisticsEdit.aspx + ASPXCodeBehind + + + EnergyStatisticsEdit.aspx + + + EnergyWaterConservation.aspx + ASPXCodeBehind + + + EnergyWaterConservation.aspx + + + EnergyWaterConservationEdit.aspx + ASPXCodeBehind + + + EnergyWaterConservationEdit.aspx + Components.aspx ASPXCodeBehind @@ -17759,6 +17806,13 @@ imageUp.ashx + + ScoreFlowLog.aspx + ASPXCodeBehind + + + ScoreFlowLog.aspx + SafetyBriefing.aspx @@ -20305,7 +20359,7 @@ - + diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index b4ec9ad1..795045c7 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -1,11 +1,17 @@ namespace FineUIPro.Web { - using System; - using System.Configuration; - using System.Globalization; - using System.Text; using BLL; + using FineUIPro.Web.Score; using Model; + using NPOI.SS.Formula.Functions; + using System; + using System.Collections.Generic; + using System.Configuration; + using System.Data.SqlClient; + using System.Globalization; + using System.Linq; + using System.Text; + using System.Windows.Forms; public class Global : System.Web.HttpApplication { @@ -33,11 +39,10 @@ ErrLogInfo.WriteLog(string.Empty, ex); //AppDomain.Unload(AppDomain.CurrentDomain); } - - ////通用定时器 + //通用定时器 try { - ErrLogInfo.WriteLog("通用定时器开启!" ); + ErrLogInfo.WriteLog("通用定时器开启!"); QuartzServices.Init(); ErrLogInfo.WriteLog("通用定时器结束!"); } @@ -45,6 +50,485 @@ { ErrLogInfo.WriteLog("通用定时器!", ex); } + // 开启线程 + System.Threading.Thread LoadServiceData = new System.Threading.Thread(new System.Threading.ThreadStart(EduTrainAddScore)); + LoadServiceData.Start(); + } + + private void EduTrainAddScore() + { + //定义一个定时器,并开启和配置相关属性 + System.Timers.Timer Wtimer = new System.Timers.Timer(); + //执行任务的周期 ,60分钟 + Wtimer.Interval =1000 * 60 * 60; //120000; + Wtimer.Enabled = true; + Wtimer.Start(); + Wtimer.Elapsed += new System.Timers.ElapsedEventHandler(Wtimer_Elapsed); + } + + /// + /// 培训考试加分 + /// + /// + /// + void Wtimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + //考试大于等于80分通过,且没有加过分的记录,加分 + var testRecordList = (from x in Funs.DB.View_Training_TestRecord where x.TestScores >= 80 + && !Funs.DB.ScoreFlowLog.Any(log => log.DataSourceId == x.TestRecordId) + orderby x.TestStartTime select x).ToList(); + foreach (var item in testRecordList) + { + //查找最新一条积分记录 + var flowLog = BLL.ScoreFlowLogService.GetScoreFlowLogByIdentityCard(item.IdentityCard, item.TestStartTime.Value.Year, DateTime.Now); + + //作业人员考试加分 + if (item.WorkPostType == "一般作业岗位" || item.WorkPostType == "特种作业人员") + { + //必修-岗位基本操作技能:一门专业课20分,最高20分;超过1门课程,多出的学习课程每门2分 + if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId3) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【岗位基本操作技能】") orderby x.CompileDate descending select x).ToList(); + //一个课程加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("岗位基本操作技能【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【岗位基本操作技能】"; + newlog.LogContent = "岗位基本操作技能【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + + if (scoreFlowLog.Count == 0) + { + newlog.Score = 20; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 20; + } + else + { + newlog.CurrentScore = 120; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //必修-通用安全知识:60分,每门10分,最高60分;超过6门课程,多出的学习课程每门2分 + else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId1) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【通用安全知识】") orderby x.CompileDate descending select x).ToList(); + //一个课程加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("通用安全知识【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【通用安全知识】"; + newlog.LogContent = "通用安全知识【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 6) + { + newlog.Score = 10; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 10; + } + else + { + newlog.CurrentScore = 110; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //选修加分 每节课2分,加分上线不限制,以年度为节点 + else + { + var isExist = (from x in Funs.DB.ScoreFlowLog + where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year + && x.Item.Contains(item.CompanyTrainingName) + && x.LogContent.Contains(item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】") + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (isExist == null) + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【" + item.CompanyTrainingName + "】"; + newlog.LogContent = item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + } + //管理人员考试加分 + else if (item.WorkPostType == "一般管理岗位" || item.WorkPostType == "特种管理人员") + { + //必修-知识方法工具,最少学习5门课程,一门5分;超过5门课程,多出的学习课程每门2分 + if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId2) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【知识方法工具】") orderby x.CompileDate descending select x).ToList(); + //一次考试加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("知识方法工具【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【知识方法工具】"; + newlog.LogContent = "知识方法工具【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 5) + { + newlog.Score = 5; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 5; + } + else + { + newlog.CurrentScore = 105; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //必修-生产受控管理,最少学习5门课程,一门5分;超过5门课程,多出的学习课程每门2分 + else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId4) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【生产受控管理】") orderby x.CompileDate descending select x).ToList(); + //一次考试加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("生产受控管理【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【生产受控管理】"; + newlog.LogContent = "生产受控管理【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 5) + { + newlog.Score = 5; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 5; + } + else + { + newlog.CurrentScore = 105; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + //必修-通用课程:通用安全知识:30分,每门10分,最高30分;超过3门课程,多出的学习课程每门2分 + else if (item.CompanyTrainingId == BLL.Const.CompanyTrainingId1) + { + var scoreFlowLog = (from x in Funs.DB.ScoreFlowLog where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year && x.Item.Contains("考试【通用安全知识】") orderby x.CompileDate descending select x).ToList(); + //一次考试加分一次 + var isExist = scoreFlowLog.Where(x => x.LogContent.Contains("通用安全知识【" + item.CompanyTrainingItemName + "】")).FirstOrDefault(); + if (isExist == null)//第一次加分 + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【通用安全知识】"; + newlog.LogContent = "通用安全知识【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + if (scoreFlowLog.Count < 3) + { + newlog.Score = 10; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 10; + } + else + { + newlog.CurrentScore = 110; + } + } + else + { + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + else //选修加分 每节课2分,加分上线不限制,以年度为节点 + { + var isExist = (from x in Funs.DB.ScoreFlowLog + where x.Type == 1 && x.IdentityCard == item.IdentityCard && x.Year == item.TestStartTime.Value.Year + && x.Item.Contains(item.CompanyTrainingName) + && x.LogContent.Contains(item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】") + orderby x.CompileDate descending + select x).FirstOrDefault(); + if (isExist == null) + { + //人员记分流水日志表 + Model.ScoreFlowLog newlog = new Model.ScoreFlowLog(); + newlog.Id = SQLHelper.GetNewID(); + newlog.Year = item.TestStartTime.Value.Year; + newlog.IdentityCard = item.IdentityCard; + newlog.UserName = item.PersonName; + newlog.PersonId = item.TestManId; + newlog.UnitId = item.UnitId; + newlog.ProjectId = item.ProjectId; + newlog.UnitName = item.UnitName; + newlog.ProjectName = item.ProjectName; + newlog.Type = 1; + newlog.Item = "考试【" + item.CompanyTrainingName + "】"; + newlog.LogContent = item.CompanyTrainingName + "【" + item.CompanyTrainingItemName + "】考试得分" + item.TestScores + "分后,加分"; + newlog.CompileDate = DateTime.Now; + newlog.CompileManId = ""; + newlog.CompileMan = ""; + newlog.DataSourceId = item.TestRecordId; + newlog.CheckDate = item.TestStartTime; + newlog.Score = 2; + if (flowLog != null) + { + newlog.CurrentScore = flowLog.CurrentScore + 2; + } + else + { + newlog.CurrentScore = 102; + } + BLL.ScoreFlowLogService.AddScoreFlowLog(newlog); + + //人员记分情况 + Model.ScoreUser newScoreUser = new ScoreUser(); + newScoreUser.Id = SQLHelper.GetNewID(); + newScoreUser.Year = newlog.Year; + newScoreUser.IdentityCard = item.IdentityCard; + newScoreUser.Score = newlog.CurrentScore; + newScoreUser.UserName = newlog.UserName; + newScoreUser.CompileDate = newlog.CompileDate; + newScoreUser.DataSourceId = newlog.DataSourceId; + newScoreUser.CheckDate = newlog.CheckDate; + BLL.ScoreUserService.AddScoreUser(newScoreUser); + } + } + } + } } protected void Session_Start(object sender, EventArgs e) diff --git a/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx b/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx new file mode 100644 index 00000000..175dbdb3 --- /dev/null +++ b/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx @@ -0,0 +1,117 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ScoreFlowLog.aspx.cs" Inherits="FineUIPro.Web.Score.ScoreFlowLog" %> + +<%@ Register Src="~/Controls/UnitProjectTControl.ascx" TagName="UnitProjectTControl" TagPrefix="uc1" %> + + + + + + 得分扣分记录流水日志 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.cs b/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.cs new file mode 100644 index 00000000..92f0c488 --- /dev/null +++ b/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.cs @@ -0,0 +1,256 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.Score +{ + public partial class ScoreFlowLog : PageBase + { + #region 项目主键 + /// + /// 项目主键 + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + this.ProjectId = this.CurrUser.LoginProjectId; + if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId) + { + this.ProjectId = Request.Params["projectId"]; + } + ////权限按钮方法 + this.ucTree.UnitId = this.CurrUser.UnitId; + this.ucTree.ProjectId = this.ProjectId; + if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) + { + this.panelLeftRegion.Hidden = true; + ////权限按钮方法 + this.GetButtonPower(); + } + + if (this.CurrUser != null && this.CurrUser.PageSize.HasValue) + { + Grid1.PageSize = this.CurrUser.PageSize.Value; + } + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + this.BindGrid(); + } + } + + /// + /// 加载树 + /// + /// + /// + protected void changeTree(object sender, EventArgs e) + { + this.ProjectId = this.ucTree.ProjectId; + this.BindGrid(); + this.GetButtonPower(); + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + if (string.IsNullOrEmpty(this.ProjectId)) + { + return; + } + string strSql = "select flowLog.Id, flowLog.Year, flowLog.IdentityCard, flowLog.UserName, flowLog.Type, (case when flowLog.Type=0 then '扣分' else '加分' end) as TypeName,flowLog.Score, flowLog.CurrentScore, flowLog.Item, flowLog.LogContent, flowLog.UserId, flowLog.PersonId, flowLog.UnitId, flowLog.ProjectId, flowLog.UnitName, flowLog.ProjectName, flowLog.Remark, flowLog.CompileDate, flowLog.CompileMan, flowLog.CompileManId from ScoreFlowLog flowLog WHERE 1=1 "; + List listStr = new List(); + + strSql += " AND flowLog.ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); + if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + strSql += " AND flowLog.UserName like @name"; + listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.drpType.SelectedValue)) + { + strSql += " AND flowLog.Type = @type"; + listStr.Add(new SqlParameter("@type", this.drpType.SelectedValue)); + } + if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId)) + { + strSql += " AND flowLog.UnitId =@unitId"; + listStr.Add(new SqlParameter("@unitId", this.CurrUser.UnitId)); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + /// + /// 改变索引事件 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + + /// + /// 分页下拉选择事件 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + //if (string.IsNullOrEmpty(this.ProjectId)) + //{ + // return; + //} + //if (Request.Params["value"] == "0") ///文件柜时 没有操作权限 + //{ + // return; + //} + //var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.TeamGroupMenuId); + //if (buttonList.Count() > 0) + //{ + // if (buttonList.Contains(BLL.Const.BtnAdd)) + // { + // //this.btnNew.Hidden = false; + // } + // if (buttonList.Contains(BLL.Const.BtnModify)) + // { + // //this.btnMenuEdit.Hidden = false; + // } + // if (buttonList.Contains(BLL.Const.BtnDelete)) + // { + // //this.btnMenuDelete.Hidden = false; + // } + //} + } + #endregion + + #region 导出按钮 + /// 导出按钮 + ///
+ /// + /// + protected void btnOut_Click(object sender, EventArgs e) + { + Response.ClearContent(); + string filename = Funs.GetNewFileName(); + Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("人员记分流水日志表" + filename, System.Text.Encoding.UTF8) + ".xls"); + Response.ContentType = "application/excel"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + this.Grid1.PageSize = 500; + this.BindGrid(); + Response.Write(GetGridTableHtml(Grid1)); + Response.End(); + } + + /// + /// 导出方法 + /// + /// + /// + private string GetGridTableHtml(Grid grid) + { + StringBuilder sb = new StringBuilder(); + sb.Append(""); + sb.Append(""); + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + sb.AppendFormat("", column.HeaderText); + } + sb.Append(""); + foreach (GridRow row in grid.Rows) + { + sb.Append(""); + foreach (GridColumn column in grid.Columns) + { + string html = row.Values[column.ColumnIndex].ToString(); + if (column.ColumnID == "tfNumber") + { + html = (row.FindControl("lblNumber") as AspNet.Label).Text; + } + if (column.ColumnID == "tfI") + { + html = (row.FindControl("lbI") as AspNet.Label).Text; + } + //sb.AppendFormat("", html); + sb.AppendFormat("", html); + } + + sb.Append(""); + } + + sb.Append("
{0}
{0}{0}
"); + + return sb.ToString(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.designer.cs b/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.designer.cs new file mode 100644 index 00000000..973e790f --- /dev/null +++ b/SGGL/FineUIPro.Web/Score/ScoreFlowLog.aspx.designer.cs @@ -0,0 +1,179 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Score +{ + + + public partial class ScoreFlowLog + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelLeftRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelLeftRegion; + + /// + /// ContentPanel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel ContentPanel1; + + /// + /// ucTree 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Web.Controls.UnitProjectTControl ucTree; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// drpType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpType; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// lbI 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbI; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 4ab1ff46..2edacb66 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -125,6 +125,9 @@ namespace Model partial void InsertBase_EmployeeSubgroup(Base_EmployeeSubgroup instance); partial void UpdateBase_EmployeeSubgroup(Base_EmployeeSubgroup instance); partial void DeleteBase_EmployeeSubgroup(Base_EmployeeSubgroup instance); + partial void InsertBase_Energy(Base_Energy instance); + partial void UpdateBase_Energy(Base_Energy instance); + partial void DeleteBase_Energy(Base_Energy instance); partial void InsertBase_Equipment(Base_Equipment instance); partial void UpdateBase_Equipment(Base_Equipment instance); partial void DeleteBase_Equipment(Base_Equipment instance); @@ -974,6 +977,12 @@ namespace Model partial void InsertEmergency_EmergencyTeamItem(Emergency_EmergencyTeamItem instance); partial void UpdateEmergency_EmergencyTeamItem(Emergency_EmergencyTeamItem instance); partial void DeleteEmergency_EmergencyTeamItem(Emergency_EmergencyTeamItem instance); + partial void InsertEnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics instance); + partial void UpdateEnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics instance); + partial void DeleteEnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics instance); + partial void InsertEnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation instance); + partial void UpdateEnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation instance); + partial void DeleteEnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation instance); partial void InsertEnvironmental_ArchitectureReport(Environmental_ArchitectureReport instance); partial void UpdateEnvironmental_ArchitectureReport(Environmental_ArchitectureReport instance); partial void DeleteEnvironmental_ArchitectureReport(Environmental_ArchitectureReport instance); @@ -2981,6 +2990,14 @@ namespace Model } } + public System.Data.Linq.Table Base_Energy + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Base_Equipment { get @@ -5245,6 +5262,22 @@ namespace Model } } + public System.Data.Linq.Table EnergyReport_EnergyStatistics + { + get + { + return this.GetTable(); + } + } + + public System.Data.Linq.Table EnergyReport_EnergyWaterConservation + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Environmental_ArchitectureReport { get @@ -10845,6 +10878,14 @@ namespace Model } } + public System.Data.Linq.Table View_Training_TestRecord + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table View_Training_TestTrainingItem { get @@ -23440,6 +23481,168 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Base_Energy")] + public partial class Base_Energy : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _EnergyId; + + private string _EnergyName; + + private string _EnergyUnit; + + private System.Nullable _ReferenceCoefficient; + + private EntitySet _EnergyReport_EnergyStatistics; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEnergyIdChanging(string value); + partial void OnEnergyIdChanged(); + partial void OnEnergyNameChanging(string value); + partial void OnEnergyNameChanged(); + partial void OnEnergyUnitChanging(string value); + partial void OnEnergyUnitChanged(); + partial void OnReferenceCoefficientChanging(System.Nullable value); + partial void OnReferenceCoefficientChanged(); + #endregion + + public Base_Energy() + { + this._EnergyReport_EnergyStatistics = new EntitySet(new Action(this.attach_EnergyReport_EnergyStatistics), new Action(this.detach_EnergyReport_EnergyStatistics)); + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergyId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string EnergyId + { + get + { + return this._EnergyId; + } + set + { + if ((this._EnergyId != value)) + { + this.OnEnergyIdChanging(value); + this.SendPropertyChanging(); + this._EnergyId = value; + this.SendPropertyChanged("EnergyId"); + this.OnEnergyIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergyName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string EnergyName + { + get + { + return this._EnergyName; + } + set + { + if ((this._EnergyName != value)) + { + this.OnEnergyNameChanging(value); + this.SendPropertyChanging(); + this._EnergyName = value; + this.SendPropertyChanged("EnergyName"); + this.OnEnergyNameChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergyUnit", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string EnergyUnit + { + get + { + return this._EnergyUnit; + } + set + { + if ((this._EnergyUnit != value)) + { + this.OnEnergyUnitChanging(value); + this.SendPropertyChanging(); + this._EnergyUnit = value; + this.SendPropertyChanged("EnergyUnit"); + this.OnEnergyUnitChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReferenceCoefficient", DbType="Decimal(18,4)")] + public System.Nullable ReferenceCoefficient + { + get + { + return this._ReferenceCoefficient; + } + set + { + if ((this._ReferenceCoefficient != value)) + { + this.OnReferenceCoefficientChanging(value); + this.SendPropertyChanging(); + this._ReferenceCoefficient = value; + this.SendPropertyChanged("ReferenceCoefficient"); + this.OnReferenceCoefficientChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Base_Energy", Storage="_EnergyReport_EnergyStatistics", ThisKey="EnergyId", OtherKey="EnergyId", DeleteRule="NO ACTION")] + public EntitySet EnergyReport_EnergyStatistics + { + get + { + return this._EnergyReport_EnergyStatistics; + } + set + { + this._EnergyReport_EnergyStatistics.Assign(value); + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + private void attach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Base_Energy = this; + } + + private void detach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Base_Energy = null; + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Base_Equipment")] public partial class Base_Equipment : INotifyPropertyChanging, INotifyPropertyChanged { @@ -29035,6 +29238,10 @@ namespace Model private EntitySet _Emergency_EmergencyTeamAndTrain; + private EntitySet _EnergyReport_EnergyStatistics; + + private EntitySet _EnergyReport_EnergyWaterConservation; + private EntitySet _Environmental_ProjectArchitectureReport; private EntitySet _Environmental_ProjectChemicalReport; @@ -29602,6 +29809,8 @@ namespace Model this._Emergency_EmergencyProcess = new EntitySet(new Action(this.attach_Emergency_EmergencyProcess), new Action(this.detach_Emergency_EmergencyProcess)); this._Emergency_EmergencySupply = new EntitySet(new Action(this.attach_Emergency_EmergencySupply), new Action(this.detach_Emergency_EmergencySupply)); this._Emergency_EmergencyTeamAndTrain = new EntitySet(new Action(this.attach_Emergency_EmergencyTeamAndTrain), new Action(this.detach_Emergency_EmergencyTeamAndTrain)); + this._EnergyReport_EnergyStatistics = new EntitySet(new Action(this.attach_EnergyReport_EnergyStatistics), new Action(this.detach_EnergyReport_EnergyStatistics)); + this._EnergyReport_EnergyWaterConservation = new EntitySet(new Action(this.attach_EnergyReport_EnergyWaterConservation), new Action(this.detach_EnergyReport_EnergyWaterConservation)); this._Environmental_ProjectArchitectureReport = new EntitySet(new Action(this.attach_Environmental_ProjectArchitectureReport), new Action(this.detach_Environmental_ProjectArchitectureReport)); this._Environmental_ProjectChemicalReport = new EntitySet(new Action(this.attach_Environmental_ProjectChemicalReport), new Action(this.detach_Environmental_ProjectChemicalReport)); this._Environmental_ProjectOperationReport = new EntitySet(new Action(this.attach_Environmental_ProjectOperationReport), new Action(this.detach_Environmental_ProjectOperationReport)); @@ -32081,6 +32290,32 @@ namespace Model } } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Base_Project", Storage="_EnergyReport_EnergyStatistics", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")] + public EntitySet EnergyReport_EnergyStatistics + { + get + { + return this._EnergyReport_EnergyStatistics; + } + set + { + this._EnergyReport_EnergyStatistics.Assign(value); + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyWaterConservation_Base_Project", Storage="_EnergyReport_EnergyWaterConservation", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")] + public EntitySet EnergyReport_EnergyWaterConservation + { + get + { + return this._EnergyReport_EnergyWaterConservation; + } + set + { + this._EnergyReport_EnergyWaterConservation.Assign(value); + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Environmental_ProjectArchitectureReport_Base_Project", Storage="_Environmental_ProjectArchitectureReport", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")] public EntitySet Environmental_ProjectArchitectureReport { @@ -35886,6 +36121,30 @@ namespace Model entity.Base_Project = null; } + private void attach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Base_Project = this; + } + + private void detach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Base_Project = null; + } + + private void attach_EnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation entity) + { + this.SendPropertyChanging(); + entity.Base_Project = this; + } + + private void detach_EnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation entity) + { + this.SendPropertyChanging(); + entity.Base_Project = null; + } + private void attach_Environmental_ProjectArchitectureReport(Environmental_ProjectArchitectureReport entity) { this.SendPropertyChanging(); @@ -44630,6 +44889,8 @@ namespace Model private EntitySet _Emergency_EmergencyTeamAndTrain; + private EntitySet _EnergyReport_EnergyStatistics; + private EntitySet _Environmental_ArchitectureReport; private EntitySet _Environmental_ChemicalReport; @@ -45016,6 +45277,7 @@ namespace Model this._Emergency_EmergencyList = new EntitySet(new Action(this.attach_Emergency_EmergencyList), new Action(this.detach_Emergency_EmergencyList)); this._Emergency_EmergencySupply = new EntitySet(new Action(this.attach_Emergency_EmergencySupply), new Action(this.detach_Emergency_EmergencySupply)); this._Emergency_EmergencyTeamAndTrain = new EntitySet(new Action(this.attach_Emergency_EmergencyTeamAndTrain), new Action(this.detach_Emergency_EmergencyTeamAndTrain)); + this._EnergyReport_EnergyStatistics = new EntitySet(new Action(this.attach_EnergyReport_EnergyStatistics), new Action(this.detach_EnergyReport_EnergyStatistics)); this._Environmental_ArchitectureReport = new EntitySet(new Action(this.attach_Environmental_ArchitectureReport), new Action(this.detach_Environmental_ArchitectureReport)); this._Environmental_ChemicalReport = new EntitySet(new Action(this.attach_Environmental_ChemicalReport), new Action(this.detach_Environmental_ChemicalReport)); this._Environmental_EnergyReport = new EntitySet(new Action(this.attach_Environmental_EnergyReport), new Action(this.detach_Environmental_EnergyReport)); @@ -46590,6 +46852,19 @@ namespace Model } } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Base_Unit", Storage="_EnergyReport_EnergyStatistics", ThisKey="UnitId", OtherKey="UnitId", DeleteRule="NO ACTION")] + public EntitySet EnergyReport_EnergyStatistics + { + get + { + return this._EnergyReport_EnergyStatistics; + } + set + { + this._EnergyReport_EnergyStatistics.Assign(value); + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Environmental_ArchitectureReport_Base_Unit", Storage="_Environmental_ArchitectureReport", ThisKey="UnitId", OtherKey="UnitId", DeleteRule="NO ACTION")] public EntitySet Environmental_ArchitectureReport { @@ -49077,6 +49352,18 @@ namespace Model entity.Base_Unit = null; } + private void attach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Base_Unit = this; + } + + private void detach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Base_Unit = null; + } + private void attach_Environmental_ArchitectureReport(Environmental_ArchitectureReport entity) { this.SendPropertyChanging(); @@ -155169,6 +155456,1024 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.EnergyReport_EnergyStatistics")] + public partial class EnergyReport_EnergyStatistics : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _EnergyStatisticsId; + + private string _ProjectId; + + private string _UnitId; + + private System.DateTime _ReportDate; + + private string _EnergyId; + + private System.Nullable _Consumption; + + private System.Nullable _Amount; + + private System.Nullable _UnitPrice; + + private string _ConversionUnit; + + private System.Nullable _ConvertedQuantity; + + private System.Nullable _TCE; + + private string _CompileMan; + + private System.Nullable _CompileDate; + + private EntityRef _Base_Energy; + + private EntityRef _Base_Project; + + private EntityRef _Base_Unit; + + private EntityRef _Sys_User; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEnergyStatisticsIdChanging(string value); + partial void OnEnergyStatisticsIdChanged(); + partial void OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); + partial void OnUnitIdChanging(string value); + partial void OnUnitIdChanged(); + partial void OnReportDateChanging(System.DateTime value); + partial void OnReportDateChanged(); + partial void OnEnergyIdChanging(string value); + partial void OnEnergyIdChanged(); + partial void OnConsumptionChanging(System.Nullable value); + partial void OnConsumptionChanged(); + partial void OnAmountChanging(System.Nullable value); + partial void OnAmountChanged(); + partial void OnUnitPriceChanging(System.Nullable value); + partial void OnUnitPriceChanged(); + partial void OnConversionUnitChanging(string value); + partial void OnConversionUnitChanged(); + partial void OnConvertedQuantityChanging(System.Nullable value); + partial void OnConvertedQuantityChanged(); + partial void OnTCEChanging(System.Nullable value); + partial void OnTCEChanged(); + partial void OnCompileManChanging(string value); + partial void OnCompileManChanged(); + partial void OnCompileDateChanging(System.Nullable value); + partial void OnCompileDateChanged(); + #endregion + + public EnergyReport_EnergyStatistics() + { + this._Base_Energy = default(EntityRef); + this._Base_Project = default(EntityRef); + this._Base_Unit = default(EntityRef); + this._Sys_User = default(EntityRef); + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergyStatisticsId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string EnergyStatisticsId + { + get + { + return this._EnergyStatisticsId; + } + set + { + if ((this._EnergyStatisticsId != value)) + { + this.OnEnergyStatisticsIdChanging(value); + this.SendPropertyChanging(); + this._EnergyStatisticsId = value; + this.SendPropertyChanged("EnergyStatisticsId"); + this.OnEnergyStatisticsIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + if (this._Base_Project.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")] + public string UnitId + { + get + { + return this._UnitId; + } + set + { + if ((this._UnitId != value)) + { + if (this._Base_Unit.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + this.OnUnitIdChanging(value); + this.SendPropertyChanging(); + this._UnitId = value; + this.SendPropertyChanged("UnitId"); + this.OnUnitIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReportDate", DbType="DateTime NOT NULL")] + public System.DateTime ReportDate + { + get + { + return this._ReportDate; + } + set + { + if ((this._ReportDate != value)) + { + this.OnReportDateChanging(value); + this.SendPropertyChanging(); + this._ReportDate = value; + this.SendPropertyChanged("ReportDate"); + this.OnReportDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergyId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string EnergyId + { + get + { + return this._EnergyId; + } + set + { + if ((this._EnergyId != value)) + { + if (this._Base_Energy.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + this.OnEnergyIdChanging(value); + this.SendPropertyChanging(); + this._EnergyId = value; + this.SendPropertyChanged("EnergyId"); + this.OnEnergyIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Consumption", DbType="Decimal(18,2)")] + public System.Nullable Consumption + { + get + { + return this._Consumption; + } + set + { + if ((this._Consumption != value)) + { + this.OnConsumptionChanging(value); + this.SendPropertyChanging(); + this._Consumption = value; + this.SendPropertyChanged("Consumption"); + this.OnConsumptionChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Amount", DbType="Decimal(18,2)")] + public System.Nullable Amount + { + get + { + return this._Amount; + } + set + { + if ((this._Amount != value)) + { + this.OnAmountChanging(value); + this.SendPropertyChanging(); + this._Amount = value; + this.SendPropertyChanged("Amount"); + this.OnAmountChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitPrice", DbType="Decimal(18,2)")] + public System.Nullable UnitPrice + { + get + { + return this._UnitPrice; + } + set + { + if ((this._UnitPrice != value)) + { + this.OnUnitPriceChanging(value); + this.SendPropertyChanging(); + this._UnitPrice = value; + this.SendPropertyChanged("UnitPrice"); + this.OnUnitPriceChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConversionUnit", DbType="NVarChar(50)")] + public string ConversionUnit + { + get + { + return this._ConversionUnit; + } + set + { + if ((this._ConversionUnit != value)) + { + this.OnConversionUnitChanging(value); + this.SendPropertyChanging(); + this._ConversionUnit = value; + this.SendPropertyChanged("ConversionUnit"); + this.OnConversionUnitChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConvertedQuantity", DbType="Decimal(18,7)")] + public System.Nullable ConvertedQuantity + { + get + { + return this._ConvertedQuantity; + } + set + { + if ((this._ConvertedQuantity != value)) + { + this.OnConvertedQuantityChanging(value); + this.SendPropertyChanging(); + this._ConvertedQuantity = value; + this.SendPropertyChanged("ConvertedQuantity"); + this.OnConvertedQuantityChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TCE", DbType="Decimal(18,5)")] + public System.Nullable TCE + { + get + { + return this._TCE; + } + set + { + if ((this._TCE != value)) + { + this.OnTCEChanging(value); + this.SendPropertyChanging(); + this._TCE = value; + this.SendPropertyChanged("TCE"); + this.OnTCEChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")] + public string CompileMan + { + get + { + return this._CompileMan; + } + set + { + if ((this._CompileMan != value)) + { + if (this._Sys_User.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + this.OnCompileManChanging(value); + this.SendPropertyChanging(); + this._CompileMan = value; + this.SendPropertyChanged("CompileMan"); + this.OnCompileManChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileDate", DbType="DateTime")] + public System.Nullable CompileDate + { + get + { + return this._CompileDate; + } + set + { + if ((this._CompileDate != value)) + { + this.OnCompileDateChanging(value); + this.SendPropertyChanging(); + this._CompileDate = value; + this.SendPropertyChanged("CompileDate"); + this.OnCompileDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Base_Energy", Storage="_Base_Energy", ThisKey="EnergyId", OtherKey="EnergyId", IsForeignKey=true)] + public Base_Energy Base_Energy + { + get + { + return this._Base_Energy.Entity; + } + set + { + Base_Energy previousValue = this._Base_Energy.Entity; + if (((previousValue != value) + || (this._Base_Energy.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Base_Energy.Entity = null; + previousValue.EnergyReport_EnergyStatistics.Remove(this); + } + this._Base_Energy.Entity = value; + if ((value != null)) + { + value.EnergyReport_EnergyStatistics.Add(this); + this._EnergyId = value.EnergyId; + } + else + { + this._EnergyId = default(string); + } + this.SendPropertyChanged("Base_Energy"); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] + public Base_Project Base_Project + { + get + { + return this._Base_Project.Entity; + } + set + { + Base_Project previousValue = this._Base_Project.Entity; + if (((previousValue != value) + || (this._Base_Project.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Base_Project.Entity = null; + previousValue.EnergyReport_EnergyStatistics.Remove(this); + } + this._Base_Project.Entity = value; + if ((value != null)) + { + value.EnergyReport_EnergyStatistics.Add(this); + this._ProjectId = value.ProjectId; + } + else + { + this._ProjectId = default(string); + } + this.SendPropertyChanged("Base_Project"); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Base_Unit", Storage="_Base_Unit", ThisKey="UnitId", OtherKey="UnitId", IsForeignKey=true)] + public Base_Unit Base_Unit + { + get + { + return this._Base_Unit.Entity; + } + set + { + Base_Unit previousValue = this._Base_Unit.Entity; + if (((previousValue != value) + || (this._Base_Unit.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Base_Unit.Entity = null; + previousValue.EnergyReport_EnergyStatistics.Remove(this); + } + this._Base_Unit.Entity = value; + if ((value != null)) + { + value.EnergyReport_EnergyStatistics.Add(this); + this._UnitId = value.UnitId; + } + else + { + this._UnitId = default(string); + } + this.SendPropertyChanged("Base_Unit"); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Sys_User", Storage="_Sys_User", ThisKey="CompileMan", OtherKey="UserId", IsForeignKey=true)] + public Sys_User Sys_User + { + get + { + return this._Sys_User.Entity; + } + set + { + Sys_User previousValue = this._Sys_User.Entity; + if (((previousValue != value) + || (this._Sys_User.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Sys_User.Entity = null; + previousValue.EnergyReport_EnergyStatistics.Remove(this); + } + this._Sys_User.Entity = value; + if ((value != null)) + { + value.EnergyReport_EnergyStatistics.Add(this); + this._CompileMan = value.UserId; + } + else + { + this._CompileMan = default(string); + } + this.SendPropertyChanged("Sys_User"); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.EnergyReport_EnergyWaterConservation")] + public partial class EnergyReport_EnergyWaterConservation : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _EnergyWaterConservationId; + + private string _ProjectId; + + private System.Nullable _EnergySavingIndex; + + private System.Nullable _WaterSavingIndex; + + private string _EnergySavingSchemes; + + private string _WaterSavingSchemes; + + private string _SelfEvaluation; + + private string _Summary; + + private string _SupportingDocuments; + + private System.Nullable _ActualEnergySaving; + + private System.Nullable _ActualWaterSaving; + + private System.Nullable _EnergySavingCompletionRate; + + private System.Nullable _WaterSavingCompletionRate; + + private string _CompileMan; + + private System.Nullable _CompileDate; + + private string _Remarks; + + private EntityRef _Base_Project; + + private EntityRef _Sys_User; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnEnergyWaterConservationIdChanging(string value); + partial void OnEnergyWaterConservationIdChanged(); + partial void OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); + partial void OnEnergySavingIndexChanging(System.Nullable value); + partial void OnEnergySavingIndexChanged(); + partial void OnWaterSavingIndexChanging(System.Nullable value); + partial void OnWaterSavingIndexChanged(); + partial void OnEnergySavingSchemesChanging(string value); + partial void OnEnergySavingSchemesChanged(); + partial void OnWaterSavingSchemesChanging(string value); + partial void OnWaterSavingSchemesChanged(); + partial void OnSelfEvaluationChanging(string value); + partial void OnSelfEvaluationChanged(); + partial void OnSummaryChanging(string value); + partial void OnSummaryChanged(); + partial void OnSupportingDocumentsChanging(string value); + partial void OnSupportingDocumentsChanged(); + partial void OnActualEnergySavingChanging(System.Nullable value); + partial void OnActualEnergySavingChanged(); + partial void OnActualWaterSavingChanging(System.Nullable value); + partial void OnActualWaterSavingChanged(); + partial void OnEnergySavingCompletionRateChanging(System.Nullable value); + partial void OnEnergySavingCompletionRateChanged(); + partial void OnWaterSavingCompletionRateChanging(System.Nullable value); + partial void OnWaterSavingCompletionRateChanged(); + partial void OnCompileManChanging(string value); + partial void OnCompileManChanged(); + partial void OnCompileDateChanging(System.Nullable value); + partial void OnCompileDateChanged(); + partial void OnRemarksChanging(string value); + partial void OnRemarksChanged(); + #endregion + + public EnergyReport_EnergyWaterConservation() + { + this._Base_Project = default(EntityRef); + this._Sys_User = default(EntityRef); + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergyWaterConservationId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string EnergyWaterConservationId + { + get + { + return this._EnergyWaterConservationId; + } + set + { + if ((this._EnergyWaterConservationId != value)) + { + this.OnEnergyWaterConservationIdChanging(value); + this.SendPropertyChanging(); + this._EnergyWaterConservationId = value; + this.SendPropertyChanged("EnergyWaterConservationId"); + this.OnEnergyWaterConservationIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + if (this._Base_Project.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergySavingIndex", DbType="Int")] + public System.Nullable EnergySavingIndex + { + get + { + return this._EnergySavingIndex; + } + set + { + if ((this._EnergySavingIndex != value)) + { + this.OnEnergySavingIndexChanging(value); + this.SendPropertyChanging(); + this._EnergySavingIndex = value; + this.SendPropertyChanged("EnergySavingIndex"); + this.OnEnergySavingIndexChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WaterSavingIndex", DbType="Int")] + public System.Nullable WaterSavingIndex + { + get + { + return this._WaterSavingIndex; + } + set + { + if ((this._WaterSavingIndex != value)) + { + this.OnWaterSavingIndexChanging(value); + this.SendPropertyChanging(); + this._WaterSavingIndex = value; + this.SendPropertyChanged("WaterSavingIndex"); + this.OnWaterSavingIndexChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergySavingSchemes", DbType="NVarChar(200)")] + public string EnergySavingSchemes + { + get + { + return this._EnergySavingSchemes; + } + set + { + if ((this._EnergySavingSchemes != value)) + { + this.OnEnergySavingSchemesChanging(value); + this.SendPropertyChanging(); + this._EnergySavingSchemes = value; + this.SendPropertyChanged("EnergySavingSchemes"); + this.OnEnergySavingSchemesChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WaterSavingSchemes", DbType="NVarChar(200)")] + public string WaterSavingSchemes + { + get + { + return this._WaterSavingSchemes; + } + set + { + if ((this._WaterSavingSchemes != value)) + { + this.OnWaterSavingSchemesChanging(value); + this.SendPropertyChanging(); + this._WaterSavingSchemes = value; + this.SendPropertyChanged("WaterSavingSchemes"); + this.OnWaterSavingSchemesChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SelfEvaluation", DbType="NVarChar(200)")] + public string SelfEvaluation + { + get + { + return this._SelfEvaluation; + } + set + { + if ((this._SelfEvaluation != value)) + { + this.OnSelfEvaluationChanging(value); + this.SendPropertyChanging(); + this._SelfEvaluation = value; + this.SendPropertyChanged("SelfEvaluation"); + this.OnSelfEvaluationChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Summary", DbType="NVarChar(200)")] + public string Summary + { + get + { + return this._Summary; + } + set + { + if ((this._Summary != value)) + { + this.OnSummaryChanging(value); + this.SendPropertyChanging(); + this._Summary = value; + this.SendPropertyChanged("Summary"); + this.OnSummaryChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SupportingDocuments", DbType="NVarChar(200)")] + public string SupportingDocuments + { + get + { + return this._SupportingDocuments; + } + set + { + if ((this._SupportingDocuments != value)) + { + this.OnSupportingDocumentsChanging(value); + this.SendPropertyChanging(); + this._SupportingDocuments = value; + this.SendPropertyChanged("SupportingDocuments"); + this.OnSupportingDocumentsChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ActualEnergySaving", DbType="Int")] + public System.Nullable ActualEnergySaving + { + get + { + return this._ActualEnergySaving; + } + set + { + if ((this._ActualEnergySaving != value)) + { + this.OnActualEnergySavingChanging(value); + this.SendPropertyChanging(); + this._ActualEnergySaving = value; + this.SendPropertyChanged("ActualEnergySaving"); + this.OnActualEnergySavingChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ActualWaterSaving", DbType="Int")] + public System.Nullable ActualWaterSaving + { + get + { + return this._ActualWaterSaving; + } + set + { + if ((this._ActualWaterSaving != value)) + { + this.OnActualWaterSavingChanging(value); + this.SendPropertyChanging(); + this._ActualWaterSaving = value; + this.SendPropertyChanged("ActualWaterSaving"); + this.OnActualWaterSavingChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnergySavingCompletionRate", DbType="Int")] + public System.Nullable EnergySavingCompletionRate + { + get + { + return this._EnergySavingCompletionRate; + } + set + { + if ((this._EnergySavingCompletionRate != value)) + { + this.OnEnergySavingCompletionRateChanging(value); + this.SendPropertyChanging(); + this._EnergySavingCompletionRate = value; + this.SendPropertyChanged("EnergySavingCompletionRate"); + this.OnEnergySavingCompletionRateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WaterSavingCompletionRate", DbType="Int")] + public System.Nullable WaterSavingCompletionRate + { + get + { + return this._WaterSavingCompletionRate; + } + set + { + if ((this._WaterSavingCompletionRate != value)) + { + this.OnWaterSavingCompletionRateChanging(value); + this.SendPropertyChanging(); + this._WaterSavingCompletionRate = value; + this.SendPropertyChanged("WaterSavingCompletionRate"); + this.OnWaterSavingCompletionRateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")] + public string CompileMan + { + get + { + return this._CompileMan; + } + set + { + if ((this._CompileMan != value)) + { + if (this._Sys_User.HasLoadedOrAssignedValue) + { + throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); + } + this.OnCompileManChanging(value); + this.SendPropertyChanging(); + this._CompileMan = value; + this.SendPropertyChanged("CompileMan"); + this.OnCompileManChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileDate", DbType="DateTime")] + public System.Nullable CompileDate + { + get + { + return this._CompileDate; + } + set + { + if ((this._CompileDate != value)) + { + this.OnCompileDateChanging(value); + this.SendPropertyChanging(); + this._CompileDate = value; + this.SendPropertyChanged("CompileDate"); + this.OnCompileDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Remarks", DbType="NVarChar(200)")] + public string Remarks + { + get + { + return this._Remarks; + } + set + { + if ((this._Remarks != value)) + { + this.OnRemarksChanging(value); + this.SendPropertyChanging(); + this._Remarks = value; + this.SendPropertyChanged("Remarks"); + this.OnRemarksChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyWaterConservation_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] + public Base_Project Base_Project + { + get + { + return this._Base_Project.Entity; + } + set + { + Base_Project previousValue = this._Base_Project.Entity; + if (((previousValue != value) + || (this._Base_Project.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Base_Project.Entity = null; + previousValue.EnergyReport_EnergyWaterConservation.Remove(this); + } + this._Base_Project.Entity = value; + if ((value != null)) + { + value.EnergyReport_EnergyWaterConservation.Add(this); + this._ProjectId = value.ProjectId; + } + else + { + this._ProjectId = default(string); + } + this.SendPropertyChanged("Base_Project"); + } + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyWaterConservation_Sys_User", Storage="_Sys_User", ThisKey="CompileMan", OtherKey="UserId", IsForeignKey=true)] + public Sys_User Sys_User + { + get + { + return this._Sys_User.Entity; + } + set + { + Sys_User previousValue = this._Sys_User.Entity; + if (((previousValue != value) + || (this._Sys_User.HasLoadedOrAssignedValue == false))) + { + this.SendPropertyChanging(); + if ((previousValue != null)) + { + this._Sys_User.Entity = null; + previousValue.EnergyReport_EnergyWaterConservation.Remove(this); + } + this._Sys_User.Entity = value; + if ((value != null)) + { + value.EnergyReport_EnergyWaterConservation.Add(this); + this._CompileMan = value.UserId; + } + else + { + this._CompileMan = default(string); + } + this.SendPropertyChanged("Sys_User"); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Environmental_ArchitectureReport")] public partial class Environmental_ArchitectureReport : INotifyPropertyChanging, INotifyPropertyChanged { @@ -337023,6 +338328,10 @@ namespace Model private string _CompileManId; + private string _DataSourceId; + + private System.Nullable _CheckDate; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -337065,6 +338374,10 @@ namespace Model partial void OnCompileManChanged(); partial void OnCompileManIdChanging(string value); partial void OnCompileManIdChanged(); + partial void OnDataSourceIdChanging(string value); + partial void OnDataSourceIdChanged(); + partial void OnCheckDateChanging(System.Nullable value); + partial void OnCheckDateChanged(); #endregion public ScoreFlowLog() @@ -337452,6 +338765,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DataSourceId", DbType="NVarChar(50)")] + public string DataSourceId + { + get + { + return this._DataSourceId; + } + set + { + if ((this._DataSourceId != value)) + { + this.OnDataSourceIdChanging(value); + this.SendPropertyChanging(); + this._DataSourceId = value; + this.SendPropertyChanged("DataSourceId"); + this.OnDataSourceIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CheckDate", DbType="DateTime")] + public System.Nullable CheckDate + { + get + { + return this._CheckDate; + } + set + { + if ((this._CheckDate != value)) + { + this.OnCheckDateChanging(value); + this.SendPropertyChanging(); + this._CheckDate = value; + this.SendPropertyChanged("CheckDate"); + this.OnCheckDateChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -337491,6 +338844,10 @@ namespace Model private System.DateTime _CompileDate; + private string _DataSourceId; + + private System.Nullable _CheckDate; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -337507,6 +338864,10 @@ namespace Model partial void OnUserNameChanged(); partial void OnCompileDateChanging(System.DateTime value); partial void OnCompileDateChanged(); + partial void OnDataSourceIdChanging(string value); + partial void OnDataSourceIdChanged(); + partial void OnCheckDateChanging(System.Nullable value); + partial void OnCheckDateChanged(); #endregion public ScoreUser() @@ -337634,6 +338995,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DataSourceId", DbType="NVarChar(50)")] + public string DataSourceId + { + get + { + return this._DataSourceId; + } + set + { + if ((this._DataSourceId != value)) + { + this.OnDataSourceIdChanging(value); + this.SendPropertyChanging(); + this._DataSourceId = value; + this.SendPropertyChanged("DataSourceId"); + this.OnDataSourceIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CheckDate", DbType="DateTime")] + public System.Nullable CheckDate + { + get + { + return this._CheckDate; + } + set + { + if ((this._CheckDate != value)) + { + this.OnCheckDateChanging(value); + this.SendPropertyChanging(); + this._CheckDate = value; + this.SendPropertyChanged("CheckDate"); + this.OnCheckDateChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -371520,6 +372921,10 @@ namespace Model private EntitySet _Emergency_EmergencyTeamAndTrain; + private EntitySet _EnergyReport_EnergyStatistics; + + private EntitySet _EnergyReport_EnergyWaterConservation; + private EntitySet _Environmental_EIAReport; private EntitySet _Environmental_EnvironmentalEmergencyPlan; @@ -372208,6 +373613,8 @@ namespace Model this._Emergency_EmergencyList_Sys_User2 = new EntitySet(new Action(this.attach_Emergency_EmergencyList_Sys_User2), new Action(this.detach_Emergency_EmergencyList_Sys_User2)); this._Emergency_EmergencySupply = new EntitySet(new Action(this.attach_Emergency_EmergencySupply), new Action(this.detach_Emergency_EmergencySupply)); this._Emergency_EmergencyTeamAndTrain = new EntitySet(new Action(this.attach_Emergency_EmergencyTeamAndTrain), new Action(this.detach_Emergency_EmergencyTeamAndTrain)); + this._EnergyReport_EnergyStatistics = new EntitySet(new Action(this.attach_EnergyReport_EnergyStatistics), new Action(this.detach_EnergyReport_EnergyStatistics)); + this._EnergyReport_EnergyWaterConservation = new EntitySet(new Action(this.attach_EnergyReport_EnergyWaterConservation), new Action(this.detach_EnergyReport_EnergyWaterConservation)); this._Environmental_EIAReport = new EntitySet(new Action(this.attach_Environmental_EIAReport), new Action(this.detach_Environmental_EIAReport)); this._Environmental_EnvironmentalEmergencyPlan = new EntitySet(new Action(this.attach_Environmental_EnvironmentalEmergencyPlan), new Action(this.detach_Environmental_EnvironmentalEmergencyPlan)); this._Environmental_EnvironmentalMonitoring = new EntitySet(new Action(this.attach_Environmental_EnvironmentalMonitoring), new Action(this.detach_Environmental_EnvironmentalMonitoring)); @@ -375000,6 +376407,32 @@ namespace Model } } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyStatistics_Sys_User", Storage="_EnergyReport_EnergyStatistics", ThisKey="UserId", OtherKey="CompileMan", DeleteRule="NO ACTION")] + public EntitySet EnergyReport_EnergyStatistics + { + get + { + return this._EnergyReport_EnergyStatistics; + } + set + { + this._EnergyReport_EnergyStatistics.Assign(value); + } + } + + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EnergyReport_EnergyWaterConservation_Sys_User", Storage="_EnergyReport_EnergyWaterConservation", ThisKey="UserId", OtherKey="CompileMan", DeleteRule="NO ACTION")] + public EntitySet EnergyReport_EnergyWaterConservation + { + get + { + return this._EnergyReport_EnergyWaterConservation; + } + set + { + this._EnergyReport_EnergyWaterConservation.Assign(value); + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Environmental_EIAReport_Sys_User", Storage="_Environmental_EIAReport", ThisKey="UserId", OtherKey="CompileMan", DeleteRule="NO ACTION")] public EntitySet Environmental_EIAReport { @@ -379377,6 +380810,30 @@ namespace Model entity.Sys_User = null; } + private void attach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Sys_User = this; + } + + private void detach_EnergyReport_EnergyStatistics(EnergyReport_EnergyStatistics entity) + { + this.SendPropertyChanging(); + entity.Sys_User = null; + } + + private void attach_EnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation entity) + { + this.SendPropertyChanging(); + entity.Sys_User = this; + } + + private void detach_EnergyReport_EnergyWaterConservation(EnergyReport_EnergyWaterConservation entity) + { + this.SendPropertyChanging(); + entity.Sys_User = null; + } + private void attach_Environmental_EIAReport(Environmental_EIAReport entity) { this.SendPropertyChanging(); @@ -458460,6 +459917,339 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Training_TestRecord")] + public partial class View_Training_TestRecord + { + + private string _TestRecordId; + + private string _ProjectId; + + private string _ProjectName; + + private string _UnitId; + + private string _UnitName; + + private System.Nullable _TestStartTime; + + private System.Nullable _TestEndTime; + + private string _TestManId; + + private string _PersonName; + + private string _IdentityCard; + + private System.Nullable _TestScores; + + private string _CompanyTrainingItemId; + + private string _CompanyTrainingItemName; + + private string _CompanyTrainingId; + + private string _CompanyTrainingName; + + private string _WorkPostId; + + private string _WorkPostName; + + private string _WorkPostType; + + public View_Training_TestRecord() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestRecordId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string TestRecordId + { + get + { + return this._TestRecordId; + } + set + { + if ((this._TestRecordId != value)) + { + this._TestRecordId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this._ProjectId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectName", DbType="NVarChar(200)")] + public string ProjectName + { + get + { + return this._ProjectName; + } + set + { + if ((this._ProjectName != value)) + { + this._ProjectName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")] + public string UnitId + { + get + { + return this._UnitId; + } + set + { + if ((this._UnitId != value)) + { + this._UnitId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitName", DbType="NVarChar(200)")] + public string UnitName + { + get + { + return this._UnitName; + } + set + { + if ((this._UnitName != value)) + { + this._UnitName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestStartTime", DbType="DateTime")] + public System.Nullable TestStartTime + { + get + { + return this._TestStartTime; + } + set + { + if ((this._TestStartTime != value)) + { + this._TestStartTime = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestEndTime", DbType="DateTime")] + public System.Nullable TestEndTime + { + get + { + return this._TestEndTime; + } + set + { + if ((this._TestEndTime != value)) + { + this._TestEndTime = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestManId", DbType="NVarChar(50)")] + public string TestManId + { + get + { + return this._TestManId; + } + set + { + if ((this._TestManId != value)) + { + this._TestManId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PersonName", DbType="NVarChar(50)")] + public string PersonName + { + get + { + return this._PersonName; + } + set + { + if ((this._PersonName != value)) + { + this._PersonName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdentityCard", DbType="NVarChar(50)")] + public string IdentityCard + { + get + { + return this._IdentityCard; + } + set + { + if ((this._IdentityCard != value)) + { + this._IdentityCard = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestScores", DbType="Decimal(18,1)")] + public System.Nullable TestScores + { + get + { + return this._TestScores; + } + set + { + if ((this._TestScores != value)) + { + this._TestScores = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingItemId", DbType="NVarChar(50)")] + public string CompanyTrainingItemId + { + get + { + return this._CompanyTrainingItemId; + } + set + { + if ((this._CompanyTrainingItemId != value)) + { + this._CompanyTrainingItemId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingItemName", DbType="NVarChar(100)")] + public string CompanyTrainingItemName + { + get + { + return this._CompanyTrainingItemName; + } + set + { + if ((this._CompanyTrainingItemName != value)) + { + this._CompanyTrainingItemName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingId", DbType="NVarChar(50)")] + public string CompanyTrainingId + { + get + { + return this._CompanyTrainingId; + } + set + { + if ((this._CompanyTrainingId != value)) + { + this._CompanyTrainingId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingName", DbType="NVarChar(100)")] + public string CompanyTrainingName + { + get + { + return this._CompanyTrainingName; + } + set + { + if ((this._CompanyTrainingName != value)) + { + this._CompanyTrainingName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostId", DbType="NVarChar(50)")] + public string WorkPostId + { + get + { + return this._WorkPostId; + } + set + { + if ((this._WorkPostId != value)) + { + this._WorkPostId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostName", DbType="NVarChar(100)")] + public string WorkPostName + { + get + { + return this._WorkPostName; + } + set + { + if ((this._WorkPostName != value)) + { + this._WorkPostName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPostType", DbType="NVarChar(100)")] + public string WorkPostType + { + get + { + return this._WorkPostType; + } + set + { + if ((this._WorkPostType != value)) + { + this._WorkPostType = value; + } + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_Training_TestTrainingItem")] public partial class View_Training_TestTrainingItem { diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index b20aa9db..115e7efc 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -274,6 +274,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -304,6 +455,19 @@ + + + + + + + + + + + + +