diff --git a/.gitignore b/.gitignore index 2f716de9..050d531c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ /SGGLPackFile /SGGL/FineUIPro.Web/File/Excel/Temp /SGGL/FineUIPro.Web/FileUpload +/CreateModel_lpf.bat +/ReleasePackerALL2017 - 副本 (2).bat diff --git a/DataBase/版本日志/SGGLDB_V2023-09-26.sql b/DataBase/版本日志/SGGLDB_V2023-09-26.sql new file mode 100644 index 00000000..165baecc --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2023-09-26.sql @@ -0,0 +1,174 @@ + + alter table Sys_HttpLog add MeThod nvarchar(50) + go + +INSERT Sys_Menu (MenuId,MenuName,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed) +VALUES ( N'831FA803-E2E9-4674-9B56-44E5A5DDCB1A',N'ԶϱŶԽ',10,N'0',N'Menu_ZHGL',1,0,1) + +INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsEnd,IsUsed) +VALUES('FFD221D7-AE05-447F-8727-80058A04F401','ӿ','TaskScheduling/InterFace/InterFaceSet.aspx',20,'831FA803-E2E9-4674-9B56-44E5A5DDCB1A','Menu_ZHGL',1,1) +GO +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'3D57D9D0-163A-493A-93B4-FF34F7ECD05A',N'FFD221D7-AE05-447F-8727-80058A04F401',N'',1) +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'518962FE-4E79-4812-8CCD-2EC351DA1EB7',N'FFD221D7-AE05-447F-8727-80058A04F401',N'޸',2) +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'65C09E8A-1C07-4155-A970-AE2D3DADA794',N'FFD221D7-AE05-447F-8727-80058A04F401',N'ɾ',3) +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'A4617107-FF92-4446-B037-6D2E15CAAE5C',N'FFD221D7-AE05-447F-8727-80058A04F401',N'',4) +INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsEnd,IsUsed) +VALUES('FFD221D7-AE05-447F-8727-80058A04F402','嵥','TaskScheduling/InterFace/InterFaceTask.aspx',30,'831FA803-E2E9-4674-9B56-44E5A5DDCB1A','Menu_ZHGL',1,1) +GO +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'0AA0B45D-28B8-4DEE-9BEE-0CFF08DB42BD',N'FFD221D7-AE05-447F-8727-80058A04F402',N'',1) +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'77D8A100-82E3-4640-ABB9-61DDB66A1596',N'FFD221D7-AE05-447F-8727-80058A04F402',N'޸',2) +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'D8621A85-7D2D-4AA8-9C80-321B82FAC36F',N'FFD221D7-AE05-447F-8727-80058A04F402',N'ɾ',3) +INSERT Sys_ButtonToMenu (ButtonToMenuId,MenuId,ButtonName,SortIndex) +VALUES ( N'9E233D11-8160-41A0-AAC6-FAA472E839BD',N'FFD221D7-AE05-447F-8727-80058A04F402',N'',4) +INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsEnd,IsUsed) +VALUES('FFD221D7-AE05-447F-8727-80058A04F404','ݵ־','TaskScheduling/InterFace/IFLogList.aspx',40,'831FA803-E2E9-4674-9B56-44E5A5DDCB1A','Menu_ZHGL',1,1) +GO + go + CREATE TABLE [dbo].[InterFaceLog]( + [InterFaceLogId] [nvarchar](50) NOT NULL, + [UserId] [nvarchar](50) NULL, + [UnitId] [nvarchar](50) NULL, + [InterFaceName] [nchar](10) NULL, + [InterFaceUrl] [varchar](max) NULL, + [InterFaceMehtod] [nchar](10) NULL, + [InterFaceBody] [varchar](max) NULL, + [InterFaceReturnData] [varchar](max) NULL, + [InterFaceLogDate] [datetime] NULL, + [InterFaceType] [nvarchar](50) NULL, + [LogSate] [bit] NULL, + [IP] [nvarchar](50) NULL, + CONSTRAINT [PK_InterFaceLog] PRIMARY KEY CLUSTERED +( + [InterFaceLogId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] + +GO + +SET ANSI_PADDING OFF +GO + + + +CREATE TABLE [dbo].[InterFaceSet]( + [InterFaceSetId] [nvarchar](50) NOT NULL, + [InterFaceName] [nvarchar](100) NULL, + [InterFaceUrl] [nvarchar](500) NULL, + [UrlReqMethod] [varchar](50) NULL, + [UnitId] [nvarchar](50) NULL, + [AuthUnitIds] [nvarchar](1020) NULL, + [AuthUnitName] [nvarchar](2000) NULL, + [IsOpen] [bit] NULL, + [ValidPeriod] [nvarchar](20) NULL, + [TxtRemarks] [nvarchar](2000) NULL, + [InterFaceForUrl] [nvarchar](500) NULL, + [ForUrlReqMethod] [varchar](50) NULL, + [IsCallBack] [bit] NULL, + [InterFaceCallBackUrl] [nvarchar](500) NULL, + [CallBackUrlReqMethod] [varchar](50) NULL, + CONSTRAINT [PK_InterFaceSet] PRIMARY KEY CLUSTERED +( + [InterFaceSetId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] + +GO + +SET ANSI_PADDING OFF +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ӿñ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'InterFaceSetId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ӿ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'InterFaceName' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ӿڵַ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'InterFaceUrl' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Դλ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'UnitId' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ȩλɶѡʹãƴ20' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'AuthUnitIds' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ƿ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'IsOpen' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ƶʣƴ߿ʱ磺08-1215-1822-24' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'ValidPeriod' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceSet', @level2type=N'COLUMN',@level2name=N'TxtRemarks' +GO + + + +CREATE TABLE [dbo].[InterFaceTask]( + [InterFaceTaskId] [nvarchar](50) NOT NULL, + [InterFaceName] [nvarchar](100) NULL, + [InterFaceSetLists] [nvarchar](max) NULL, + [Frequency] [nchar](10) NULL, + [CreateTime] [datetime] NULL, + [Enable] [bit] NULL, + CONSTRAINT [PK_InterFaceDetail] PRIMARY KEY CLUSTERED +( + [InterFaceTaskId] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] + +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ӿ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceTask', @level2type=N'COLUMN',@level2name=N'InterFaceName' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ӿϢ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceTask', @level2type=N'COLUMN',@level2name=N'InterFaceSetLists' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ƶ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceTask', @level2type=N'COLUMN',@level2name=N'Frequency' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceTask', @level2type=N'COLUMN',@level2name=N'CreateTime' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ƿ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'InterFaceTask', @level2type=N'COLUMN',@level2name=N'Enable' +GO + + +delete from Sys_Const where GroupId='InterfacePopup'; + +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'AccidentEvent', '/DataShow/Accident.aspx',1,'InterfacePopup') --¹¼ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'ConstructionEquipment', '/DataShow/ConstructionEquipment.aspx',1,'InterfacePopup')--ʩ豸 +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'EmergencyManagement', '/DataShow/Emergency.aspx',1,'InterfacePopup')--Ӧ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'EnvironmentalData', '/DataShow/Environmental.aspx',1,'InterfacePopup')-- +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'HiddenRectification', '/DataShow/HiddenRectification.aspx',1,'InterfacePopup')--Ų +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'HighRiskWorkPermit', '/DataShow/License.aspx',1,'InterfacePopup')--߷ҵ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'LargeDangerousProject', '/DataShow/LargeEngineering.aspx',1,'InterfacePopup')--Σ󹤳 +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'ProjectInfomation', '/DataShow/Project.aspx',1,'InterfacePopup')--ĿϢ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafeCheck', '/DataShow/Check.aspx',1,'InterfacePopup')--ȫල +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafeCost', '/DataShow/SecurityCost.aspx',1,'InterfacePopup')--ȫ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafePerson_Branch', '/DataShow/CompanyPerson.aspx',1,'InterfacePopup')--֧ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafePerson_HeadOffice', '/DataShow/CompanyPerson.aspx',1,'InterfacePopup')--ҵܲ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafePerson_ProjectPerson', '/DataShow/ProjectPerson.aspx',1,'InterfacePopup')--ĿԱ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafeRiskData', '/DataShow/SecurityRisk.aspx',1,'InterfacePopup')--ȫ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafeTrainData', '/DataShow/EduTrain.aspx',1,'InterfacePopup')--ȫѵ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'SafetyMeetingData', '/DataShow/Meeting.aspx',1,'InterfacePopup')--ȫ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'WorkingHourData', '/DataShow/WorkingHours.aspx',1,'InterfacePopup')--ʱ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'QualityTrainingData', '/DataShow/QualityTraining.aspx',1,'InterfacePopup')--ѵ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'MeasuringInstrumentsData', '/DataShow/QualityInstruments.aspx',1,'InterfacePopup')-- +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'ManagerData', '/DataShow/QualityPerson.aspx',1,'InterfacePopup')--Ա +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'QualityProblem', '/DataShow/QualityProblem.aspx',1,'InterfacePopup')-- +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'QualityControlPoint', '/DataShow/QualityControlPoint.aspx',1,'InterfacePopup')--Ƶ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'QualityAcceptance', '/DataShow/QualityAcceptance.aspx',1,'InterfacePopup')-- +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'ProjectDivision', '/DataShow/ProjectDivision.aspx',1,'InterfacePopup')--̻ +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'HjData', '/DataShow/HJGLWelding.aspx',1,'InterfacePopup')-- +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'DefectAnalysis', '/DataShow/HJGLDefect.aspx',1,'InterfacePopup')--ȱݷ + +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'', 'http://114.247.88.97:20080/',1,'SafeReferer')--referer +insert into Sys_Const ([ID],[ConstText],[ConstValue],[SortIndex],[GroupId]) values (NEWID(),'nbd', 'https://lygcgs.com.cn/',1,'SafeReferer')--referer diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 863e5289..ed68de8b 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -58,6 +58,9 @@ ..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll + False @@ -65,9 +68,8 @@ False ..\Lib\Microsoft.SQLServer.ManagedDTS.dll - - False - ..\..\..\..\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\bin\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\NPOI.2.5.5\lib\net45\NPOI.dll @@ -81,6 +83,9 @@ ..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXmlFormats.dll + + ..\packages\Quartz.3.7.0\lib\netstandard2.0\Quartz.dll + ..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll @@ -89,23 +94,42 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + ..\packages\System.Configuration.ConfigurationManager.6.0.1\lib\net461\System.Configuration.ConfigurationManager.dll + + + + ..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + - - ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Security.AccessControl.6.0.0\lib\net461\System.Security.AccessControl.dll + + + ..\packages\System.Security.Permissions.6.0.0\lib\net461\System.Security.Permissions.dll + + + ..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll + + ..\packages\System.Text.Encodings.Web.7.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll @@ -115,6 +139,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll @@ -128,6 +153,7 @@ ..\..\..\..\五环施工平台\SGGL_CWCEC\SGGL\BLL\bin\Debug\ThoughtWorks.QRCode.dll + @@ -735,12 +761,20 @@ + + + + + + + + diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index f17b997b..a41b48bb 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -7,7 +7,10 @@ namespace BLL { public static class Const { - + /// + /// 时间书签(用于筛选数据范围) + /// + public static DateTime DtmarkTime = DateTime.Parse("2023-01-01"); /// /// 默认用户密码 /// @@ -5969,6 +5972,9 @@ namespace BLL public const string SYHSEData_DataMenuId = "S89E5EC2-F725-4656-9110-5AF83C18FB6C"; + public const string InterFaceSetMenuId = "FFD221D7-AE05-447F-8727-80058A04F401"; + public const string InterFaceTaskMenuId = "FFD221D7-AE05-447F-8727-80058A04F402"; + public const string IFLogListMenuId = "FFD221D7-AE05-447F-8727-80058A04F404"; #endregion #region 数据同步状态 diff --git a/SGGL/BLL/Common/ConstValue.cs b/SGGL/BLL/Common/ConstValue.cs index 29297721..8d676254 100644 --- a/SGGL/BLL/Common/ConstValue.cs +++ b/SGGL/BLL/Common/ConstValue.cs @@ -386,6 +386,25 @@ namespace BLL /// 项目细分状态 /// public const string GroupId_ProjectState = "ProjectState"; + /// + /// 子公司弹窗界面 + /// + public const string Group_InterfacePopup = "InterfacePopup"; + /// + /// 穿透界面Referer白名单 + /// + public const string Group_SafeReferer = "SafeReferer"; #endregion + + public static void DeleteConstValueBygroupId(string groupId) + { + var q = Funs.DB.Sys_Const.Where(x => x.GroupId == groupId); + if (q != null) + { + Funs.DB.Sys_Const.DeleteAllOnSubmit(q.ToList()); + Funs.DB.SubmitChanges(); + } + } + } } \ No newline at end of file diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index 8adac158..cfa21c1f 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -1,11 +1,14 @@ namespace BLL { using Model; + using Quartz; + using RestSharp; using System; using System.Collections.Generic; using System.Data; using System.Data.Linq; using System.Globalization; + using System.Net; using System.Reflection; using System.Text; @@ -31,7 +34,11 @@ namespace BLL } } - + public static IScheduler ScheduledTasks + { + get; + set; + } /// /// ݿַ /// @@ -1160,6 +1167,39 @@ namespace BLL } return value; } + + public static string RequestGet(string Baseurl, string Token) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + var client = new RestClient(Baseurl); + client.Timeout = -1; + var request = new RestRequest(Method.GET); + request.AddHeader("token", Token); + request.AddHeader("ClientId", SysConstSetService.ClientId); + request.AddHeader("OperationCode", Baseurl.Substring(Baseurl.LastIndexOf("/", StringComparison.Ordinal) + 1)); + IRestResponse response = client.Execute(request); + Console.WriteLine(response.Content); + return response.Content; + } + public static string RequestPost(string Baseurl, string Token, string JsonBody) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + + var client = new RestClient(Baseurl); + client.Timeout = -1; + var request = new RestRequest(Method.POST); + request.AddHeader("token", Token); + request.AddHeader("ClientId", SysConstSetService.ClientId); + request.AddHeader("OperationCode", Baseurl.Substring(Baseurl.LastIndexOf("/", StringComparison.Ordinal) + 1)); + if (!string.IsNullOrEmpty(JsonBody)) + { + request.AddJsonBody(JsonBody); + } + + IRestResponse response = client.Execute(request); + return response.Content; + } } } diff --git a/SGGL/BLL/DropListService.cs b/SGGL/BLL/DropListService.cs index 19fc54ba..e3c723a7 100644 --- a/SGGL/BLL/DropListService.cs +++ b/SGGL/BLL/DropListService.cs @@ -360,5 +360,16 @@ lis[2] = new ListItem("仪表安装工程", "3"); return lis; } + + // 定义允许上传的文件类型列表 + public static List allowExtensions = new List + { + ".txt", ".doc", ".docx", ".pdf", ".xls", ".xlsx", ".ppt",".pptx",// 文本和办公文档文件类型 + ".jpg", ".jpeg", ".png", ".bmp", ".gif", // 图片文件类型 + ".mp3", ".wav", ".wma", ".ogg", ".ape", ".flac", // 音频文件类型 + ".mp4", ".avi", ".flv", ".wmv", ".mov", ".rmvb", // 视频文件类型 + ".zip", ".rar", ".7z" // 压缩包文件类型 + }; + } } diff --git a/SGGL/BLL/SysManage/LogService.cs b/SGGL/BLL/SysManage/LogService.cs index 8427412c..0361805f 100644 --- a/SGGL/BLL/SysManage/LogService.cs +++ b/SGGL/BLL/SysManage/LogService.cs @@ -74,6 +74,37 @@ namespace BLL } } + /// + /// Ӳ־ + /// + /// + /// + public static void AddLog(string userId, string opLog) + { + //SetOvertime(userId); + Model.SGGLDB db = Funs.DB; + Model.Sys_Log log = new Model.Sys_Log + { + LogId = SQLHelper.GetNewID(typeof(Model.Sys_Log)), + HostName = Dns.GetHostName() + }; + IPAddress[] ips = Dns.GetHostAddresses(log.HostName); + if (ips.Length > 0) + { + foreach (IPAddress ip in ips) + { + if (ip.ToString().IndexOf('.') != -1) + { + log.Ip = ip.ToString(); + } + } + } + log.OperationTime = DateTime.Now; + log.OperationLog = opLog; + log.UserId = userId; + db.Sys_Log.InsertOnSubmit(log); + db.SubmitChanges(); + } /// /// ĿIdɾ־Ϣ /// diff --git a/SGGL/BLL/SysManage/SysConstSetService.cs b/SGGL/BLL/SysManage/SysConstSetService.cs index d83ad083..b2fae337 100644 --- a/SGGL/BLL/SysManage/SysConstSetService.cs +++ b/SGGL/BLL/SysManage/SysConstSetService.cs @@ -8,8 +8,10 @@ public static class SysConstSetService { private static string _CNCECPath; + private static string _CncecEsbPath; private static string _CNCECToken; private static string _CNCECTokenExTime; + private static string _ClientId; public static string CNCECPath { @@ -31,6 +33,46 @@ _CNCECPath = value; } } + public static string CncecEsbPath + { + get + { + var sysSet5 = (from x in Funs.DB.Sys_Const where x.ConstText == "集团ESB地址" select x).ToList().FirstOrDefault(); + if (sysSet5 != null) + { + _CncecEsbPath = sysSet5.ConstValue; + } + else + { + _CncecEsbPath = ""; + } + return _CncecEsbPath; + } + set + { + _CncecEsbPath = value; + } + } + public static string ClientId + { + get + { + var sysSet5 = (from x in Funs.DB.Sys_Const where x.ConstText == "ClientId" select x).ToList().FirstOrDefault(); + if (sysSet5 != null) + { + _ClientId = sysSet5.ConstValue; + } + else + { + _ClientId = ""; + } + return _ClientId; + } + set + { + _ClientId = value; + } + } public static string CNCECToken { get diff --git a/SGGL/BLL/SysManage/SysHttplogService.cs b/SGGL/BLL/SysManage/SysHttplogService.cs new file mode 100644 index 00000000..bec05059 --- /dev/null +++ b/SGGL/BLL/SysManage/SysHttplogService.cs @@ -0,0 +1,143 @@ +using FineUIPro; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace BLL +{ + + public static class SysHttplogService + { + public static Model.SGGLDB db = Funs.DB; + + + #region 获取列表 + /// + /// 记录数 + /// + public static int count + { + get; + set; + } + public static List GetSys_HttpLogByModle(Model.Sys_HttpLog table) + { + var q = from x in db.Sys_HttpLog + where + (string.IsNullOrEmpty(table.HttpLogId) || x.HttpLogId.Contains(table.HttpLogId)) && + (string.IsNullOrEmpty(table.UserName) || x.UserName.Contains(table.UserName)) && + (string.IsNullOrEmpty(table.HttpUrl) || x.HttpUrl.Contains(table.HttpUrl)) && + (string.IsNullOrEmpty(table.LogTxt) || x.LogTxt.Contains(table.LogTxt)) && + (string.IsNullOrEmpty(table.MeThod) || x.MeThod.Contains(table.MeThod)) //&& + // (!table.LogTime.HasValue || (x.LogTime.HasValue && x.LogTime.Value.Date == table.LogTime.Value.Date)) + + select x + ; + if (table.LogTime.HasValue) + { + q=q.Where(x=> x.LogTime.Value.Date.CompareTo(table.LogTime.Value.Date) == 0); + } + return q.OrderByDescending(x=>x.LogTime ).ToList(); + } + + /// 获取分页列表 + /// + /// 页码 + /// 每页数量 + /// + public static IEnumerable getListData(Model.Sys_HttpLog table, Grid Grid1) + { + var q = GetSys_HttpLogByModle(table); + count = q.Count(); + if (count == 0) + { + return null; + } + q= q.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList(); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in q + select new + { + x.HttpLogId, + x.LogTime, + x.UserName, + x.HttpUrl, + x.LogTxt, + x.MeThod, + + }; + } + #endregion + + public static Model.Sys_HttpLog GetSys_HttpLogById(string HttpLogId) + { + return db.Sys_HttpLog.FirstOrDefault(x => x.HttpLogId == HttpLogId); + } + + + public static void AddSys_HttpLog(Model.Sys_HttpLog newtable) + { + + Model.Sys_HttpLog table = new Model.Sys_HttpLog + { + HttpLogId = newtable.HttpLogId, + LogTime = newtable.LogTime, + UserName = newtable.UserName, + HttpUrl = newtable.HttpUrl, + LogTxt = newtable.LogTxt, + MeThod = newtable.MeThod, + }; + db.Sys_HttpLog.InsertOnSubmit(table); + db.SubmitChanges(); + } + + public static void AddBulkSys_HttpLog(List newtables) + { + + db.Sys_HttpLog.InsertAllOnSubmit(newtables); + db.SubmitChanges(); + } + + + public static void UpdateSys_HttpLog(Model.Sys_HttpLog newtable) + { + + Model.Sys_HttpLog table = db.Sys_HttpLog.FirstOrDefault(x => x.HttpLogId == newtable.HttpLogId); + if (table != null) + { + table.HttpLogId = newtable.HttpLogId; + table.LogTime = newtable.LogTime; + table.UserName = newtable.UserName; + table.HttpUrl = newtable.HttpUrl; + table.LogTxt = newtable.LogTxt; + table.MeThod = newtable.MeThod; + db.SubmitChanges(); + } + + } + public static void DeleteSys_HttpLogById(string HttpLogId) + { + + Model.Sys_HttpLog table = db.Sys_HttpLog.FirstOrDefault(x => x.HttpLogId == HttpLogId); + if (table != null) + { + db.Sys_HttpLog.DeleteOnSubmit(table); + db.SubmitChanges(); + } + + } + + public static void DeleteALLSys_HttpLog() + { + if (db.Sys_HttpLog != null) + { + db.Sys_HttpLog.DeleteAllOnSubmit(db.Sys_HttpLog); + db.SubmitChanges(); + } + } + + } +} \ No newline at end of file diff --git a/SGGL/BLL/TaskScheduling/InterFaceService/DataForJTApiService.cs b/SGGL/BLL/TaskScheduling/InterFaceService/DataForJTApiService.cs new file mode 100644 index 00000000..e9405578 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/InterFaceService/DataForJTApiService.cs @@ -0,0 +1,132 @@ +namespace BLL +{ + using System; + using System.Collections.Generic; + using System.Linq; + + public static class DataForJTApiService + { + public static Model.SGGLDB db = Funs.DB; + + /// + /// ȡӿϢ + /// + /// Id + /// ӿϢ + public static Model.InterFaceSet GetFaceSetById(string InterFaceSetId) + { + return Funs.DB.InterFaceSet.FirstOrDefault(e => e.InterFaceSetId == InterFaceSetId); + } + + /// + /// ӽӿϢ + /// + /// ӿ + public static void AddFaceSet(Model.InterFaceSet faceset) + { + Model.SGGLDB db = Funs.DB; + string newKeyID = SQLHelper.GetNewID(typeof(Model.InterFaceSet)); + Model.InterFaceSet newSet = new Model.InterFaceSet + { + InterFaceSetId = newKeyID, + InterFaceName = faceset.InterFaceName, + AuthUnitIds = faceset.AuthUnitIds, + AuthUnitName = faceset.AuthUnitName, + InterFaceUrl = faceset.InterFaceUrl, + ValidPeriod = faceset.ValidPeriod, + UnitId = faceset.UnitId, + TxtRemarks = faceset.TxtRemarks, + IsOpen = faceset.IsOpen, + }; + db.InterFaceSet.InsertOnSubmit(newSet); + db.SubmitChanges(); + } + + /// + /// ޸ĽӿϢ + /// + /// ӿʵ + public static void UpdateFaceSet(Model.InterFaceSet user) + { + Model.SGGLDB db = Funs.DB; + Model.InterFaceSet newSet = db.InterFaceSet.FirstOrDefault(e => e.InterFaceSetId == user.InterFaceSetId); + if (newSet != null) + { + newSet.InterFaceName = user.InterFaceName; + newSet.AuthUnitIds = user.AuthUnitIds; + newSet.AuthUnitName = user.AuthUnitName; + newSet.InterFaceUrl = user.InterFaceUrl; + newSet.UnitId = user.UnitId; + newSet.ValidPeriod = user.ValidPeriod; + newSet.UnitId = user.UnitId; + newSet.TxtRemarks = user.TxtRemarks; + newSet.IsOpen = user.IsOpen; + db.SubmitChanges(); + } + } + + + /// + /// IdɾϢ + /// + /// + public static void DeleteFaceSet(string SetId) + { + Model.SGGLDB db = Funs.DB; + Model.InterFaceSet FaceSet = db.InterFaceSet.FirstOrDefault(e => e.InterFaceSetId == SetId); + if (FaceSet != null) + { + var logs = from x in db.Sys_Log where x.UserId == SetId select x; + if (logs.Count() > 0) + { + db.Sys_Log.DeleteAllOnSubmit(logs); + } + db.InterFaceSet.DeleteOnSubmit(FaceSet); + db.SubmitChanges(); + } + } + + ///// + ///// ϱݼ¼ + ///// + ///// ϱ + ///// + //public static string SaveUpData(Model.InterFaceItem newItem) + //{ + // if (newItem.FaceLogDate.Count() == 0) + // return "ݲΪգ"; + // using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + // { + // List InterFaceLogIdList=new List (); + // List logList = new List(); + // string message = string.Empty; + // var InterFaceSetList = db.InterFaceSet.Where(x => x.InterFaceName != ""); + // foreach (var item in newItem.FaceLogDate) + // { + // //ýӿƴ ݱ + // var faceset = InterFaceSetList.FirstOrDefault(p => p.InterFaceName == item.InterFaceName); + // if (faceset != null) + // { + // Model.InterFaceLog FaceLog = new Model.InterFaceLog(); + // FaceLog.InterFaceLogId = Guid.NewGuid().ToString(); + // FaceLog.TxtContent = item.TxtContent; + // FaceLog.InterFaceLogDate = Convert.ToDateTime(item.InterFaceLogDate); + // FaceLog.LogSate = false; + // FaceLog.CollCropCode = item.CollCropCode; + // FaceLog.IP = item.IP; + // FaceLog.UnitId = item.UnitId; + // FaceLog.InterFaceDetailId =""; + // logList.Add(FaceLog); + // } + // else //ýӿƲ ¼ǰʾ + // { + // InterFaceLogIdList.Add(item.InterFaceName); + // } + // } + // db.InterFaceLog.InsertAllOnSubmit(logList); + // db.SubmitChanges(); + // } + // return "ͬɹ"; + //} + } +} diff --git a/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceLogService .cs b/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceLogService .cs new file mode 100644 index 00000000..073b2938 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceLogService .cs @@ -0,0 +1,186 @@ +using FineUIPro; +using Newtonsoft.Json; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing.Printing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; + + +namespace BLL +{ + + public static class InterFaceLogService + { + public static Model.SGGLDB db = Funs.DB; + + public const string Type1 = "上报"; + public const string Type2= "下发"; + public const string Type3 = "回调"; + + #region 获取列表 + /// + /// 记录数 + /// + public static int count + { + get; + set; + } + public static List GetInterFaceLogByModle(Model.InterFaceLog table) + { + var q= from x in db.InterFaceLog + where + ( string.IsNullOrEmpty(table.InterFaceLogId)||x.InterFaceLogId.Contains(table.InterFaceLogId)) && + ( string.IsNullOrEmpty(table.UserId)||x.UserId.Contains(table.UserId)) && + ( string.IsNullOrEmpty(table.UnitId)||x.UnitId.Contains(table.UnitId)) && + ( string.IsNullOrEmpty(table.InterFaceName)||x.InterFaceName.Contains(table.InterFaceName)) && + ( string.IsNullOrEmpty(table.InterFaceUrl)||x.InterFaceUrl.Contains(table.InterFaceUrl)) && + ( string.IsNullOrEmpty(table.InterFaceMehtod)||x.InterFaceMehtod.Contains(table.InterFaceMehtod)) && + ( string.IsNullOrEmpty(table.InterFaceBody)||x.InterFaceBody.Contains(table.InterFaceBody)) && + ( string.IsNullOrEmpty(table.InterFaceReturnData)||x.InterFaceReturnData.Contains(table.InterFaceReturnData)) && + ( string.IsNullOrEmpty(table.InterFaceType)||x.InterFaceType.Contains(table.InterFaceType)) && + ( string.IsNullOrEmpty(table.IP)||x.IP.Contains(table.IP)) + orderby x.InterFaceLogDate descending + select x + ; + + return q.ToList(); + } + + /// 获取分页列表 + /// + /// 页码 + /// 每页数量 + /// + public static IEnumerable getListData(Model.InterFaceLog table, Grid Grid1) + { + var q= GetInterFaceLogByModle(table); + count = q.Count(); + if (count == 0) + { + return null; + } + q = q.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList(); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return (from x in q + select new + { + x.InterFaceLogId, + x.UserId, + x.UnitId, + x.InterFaceName, + x.InterFaceUrl, + x.InterFaceMehtod, + x.InterFaceBody, + x.InterFaceReturnData, + x.InterFaceLogDate, + x.InterFaceType, + x.LogSate, + x.IP, + + }); + } + #endregion + + public static Model.InterFaceLog GetInterFaceLogById(string InterFaceLogId) + { + return db.InterFaceLog.FirstOrDefault(x=>x.InterFaceLogId==InterFaceLogId); + } + + + public static void AddInterFaceLog(Model.InterFaceLog newtable) + { + + + Model.InterFaceLog table = new Model.InterFaceLog{ + InterFaceLogId=newtable.InterFaceLogId, + UserId=newtable.UserId, + UnitId=newtable.UnitId, + InterFaceName=newtable.InterFaceName, + InterFaceUrl=newtable.InterFaceUrl, + InterFaceMehtod=newtable.InterFaceMehtod, + InterFaceBody=newtable.InterFaceBody, + InterFaceReturnData=newtable.InterFaceReturnData, + InterFaceLogDate=newtable.InterFaceLogDate, + InterFaceType=newtable.InterFaceType, + LogSate=newtable.LogSate, + IP=newtable.IP, + }; + Funs.DB.InterFaceLog.InsertOnSubmit(table); + Funs.DB.SubmitChanges(); + } + public static void WriteInterFaceLog(string InterFaceSetlId, string InterFaceBody, string ReturnData, string InterFaceType,bool isSuccess) + { + var InterfaceSetModel = InterFaceSetService.GetInterFaceSetById(InterFaceSetlId); + Model.InterFaceLog table = new Model.InterFaceLog(); + table.InterFaceLogId = SQLHelper.GetNewID(typeof(Model.InterFaceLog)); + table.UserId = Const.sysglyId; + table.InterFaceLogDate = DateTime.Now; + table.IP = ""; + table.InterFaceName = InterfaceSetModel.InterFaceName; + table.InterFaceBody = InterFaceBody; + table.InterFaceReturnData = ReturnData; + table.InterFaceType = InterFaceType; + table.LogSate = isSuccess; + switch (InterFaceType) + { + case Type1: + table.UnitId = InterfaceSetModel.UnitId; + table.InterFaceUrl = InterfaceSetModel.InterFaceUrl; + table.InterFaceMehtod = InterfaceSetModel.UrlReqMethod; + + break; + case Type2: + table.UnitId = InterfaceSetModel.AuthUnitIds; + table.InterFaceUrl = InterfaceSetModel.InterFaceForUrl; + table.InterFaceMehtod = InterfaceSetModel.ForUrlReqMethod; + break; + case Type3: + table.UnitId = InterfaceSetModel.UnitId; + table.InterFaceUrl = InterfaceSetModel.InterFaceCallBackUrl; + table.InterFaceMehtod = InterfaceSetModel.CallBackUrlReqMethod; + break; + } + Funs.DB.InterFaceLog.InsertOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + public static void UpdateInterFaceLog(Model.InterFaceLog newtable) + { + + Model.InterFaceLog table = db.InterFaceLog.FirstOrDefault(x=>x.InterFaceLogId==newtable.InterFaceLogId); + if (table != null) + { + table.InterFaceLogId=newtable.InterFaceLogId; + table.UserId=newtable.UserId; + table.UnitId=newtable.UnitId; + table.InterFaceName=newtable.InterFaceName; + table.InterFaceUrl=newtable.InterFaceUrl; + table.InterFaceMehtod=newtable.InterFaceMehtod; + table.InterFaceBody=newtable.InterFaceBody; + table.InterFaceReturnData=newtable.InterFaceReturnData; + table.InterFaceLogDate=newtable.InterFaceLogDate; + table.InterFaceType=newtable.InterFaceType; + table.LogSate=newtable.LogSate; + table.IP=newtable.IP; + Funs.DB.SubmitChanges(); + } + + } + public static void DeleteInterFaceLogById (string InterFaceLogId) + { + + Model.InterFaceLog table =Funs.DB.InterFaceLog.FirstOrDefault(x=>x.InterFaceLogId==InterFaceLogId); + if (table != null) + { + Funs.DB.InterFaceLog.DeleteOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + } + + } +} \ No newline at end of file diff --git a/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceSetService .cs b/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceSetService .cs new file mode 100644 index 00000000..15f62596 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceSetService .cs @@ -0,0 +1,184 @@ +using FineUIPro; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace BLL +{ + + public static class InterFaceSetService + { + + + #region 获取列表 + /// + /// 记录数 + /// + public static int count + { + get; + set; + } + public static List GetInterFaceSetByModle(Model.InterFaceSet table) + { + var q= from x in Funs.DB.InterFaceSet + where + ( string.IsNullOrEmpty(table.InterFaceSetId)||x.InterFaceSetId.Contains(table.InterFaceSetId)) && + ( string.IsNullOrEmpty(table.InterFaceName)||x.InterFaceName.Contains(table.InterFaceName)) && + ( string.IsNullOrEmpty(table.InterFaceUrl)||x.InterFaceUrl.Contains(table.InterFaceUrl)) && + ( string.IsNullOrEmpty(table.UnitId)||x.UnitId.Contains(table.UnitId)) && + ( string.IsNullOrEmpty(table.AuthUnitIds)||x.AuthUnitIds.Contains(table.AuthUnitIds)) && + ( string.IsNullOrEmpty(table.AuthUnitName)||x.AuthUnitName.Contains(table.AuthUnitName)) && + ( string.IsNullOrEmpty(table.ValidPeriod)||x.ValidPeriod.Contains(table.ValidPeriod)) && + ( string.IsNullOrEmpty(table.TxtRemarks)||x.TxtRemarks.Contains(table.TxtRemarks)) && + ( string.IsNullOrEmpty(table.InterFaceForUrl)||x.InterFaceForUrl.Contains(table.InterFaceForUrl)) && + ( string.IsNullOrEmpty(table.InterFaceCallBackUrl)||x.InterFaceCallBackUrl.Contains(table.InterFaceCallBackUrl)) + select x + ; + + return q.ToList(); + } + + /// 获取分页列表 + /// + /// 页码 + /// 每页数量 + /// + public static IEnumerable getListData(Model.InterFaceSet table, Grid Grid1) + { + var q= GetInterFaceSetByModle(table); + count = q.Count(); + if (count == 0) + { + return null; + } + // q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList(); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in q + select new + { + x.InterFaceSetId, + x.InterFaceName, + x.InterFaceUrl, + x.UnitId, + x.AuthUnitIds, + x.AuthUnitName, + x.IsOpen, + x.ValidPeriod, + x.TxtRemarks, + x.InterFaceForUrl, + x.IsCallBack, + x.InterFaceCallBackUrl, + x.UrlReqMethod, + x.CallBackUrlReqMethod, + x.ForUrlReqMethod + + }; + } + #endregion + + public static Model.InterFaceSet GetInterFaceSetById(string InterFaceSetId) + { + return Funs.DB.InterFaceSet.FirstOrDefault(x=>x.InterFaceSetId==InterFaceSetId); + } + public static List GetInterFaceSets() + { + var q = (from x in Funs.DB.InterFaceSet select x).ToList(); + return q; + } + + public static void AddInterFaceSet(Model.InterFaceSet newtable) + { + + Model.InterFaceSet table = new Model.InterFaceSet{ + InterFaceSetId=newtable.InterFaceSetId, + InterFaceName=newtable.InterFaceName, + InterFaceUrl=newtable.InterFaceUrl, + UnitId=newtable.UnitId, + AuthUnitIds=newtable.AuthUnitIds, + AuthUnitName=newtable.AuthUnitName, + IsOpen=newtable.IsOpen, + ValidPeriod=newtable.ValidPeriod, + TxtRemarks=newtable.TxtRemarks, + InterFaceForUrl=newtable.InterFaceForUrl, + IsCallBack=newtable.IsCallBack, + InterFaceCallBackUrl=newtable.InterFaceCallBackUrl, + UrlReqMethod=newtable.UrlReqMethod, + ForUrlReqMethod=newtable.ForUrlReqMethod, + CallBackUrlReqMethod= newtable.CallBackUrlReqMethod, + }; + Funs.DB.InterFaceSet.InsertOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + + public static void UpdateInterFaceSet(Model.InterFaceSet newtable) + { + + Model.InterFaceSet table = Funs.DB.InterFaceSet.FirstOrDefault(x=>x.InterFaceSetId==newtable.InterFaceSetId); + if (table != null) + { + table.InterFaceSetId=newtable.InterFaceSetId; + table.InterFaceName=newtable.InterFaceName; + table.InterFaceUrl=newtable.InterFaceUrl; + table.UnitId=newtable.UnitId; + table.AuthUnitIds=newtable.AuthUnitIds; + table.AuthUnitName=newtable.AuthUnitName; + table.IsOpen=newtable.IsOpen; + table.ValidPeriod=newtable.ValidPeriod; + table.TxtRemarks=newtable.TxtRemarks; + table.InterFaceForUrl=newtable.InterFaceForUrl; + table.IsCallBack=newtable.IsCallBack; + table.InterFaceCallBackUrl=newtable.InterFaceCallBackUrl; + table.UrlReqMethod=newtable.UrlReqMethod; + table.ForUrlReqMethod=newtable.ForUrlReqMethod; + table.CallBackUrlReqMethod=newtable.CallBackUrlReqMethod; + Funs.DB.SubmitChanges(); + } + + } + public static void DeleteInterFaceSetById (string InterFaceSetId) + { + + Model.InterFaceSet table =Funs.DB.InterFaceSet.FirstOrDefault(x=>x.InterFaceSetId==InterFaceSetId); + if (table != null) + { + Funs.DB.InterFaceSet.DeleteOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + } + public static void InitInterFaceDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) + { + dropName.DataValueField = "InterFaceSetId"; + dropName.DataTextField = "InterFaceName"; + dropName.DataSource = GetInterFaceSets(); + dropName.DataBind(); + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } + public static ListItem[] GetReqMethod() + { + ListItem[] listItem = new ListItem[2]; + listItem[0] = new ListItem("Get", "Get"); + listItem[1] = new ListItem("Post", "Post"); + return listItem; + } + public static void InitReqMethodDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) + { + dropName.DataValueField = "Value"; + dropName.DataTextField = "Text"; + dropName.DataSource = GetReqMethod(); + dropName.DataBind(); + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } + } +} \ No newline at end of file diff --git a/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceTaskService .cs b/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceTaskService .cs new file mode 100644 index 00000000..ce3b8fe3 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/InterFaceService/InterFaceTaskService .cs @@ -0,0 +1,323 @@ +using FineUIPro; +using Model; +using Newtonsoft.Json; +using Quartz; +using RestSharp; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace BLL +{ + + public static class InterFaceTaskService + { + public static Model.SGGLDB db = Funs.DB; + + + #region 获取列表 + /// + /// 记录数 + /// + public static int count + { + get; + set; + } + public static List GetInterFaceTaskByModle(Model.InterFaceTask table) + { + var q= from x in db.InterFaceTask + where + ( string.IsNullOrEmpty(table.InterFaceTaskId)||x.InterFaceTaskId.Contains(table.InterFaceTaskId)) && + ( string.IsNullOrEmpty(table.InterFaceName)||x.InterFaceName.Contains(table.InterFaceName)) && + ( string.IsNullOrEmpty(table.InterFaceSetLists)||x.InterFaceSetLists.Contains(table.InterFaceSetLists)) && + ( string.IsNullOrEmpty(table.Frequency)||x.Frequency.Contains(table.Frequency)) && + (table.Enable ==null|| x.Enable==table.Enable) + select x + ; + + return q.ToList(); + } + + /// 获取分页列表 + /// + /// 页码 + /// 每页数量 + /// + public static IEnumerable getListData(Model.InterFaceTask table, Grid Grid1) + { + var q= GetInterFaceTaskByModle(table); + count = q.Count(); + if (count == 0) + { + return null; + } + // q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList(); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in q + select new + { + x.InterFaceTaskId, + x.InterFaceName, + x.InterFaceSetLists, + x.Frequency, + x.CreateTime, + x.Enable, + + }; + } + #endregion + + public static Model.InterFaceTask GetInterFaceTaskById(string InterFaceTaskId) + { + return db.InterFaceTask.FirstOrDefault(x=>x.InterFaceTaskId==InterFaceTaskId); + } + public static void AddInterFaceTask(Model.InterFaceTask newtable) + { + + Model.InterFaceTask table = new Model.InterFaceTask{ + InterFaceTaskId=newtable.InterFaceTaskId, + InterFaceName=newtable.InterFaceName, + InterFaceSetLists=newtable.InterFaceSetLists, + Frequency=newtable.Frequency, + CreateTime=newtable.CreateTime, + Enable=newtable.Enable, + }; + db.InterFaceTask.InsertOnSubmit(table); + db.SubmitChanges(); + } + + + public static void UpdateInterFaceTask(Model.InterFaceTask newtable) + { + + Model.InterFaceTask table = db.InterFaceTask.FirstOrDefault(x=>x.InterFaceTaskId==newtable.InterFaceTaskId); + if (table != null) + { + table.InterFaceTaskId=newtable.InterFaceTaskId; + table.InterFaceName=newtable.InterFaceName; + table.InterFaceSetLists=newtable.InterFaceSetLists; + table.Frequency=newtable.Frequency; + table.CreateTime=newtable.CreateTime; + table.Enable=newtable.Enable; + db.SubmitChanges(); + } + + } + public static void DeleteInterFaceTaskById (string InterFaceTaskId) + { + + Model.InterFaceTask table =db.InterFaceTask.FirstOrDefault(x=>x.InterFaceTaskId==InterFaceTaskId); + if (table != null) + { + db.InterFaceTask.DeleteOnSubmit(table); + db.SubmitChanges(); + } + + } + #region 执行任务 + public static void ExecuteTasks(string InterFaceTaskId) + { + + var model = GetInterFaceTaskById(InterFaceTaskId); + var InterFaceSetlIds = model.InterFaceSetLists.Split(','); + foreach (var item in InterFaceSetlIds) + { + ExecuteTasksByInterFaceSetlId(item); + + } + } + /// + /// 执行接口 + /// + /// 接口id + public static void ExecuteTasksByInterFaceSetlId(string InterFaceSetlId) + { + var InterfaceSetModel = InterFaceSetService.GetInterFaceSetById(InterFaceSetlId); + if (InterfaceSetModel == null) + { + return; + } + try + { + + var sourseData = GetSourseData(InterfaceSetModel.InterFaceUrl, InterfaceSetModel.UrlReqMethod); + bool sourseisSuccess = false; + if (sourseData.code == 1) + { + sourseisSuccess = true; + } + InterFaceLogService.WriteInterFaceLog(InterFaceSetlId, "", JsonConvert.SerializeObject(sourseData), InterFaceLogService.Type1, sourseisSuccess); + if (sourseData.code == 0) + { + return; + } + var TargetData = GetTargetData(InterfaceSetModel.InterFaceForUrl, sourseData, InterfaceSetModel.ForUrlReqMethod); + + bool TargetisSuccess = false; + if (TargetData.code == 1) + { + TargetisSuccess = true; + } + InterFaceLogService.WriteInterFaceLog(InterFaceSetlId, JsonConvert.SerializeObject(sourseData.data), JsonConvert.SerializeObject(TargetData), InterFaceLogService.Type2, TargetisSuccess); + + if (TargetData.code == 0 || InterfaceSetModel.IsCallBack == false) + { + return; + } + var callbackData = ExecuteCallBack(InterfaceSetModel.InterFaceCallBackUrl, sourseData, InterfaceSetModel.CallBackUrlReqMethod); + + bool CallBackisSuccess = false; + if (TargetData.code == 1) + { + CallBackisSuccess = true; + } + InterFaceLogService.WriteInterFaceLog(InterFaceSetlId, JsonConvert.SerializeObject(sourseData.data), JsonConvert.SerializeObject(callbackData), InterFaceLogService.Type3, CallBackisSuccess); + + } + catch (Exception ex ) + { + Model.InterFaceLog interFaceLog=new InterFaceLog(); + interFaceLog.InterFaceLogId=Guid.NewGuid().ToString(); + interFaceLog.InterFaceType = "异常"; + interFaceLog.LogSate = false; + interFaceLog.InterFaceLogDate= DateTime.Now; + interFaceLog.InterFaceName = InterfaceSetModel.InterFaceName; + interFaceLog.InterFaceReturnData = ex.ToString(); + InterFaceLogService.AddInterFaceLog(interFaceLog); + } + + } + public static Model.ReturnData GetSourseData(string baseurl,string ReqMethod) + { + Model.ReturnData returnData = new ReturnData(); + string token = "C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0"; + string Content = ""; + switch (ReqMethod) + { + case "Get": + Content = Funs.RequestGet(baseurl, token); + break; + case "Post": + Content = Funs.RequestPost(baseurl, token, ""); + break; + } + //var client = new RestClient(baseurl); + //client.Timeout = -1; + //var request = new RestRequest(Method.POST); + //request.AddHeader("token", "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"); + //IRestResponse response = client.Execute(request); + //Console.WriteLine(response.Content); + try + { + returnData = JsonConvert.DeserializeObject(Content); + } + catch (Exception) + { + returnData.code = 0; + returnData.message = "获取数据失败:" + Content; + } + + + return returnData; + } + public static Model.ResponeData GetTargetData(string baseurl, ReturnData DataInput, string ReqMethod) + { + Model.ResponeData responeData = new ResponeData(); + if (DataInput.code == 1) + { + + string token = DataInput.token; + string returnContent = ""; + switch (ReqMethod) + { + case "Get": + returnContent = Funs.RequestGet(baseurl, token); + break; + case "Post": + returnContent = Funs.RequestPost(baseurl, token, JsonConvert.SerializeObject(DataInput.data)); + break; + } + //var client = new RestClient(baseurl); + //client.Timeout = -1; + //if (isPost) + //{ + // var request = new RestRequest(Method.POST); + // request.AddHeader("token", DataInput.token); + // request.AddJsonBody(JsonConvert.SerializeObject(DataInput.data)); + // IRestResponse response = client.Execute(request); + // returnContent = response.Content; + + //} + //else + //{ + // var request = new RestRequest(Method.GET); + // request.AddHeader("token", DataInput.token); + // IRestResponse response = client.Execute(request); + // returnContent = response.Content; + + //} + try + { + responeData = JsonConvert.DeserializeObject(returnContent); + } + catch (Exception) + { + responeData.code = 0; + responeData.message = "推送数据失败:" + returnContent; + + } + return responeData; + } + else + { + + } + return responeData; + } + public static ReturnData ExecuteCallBack(string baseurl, ReturnData DataInput,string ReqMethod) + { + Model.ReturnData returnData = new ReturnData(); + if (DataInput.code == 1) + { + string token = "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"; + string Content = ""; + switch (ReqMethod) + { + case "Get": + Content = Funs.RequestGet(baseurl, token); + break; + case "Post": + Content = Funs.RequestPost(baseurl, token, JsonConvert.SerializeObject(DataInput.data)); + break; + } + + //var client = new RestClient(baseurl); + //client.Timeout = -1; + //var request = new RestRequest(Method.POST); + //request.AddHeader("token", "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"); + //request.AddJsonBody(JsonConvert.SerializeObject(DataInput.data)); + //IRestResponse response = client.Execute(request); + //returnContent = response.Content; + try + { + returnData = JsonConvert.DeserializeObject(Content); + } + catch (Exception) + { + returnData.code = 0; + returnData.message = "回调失败:" + Content; + + } + + } + return returnData; + } + #endregion + + + } +} \ No newline at end of file diff --git a/SGGL/BLL/TaskScheduling/TimerTask/CustomJobListener.cs b/SGGL/BLL/TaskScheduling/TimerTask/CustomJobListener.cs new file mode 100644 index 00000000..a7e571d5 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/TimerTask/CustomJobListener.cs @@ -0,0 +1,15 @@ +using Quartz; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace BLL +{ + public class CustomJobListener + { + + } +} diff --git a/SGGL/BLL/TaskScheduling/TimerTask/TaskJob.cs b/SGGL/BLL/TaskScheduling/TimerTask/TaskJob.cs new file mode 100644 index 00000000..2b519454 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/TimerTask/TaskJob.cs @@ -0,0 +1,30 @@ +using Quartz; +using System.Threading; +using System; +using System.Threading.Tasks; + +namespace BLL +{ + public class MyJob : IJob + { + public async Task Execute(IJobExecutionContext context) + { + JobKey key = context.JobDetail.Key; + + // note: use context.MergedJobDataMap in production code + JobDataMap dataMap = context.JobDetail.JobDataMap; + string InterFaceTaskId = dataMap.GetString("InterFaceTaskId"); + + //使用异步任务来实现 + await Task.Run(() => + { + + InterFaceTaskService.ExecuteTasks(InterFaceTaskId); + + + //Console.WriteLine($"{DateTime.Now}【{Thread.CurrentThread.ManagedThreadId}】:自定义的工作正在执行... ..."); + }); + } + } +} + diff --git a/SGGL/BLL/TaskScheduling/TimerTask/TimerTaskBase.cs b/SGGL/BLL/TaskScheduling/TimerTask/TimerTaskBase.cs new file mode 100644 index 00000000..c4459a66 --- /dev/null +++ b/SGGL/BLL/TaskScheduling/TimerTask/TimerTaskBase.cs @@ -0,0 +1,165 @@ + + using System; + using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Drawing.Printing; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + using Quartz; + using Quartz.Impl; + + namespace BLL + { + public class QuartzServices + { + + public static async Task Init() + { + + + //初始化计划者 + StdSchedulerFactory factory = new StdSchedulerFactory(); + // StdSchedulerFactory factory = new StdSchedulerFactory(properties); + IScheduler scheduler = await factory.GetScheduler(); + var jobAndTriggerMapping = new Dictionary>(); + // 将映射关系包装成制度字典集合 + var model = new Model.InterFaceTask(); + model.Enable = true; + var list = InterFaceTaskService.GetInterFaceTaskByModle(model); + foreach (var item in list) + { + + var jobDetail1 = GetJobDetailByInterFaceTaskId(item.InterFaceTaskId); + var trigger1 = GetTriggerByTime(item.InterFaceTaskId, item.Frequency); + //给计划者添加Job和触发器 + jobAndTriggerMapping[jobDetail1] = trigger1; + //keyValuePairs.Add(item.InterFaceTaskId, scheduler); + //Funs.ScheduledTasks = keyValuePairs; + } + var readOnlyjobAndTriggerMapping = new ReadOnlyDictionary>(jobAndTriggerMapping); + await scheduler.ScheduleJobs(readOnlyjobAndTriggerMapping, true); + await scheduler.Start(); //只有启动了,里面的任务才会定时触发 + Funs.ScheduledTasks = scheduler; + + } + + public static void ISchedulerShupDown(IScheduler scheduler) + { + scheduler.Shutdown(); + + } + /// + /// 同步任务调度 + /// + /// + /// + public static async Task SyncISchedulerById(string InterFaceTaskId) + { + try + { + StdSchedulerFactory factory = new StdSchedulerFactory(); + var model = InterFaceTaskService.GetInterFaceTaskById(InterFaceTaskId); + // var item = Funs.ScheduledTasks.Where(x => x.Key == InterFaceTaskId).FirstOrDefault(); + IScheduler scheduler = Funs.ScheduledTasks; + JobKey jk = new JobKey(InterFaceTaskId, "group1"); + if (model != null) + { + if (model.Enable == true) + { + if (scheduler.GetJobDetail(jk, default) != null) + { + var jobDetail1 = GetJobDetailByInterFaceTaskId(model.InterFaceTaskId); + var trigger1 = GetTriggerByTime(model.InterFaceTaskId, model.Frequency); + await scheduler.ScheduleJob(jobDetail1, trigger1,true); + + } + else + { + + var jobDetail1 = GetJobDetailByInterFaceTaskId(model.InterFaceTaskId); + var trigger1 = GetTriggerByTime(model.InterFaceTaskId, model.Frequency); + await scheduler.ScheduleJob(jobDetail1, trigger1,true); + } + + } + else + { + if (scheduler.GetJobDetail(jk, default) != null) + { + await scheduler.DeleteJob(jk, default); + + + // SyncScheduledTasks(model.InterFaceTaskId, scheduler, 2); + } + + } + + } + Funs.ScheduledTasks = scheduler; + + } + catch (Exception ex) + { + string a = ex.ToString(); + throw; + } + + } + /// + /// 同步任务列表 + /// + /// + /// + /// 0 增 1 修改 2删除 + public static void SyncScheduledTasks(string InterFaceTaskId, IScheduler scheduler, int type) + { + if (type == 0) + { + // Funs.ScheduledTasks.Add(InterFaceTaskId, scheduler); + } + else if (type == 1) + { + // Funs.ScheduledTasks.Remove(InterFaceTaskId); + // Funs.ScheduledTasks.Add(InterFaceTaskId, scheduler); + } + else if (type == 2) + { + // Funs.ScheduledTasks.Remove(InterFaceTaskId); + } + } + public static IJobDetail GetJobDetailByInterFaceTaskId(string InterFaceTaskId) + { //创建Job + IJobDetail jobDetail1 = JobBuilder.Create() + .WithIdentity(InterFaceTaskId, "group1")//给Job身份 + .WithDescription("任务的描述,方便查找") + .UsingJobData("InterFaceTaskId", InterFaceTaskId) + .Build(); + return jobDetail1; + } + public static ReadOnlyCollection GetTriggerByTime(string InterFaceTaskId, string time) + { + string cron = "0 0 0/& * * ? "; + cron = cron.Replace("&", time); + // cron = "0 0/1 * * * ? "; + //创建触发器 + var trigger1 = new ReadOnlyCollection( + new List() + { + TriggerBuilder.Create() + .WithIdentity(InterFaceTaskId, "group1") //给触发器身份 + .WithDescription("触发器的描述,方便查找") + .StartAt(new DateTimeOffset(DateTime.Now.AddSeconds(10))) //.StartNow()都是启动触发器方式 + .WithCronSchedule(cron) //定时策略,Cron表达式 + .Build() + }); + return trigger1; + + } + } + } + + \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs index 7de86278..6a49cea8 100644 --- a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs @@ -11,38 +11,27 @@ namespace BLL { public static class CQMSDataService { - public static Model.SGGLDB db = Funs.DB; - - /// - /// 集团接口地址 - /// - public static string CNCECServerUrl - { - get; - set; - } + public static SGGLDB db = Funs.DB; #region 获取列表 /// /// 记录数 /// - public static int count - { - get; - set; - } + public static int count { get; set; } - public static List GetCQMSData_CQMSByModle(Model.CQMSData_CQMS table) + public static List GetCQMSData_CQMSByModle(CQMSData_CQMS table) { + var db = Funs.DB; var q = from x in db.CQMSData_CQMS where - (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && - (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && + (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + orderby x.ReportDate descending select x - ; + ; return q.ToList(); } @@ -52,64 +41,62 @@ namespace BLL /// 页码 /// 每页数量 /// - public static IEnumerable getListData(Model.CQMSData_CQMS table, Grid Grid1) + public static IEnumerable getListData(CQMSData_CQMS table, Grid Grid1) { var q = GetCQMSData_CQMSByModle(table); count = q.Count(); - if (count == 0) - { - return null; - } + if (count == 0) return null; // q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList(); // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q - select new - { - x.Id, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.TrainPersonNum, - x.TechnicalDisclosePersonNum, - x.UseNum, - x.OKNum, - x.CompanyPersonNum, - x.BranchPersonNum, - x.ProjectPersonNum, - x.ProblemNum, - x.ProblemCompletedNum, - x.ProblemNotCompletedNum, - x.SNum, - x.ANum, - x.BNum, - x.CNum, - x.KeyProcessNum, - x.KeyProcessOKNum, - x.SpecialProcessNum, - x.SpecialProcessOKNum, - x.ConcealedWorksNum, - x.ConcealedWorksOKNum, - x.UnitProjectOnesNum, - x.UnitProjectOnesOKNum, - x.MaterialInRecheckNum, - x.MaterialInRecheckOKNum, - x.SingleProjectNum, - x.UnitProjectNum, - x.SubProjectNum, - x.SubdivisionalWorksNum, - x.InspectionLotNum, - x.State, - x.CreateDate, - x.CreateMan, - }; + select new + { + x.Id, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.TrainPersonNum, + x.TechnicalDisclosePersonNum, + x.UseNum, + x.OKNum, + x.CompanyPersonNum, + x.BranchPersonNum, + x.ProjectPersonNum, + x.ProblemNum, + x.ProblemCompletedNum, + x.ProblemNotCompletedNum, + x.SNum, + x.ANum, + x.BNum, + x.CNum, + x.KeyProcessNum, + x.KeyProcessOKNum, + x.SpecialProcessNum, + x.SpecialProcessOKNum, + x.ConcealedWorksNum, + x.ConcealedWorksOKNum, + x.UnitProjectOnesNum, + x.UnitProjectOnesOKNum, + x.MaterialInRecheckNum, + x.MaterialInRecheckOKNum, + x.SingleProjectNum, + x.UnitProjectNum, + x.SubProjectNum, + x.SubdivisionalWorksNum, + x.InspectionLotNum, + x.State, + x.CreateDate, + x.CreateMan + }; } #endregion 获取列表 - public static void AddCQMSData_CQMS(Model.CQMSData_CQMS newtable) + public static void AddCQMSData_CQMS(CQMSData_CQMS newtable) { - Model.CQMSData_CQMS table = new Model.CQMSData_CQMS + var db = Funs.DB; + var table = new CQMSData_CQMS { Id = newtable.Id, UnitId = newtable.UnitId, @@ -147,15 +134,16 @@ namespace BLL InspectionLotNum = newtable.InspectionLotNum, State = newtable.State, CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan, + CreateMan = newtable.CreateMan }; db.CQMSData_CQMS.InsertOnSubmit(table); db.SubmitChanges(); } - public static void DeleteCQMSData_CQMSById(string Id) + public static void DeleteCQMSData_CQMSById(string id) { - Model.CQMSData_CQMS table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); + var db = Funs.DB; + var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == id); if (table != null) { db.CQMSData_CQMS.DeleteOnSubmit(table); @@ -163,16 +151,17 @@ namespace BLL } } - public static Model.CQMSData_CQMS GetCQMSData_CQMSById(string Id) + public static CQMSData_CQMS GetCQMSData_CQMSById(string id) { - return db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); + var db = Funs.DB; + return db.CQMSData_CQMS.FirstOrDefault(x => x.Id == id); } - public static Model.CQMSData GetItemById(string Id) + public static CQMSData GetItemById(string id) { - var model = GetCQMSData_CQMSById(Id); - CQMSData data = new CQMSData(); - CqmsDataItem item = new CqmsDataItem(); + var model = GetCQMSData_CQMSById(id); + var data = new CQMSData(); + var item = new CqmsDataItem(); if (model != null) { item.Id = model.Id; @@ -215,55 +204,56 @@ namespace BLL item.SubdivisionalWorksNum = model.SubdivisionalWorksNum; item.InspectionLotNum = model.InspectionLotNum; } - List cqmsDataItems = new List(); + + var cqmsDataItems = new List(); cqmsDataItems.Add(item); data.CQMSDataItems = cqmsDataItems; return data; } - public static Model.CQMSData GetTodayCQMSData_CQMS() + public static CQMSData GetTodayCQMSData_CQMS() { + // var q = GetTodayData(); + var data = new CQMSData(); + data = StatisticalData(); - var q = GetTodayData(); - CQMSData data = new CQMSData(); - if (q != null && q.State == Const.CNCEC_State_S) - { - data = GetDataByCQMSData_CQMS(q); - } - else - { - data = StatisticalData(); - } + //if (q != null && q.State == Const.CNCEC_State_S) + //{ + // // data = GetDataByCQMSData_CQMS(q); + // data = StatisticalData(); + //} + //else + //{ + // data = StatisticalData(); + //} return data; } - public static Model.CQMSData_CQMS GetTodayData() + public static CQMSData_CQMS GetTodayData() { var q = (from x in Funs.DB.CQMSData_CQMS - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } - public static void UpdateTodyData_State() + + public static void UpdateTodyData_State() { var q = GetTodayData(); - if (q!=null ) + if (q != null) { q.State = Const.CNCEC_State_1; UpdateCQMSData_CQMS(q); - } } + public static bool IsReportByDate(DateTime dateTime) { var result = false; var q = (from x in Funs.DB.CQMSData_CQMS - where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date) - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date + select x).ToList(); + if (q.Count > 0) result = true; return result; } @@ -275,35 +265,35 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.CQMSData_CQMS - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); + if (q.Count > 0) result = true; return result; } - public static Model.ReturnData PushCNCEC(string Id) + public static ReturnData PushCncec(string id) { - string baseurl = "/api/CQMSData/SaveCQMSData"; - var item = GetItemById(Id); - string str = JsonConvert.SerializeObject(item); - var responeData = BLL.ServerService.PushCNCEC(str, baseurl); + var baseurl = "/api/CQMSData/SaveCQMSData"; + var item = GetItemById(id); + var str = JsonConvert.SerializeObject(item); + var responeData = ServerService.PushCNCEC(str, baseurl); return responeData; } public static CQMSData StatisticalData() { - var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CD); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var base_Unit = UnitService.GetUnitByUnitId(thisUnitId); Project_CQMSDataService.StatisticalAllProjectData(); var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); - Model.CQMSData_CQMS table = new Model.CQMSData_CQMS + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); + var table = new CQMSData_CQMS { - UnitId = BLL.Const.UnitId_CD, + UnitId = thisUnitId, CollCropCode = base_Unit.CollCropCode, UnitName = base_Unit.UnitName, ReportDate = DateTime.Now.Date, @@ -311,8 +301,8 @@ namespace BLL TechnicalDisclosePersonNum = ProjectData.Sum(x => x.TechnicalDisclosePersonNum), UseNum = ProjectData.Sum(x => x.UseNum), OKNum = ProjectData.Sum(x => x.OKNum), - CompanyPersonNum = ProjectData.Sum(x => x.CompanyPersonNum), - BranchPersonNum = ProjectData.Sum(x => x.BranchPersonNum), + CompanyPersonNum = GetCompanyPersonNum(), + BranchPersonNum = GetBranchPersonNum(), ProjectPersonNum = ProjectData.Sum(x => x.ProjectPersonNum), ProblemNum = ProjectData.Sum(x => x.ProblemNum), ProblemCompletedNum = ProjectData.Sum(x => x.ProblemCompletedNum), @@ -337,7 +327,7 @@ namespace BLL SubdivisionalWorksNum = ProjectData.Sum(x => x.SubdivisionalWorksNum), InspectionLotNum = ProjectData.Sum(x => x.InspectionLotNum), CreateMan = Const.sysglyId, - CreateDate = DateTime.Now, + CreateDate = DateTime.Now }; if (IsReportByToday()) { @@ -351,14 +341,16 @@ namespace BLL table.State = Const.CNCEC_State_0; AddCQMSData_CQMS(table); } - CQMSData data = new CQMSData(); + + var data = new CQMSData(); data = GetDataByCQMSData_CQMS(table); return data; } - public static CQMSData GetDataByCQMSData_CQMS(Model.CQMSData_CQMS table) + + public static CQMSData GetDataByCQMSData_CQMS(CQMSData_CQMS table) { - CQMSData data = new CQMSData(); - CqmsDataItem item = new CqmsDataItem(); + var data = new CQMSData(); + var item = new CqmsDataItem(); item.Id = table.Id; item.ReportDate = table.ReportDate.Value.ToShortDateString(); item.UnitId = table.UnitId; @@ -398,14 +390,16 @@ namespace BLL item.SubProjectNum = table.SubProjectNum; item.SubdivisionalWorksNum = table.SubdivisionalWorksNum; item.InspectionLotNum = table.InspectionLotNum; - List cqmsDataItems = new List(); + var cqmsDataItems = new List(); cqmsDataItems.Add(item); data.CQMSDataItems = cqmsDataItems; return data; } - public static void UpdateCQMSData_CQMS(Model.CQMSData_CQMS newtable) + + public static void UpdateCQMSData_CQMS(CQMSData_CQMS newtable) { - Model.CQMSData_CQMS table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); + var db = Funs.DB; + var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { table.Id = newtable.Id; @@ -448,5 +442,37 @@ namespace BLL db.SubmitChanges(); } } + + /// + /// 获取企业总部人数 + /// + /// + public static int GetCompanyPersonNum() + { + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_CompanyBranchPerson + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsOnJob == true && y.IsCQMS == true && x.UnitId == unitId + select x).Count(); + return result; + } + + /// + /// 获取分支机构人数 + /// + /// + public static int GetBranchPersonNum() + { + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_CompanyBranchPerson + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsOnJob == true && y.IsCQMS == true && x.UnitId != unitId + select x).Count(); + return result; + } } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs index 8b1e492f..ffd34465 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs @@ -5,34 +5,33 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json.Linq; namespace BLL { public static class HJGLData_HJGLService { - public static Model.SGGLDB db = Funs.DB; + public static SGGLDB db = Funs.DB; #region 获取列表 /// /// 记录数 /// - public static int count - { - get; - set; - } + public static int count { get; set; } - public static List GetHJGLData_HJGLByModle(Model.HJGLData_HJGL table) + public static List GetHJGLData_HJGLByModle(HJGLData_HJGL table) { + var db = Funs.DB; var q = from x in db.HJGLData_HJGL where - (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && - (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && + (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + orderby x.ReportDate descending select x - ; + ; return q.ToList(); } @@ -42,39 +41,37 @@ namespace BLL /// 页码 /// 每页数量 /// - public static IEnumerable getListData(Model.HJGLData_HJGL table, Grid Grid1) + public static IEnumerable getListData(HJGLData_HJGL table, Grid Grid1) { var q = GetHJGLData_HJGLByModle(table); count = q.Count(); - if (count == 0) - { - return null; - } + if (count == 0) return null; // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q - select new - { - x.Id, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.WelderNum, - x.TotalDineNum, - x.CompleteDineNum, - x.TotalFilmNum, - x.OKFilmNum, - x.State, - x.CreateDate, - x.CreateMan, - }; + select new + { + x.Id, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.WelderNum, + x.TotalDineNum, + x.CompleteDineNum, + x.TotalFilmNum, + x.OKFilmNum, + x.State, + x.CreateDate, + x.CreateMan + }; } #endregion 获取列表 - public static void AddHJGLData_HJGL(Model.HJGLData_HJGL newtable) + public static void AddHJGLData_HJGL(HJGLData_HJGL newtable) { - Model.HJGLData_HJGL table = new Model.HJGLData_HJGL + var db = Funs.DB; + var table = new HJGLData_HJGL { Id = newtable.Id, UnitId = newtable.UnitId, @@ -88,7 +85,7 @@ namespace BLL OKFilmNum = newtable.OKFilmNum, State = newtable.State, CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan, + CreateMan = newtable.CreateMan }; db.HJGLData_HJGL.InsertOnSubmit(table); db.SubmitChanges(); @@ -96,7 +93,8 @@ namespace BLL public static void DeleteHJGLData_HJGLById(string Id) { - Model.HJGLData_HJGL table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); + var db = Funs.DB; + var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); if (table != null) { db.HJGLData_HJGL.DeleteOnSubmit(table); @@ -104,19 +102,20 @@ namespace BLL } } - public static Model.HJGLData_HJGL GetHJGLData_HJGLById(string Id) + public static HJGLData_HJGL GetHJGLData_HJGLById(string Id) { + var db = Funs.DB; return db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); } - public static Model.HJGLData GetItemById(string Id) + public static HJGLData GetItemById(string Id) { - HJGLDataItem item = new HJGLDataItem(); - HJGLData data = new HJGLData(); + var item = new HJGLDataItem(); + var data = new HJGLData(); var data_HJGL = GetHJGLData_HJGLById(Id); if (data_HJGL != null) { - var data_HJGL_detail = BLL.HJGLData_DefectService.GetHJGLData_DefectByDate(data_HJGL.ReportDate); + var data_HJGL_detail = HJGLData_DefectService.GetHJGLData_DefectByDate(data_HJGL.ReportDate); item.CollCropCode = data_HJGL.CollCropCode; item.CompleteDineNum = data_HJGL.CompleteDineNum; @@ -132,76 +131,82 @@ namespace BLL { foreach (var detail in data_HJGL_detail) { - HJGLDataDefectItems hjglDataDefectItem = new HJGLDataDefectItems(); + var hjglDataDefectItem = new HJGLDataDefectItems(); hjglDataDefectItem.DefectNum = detail.DefectNum; hjglDataDefectItem.DefectName = detail.DefectName; hjglDataDefectItem.Id = detail.Id; list.Add(hjglDataDefectItem); } + item.HJGLDataDefectItems = list; } } - List hJGLDataItems = new List(); + + var hJGLDataItems = new List(); hJGLDataItems.Add(item); data.HJGLDataItems = hJGLDataItems; return data; } - public static Model.HJGLData GetTodayHJGLData_HJGL() + public static HJGLData GetTodayHJGLData_HJGL() { var q = GetTodayData(); - HJGLData data = new HJGLData(); + var data = new HJGLData(); + if (CommonService.GetIsThisUnit().CollCropCode== "91410200170644116B") + { + return GetELECLTodayHJGLData_HJGL(); + } if (q != null && q.State == Const.CNCEC_State_S) - { - - HJGLDataItem item = new HJGLDataItem(); - item.CollCropCode = q.CollCropCode; - item.CompleteDineNum = q.CompleteDineNum; - item.Id = q.Id; - item.OKFilmNum = q.OKFilmNum; - item.ReportDate = q.ReportDate.Value.ToShortDateString(); - item.TotalDineNum = q.TotalDineNum; - item.TotalFilmNum = q.TotalFilmNum; - item.UnitId = q.UnitId; - item.WelderNum = q.WelderNum; - item.HJGLDataDefectItems = Project_HJGLData_DefectService.getTodayProject_HJGLData_Defect(); - List hJGLDataItems = new List(); - hJGLDataItems.Add(item); - data.HJGLDataItems = hJGLDataItems; - } - else - { data = StatisticalData(); - } + else + data = StatisticalData(); return data; } - public static Model.HJGLData_HJGL GetTodayData() + /// + /// 获取十一化建焊接数据 + /// + /// + public static HJGLData GetELECLTodayHJGLData_HJGL() + { + var data = new HJGLData(); + string baseurl = "http://36.99.162.230:9493/sgglapi/api/CNCECServer/PostGetHJGLData"; + string token = Const.sysglyId; + string response = Funs.RequestPost(baseurl, token, ""); + var json = JsonConvert.DeserializeObject(response) as JObject; + if (json != null && json["code"]?.ToString()=="1") + { + var str = json["data"]?.ToString(); + if (str != null) data = JsonConvert.DeserializeObject(str); + } + return data; + + } + + public static HJGLData_HJGL GetTodayData() { var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } + public static void UpdateTodyData_State() { var q = GetTodayData(); - if (q!=null) + if (q != null) { q.State = Const.CNCEC_State_1; UpdateHJGLData_HJGL(q); } - } + public static bool IsReportByDate(DateTime dateTime) { var result = false; var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date) - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date + select x).ToList(); + if (q != null && q.Count > 0) result = true; return result; } @@ -213,39 +218,39 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); + if (q.Count > 0) result = true; return result; } - public static Model.ReturnData PushCNCEC(string Id) + public static ReturnData PushCncec(string Id) { - string baseurl = "/api/HJGLData/SaveHJGLData"; + var baseurl = "/api/HJGLData/SaveHJGLData"; var item = GetItemById(Id); - string str = JsonConvert.SerializeObject(item); - var responeData = BLL.ServerService.PushCNCEC(str, baseurl); + var str = JsonConvert.SerializeObject(item); + var responeData = ServerService.PushCNCEC(str, baseurl); return responeData; } public static HJGLData StatisticalData() { - HJGLData data = new HJGLData(); - string thisUnitId = BLL.Const.UnitId_CD; - var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var data = new HJGLData(); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); var ProjectData = (from x in Funs.DB.Project_HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); Project_HJGLData_HJGLService.StatisticalAllProjectData(); + Project_HJGLData_DefectService.StatisticalAllProjectData(); - Model.HJGLData_HJGL table = new Model.HJGLData_HJGL + var table = new HJGLData_HJGL { UnitId = thisUnitId, - CollCropCode = base_Unit.CollCropCode, - UnitName = base_Unit.UnitName, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, ReportDate = DateTime.Now.Date, WelderNum = ProjectData.Sum(x => x.WelderNum), TotalDineNum = ProjectData.Sum(x => x.TotalDineNum), @@ -253,7 +258,7 @@ namespace BLL TotalFilmNum = ProjectData.Sum(x => x.TotalFilmNum), OKFilmNum = ProjectData.Sum(x => x.OKFilmNum), CreateMan = Const.sysglyId, - CreateDate = DateTime.Now, + CreateDate = DateTime.Now }; if (IsReportByToday()) { @@ -268,7 +273,8 @@ namespace BLL AddHJGLData_HJGL(table); } - HJGLDataItem item = new HJGLDataItem(); + + var item = new HJGLDataItem(); item.CollCropCode = table.CollCropCode; item.CompleteDineNum = table.CompleteDineNum; item.Id = table.Id; @@ -279,19 +285,17 @@ namespace BLL item.UnitId = table.UnitId; item.WelderNum = table.WelderNum; item.HJGLDataDefectItems = Project_HJGLData_DefectService.getTodayProject_HJGLData_Defect(); - List hJGLDataItems = new List(); + var hJGLDataItems = new List(); hJGLDataItems.Add(item); data.HJGLDataItems = hJGLDataItems; return data; - - - } - public static void UpdateHJGLData_HJGL(Model.HJGLData_HJGL newtable) + public static void UpdateHJGLData_HJGL(HJGLData_HJGL newtable) { - Model.HJGLData_HJGL table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); + var db = Funs.DB; + var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { table.Id = newtable.Id; diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index 90ff4762..ec66dd73 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -1,615 +1,493 @@ -using FineUIPro; -using Model; -using Newtonsoft.Json; -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using FineUIPro; +using Model; +using Newtonsoft.Json; namespace BLL { public static class HSSEData_HSSEService { - public static Model.SGGLDB db = Funs.DB; + public static SGGLDB Db = Funs.DB; - #region 获取列表 - - /// - /// 记录数 - /// - public static int count + public static void AddHSSEData_HSSE(HSSEData_HSSE newtable) { - get; - set; - } - - public static List GetHSSEData_HSSEByModle(Model.HSSEData_HSSE table) - { - var q = from x in db.HSSEData_HSSE - where - (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && - (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) - select x - ; - - return q.ToList(); - } - - /// 获取分页列表 - /// - /// 页码 - /// 每页数量 - /// - public static IEnumerable getListData(Model.HSSEData_HSSE table, Grid Grid1) - { - var q = GetHSSEData_HSSEByModle(table); - count = q.Count(); - if (count == 0) + using (var db = new SGGLDB(Funs.ConnString)) { - return null; - } - // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); - return from x in q - select new - { - x.Id, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.BeUnderConstructionNum, - x.ShutdownNum, - x.JoinConstructionPersonNum, - x.MajorProjectsUnderConstructionNum, - x.TotalWorkingHour, - x.LostWorkingHour, - x.SafeWorkingHour, - x.SafeTrainNum, - x.SpecialTrainNum, - x.SpecialOperationTrainNum, - x.TotalEnergyConsumption, - x.IncomeComprehensiveEnergyConsumption, - x.NewWaterConsumption, - x.HeadOfficeInspectorGeneralNum, - x.HeadOfficeFullTimeNum, - x.BranchInspectorGeneralNum, - x.BranchFullTimeNum, - x.ProjectInspectorGeneralNum, - x.ProjectFullTimeNum, - x.ProjectSafetyMonitorNum, - x.SafetyInjectionEngineer, - x.CertificateANum, - x.CertificateBNum, - x.CertificateCNum, - x.SafetyCommitteeMeetingNum, - x.EnterpriseTopicsMeetingNum, - x.ProjectSafetyLeadingGroupMeetingNum, - x.ProjectSafetyMeetingNum, - x.CompanyLeadShiftCheckNum, - x.CompanyComprehensiveCheckNum, - x.CompanySpecialCheckNum, - x.ProjectLeadShiftCheckNum, - x.ProjectSpecialCheckNum, - x.ProjectMajorCheckNum, - x.NearMissNum, - x.RecordableEventNum, - x.GeneralAccidentNum, - x.MajorAccidentNum, - x.SeriousAccidentNum, - x.SpecialSeriousAccidentNum, - x.CompanyComprehensivePlanNum, - x.CompanySpecialPlanNum, - x.CompanyOnSiteDisposalPlan, - x.CompanyDrillNum, - x.ProjectComprehensivePlanNum, - x.ProjectSpecialPlanNum, - x.ProjectOnSiteDisposalPlan, - x.ProjectDrillNum, - x.CostExtract, - x.CostUse, - x.UseEquipmentNum, - x.SpecialEquipmentNum, - x.LicensesNum, - x.LicensesCloseNum, - x.GeneralClosedNum, - x.GeneralNotClosedNum, - x.MajorClosedNum, - x.MajorNotClosedNum, - x.GeneralRiskNum, - x.LowRiskNum, - x.MediumRiskNum, - x.HighRiskNum, - x.CompletedNum, - x.TrainPersonNum, - x.ConstructionNum, - x.FinishedNum, - x.SuperCompletedNum, - x.SuperTrainPersonNum, - x.SuperConstructionNum, - x.SuperFinishedNum, - x.State, - x.CreateDate, - x.CreateMan, - }; - } - - #endregion 获取列表 - - public static void AddHSSEData_HSSE(Model.HSSEData_HSSE newtable) - { - Model.HSSEData_HSSE table = new Model.HSSEData_HSSE - { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - BeUnderConstructionNum = newtable.BeUnderConstructionNum, - ShutdownNum = newtable.ShutdownNum, - JoinConstructionPersonNum = newtable.JoinConstructionPersonNum, - MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum, - TotalWorkingHour = newtable.TotalWorkingHour, - LostWorkingHour = newtable.LostWorkingHour, - SafeWorkingHour = newtable.SafeWorkingHour, - SafeTrainNum = newtable.SafeTrainNum, - SpecialTrainNum = newtable.SpecialTrainNum, - SpecialOperationTrainNum = newtable.SpecialOperationTrainNum, - TotalEnergyConsumption = newtable.TotalEnergyConsumption, - IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, - NewWaterConsumption = newtable.NewWaterConsumption, - HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum, - HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum, - BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum, - BranchFullTimeNum = newtable.BranchFullTimeNum, - ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum, - ProjectFullTimeNum = newtable.ProjectFullTimeNum, - ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum, - SafetyInjectionEngineer = newtable.SafetyInjectionEngineer, - CertificateANum = newtable.CertificateANum, - CertificateBNum = newtable.CertificateBNum, - CertificateCNum = newtable.CertificateCNum, - SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum, - EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum, - ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum, - ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum, - CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum, - CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum, - CompanySpecialCheckNum = newtable.CompanySpecialCheckNum, - ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum, - ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum, - ProjectMajorCheckNum = newtable.ProjectMajorCheckNum, - NearMissNum = newtable.NearMissNum, - RecordableEventNum = newtable.RecordableEventNum, - GeneralAccidentNum = newtable.GeneralAccidentNum, - MajorAccidentNum = newtable.MajorAccidentNum, - SeriousAccidentNum = newtable.SeriousAccidentNum, - SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum, - CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum, - CompanySpecialPlanNum = newtable.CompanySpecialPlanNum, - CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan, - CompanyDrillNum = newtable.CompanyDrillNum, - ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum, - ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum, - ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan, - ProjectDrillNum = newtable.ProjectDrillNum, - CostExtract = newtable.CostExtract, - CostUse = newtable.CostUse, - UseEquipmentNum = newtable.UseEquipmentNum, - SpecialEquipmentNum = newtable.SpecialEquipmentNum, - LicensesNum = newtable.LicensesNum, - LicensesCloseNum = newtable.LicensesCloseNum, - GeneralClosedNum = newtable.GeneralClosedNum, - GeneralNotClosedNum = newtable.GeneralNotClosedNum, - MajorClosedNum = newtable.MajorClosedNum, - MajorNotClosedNum = newtable.MajorNotClosedNum, - GeneralRiskNum = newtable.GeneralRiskNum, - LowRiskNum = newtable.LowRiskNum, - MediumRiskNum = newtable.MediumRiskNum, - HighRiskNum = newtable.HighRiskNum, - CompletedNum = newtable.CompletedNum, - TrainPersonNum = newtable.TrainPersonNum, - ConstructionNum = newtable.ConstructionNum, - FinishedNum = newtable.FinishedNum, - SuperCompletedNum = newtable.SuperCompletedNum, - SuperTrainPersonNum = newtable.SuperTrainPersonNum, - SuperConstructionNum = newtable.SuperConstructionNum, - SuperFinishedNum = newtable.SuperFinishedNum, - State = newtable.State, - CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan, - }; - db.HSSEData_HSSE.InsertOnSubmit(table); - db.SubmitChanges(); - } - - public static void DeleteHSSEData_HSSEById(string Id) - { - Model.HSSEData_HSSE table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); - if (table != null) - { - db.HSSEData_HSSE.DeleteOnSubmit(table); + var table = new HSSEData_HSSE + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + BeUnderConstructionNum = newtable.BeUnderConstructionNum, + ShutdownNum = newtable.ShutdownNum, + JoinConstructionPersonNum = newtable.JoinConstructionPersonNum, + MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum, + TotalWorkingHour = newtable.TotalWorkingHour, + LostWorkingHour = newtable.LostWorkingHour, + SafeWorkingHour = newtable.SafeWorkingHour, + SafeTrainNum = newtable.SafeTrainNum, + SpecialTrainNum = newtable.SpecialTrainNum, + SpecialOperationTrainNum = newtable.SpecialOperationTrainNum, + TotalEnergyConsumption = newtable.TotalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, + NewWaterConsumption = newtable.NewWaterConsumption, + HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum, + HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum, + BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum, + BranchFullTimeNum = newtable.BranchFullTimeNum, + ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum, + ProjectFullTimeNum = newtable.ProjectFullTimeNum, + ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum, + SafetyInjectionEngineer = newtable.SafetyInjectionEngineer, + CertificateANum = newtable.CertificateANum, + CertificateBNum = newtable.CertificateBNum, + CertificateCNum = newtable.CertificateCNum, + SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum, + EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum, + ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum, + ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum, + CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum, + CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum, + CompanySpecialCheckNum = newtable.CompanySpecialCheckNum, + ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum, + ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum, + ProjectMajorCheckNum = newtable.ProjectMajorCheckNum, + NearMissNum = newtable.NearMissNum, + RecordableEventNum = newtable.RecordableEventNum, + GeneralAccidentNum = newtable.GeneralAccidentNum, + MajorAccidentNum = newtable.MajorAccidentNum, + SeriousAccidentNum = newtable.SeriousAccidentNum, + SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum, + CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum, + CompanySpecialPlanNum = newtable.CompanySpecialPlanNum, + CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan, + CompanyDrillNum = newtable.CompanyDrillNum, + ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum, + ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum, + ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan, + ProjectDrillNum = newtable.ProjectDrillNum, + CostExtract = newtable.CostExtract, + CostUse = newtable.CostUse, + UseEquipmentNum = newtable.UseEquipmentNum, + SpecialEquipmentNum = newtable.SpecialEquipmentNum, + LicensesNum = newtable.LicensesNum, + LicensesCloseNum = newtable.LicensesCloseNum, + GeneralClosedNum = newtable.GeneralClosedNum, + GeneralNotClosedNum = newtable.GeneralNotClosedNum, + MajorClosedNum = newtable.MajorClosedNum, + MajorNotClosedNum = newtable.MajorNotClosedNum, + GeneralRiskNum = newtable.GeneralRiskNum, + LowRiskNum = newtable.LowRiskNum, + MediumRiskNum = newtable.MediumRiskNum, + HighRiskNum = newtable.HighRiskNum, + CompletedNum = newtable.CompletedNum, + TrainPersonNum = newtable.TrainPersonNum, + ConstructionNum = newtable.ConstructionNum, + FinishedNum = newtable.FinishedNum, + SuperCompletedNum = newtable.SuperCompletedNum, + SuperTrainPersonNum = newtable.SuperTrainPersonNum, + SuperConstructionNum = newtable.SuperConstructionNum, + SuperFinishedNum = newtable.SuperFinishedNum, + State = newtable.State, + CreateDate = newtable.CreateDate, + CreateMan = newtable.CreateMan + }; + db.HSSEData_HSSE.InsertOnSubmit(table); db.SubmitChanges(); } } - public static Model.HSSEData_HSSE GetHSSEData_HSSEById(string Id) + public static void DeleteHSSEData_HSSEById(string id) { - return db.HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); - } - public static Model.HSSEData GetItemById(string Id) - { - HsseDataItem item = new HsseDataItem(); - HSSEData data = new HSSEData(); - var data_HSSE = GetHSSEData_HSSEById(Id); - if (data_HSSE != null) + using (var db = new SGGLDB(Funs.ConnString)) { - item.BeUnderConstructionNum = data_HSSE.BeUnderConstructionNum; - item.BranchFullTimeNum = data_HSSE.BranchFullTimeNum; - item.BranchInspectorGeneralNum = data_HSSE.BranchInspectorGeneralNum; - item.CertificateANum = data_HSSE.CertificateANum; - item.CertificateBNum = data_HSSE.CertificateBNum; - item.CertificateCNum = data_HSSE.CertificateCNum; - item.CollCropCode = data_HSSE.CollCropCode; - item.CompanyComprehensiveCheckNum = data_HSSE.CompanyComprehensiveCheckNum; - item.CompanyComprehensivePlanNum = data_HSSE.CompanyComprehensivePlanNum; - item.CompanyDrillNum = data_HSSE.CompanyDrillNum; - item.CompanyLeadShiftCheckNum = data_HSSE.CompanyLeadShiftCheckNum; - item.CompanyOnSiteDisposalPlan = data_HSSE.CompanyOnSiteDisposalPlan; - item.CompanySpecialCheckNum = data_HSSE.CompanySpecialCheckNum; - item.CompanySpecialPlanNum = data_HSSE.CompanySpecialPlanNum; - item.CompletedNum = data_HSSE.CompletedNum; - item.ConstructionNum = data_HSSE.ConstructionNum; - item.CostExtract = data_HSSE.CostExtract; - item.CostUse = data_HSSE.CostUse; - item.EnterpriseTopicsMeetingNum = data_HSSE.EnterpriseTopicsMeetingNum; - item.FinishedNum = data_HSSE.FinishedNum; - item.GeneralAccidentNum = data_HSSE.GeneralAccidentNum; - item.GeneralClosedNum = data_HSSE.GeneralClosedNum; - item.GeneralNotClosedNum = data_HSSE.GeneralNotClosedNum; - item.GeneralRate = ""; - item.GeneralRiskNum = data_HSSE.GeneralRiskNum; - item.HeadOfficeFullTimeNum = data_HSSE.HeadOfficeFullTimeNum; - item.HeadOfficeInspectorGeneralNum = data_HSSE.HeadOfficeInspectorGeneralNum; - item.HighRiskNum = data_HSSE.HighRiskNum; - item.Id = data_HSSE.Id; - item.IncomeComprehensiveEnergyConsumption = data_HSSE.IncomeComprehensiveEnergyConsumption; - item.JoinConstructionPersonNum = data_HSSE.JoinConstructionPersonNum; - item.LicensesCloseNum = data_HSSE.LicensesCloseNum; - item.LicensesNum = data_HSSE.LicensesNum; - item.LostWorkingHour = data_HSSE.LostWorkingHour; - item.LowRiskNum = data_HSSE.LowRiskNum; - item.MajorAccidentNum = data_HSSE.MajorAccidentNum; - item.MajorClosedNum = data_HSSE.MajorClosedNum; - item.MajorNotClosedNum = data_HSSE.MajorNotClosedNum; - item.MajorProjectsUnderConstructionNum = data_HSSE.MajorProjectsUnderConstructionNum; - item.MajorRate = ""; - item.MediumRiskNum = data_HSSE.MediumRiskNum; - item.NearMissNum = data_HSSE.NearMissNum; - item.NewWaterConsumption = data_HSSE.NewWaterConsumption; - item.ProjectComprehensivePlanNum = data_HSSE.ProjectComprehensivePlanNum; - item.ProjectDrillNum = data_HSSE.ProjectDrillNum; - item.ProjectFullTimeNum = data_HSSE.ProjectFullTimeNum; - item.ProjectInspectorGeneralNum = data_HSSE.ProjectInspectorGeneralNum; - item.ProjectLeadShiftCheckNum = data_HSSE.ProjectLeadShiftCheckNum; - item.ProjectMajorCheckNum = data_HSSE.ProjectMajorCheckNum; - item.ProjectOnSiteDisposalPlan = data_HSSE.ProjectOnSiteDisposalPlan; - item.ProjectSafetyLeadingGroupMeetingNum = data_HSSE.ProjectSafetyLeadingGroupMeetingNum; - item.ProjectSafetyMeetingNum = data_HSSE.ProjectSafetyMeetingNum; - item.ProjectSafetyMonitorNum = data_HSSE.ProjectSafetyMonitorNum; - item.ProjectSpecialCheckNum = data_HSSE.ProjectSpecialCheckNum; - item.ProjectSpecialPlanNum = data_HSSE.ProjectSpecialPlanNum; - item.RecordableEventNum = data_HSSE.RecordableEventNum; - item.ReportDate = data_HSSE.ReportDate.Value.ToShortDateString(); - item.SafeTrainNum = data_HSSE.SafeTrainNum; - item.SafetyCommitteeMeetingNum = data_HSSE.SafetyCommitteeMeetingNum; - item.SafetyInjectionEngineer = data_HSSE.SafetyInjectionEngineer; - item.SafeWorkingHour = data_HSSE.SafeWorkingHour; - item.SeriousAccidentNum = data_HSSE.SeriousAccidentNum; - item.ShutdownNum = data_HSSE.ShutdownNum; - item.SpecialEquipmentNum = data_HSSE.SpecialEquipmentNum; - item.SpecialOperationTrainNum = data_HSSE.SpecialOperationTrainNum; - item.SpecialSeriousAccidentNum = data_HSSE.SpecialSeriousAccidentNum; - item.SpecialTrainNum = data_HSSE.SpecialTrainNum; - item.SuperCompletedNum = data_HSSE.SuperCompletedNum; - item.SuperConstructionNum = data_HSSE.SuperConstructionNum; - item.SuperFinishedNum = data_HSSE.SuperFinishedNum; - item.SuperTrainPersonNum = data_HSSE.SuperTrainPersonNum; - item.TotalEnergyConsumption = data_HSSE.TotalEnergyConsumption; - item.TotalWorkingHour = data_HSSE.TotalWorkingHour; - item.TrainPersonNum = data_HSSE.TrainPersonNum; - item.UnitId = data_HSSE.UnitId; - item.UseEquipmentNum = data_HSSE.UseEquipmentNum; - var hSSEData_Hiddens = HSSEData_HiddenDangerDetailService.GetHSSEData_HiddenDangerDetailByDate(data_HSSE.ReportDate); - if (hSSEData_Hiddens != null) + var table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == id); + if (table != null) { - var list = new List(); - foreach (var detail in hSSEData_Hiddens) - { - HSSEDataHiddenDangerDetailItem hSSEDataHiddenDangerDetailItem = new HSSEDataHiddenDangerDetailItem(); + db.HSSEData_HSSE.DeleteOnSubmit(table); + db.SubmitChanges(); + } + } + } + + public static HSSEData_HSSE GetHSSEData_HSSEById(string id) + { + using (var db = new SGGLDB(Funs.ConnString)) + { + return db.HSSEData_HSSE.FirstOrDefault(x => x.Id == id); + } + } + + public static HSSEData GetItemById(string id) + { + var item = new HsseDataItem(); + var data = new HSSEData(); + var dataHsse = GetHSSEData_HSSEById(id); + if (dataHsse != null) + { + item.BeUnderConstructionNum = dataHsse.BeUnderConstructionNum; + item.BranchFullTimeNum = dataHsse.BranchFullTimeNum; + item.BranchInspectorGeneralNum = dataHsse.BranchInspectorGeneralNum; + item.CertificateANum = dataHsse.CertificateANum; + item.CertificateBNum = dataHsse.CertificateBNum; + item.CertificateCNum = dataHsse.CertificateCNum; + item.CollCropCode = dataHsse.CollCropCode; + item.CompanyComprehensiveCheckNum = dataHsse.CompanyComprehensiveCheckNum; + item.CompanyComprehensivePlanNum = dataHsse.CompanyComprehensivePlanNum; + item.CompanyDrillNum = dataHsse.CompanyDrillNum; + item.CompanyLeadShiftCheckNum = dataHsse.CompanyLeadShiftCheckNum; + item.CompanyOnSiteDisposalPlan = dataHsse.CompanyOnSiteDisposalPlan; + item.CompanySpecialCheckNum = dataHsse.CompanySpecialCheckNum; + item.CompanySpecialPlanNum = dataHsse.CompanySpecialPlanNum; + item.CompletedNum = dataHsse.CompletedNum; + item.ConstructionNum = dataHsse.ConstructionNum; + item.CostExtract = dataHsse.CostExtract; + item.CostUse = dataHsse.CostUse; + item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum; + item.FinishedNum = dataHsse.FinishedNum; + item.GeneralAccidentNum = dataHsse.GeneralAccidentNum; + item.GeneralClosedNum = dataHsse.GeneralClosedNum; + item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum; + item.GeneralRate = ""; + item.GeneralRiskNum = dataHsse.GeneralRiskNum; + item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum; + item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum; + item.HighRiskNum = dataHsse.HighRiskNum; + item.Id = dataHsse.Id; + item.IncomeComprehensiveEnergyConsumption = dataHsse.IncomeComprehensiveEnergyConsumption; + item.JoinConstructionPersonNum = dataHsse.JoinConstructionPersonNum; + item.LicensesCloseNum = dataHsse.LicensesCloseNum; + item.LicensesNum = dataHsse.LicensesNum; + item.LostWorkingHour = dataHsse.LostWorkingHour; + item.LowRiskNum = dataHsse.LowRiskNum; + item.MajorAccidentNum = dataHsse.MajorAccidentNum; + item.MajorClosedNum = dataHsse.MajorClosedNum; + item.MajorNotClosedNum = dataHsse.MajorNotClosedNum; + item.MajorProjectsUnderConstructionNum = dataHsse.MajorProjectsUnderConstructionNum; + item.MajorRate = ""; + item.MediumRiskNum = dataHsse.MediumRiskNum; + item.NearMissNum = dataHsse.NearMissNum; + item.NewWaterConsumption = dataHsse.NewWaterConsumption; + item.ProjectComprehensivePlanNum = dataHsse.ProjectComprehensivePlanNum; + item.ProjectDrillNum = dataHsse.ProjectDrillNum; + item.ProjectFullTimeNum = dataHsse.ProjectFullTimeNum; + item.ProjectInspectorGeneralNum = dataHsse.ProjectInspectorGeneralNum; + item.ProjectLeadShiftCheckNum = dataHsse.ProjectLeadShiftCheckNum; + item.ProjectMajorCheckNum = dataHsse.ProjectMajorCheckNum; + item.ProjectOnSiteDisposalPlan = dataHsse.ProjectOnSiteDisposalPlan; + item.ProjectSafetyLeadingGroupMeetingNum = dataHsse.ProjectSafetyLeadingGroupMeetingNum; + item.ProjectSafetyMeetingNum = dataHsse.ProjectSafetyMeetingNum; + item.ProjectSafetyMonitorNum = dataHsse.ProjectSafetyMonitorNum; + item.ProjectSpecialCheckNum = dataHsse.ProjectSpecialCheckNum; + item.ProjectSpecialPlanNum = dataHsse.ProjectSpecialPlanNum; + item.RecordableEventNum = dataHsse.RecordableEventNum; + item.ReportDate = dataHsse.ReportDate.Value.ToShortDateString(); + item.SafeTrainNum = dataHsse.SafeTrainNum; + item.SafetyCommitteeMeetingNum = dataHsse.SafetyCommitteeMeetingNum; + item.SafetyInjectionEngineer = dataHsse.SafetyInjectionEngineer; + item.SafeWorkingHour = dataHsse.SafeWorkingHour; + item.SeriousAccidentNum = dataHsse.SeriousAccidentNum; + item.ShutdownNum = dataHsse.ShutdownNum; + item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum; + item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum; + item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum; + item.SpecialTrainNum = dataHsse.SpecialTrainNum; + item.SuperCompletedNum = dataHsse.SuperCompletedNum; + item.SuperConstructionNum = dataHsse.SuperConstructionNum; + item.SuperFinishedNum = dataHsse.SuperFinishedNum; + item.SuperTrainPersonNum = dataHsse.SuperTrainPersonNum; + item.TotalEnergyConsumption = dataHsse.TotalEnergyConsumption; + item.TotalWorkingHour = dataHsse.TotalWorkingHour; + item.TrainPersonNum = dataHsse.TrainPersonNum; + item.UnitId = dataHsse.UnitId; + item.UseEquipmentNum = dataHsse.UseEquipmentNum; + var hSseDataHiddens = + HSSEData_HiddenDangerDetailService.GetHSSEData_HiddenDangerDetailByDate(dataHsse.ReportDate); + if (hSseDataHiddens != null) + { + var list = hSseDataHiddens.Select(detail => new HSSEDataHiddenDangerDetailItem + { + Id = detail.Id, NeedRectifyNum = detail.NeedRectifyNum, TotalNum = detail.TotalNum, + TypeName = detail.TypeName + }).ToList(); - hSSEDataHiddenDangerDetailItem.Id = detail.Id; - hSSEDataHiddenDangerDetailItem.NeedRectifyNum = detail.NeedRectifyNum; - hSSEDataHiddenDangerDetailItem.TotalNum = detail.TotalNum; - hSSEDataHiddenDangerDetailItem.TypeName = detail.TypeName; - list.Add(hSSEDataHiddenDangerDetailItem); - } item.HiddenDangerDetailItems = list; } } - List hsseDataItems = new List(); - hsseDataItems.Add(item); + + var hsseDataItems = new List { item }; data.HSSEDataItems = hsseDataItems; return data; } - public static Model.HSSEData GetItemByHSSEData_HSSE(Model.HSSEData_HSSE data_HSSE, List hSSEData_Hiddens) - { - HsseDataItem item = new HsseDataItem(); - HSSEData data = new HSSEData(); - if (data_HSSE != null) - { - item.BeUnderConstructionNum = data_HSSE.BeUnderConstructionNum; - item.BranchFullTimeNum = data_HSSE.BranchFullTimeNum; - item.BranchInspectorGeneralNum = data_HSSE.BranchInspectorGeneralNum; - item.CertificateANum = data_HSSE.CertificateANum; - item.CertificateBNum = data_HSSE.CertificateBNum; - item.CertificateCNum = data_HSSE.CertificateCNum; - item.CollCropCode = data_HSSE.CollCropCode; - item.CompanyComprehensiveCheckNum = data_HSSE.CompanyComprehensiveCheckNum; - item.CompanyComprehensivePlanNum = data_HSSE.CompanyComprehensivePlanNum; - item.CompanyDrillNum = data_HSSE.CompanyDrillNum; - item.CompanyLeadShiftCheckNum = data_HSSE.CompanyLeadShiftCheckNum; - item.CompanyOnSiteDisposalPlan = data_HSSE.CompanyOnSiteDisposalPlan; - item.CompanySpecialCheckNum = data_HSSE.CompanySpecialCheckNum; - item.CompanySpecialPlanNum = data_HSSE.CompanySpecialPlanNum; - item.CompletedNum = data_HSSE.CompletedNum; - item.ConstructionNum = data_HSSE.ConstructionNum; - item.CostExtract = data_HSSE.CostExtract; - item.CostUse = data_HSSE.CostUse; - item.EnterpriseTopicsMeetingNum = data_HSSE.EnterpriseTopicsMeetingNum; - item.FinishedNum = data_HSSE.FinishedNum; - item.GeneralAccidentNum = data_HSSE.GeneralAccidentNum; - item.GeneralClosedNum = data_HSSE.GeneralClosedNum; - item.GeneralNotClosedNum = data_HSSE.GeneralNotClosedNum; - item.GeneralRate = ""; - item.GeneralRiskNum = data_HSSE.GeneralRiskNum; - item.HeadOfficeFullTimeNum = data_HSSE.HeadOfficeFullTimeNum; - item.HeadOfficeInspectorGeneralNum = data_HSSE.HeadOfficeInspectorGeneralNum; - item.HighRiskNum = data_HSSE.HighRiskNum; - item.Id = data_HSSE.Id; - item.IncomeComprehensiveEnergyConsumption = data_HSSE.IncomeComprehensiveEnergyConsumption; - item.JoinConstructionPersonNum = data_HSSE.JoinConstructionPersonNum; - item.LicensesCloseNum = data_HSSE.LicensesCloseNum; - item.LicensesNum = data_HSSE.LicensesNum; - item.LostWorkingHour = data_HSSE.LostWorkingHour; - item.LowRiskNum = data_HSSE.LowRiskNum; - item.MajorAccidentNum = data_HSSE.MajorAccidentNum; - item.MajorClosedNum = data_HSSE.MajorClosedNum; - item.MajorNotClosedNum = data_HSSE.MajorNotClosedNum; - item.MajorProjectsUnderConstructionNum = data_HSSE.MajorProjectsUnderConstructionNum; - item.MajorRate = ""; - item.MediumRiskNum = data_HSSE.MediumRiskNum; - item.NearMissNum = data_HSSE.NearMissNum; - item.NewWaterConsumption = data_HSSE.NewWaterConsumption; - item.ProjectComprehensivePlanNum = data_HSSE.ProjectComprehensivePlanNum; - item.ProjectDrillNum = data_HSSE.ProjectDrillNum; - item.ProjectFullTimeNum = data_HSSE.ProjectFullTimeNum; - item.ProjectInspectorGeneralNum = data_HSSE.ProjectInspectorGeneralNum; - item.ProjectLeadShiftCheckNum = data_HSSE.ProjectLeadShiftCheckNum; - item.ProjectMajorCheckNum = data_HSSE.ProjectMajorCheckNum; - item.ProjectOnSiteDisposalPlan = data_HSSE.ProjectOnSiteDisposalPlan; - item.ProjectSafetyLeadingGroupMeetingNum = data_HSSE.ProjectSafetyLeadingGroupMeetingNum; - item.ProjectSafetyMeetingNum = data_HSSE.ProjectSafetyMeetingNum; - item.ProjectSafetyMonitorNum = data_HSSE.ProjectSafetyMonitorNum; - item.ProjectSpecialCheckNum = data_HSSE.ProjectSpecialCheckNum; - item.ProjectSpecialPlanNum = data_HSSE.ProjectSpecialPlanNum; - item.RecordableEventNum = data_HSSE.RecordableEventNum; - item.ReportDate = data_HSSE.ReportDate.Value.ToShortDateString(); - item.SafeTrainNum = data_HSSE.SafeTrainNum; - item.SafetyCommitteeMeetingNum = data_HSSE.SafetyCommitteeMeetingNum; - item.SafetyInjectionEngineer = data_HSSE.SafetyInjectionEngineer; - item.SafeWorkingHour = data_HSSE.SafeWorkingHour; - item.SeriousAccidentNum = data_HSSE.SeriousAccidentNum; - item.ShutdownNum = data_HSSE.ShutdownNum; - item.SpecialEquipmentNum = data_HSSE.SpecialEquipmentNum; - item.SpecialOperationTrainNum = data_HSSE.SpecialOperationTrainNum; - item.SpecialSeriousAccidentNum = data_HSSE.SpecialSeriousAccidentNum; - item.SpecialTrainNum = data_HSSE.SpecialTrainNum; - item.SuperCompletedNum = data_HSSE.SuperCompletedNum; - item.SuperConstructionNum = data_HSSE.SuperConstructionNum; - item.SuperFinishedNum = data_HSSE.SuperFinishedNum; - item.SuperTrainPersonNum = data_HSSE.SuperTrainPersonNum; - item.TotalEnergyConsumption = data_HSSE.TotalEnergyConsumption; - item.TotalWorkingHour = data_HSSE.TotalWorkingHour; - item.TrainPersonNum = data_HSSE.TrainPersonNum; - item.UnitId = data_HSSE.UnitId; - item.UseEquipmentNum = data_HSSE.UseEquipmentNum; - if (hSSEData_Hiddens != null) - { - var list = new List(); - foreach (var detail in hSSEData_Hiddens) - { - HSSEDataHiddenDangerDetailItem hSSEDataHiddenDangerDetailItem = new HSSEDataHiddenDangerDetailItem(); - hSSEDataHiddenDangerDetailItem.Id = detail.Id; - hSSEDataHiddenDangerDetailItem.NeedRectifyNum = detail.NeedRectifyNum; - hSSEDataHiddenDangerDetailItem.TotalNum = detail.TotalNum; - hSSEDataHiddenDangerDetailItem.TypeName = detail.TypeName; - list.Add(hSSEDataHiddenDangerDetailItem); - } + public static HSSEData GetItemByHSSEData_HSSE(HSSEData_HSSE dataHsse, + List hSseDataHiddens) + { + var item = new HsseDataItem(); + var data = new HSSEData(); + if (dataHsse != null) + { + item.BeUnderConstructionNum = dataHsse.BeUnderConstructionNum; + item.BranchFullTimeNum = dataHsse.BranchFullTimeNum; + item.BranchInspectorGeneralNum = dataHsse.BranchInspectorGeneralNum; + item.CertificateANum = dataHsse.CertificateANum; + item.CertificateBNum = dataHsse.CertificateBNum; + item.CertificateCNum = dataHsse.CertificateCNum; + item.CollCropCode = dataHsse.CollCropCode; + item.CompanyComprehensiveCheckNum = dataHsse.CompanyComprehensiveCheckNum; + item.CompanyComprehensivePlanNum = dataHsse.CompanyComprehensivePlanNum; + item.CompanyDrillNum = dataHsse.CompanyDrillNum; + item.CompanyLeadShiftCheckNum = dataHsse.CompanyLeadShiftCheckNum; + item.CompanyOnSiteDisposalPlan = dataHsse.CompanyOnSiteDisposalPlan; + item.CompanySpecialCheckNum = dataHsse.CompanySpecialCheckNum; + item.CompanySpecialPlanNum = dataHsse.CompanySpecialPlanNum; + item.CompletedNum = dataHsse.CompletedNum; + item.ConstructionNum = dataHsse.ConstructionNum; + item.CostExtract = dataHsse.CostExtract; + item.CostUse = dataHsse.CostUse; + item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum; + item.FinishedNum = dataHsse.FinishedNum; + item.GeneralAccidentNum = dataHsse.GeneralAccidentNum; + item.GeneralClosedNum = dataHsse.GeneralClosedNum; + item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum; + item.GeneralRate = ""; + item.GeneralRiskNum = dataHsse.GeneralRiskNum; + item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum; + item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum; + item.HighRiskNum = dataHsse.HighRiskNum; + item.Id = dataHsse.Id; + item.IncomeComprehensiveEnergyConsumption = dataHsse.IncomeComprehensiveEnergyConsumption; + item.JoinConstructionPersonNum = dataHsse.JoinConstructionPersonNum; + item.LicensesCloseNum = dataHsse.LicensesCloseNum; + item.LicensesNum = dataHsse.LicensesNum; + item.LostWorkingHour = dataHsse.LostWorkingHour; + item.LowRiskNum = dataHsse.LowRiskNum; + item.MajorAccidentNum = dataHsse.MajorAccidentNum; + item.MajorClosedNum = dataHsse.MajorClosedNum; + item.MajorNotClosedNum = dataHsse.MajorNotClosedNum; + item.MajorProjectsUnderConstructionNum = dataHsse.MajorProjectsUnderConstructionNum; + item.MajorRate = ""; + item.MediumRiskNum = dataHsse.MediumRiskNum; + item.NearMissNum = dataHsse.NearMissNum; + item.NewWaterConsumption = dataHsse.NewWaterConsumption; + item.ProjectComprehensivePlanNum = dataHsse.ProjectComprehensivePlanNum; + item.ProjectDrillNum = dataHsse.ProjectDrillNum; + item.ProjectFullTimeNum = dataHsse.ProjectFullTimeNum; + item.ProjectInspectorGeneralNum = dataHsse.ProjectInspectorGeneralNum; + item.ProjectLeadShiftCheckNum = dataHsse.ProjectLeadShiftCheckNum; + item.ProjectMajorCheckNum = dataHsse.ProjectMajorCheckNum; + item.ProjectOnSiteDisposalPlan = dataHsse.ProjectOnSiteDisposalPlan; + item.ProjectSafetyLeadingGroupMeetingNum = dataHsse.ProjectSafetyLeadingGroupMeetingNum; + item.ProjectSafetyMeetingNum = dataHsse.ProjectSafetyMeetingNum; + item.ProjectSafetyMonitorNum = dataHsse.ProjectSafetyMonitorNum; + item.ProjectSpecialCheckNum = dataHsse.ProjectSpecialCheckNum; + item.ProjectSpecialPlanNum = dataHsse.ProjectSpecialPlanNum; + item.RecordableEventNum = dataHsse.RecordableEventNum; + item.ReportDate = dataHsse.ReportDate.Value.ToShortDateString(); + item.SafeTrainNum = dataHsse.SafeTrainNum; + item.SafetyCommitteeMeetingNum = dataHsse.SafetyCommitteeMeetingNum; + item.SafetyInjectionEngineer = dataHsse.SafetyInjectionEngineer; + item.SafeWorkingHour = dataHsse.SafeWorkingHour; + item.SeriousAccidentNum = dataHsse.SeriousAccidentNum; + item.ShutdownNum = dataHsse.ShutdownNum; + item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum; + item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum; + item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum; + item.SpecialTrainNum = dataHsse.SpecialTrainNum; + item.SuperCompletedNum = dataHsse.SuperCompletedNum; + item.SuperConstructionNum = dataHsse.SuperConstructionNum; + item.SuperFinishedNum = dataHsse.SuperFinishedNum; + item.SuperTrainPersonNum = dataHsse.SuperTrainPersonNum; + item.TotalEnergyConsumption = dataHsse.TotalEnergyConsumption; + item.TotalWorkingHour = dataHsse.TotalWorkingHour; + item.TrainPersonNum = dataHsse.TrainPersonNum; + item.UnitId = dataHsse.UnitId; + item.UseEquipmentNum = dataHsse.UseEquipmentNum; + if (hSseDataHiddens != null) + { + var list = hSseDataHiddens.Select(detail => + new HSSEDataHiddenDangerDetailItem + { + Id = detail.Id, + NeedRectifyNum = detail.NeedRectifyNum, + TotalNum = detail.TotalNum, + TypeName = detail.TypeName + }).ToList(); + item.HiddenDangerDetailItems = list; } } - List hsseDataItems = new List(); - hsseDataItems.Add(item); + + var hsseDataItems = new List { item }; data.HSSEDataItems = hsseDataItems; return data; } - public static Model.HSSEData GetTodayHSSEData_HSSE() + + public static HSSEData GetTodayHSSEData_HSSE() { + HSSEData data; var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); - HSSEData data = new HSSEData(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); if (q != null && q.State == Const.CNCEC_State_S) - { - data = GetItemByHSSEData_HSSE(q, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); ; - } - else - { + // data = GetItemByHSSEData_HSSE(q, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); ; + data = StatisticalData(); + else data = StatisticalData(); - } return data; } - public static Model.HSSEData_HSSE GetTodayData() + + public static HSSEData_HSSE GetTodayData() { var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } + public static void UpdateTodyData_State() { var q = GetTodayData(); - if (q!=null) + if (q != null) { q.State = Const.CNCEC_State_1; UpdateHSSEData_HSSE(q); } - } + public static bool IsReportByDate(DateTime dateTime) { var result = false; var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date) - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date + select x).ToList(); + if (q.Count > 0) result = true; return result; } /// - /// 判断当天是否已上报 + /// 判断当天是否已上报 /// /// public static bool IsReportByToday() { var result = false; var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); + if (q.Count > 0) result = true; return result; } - public static Model.ReturnData PushCNCEC(string Id) + public static ReturnData PushCncec(string id) { - string baseurl = "/api/HSSEData/SaveHSSEData"; - var item = GetItemById(Id); - string str = JsonConvert.SerializeObject(item); - var responeData = BLL.ServerService.PushCNCEC(str, baseurl); + var baseurl = "/api/HSSEData/SaveHSSEData"; + var item = GetItemById(id); + var str = JsonConvert.SerializeObject(item); + var responeData = ServerService.PushCNCEC(str, baseurl); return responeData; } public static HSSEData StatisticalData() { - HSSEData data = new HSSEData(); - string thisUnitId = BLL.Const.UnitId_CD; - var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); Project_HSSEData_HSSEService.StatisticalAllProjectData(); + Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData(); - var ProjectData = (from x in Funs.DB.Project_HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); - //int TotalEnergyConsumption= Information_EnvironmentalDataService.GetLatstTimeTotalEnergyConsumption(); - //int IncomeComprehensiveEnergyConsumption = Information_EnvironmentalDataService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); - //int NewWaterConsumption = Information_EnvironmentalDataService.GetLatstTimeNewWaterConsumption(); + var projectData = (from x in Funs.DB.Project_HSSEData_HSSE + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); + var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); + var incomeComprehensiveEnergyConsumption = + ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); + var newWaterConsumption = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); - Model.HSSEData_HSSE table = new Model.HSSEData_HSSE + var table = new HSSEData_HSSE { UnitId = thisUnitId, - CollCropCode = base_Unit.CollCropCode, - UnitName = base_Unit.UnitName, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, ReportDate = DateTime.Now.Date, - BeUnderConstructionNum = ProjectData.Sum(x => x.BeUnderConstructionNum), - ShutdownNum = ProjectData.Sum(x => x.ShutdownNum), - JoinConstructionPersonNum = ProjectData.Sum(x => x.JoinConstructionPersonNum), - MajorProjectsUnderConstructionNum = ProjectData.Sum(x => x.MajorProjectsUnderConstructionNum), - TotalWorkingHour = ProjectData.Sum(x => x.TotalWorkingHour), - LostWorkingHour = ProjectData.Sum(x => x.LostWorkingHour), - SafeWorkingHour = ProjectData.Sum(x => x.SafeWorkingHour), - SafeTrainNum = ProjectData.Sum(x => x.SafeTrainNum), - SpecialTrainNum = ProjectData.Sum(x => x.SpecialTrainNum), - SpecialOperationTrainNum = ProjectData.Sum(x => x.SpecialOperationTrainNum), - TotalEnergyConsumption = 0, - IncomeComprehensiveEnergyConsumption = 0, - NewWaterConsumption = 0, + BeUnderConstructionNum = projectData.Sum(x => x.BeUnderConstructionNum), + ShutdownNum = projectData.Sum(x => x.ShutdownNum), + JoinConstructionPersonNum = projectData.Sum(x => x.JoinConstructionPersonNum), + MajorProjectsUnderConstructionNum = projectData.Sum(x => x.MajorProjectsUnderConstructionNum), + TotalWorkingHour = projectData.Sum(x => x.TotalWorkingHour), + LostWorkingHour = projectData.Sum(x => x.LostWorkingHour), + SafeWorkingHour = projectData.Sum(x => x.SafeWorkingHour), + SafeTrainNum = projectData.Sum(x => x.SafeTrainNum), + SpecialTrainNum = projectData.Sum(x => x.SpecialTrainNum), + SpecialOperationTrainNum = projectData.Sum(x => x.SpecialOperationTrainNum), + TotalEnergyConsumption = totalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, + NewWaterConsumption = newWaterConsumption, HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneralNum(), HeadOfficeFullTimeNum = GetHeadOfficeFullTimeNum(), BranchInspectorGeneralNum = GetBranchInspectorGeneralNum(), BranchFullTimeNum = GetBranchFullTimeNum(), - ProjectInspectorGeneralNum = ProjectData.Sum(x => x.ProjectInspectorGeneralNum), - ProjectFullTimeNum = ProjectData.Sum(x => x.ProjectFullTimeNum), - ProjectSafetyMonitorNum = ProjectData.Sum(x => x.ProjectSafetyMonitorNum), - SafetyInjectionEngineer = ProjectData.Sum(x => x.SafetyInjectionEngineer), - CertificateANum = ProjectData.Sum(x => x.CertificateANum), - CertificateBNum = ProjectData.Sum(x => x.CertificateBNum), - CertificateCNum = ProjectData.Sum(x => x.CertificateCNum), + ProjectInspectorGeneralNum = projectData.Sum(x => x.ProjectInspectorGeneralNum), + ProjectFullTimeNum = projectData.Sum(x => x.ProjectFullTimeNum), + ProjectSafetyMonitorNum = projectData.Sum(x => x.ProjectSafetyMonitorNum), + SafetyInjectionEngineer = projectData.Sum(x => x.SafetyInjectionEngineer), + CertificateANum = projectData.Sum(x => x.CertificateANum), + CertificateBNum = projectData.Sum(x => x.CertificateBNum), + CertificateCNum = projectData.Sum(x => x.CertificateCNum), SafetyCommitteeMeetingNum = GetSafetyCommitteeMeetingNum(), EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(), - ProjectSafetyLeadingGroupMeetingNum = ProjectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum), - ProjectSafetyMeetingNum = ProjectData.Sum(x => x.ProjectSafetyMeetingNum), + ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum), + ProjectSafetyMeetingNum = projectData.Sum(x => x.ProjectSafetyMeetingNum), CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheckNum(), CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheckNum(), CompanySpecialCheckNum = GetCompanySpecialCheckNum(), - ProjectLeadShiftCheckNum = ProjectData.Sum(x => x.ProjectLeadShiftCheckNum), - ProjectSpecialCheckNum = ProjectData.Sum(x => x.ProjectSpecialCheckNum), - ProjectMajorCheckNum = ProjectData.Sum(x => x.ProjectMajorCheckNum), - NearMissNum = ProjectData.Sum(x => x.NearMissNum), - RecordableEventNum = ProjectData.Sum(x => x.RecordableEventNum), - GeneralAccidentNum = ProjectData.Sum(x => x.GeneralAccidentNum), - MajorAccidentNum = ProjectData.Sum(x => x.MajorAccidentNum), - SeriousAccidentNum = ProjectData.Sum(x => x.SeriousAccidentNum), - SpecialSeriousAccidentNum = ProjectData.Sum(x => x.SpecialSeriousAccidentNum), + ProjectLeadShiftCheckNum = projectData.Sum(x => x.ProjectLeadShiftCheckNum), + ProjectSpecialCheckNum = projectData.Sum(x => x.ProjectSpecialCheckNum), + ProjectMajorCheckNum = projectData.Sum(x => x.ProjectMajorCheckNum), + NearMissNum = projectData.Sum(x => x.NearMissNum), + RecordableEventNum = projectData.Sum(x => x.RecordableEventNum), + GeneralAccidentNum = projectData.Sum(x => x.GeneralAccidentNum), + MajorAccidentNum = projectData.Sum(x => x.MajorAccidentNum), + SeriousAccidentNum = projectData.Sum(x => x.SeriousAccidentNum), + SpecialSeriousAccidentNum = projectData.Sum(x => x.SpecialSeriousAccidentNum), CompanyComprehensivePlanNum = GetCompanyComprehensivePlanNum(), CompanySpecialPlanNum = GetCompanySpecialPlanNum(), CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(), CompanyDrillNum = GetCompanyDrillNum(), - ProjectComprehensivePlanNum = ProjectData.Sum(x => x.ProjectComprehensivePlanNum), - ProjectSpecialPlanNum = ProjectData.Sum(x => x.ProjectSpecialPlanNum), - ProjectOnSiteDisposalPlan = ProjectData.Sum(x => x.ProjectOnSiteDisposalPlan), - ProjectDrillNum = ProjectData.Sum(x => x.ProjectDrillNum), - CostExtract = ProjectData.Sum(x => x.CostExtract), - CostUse = ProjectData.Sum(x => x.CostUse), - UseEquipmentNum = ProjectData.Sum(x => x.UseEquipmentNum), - SpecialEquipmentNum = ProjectData.Sum(x => x.SpecialEquipmentNum), - LicensesNum = ProjectData.Sum(x => x.LicensesNum), - LicensesCloseNum = ProjectData.Sum(x => x.LicensesCloseNum), - GeneralClosedNum = ProjectData.Sum(x => x.GeneralClosedNum), - GeneralNotClosedNum = ProjectData.Sum(x => x.GeneralNotClosedNum), - MajorClosedNum = ProjectData.Sum(x => x.MajorClosedNum), - MajorNotClosedNum = ProjectData.Sum(x => x.MajorNotClosedNum), - GeneralRiskNum = ProjectData.Sum(x => x.GeneralRiskNum), - LowRiskNum = ProjectData.Sum(x => x.LowRiskNum), - MediumRiskNum = ProjectData.Sum(x => x.MediumRiskNum), - HighRiskNum = ProjectData.Sum(x => x.HighRiskNum), - CompletedNum = ProjectData.Sum(x => x.CompletedNum), - TrainPersonNum = ProjectData.Sum(x => x.TrainPersonNum), - ConstructionNum = ProjectData.Sum(x => x.ConstructionNum), - FinishedNum = ProjectData.Sum(x => x.FinishedNum), - SuperCompletedNum = ProjectData.Sum(x => x.SuperCompletedNum), - SuperTrainPersonNum = ProjectData.Sum(x => x.SuperTrainPersonNum), - SuperConstructionNum = ProjectData.Sum(x => x.SuperConstructionNum), - SuperFinishedNum = ProjectData.Sum(x => x.SuperFinishedNum), + ProjectComprehensivePlanNum = projectData.Sum(x => x.ProjectComprehensivePlanNum), + ProjectSpecialPlanNum = projectData.Sum(x => x.ProjectSpecialPlanNum), + ProjectOnSiteDisposalPlan = projectData.Sum(x => x.ProjectOnSiteDisposalPlan), + ProjectDrillNum = projectData.Sum(x => x.ProjectDrillNum), + CostExtract = projectData.Sum(x => x.CostExtract), + CostUse = projectData.Sum(x => x.CostUse), + UseEquipmentNum = projectData.Sum(x => x.UseEquipmentNum), + SpecialEquipmentNum = projectData.Sum(x => x.SpecialEquipmentNum), + LicensesNum = projectData.Sum(x => x.LicensesNum), + LicensesCloseNum = projectData.Sum(x => x.LicensesCloseNum), + GeneralClosedNum = projectData.Sum(x => x.GeneralClosedNum), + GeneralNotClosedNum = projectData.Sum(x => x.GeneralNotClosedNum), + MajorClosedNum = projectData.Sum(x => x.MajorClosedNum), + MajorNotClosedNum = projectData.Sum(x => x.MajorNotClosedNum), + GeneralRiskNum = projectData.Sum(x => x.GeneralRiskNum), + LowRiskNum = projectData.Sum(x => x.LowRiskNum), + MediumRiskNum = projectData.Sum(x => x.MediumRiskNum), + HighRiskNum = projectData.Sum(x => x.HighRiskNum), + CompletedNum = projectData.Sum(x => x.CompletedNum), + TrainPersonNum = projectData.Sum(x => x.TrainPersonNum), + ConstructionNum = projectData.Sum(x => x.ConstructionNum), + FinishedNum = projectData.Sum(x => x.FinishedNum), + SuperCompletedNum = projectData.Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = projectData.Sum(x => x.SuperTrainPersonNum), + SuperConstructionNum = projectData.Sum(x => x.SuperConstructionNum), + SuperFinishedNum = projectData.Sum(x => x.SuperFinishedNum), CreateMan = Const.sysglyId, - CreateDate = DateTime.Now, + CreateDate = DateTime.Now }; if (IsReportByToday()) { @@ -623,272 +501,390 @@ namespace BLL table.State = Const.CNCEC_State_0; AddHSSEData_HSSE(table); } - data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); + + var data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); return data; } - public static void UpdateHSSEData_HSSE(Model.HSSEData_HSSE newtable) + + public static void UpdateHSSEData_HSSE(HSSEData_HSSE newtable) { - Model.HSSEData_HSSE table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + using (var db = new SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.BeUnderConstructionNum = newtable.BeUnderConstructionNum; - table.ShutdownNum = newtable.ShutdownNum; - table.JoinConstructionPersonNum = newtable.JoinConstructionPersonNum; - table.MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum; - table.TotalWorkingHour = newtable.TotalWorkingHour; - table.LostWorkingHour = newtable.LostWorkingHour; - table.SafeWorkingHour = newtable.SafeWorkingHour; - table.SafeTrainNum = newtable.SafeTrainNum; - table.SpecialTrainNum = newtable.SpecialTrainNum; - table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum; - table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; - table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; - table.NewWaterConsumption = newtable.NewWaterConsumption; - table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum; - table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum; - table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum; - table.BranchFullTimeNum = newtable.BranchFullTimeNum; - table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum; - table.ProjectFullTimeNum = newtable.ProjectFullTimeNum; - table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum; - table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer; - table.CertificateANum = newtable.CertificateANum; - table.CertificateBNum = newtable.CertificateBNum; - table.CertificateCNum = newtable.CertificateCNum; - table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum; - table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum; - table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum; - table.ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum; - table.CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum; - table.CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum; - table.CompanySpecialCheckNum = newtable.CompanySpecialCheckNum; - table.ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum; - table.ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum; - table.ProjectMajorCheckNum = newtable.ProjectMajorCheckNum; - table.NearMissNum = newtable.NearMissNum; - table.RecordableEventNum = newtable.RecordableEventNum; - table.GeneralAccidentNum = newtable.GeneralAccidentNum; - table.MajorAccidentNum = newtable.MajorAccidentNum; - table.SeriousAccidentNum = newtable.SeriousAccidentNum; - table.SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum; - table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum; - table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum; - table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan; - table.CompanyDrillNum = newtable.CompanyDrillNum; - table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum; - table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum; - table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan; - table.ProjectDrillNum = newtable.ProjectDrillNum; - table.CostExtract = newtable.CostExtract; - table.CostUse = newtable.CostUse; - table.UseEquipmentNum = newtable.UseEquipmentNum; - table.SpecialEquipmentNum = newtable.SpecialEquipmentNum; - table.LicensesNum = newtable.LicensesNum; - table.LicensesCloseNum = newtable.LicensesCloseNum; - table.GeneralClosedNum = newtable.GeneralClosedNum; - table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; - table.MajorClosedNum = newtable.MajorClosedNum; - table.MajorNotClosedNum = newtable.MajorNotClosedNum; - table.GeneralRiskNum = newtable.GeneralRiskNum; - table.LowRiskNum = newtable.LowRiskNum; - table.MediumRiskNum = newtable.MediumRiskNum; - table.HighRiskNum = newtable.HighRiskNum; - table.CompletedNum = newtable.CompletedNum; - table.TrainPersonNum = newtable.TrainPersonNum; - table.ConstructionNum = newtable.ConstructionNum; - table.FinishedNum = newtable.FinishedNum; - table.SuperCompletedNum = newtable.SuperCompletedNum; - table.SuperTrainPersonNum = newtable.SuperTrainPersonNum; - table.SuperConstructionNum = newtable.SuperConstructionNum; - table.SuperFinishedNum = newtable.SuperFinishedNum; - table.State = newtable.State; - table.CreateMan = newtable.CreateMan; - table.CreateDate = newtable.CreateDate; - db.SubmitChanges(); + var table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.BeUnderConstructionNum = newtable.BeUnderConstructionNum; + table.ShutdownNum = newtable.ShutdownNum; + table.JoinConstructionPersonNum = newtable.JoinConstructionPersonNum; + table.MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum; + table.TotalWorkingHour = newtable.TotalWorkingHour; + table.LostWorkingHour = newtable.LostWorkingHour; + table.SafeWorkingHour = newtable.SafeWorkingHour; + table.SafeTrainNum = newtable.SafeTrainNum; + table.SpecialTrainNum = newtable.SpecialTrainNum; + table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum; + table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; + table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; + table.NewWaterConsumption = newtable.NewWaterConsumption; + table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum; + table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum; + table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum; + table.BranchFullTimeNum = newtable.BranchFullTimeNum; + table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum; + table.ProjectFullTimeNum = newtable.ProjectFullTimeNum; + table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum; + table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer; + table.CertificateANum = newtable.CertificateANum; + table.CertificateBNum = newtable.CertificateBNum; + table.CertificateCNum = newtable.CertificateCNum; + table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum; + table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum; + table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum; + table.ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum; + table.CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum; + table.CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum; + table.CompanySpecialCheckNum = newtable.CompanySpecialCheckNum; + table.ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum; + table.ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum; + table.ProjectMajorCheckNum = newtable.ProjectMajorCheckNum; + table.NearMissNum = newtable.NearMissNum; + table.RecordableEventNum = newtable.RecordableEventNum; + table.GeneralAccidentNum = newtable.GeneralAccidentNum; + table.MajorAccidentNum = newtable.MajorAccidentNum; + table.SeriousAccidentNum = newtable.SeriousAccidentNum; + table.SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum; + table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum; + table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum; + table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan; + table.CompanyDrillNum = newtable.CompanyDrillNum; + table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum; + table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum; + table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan; + table.ProjectDrillNum = newtable.ProjectDrillNum; + table.CostExtract = newtable.CostExtract; + table.CostUse = newtable.CostUse; + table.UseEquipmentNum = newtable.UseEquipmentNum; + table.SpecialEquipmentNum = newtable.SpecialEquipmentNum; + table.LicensesNum = newtable.LicensesNum; + table.LicensesCloseNum = newtable.LicensesCloseNum; + table.GeneralClosedNum = newtable.GeneralClosedNum; + table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; + table.MajorClosedNum = newtable.MajorClosedNum; + table.MajorNotClosedNum = newtable.MajorNotClosedNum; + table.GeneralRiskNum = newtable.GeneralRiskNum; + table.LowRiskNum = newtable.LowRiskNum; + table.MediumRiskNum = newtable.MediumRiskNum; + table.HighRiskNum = newtable.HighRiskNum; + table.CompletedNum = newtable.CompletedNum; + table.TrainPersonNum = newtable.TrainPersonNum; + table.ConstructionNum = newtable.ConstructionNum; + table.FinishedNum = newtable.FinishedNum; + table.SuperCompletedNum = newtable.SuperCompletedNum; + table.SuperTrainPersonNum = newtable.SuperTrainPersonNum; + table.SuperConstructionNum = newtable.SuperConstructionNum; + table.SuperFinishedNum = newtable.SuperFinishedNum; + table.State = newtable.State; + table.CreateMan = newtable.CreateMan; + table.CreateDate = newtable.CreateDate; + db.SubmitChanges(); + } } } /// - /// 获取企业总部总监人数 + /// 获取企业总部总监人数 /// /// public static int GetHeadOfficeInspectorGeneralNum() { - //string unitId = string.Empty; - //var thisUnit = CommonService.GetIsThisUnit(); - //if (thisUnit != null) - //{ - // unitId = thisUnit.UnitId; - //} - //int result = (from x in Funs.DB.Person_CompanyBranchPerson - // where x.IsOnJob == true && x.WorkPostId == BLL.Const.WorkPost_HSSEDirector && x.UnitId == unitId - // select x).Count(); - return 0; + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_CompanyBranchPerson + where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId + select x).Count(); + return result; } + /// - /// 获取企业总部专职人数 + /// 获取企业总部专职人数 /// /// public static int GetHeadOfficeFullTimeNum() { - //string unitId = string.Empty; - //var thisUnit = CommonService.GetIsThisUnit(); - //if (thisUnit != null) - //{ - // unitId = thisUnit.UnitId; - //} - //int result = (from x in Funs.DB.Person_CompanyBranchPerson - // join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - // where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId - // select x).Count(); - return 0; + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_CompanyBranchPerson + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId + select x).Count(); + return result; } + /// - /// 获取分支机构总监人数 + /// 获取分支机构总监人数 /// /// public static int GetBranchInspectorGeneralNum() { - //string unitId = string.Empty; - //var thisUnit = CommonService.GetIsThisUnit(); - //if (thisUnit != null) - //{ - // unitId = thisUnit.UnitId; - //} - //int result = (from x in Funs.DB.Person_CompanyBranchPerson - // where x.IsOnJob == true && x.WorkPostId == BLL.Const.WorkPost_HSSEDirector && x.UnitId != unitId - // select x).Count(); - return 0; + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_CompanyBranchPerson + where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId + select x).Count(); + return result; } + /// - /// 获取分支机构专职人数 + /// 获取分支机构专职人数 /// /// public static int GetBranchFullTimeNum() { - //string unitId = string.Empty; - //var thisUnit = CommonService.GetIsThisUnit(); - //if (thisUnit != null) - //{ - // unitId = thisUnit.UnitId; - //} - //int result = (from x in Funs.DB.Person_CompanyBranchPerson - // join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - // where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId - // select x).Count(); - return 0; + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_CompanyBranchPerson + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId + select x).Count(); + return result; } /// - /// 获取企业安委会会议数 + /// 获取企业安委会会议数 /// /// public static int GetSafetyCommitteeMeetingNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Meeting_CompanySafetyMeeting where x.CompanySafetyMeetingDate.Value.Year == date.Year && x.CompanySafetyMeetingDate.Value.Month == date.Month && x.CompanySafetyMeetingDate.Value.Day == date.Day select x).Count(); - return 0; + var result = + (from x in Funs.DB.Meeting_CompanySafetyMeeting where x.CompileDate > Const.DtmarkTime select x) + .Count(); + return result; } + /// - /// 获取企业专题会议数 + /// 获取企业专题会议数 /// /// public static int GetEnterpriseTopicsMeetingNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Meeting_CompanySpecialMeeting where x.CompanySpecialMeetingDate.Value.Year == date.Year && x.CompanySpecialMeetingDate.Value.Month == date.Month && x.CompanySpecialMeetingDate.Value.Day == date.Day select x).Count(); - return 0; + var result = (from x in Funs.DB.Meeting_CompanySpecialMeeting + where x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } /// - /// 获取企业负责人带班检查次数 + /// 获取企业负责人带班检查次数 /// /// public static int GetCompanyLeadShiftCheckNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "1" && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count(); - return 0; + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取企业综合检查次数 - /// + /// 获取企业综合检查次数 + /// /// public static int GetCompanyComprehensiveCheckNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "2" && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count(); - return 0; + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取企业专项检查次数 + /// 获取企业专项检查次数 /// /// public static int GetCompanySpecialCheckNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "3" && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count(); - return 0; + var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取企业级综合预案数 + /// 获取企业级综合预案数 /// /// public static int GetCompanyComprehensivePlanNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Emergency_EmergencyList_Unit - // join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - // where x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month - // && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("综合") - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取企业级专项预案数 + /// 获取企业级专项预案数 /// /// public static int GetCompanySpecialPlanNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Emergency_EmergencyList_Unit - // join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - // where x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month - // && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("专项") - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取企业级现场处置预案 + /// 获取企业级现场处置预案 /// /// public static int GetCompanyOnSiteDisposalPlan() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Emergency_EmergencyList_Unit - // join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - // where x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month - // && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("现场处置") - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Emergency_EmergencyList_Unit + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取企业级演练次数 + /// 获取企业级演练次数 /// /// public static int GetCompanyDrillNum() { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Emergency_DrillRecordList_Unit - // where x.DrillRecordDate.Value.Year == date.Year && x.DrillRecordDate.Value.Month == date.Month - // && x.DrillRecordDate.Value.Day == date.Day - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit + where x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + + #region 获取列表 + + /// + /// 记录数 + /// + public static int Count { get; set; } + + public static List GetHSSEData_HSSEByModle(HSSEData_HSSE table) + { + var db = Funs.DB; + var q = from x in db.HSSEData_HSSE + where + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && + (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + orderby x.ReportDate descending + select x + ; + + return q.ToList(); + } + + // ReSharper disable once InvalidXmlDocComment + /// + /// + public static IEnumerable GetListData(HSSEData_HSSE table, Grid Grid1) + { + var q = GetHSSEData_HSSEByModle(table); + Count = q.Count(); + if (Count == 0) return null; + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in q + select new + { + x.Id, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.BeUnderConstructionNum, + x.ShutdownNum, + x.JoinConstructionPersonNum, + x.MajorProjectsUnderConstructionNum, + x.TotalWorkingHour, + x.LostWorkingHour, + x.SafeWorkingHour, + x.SafeTrainNum, + x.SpecialTrainNum, + x.SpecialOperationTrainNum, + x.TotalEnergyConsumption, + x.IncomeComprehensiveEnergyConsumption, + x.NewWaterConsumption, + x.HeadOfficeInspectorGeneralNum, + x.HeadOfficeFullTimeNum, + x.BranchInspectorGeneralNum, + x.BranchFullTimeNum, + x.ProjectInspectorGeneralNum, + x.ProjectFullTimeNum, + x.ProjectSafetyMonitorNum, + x.SafetyInjectionEngineer, + x.CertificateANum, + x.CertificateBNum, + x.CertificateCNum, + x.SafetyCommitteeMeetingNum, + x.EnterpriseTopicsMeetingNum, + x.ProjectSafetyLeadingGroupMeetingNum, + x.ProjectSafetyMeetingNum, + x.CompanyLeadShiftCheckNum, + x.CompanyComprehensiveCheckNum, + x.CompanySpecialCheckNum, + x.ProjectLeadShiftCheckNum, + x.ProjectSpecialCheckNum, + x.ProjectMajorCheckNum, + x.NearMissNum, + x.RecordableEventNum, + x.GeneralAccidentNum, + x.MajorAccidentNum, + x.SeriousAccidentNum, + x.SpecialSeriousAccidentNum, + x.CompanyComprehensivePlanNum, + x.CompanySpecialPlanNum, + x.CompanyOnSiteDisposalPlan, + x.CompanyDrillNum, + x.ProjectComprehensivePlanNum, + x.ProjectSpecialPlanNum, + x.ProjectOnSiteDisposalPlan, + x.ProjectDrillNum, + x.CostExtract, + x.CostUse, + x.UseEquipmentNum, + x.SpecialEquipmentNum, + x.LicensesNum, + x.LicensesCloseNum, + x.GeneralClosedNum, + x.GeneralNotClosedNum, + x.MajorClosedNum, + x.MajorNotClosedNum, + x.GeneralRiskNum, + x.LowRiskNum, + x.MediumRiskNum, + x.HighRiskNum, + x.CompletedNum, + x.TrainPersonNum, + x.ConstructionNum, + x.FinishedNum, + x.SuperCompletedNum, + x.SuperTrainPersonNum, + x.SuperConstructionNum, + x.SuperFinishedNum, + x.State, + x.CreateDate, + x.CreateMan + }; + } + + #endregion 获取列表 } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs index ba8715e8..d4be7285 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs @@ -17,7 +17,7 @@ namespace BLL /// /// CQMS数据类型 /// - public enum CQMSDateType + public enum CQMSDateType { /// /// 质量培训数据 @@ -145,9 +145,9 @@ namespace BLL } public static List GetProject_CQMSData_CQMSByprojectid(string projectid) { - var q =( from x in db.Project_CQMSData_CQMS - where x.ProjectId == projectid - select x).ToList(); + var q = (from x in db.Project_CQMSData_CQMS + where x.ProjectId == projectid + select x).ToList(); return q; } /// @@ -283,7 +283,7 @@ namespace BLL /// /// /// - public static bool IsReportByDate(DateTime dateTime,string projectid) + public static bool IsReportByDate(DateTime dateTime, string projectid) { var result = false; var q = (from x in Funs.DB.Project_CQMSData_CQMS @@ -320,26 +320,31 @@ namespace BLL /// /// 项目id /// 数据类型 - public static void StatisticalData(string projectid,CQMSDateType cQMSDateType) + public static void StatisticalData(string projectid, CQMSDateType cQMSDateType) { - string thisUnitId = BLL.Const.UnitId_CD; - var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + string thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) + { + thisUnitId = thisUnit.UnitId; + } + var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS(); if (IsReportByToday(projectid)) { - table= getTodayProject_CQMSData_CQMS(projectid); + table = getTodayProject_CQMSData_CQMS(projectid); } else { table.Id = SQLHelper.GetNewID(); } table.UnitId = thisUnitId; - table.CollCropCode = base_Unit.CollCropCode; - table.UnitName = base_Unit.UnitName; + table.CollCropCode = baseUnit.CollCropCode; + table.UnitName = baseUnit.UnitName; table.ProjectId = projectid; table.ReportDate = DateTime.Now.Date; - if (cQMSDateType== CQMSDateType.QualityTraining|| cQMSDateType == CQMSDateType.All) + if (cQMSDateType == CQMSDateType.QualityTraining || cQMSDateType == CQMSDateType.All) { table.TrainPersonNum = GetTrainPersonNum(projectid); table.TechnicalDisclosePersonNum = GetTechnicalDisclosePersonNum(projectid); @@ -347,7 +352,7 @@ namespace BLL if (cQMSDateType == CQMSDateType.MeasuringInstruments || cQMSDateType == CQMSDateType.All) { table.UseNum = GetUseNum(projectid); - table.OKNum = GetOKNum(projectid); + table.OKNum = GetOkNum(projectid); } if (cQMSDateType == CQMSDateType.ManagerData || cQMSDateType == CQMSDateType.All) { @@ -371,11 +376,11 @@ namespace BLL if (cQMSDateType == CQMSDateType.QualityAcceptance || cQMSDateType == CQMSDateType.All) { table.KeyProcessNum = GetKeyProcessNum(projectid); - table.KeyProcessOKNum = GetKeyProcessOKNum(projectid); + table.KeyProcessOKNum = GetKeyProcessOkNum(projectid); table.SpecialProcessNum = GetSpecialProcessNum(projectid); - table.SpecialProcessOKNum = GetSpecialProcessOKNum(projectid); + table.SpecialProcessOKNum = GetSpecialProcessOkNum(projectid); table.ConcealedWorksNum = GetConcealedWorksNum(projectid); - table.ConcealedWorksOKNum = GetConcealedWorksOKNum(projectid); + table.ConcealedWorksOKNum = GetConcealedWorksOkNum(projectid); table.UnitProjectOnesNum = GetUnitProjectOnesNum(projectid); table.UnitProjectOnesOKNum = GetUnitProjectOnesOKNum(projectid); table.MaterialInRecheckNum = GetMaterialInRecheckNum(projectid); @@ -388,7 +393,7 @@ namespace BLL table.SubProjectNum = GetSubProjectNum(projectid); table.SubdivisionalWorksNum = GetSubdivisionalWorksNum(projectid); table.InspectionLotNum = GetInspectionLotNum(projectid); - } + } if (IsReportByToday(projectid)) { @@ -406,11 +411,10 @@ namespace BLL /// public static int GetTrainPersonNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Comprehensive_InspectionPerson - // where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month && x.CompileDate.Value.Day == date.Day - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Comprehensive_InspectionPerson + where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate>Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取技术交底人次数 @@ -418,12 +422,11 @@ namespace BLL /// public static int GetTechnicalDisclosePersonNum(string projectid) { - //DateTime date = DateTime.Now; - //var result = (from x in Funs.DB.Comprehensive_DesignDetails - // where x.ProjectId == projectid && x.DetailsDate.Value.Year == date.Year && x.DetailsDate.Value.Month == date.Month && x.DetailsDate.Value.Day == date.Day - // select x.JoinPersonNum ).ToList().Sum(x=>x.Value); - //var q = Funs.GetNewIntOrZero(result.ToString()); - return 0; + var result = (from x in Funs.DB.Comprehensive_DesignDetails + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x.JoinPersonNum).ToList().Sum(x => x.Value); + var q = Funs.GetNewIntOrZero(result.ToString()); + return q; } /// /// 获取在用计量器具数 @@ -433,6 +436,7 @@ namespace BLL { int result = (from x in Funs.DB.Comprehensive_InspectionMachine where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") + && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } @@ -440,12 +444,13 @@ namespace BLL /// 获取校准合格数 /// /// - public static int GetOKNum(string projectid) + public static int GetOkNum(string projectid) { - //int result = (from x in Funs.DB.Comprehensive_InspectionMachine - // where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true - // select x).Count(); - return 0; + int result = (from x in Funs.DB.Comprehensive_InspectionMachine + where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true + && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取企业总部人数 @@ -471,11 +476,11 @@ namespace BLL /// public static int GetProjectPersonNum(string projectid) { - //int result = (from x in Funs.DB.Comprehensive_InspectionPerson - // join y in Funs.DB.Base_WorkPost on x.PostId equals y.WorkPostId - // where x.ProjectId == projectid && y.IsCQMS == true && x.IsOnSite == true - // select x).Count(); - return 0; + int result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.ProjectId == projectid && y.IsCQMS == true && x.IsUsed == 1 + select x).Count(); + return result; } /// /// 获取问题个数 @@ -483,8 +488,8 @@ namespace BLL /// public static int GetProblemNum(string projectid) { - int result = (from x in Funs.DB.Check_CheckControl - where x.ProjectId == projectid && x.CheckDate <= DateTime.Now + int result = (from x in Funs.DB.Check_CheckControl + where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime select x).Count(); return result; } @@ -495,7 +500,7 @@ namespace BLL public static int GetProblemCompletedNum(string projectid) { int result = (from x in Funs.DB.Check_CheckControl - where x.ProjectId == projectid && x.CheckDate <= DateTime.Now && x.State == "7" + where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime && x.State == "7" select x).Count(); return result; } @@ -506,7 +511,7 @@ namespace BLL public static int GetProblemNotCompletedNum(string projectid) { int result = (from x in Funs.DB.Check_CheckControl - where x.ProjectId == projectid && x.CheckDate <= DateTime.Now && x.State != "7" + where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime && x.State != "7" select x).Count(); return result; } @@ -517,7 +522,7 @@ namespace BLL public static int GetSNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject - where x.ProjectId == projectid && x.Class.Contains("S") + where x.ProjectId == projectid && x.Class.Contains("S") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } @@ -528,7 +533,7 @@ namespace BLL public static int GetANum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject - where x.ProjectId == projectid && x.Class.Contains("A") + where x.ProjectId == projectid && x.Class.Contains("A") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } @@ -539,7 +544,7 @@ namespace BLL public static int GetBNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject - where x.ProjectId == projectid && x.Class.Contains("B") + where x.ProjectId == projectid && x.Class.Contains("B") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } @@ -550,7 +555,7 @@ namespace BLL public static int GetCNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject - where x.ProjectId == projectid && x.Class.Contains("C") + where x.ProjectId == projectid && x.Class.Contains("C") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime select x).Count(); return result; } @@ -560,24 +565,24 @@ namespace BLL /// public static int GetKeyProcessNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // where y.ProjectId == projectid && y.CheckAcceptType == "1" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + where y.ProjectId == projectid && y.CheckAcceptType == "1" && x.CreateDate> Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取关键工序验收合格数 /// /// - public static int GetKeyProcessOKNum(string projectid) + public static int GetKeyProcessOkNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId - // where y.ProjectId == projectid && y.CheckAcceptType == "1" && z.IsOnceQualified == true - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId + where y.ProjectId == projectid && y.CheckAcceptType == "1" && z.IsOnceQualified == true && x.CreateDate>Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取特殊过程验收数 @@ -585,24 +590,24 @@ namespace BLL /// public static int GetSpecialProcessNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // where y.ProjectId == projectid && y.CheckAcceptType == "2" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + where y.ProjectId == projectid && y.CheckAcceptType == "2" && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取特殊过程验收合格数 /// /// - public static int GetSpecialProcessOKNum(string projectid) + public static int GetSpecialProcessOkNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId - // where y.ProjectId == projectid && y.CheckAcceptType == "2" && z.IsOnceQualified == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId + where y.ProjectId == projectid && y.CheckAcceptType == "2" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取隐蔽工程验收数 @@ -610,24 +615,24 @@ namespace BLL /// public static int GetConcealedWorksNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // where y.ProjectId == projectid && y.CheckAcceptType == "3" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + where y.ProjectId == projectid && y.CheckAcceptType == "3" && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取隐蔽工程验收合格数 /// /// - public static int GetConcealedWorksOKNum(string projectid) + public static int GetConcealedWorksOkNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId - // where y.ProjectId == projectid && y.CheckAcceptType == "3" && z.IsOnceQualified == true - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId + where y.ProjectId == projectid && y.CheckAcceptType == "3" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取单位工程一次验收数 @@ -635,11 +640,11 @@ namespace BLL /// public static int GetUnitProjectOnesNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // where y.ProjectId == projectid && y.CheckAcceptType == "4" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + where y.ProjectId == projectid && y.CheckAcceptType == "4" && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取单位工程一次验收合格数 @@ -647,12 +652,12 @@ namespace BLL /// public static int GetUnitProjectOnesOKNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId - // where y.ProjectId == projectid && y.CheckAcceptType == "4" && z.IsOnceQualified == true - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId + where y.ProjectId == projectid && y.CheckAcceptType == "4" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取材料进场复验数 @@ -660,11 +665,11 @@ namespace BLL /// public static int GetMaterialInRecheckNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // where y.ProjectId == projectid && y.CheckAcceptType == "5" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + where y.ProjectId == projectid && y.CheckAcceptType == "5" && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取材料进场复验合格数 @@ -672,12 +677,12 @@ namespace BLL /// public static int GetMaterialInRecheckOKNum(string projectid) { - //int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId - // join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId - // where y.ProjectId == projectid && y.CheckAcceptType == "5" && z.IsOnceQualified == true - // select x).Count(); - return 0; + int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId + join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId + where y.ProjectId == projectid && y.CheckAcceptType == "5" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime + select x).Count(); + return result; } /// /// 获取单项工程个数 @@ -686,7 +691,7 @@ namespace BLL public static int GetSingleProjectNum(string projectid) { int result = (from x in Funs.DB.Project_Installation - where x.ProjectId == projectid && x.SuperInstallationId == "0" + where x.ProjectId == projectid && x.SuperInstallationId == "0" select x).Count(); return result; } @@ -707,10 +712,10 @@ namespace BLL /// public static int GetSubProjectNum(string projectid) { - //int result = (from x in Funs.DB.WBS_DivisionProject - // where x.ProjectId == projectid && x.SubItemType == "1" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.WBS_DivisionProject + where x.ProjectId == projectid && x.SubItemType == "1" && x.IsSelected == true + select x).Count(); + return result; } /// /// 获取分项工程个数 @@ -718,10 +723,10 @@ namespace BLL /// public static int GetSubdivisionalWorksNum(string projectid) { - //int result = (from x in Funs.DB.WBS_DivisionProject - // where x.ProjectId == projectid && x.SubItemType == "3" - // select x).Count(); - return 0; + int result = (from x in Funs.DB.WBS_DivisionProject + where x.ProjectId == projectid && x.SubItemType == "3" && x.IsSelected == true + select x).Count(); + return result; } /// /// 获取检验批个数 @@ -730,7 +735,7 @@ namespace BLL public static int GetInspectionLotNum(string projectid) { int result = (from x in Funs.DB.WBS_BreakdownProject - where x.ProjectId == projectid + where x.ProjectId == projectid && x.IsSelected == true select x).Count(); return result; } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs index ad929431..83f584cc 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs @@ -1,38 +1,39 @@ using FineUIPro; +using Microsoft.SqlServer.Dts.Runtime; +using NPOI.SS.Formula.Functions; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; +using Model; + namespace BLL { - public static class Project_HJGLData_DefectService { - public static Model.SGGLDB db = Funs.DB; + public static SGGLDB db = Funs.DB; #region 获取列表 + /// /// 记录数 /// - public static int count - { - get; - set; - } - public static List GetProject_HJGLData_DefectByModle(Model.Project_HJGLData_Defect table) + public static int count { get; set; } + + public static List GetProject_HJGLData_DefectByModle(Project_HJGLData_Defect table) { var q = from x in db.Project_HJGLData_Defect where - (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && - (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && - (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && - (string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName)) + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && + (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && + (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && + (string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName)) select x - ; + ; return q.ToList(); } @@ -42,53 +43,51 @@ namespace BLL /// 页码 /// 每页数量 /// - public static IEnumerable getListData(Model.Project_HJGLData_Defect table, Grid Grid1) + public static IEnumerable getListData(Project_HJGLData_Defect table, Grid Grid1) { var q = GetProject_HJGLData_DefectByModle(table); count = q.Count(); - if (count == 0) - { - return null; - } + if (count == 0) return null; // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q - select new - { - x.Id, - x.ProjectId, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.DefectName, - x.DefectNum, - - }; + select new + { + x.Id, + x.ProjectId, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.DefectName, + x.DefectNum + }; } + #endregion - public static Model.Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id) + public static Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id) { return db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id); } + /// /// 获取项目该日期的缺陷分析数据 /// /// /// /// - public static List GetProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid) + public static List GetProject_HJGLData_DefectByDate(DateTime? reportDate, + string projectid) { var q = from x in db.Project_HJGLData_Defect - where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid - select x; + where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid + select x; return q.ToList(); } - public static void AddProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable) + public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable) { - - Model.Project_HJGLData_Defect table = new Model.Project_HJGLData_Defect + var table = new Project_HJGLData_Defect { Id = newtable.Id, ProjectId = newtable.ProjectId, @@ -97,16 +96,21 @@ namespace BLL UnitName = newtable.UnitName, ReportDate = newtable.ReportDate, DefectName = newtable.DefectName, - DefectNum = newtable.DefectNum, + DefectNum = newtable.DefectNum }; db.Project_HJGLData_Defect.InsertOnSubmit(table); db.SubmitChanges(); } - public static void UpdateProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable) + public static void AddBulkProject_HJGLData_Defect(List newtables) { + db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables); + db.SubmitChanges(); + } - Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); + public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable) + { + var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { table.Id = newtable.Id; @@ -119,31 +123,40 @@ namespace BLL table.DefectNum = newtable.DefectNum; db.SubmitChanges(); } - } public static void DeleteProject_HJGLData_DefectById(string Id) { - - Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id); + var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id); if (table != null) { db.Project_HJGLData_Defect.DeleteOnSubmit(table); db.SubmitChanges(); } - } - public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid) - { - var table = db.Project_HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid); + public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate) + { + var table = db.Project_HJGLData_Defect.Where(x => + x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); if (table != null) { db.Project_HJGLData_Defect.DeleteAllOnSubmit(table); db.SubmitChanges(); } - } + + public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid) + { + var table = db.Project_HJGLData_Defect.Where(x => + x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid); + if (table != null) + { + db.Project_HJGLData_Defect.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } + } + /// /// 判断当天是否已统计数据 /// @@ -152,68 +165,110 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.Project_HJGLData_Defect - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid && x.DefectName == type - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && + x.ProjectId == projectid && x.DefectName == type + select x).ToList(); + if (q != null && q.Count > 0) result = true; return result; } + /// /// 根据projectid,获取当天的统计后的数据 /// /// /// - public static Model.Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type) + public static Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type) { var q = (from x in Funs.DB.Project_HJGLData_Defect - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid && x.DefectName == type - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && + x.ProjectId == projectid && x.DefectName == type + select x).FirstOrDefault(); return q; } - public static List getTodayProject_HJGLData_Defect() + + public static List getTodayProject_HJGLData_Defect() { var q = (from x in Funs.DB.Project_HJGLData_Defect - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - group x by x.DefectName into g - select new Model.HJGLDataDefectItems - { - Id = SQLHelper.GetNewID(), - DefectName = g.Key, - DefectNum=g.Sum (p=>p.DefectNum) - }).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + group x by x.DefectName + into g + select new HJGLDataDefectItems + { + Id = SQLHelper.GetNewID(), + DefectName = g.Key, + DefectNum = g.Sum(p => p.DefectNum) + }).ToList(); return q; } + /// /// 统计所有在建项目数据 /// public static void StatisticalAllProjectData() { - var projectlist = ProjectService.GetProjectWorkList(); - foreach (var item in projectlist) + var db = Funs.DB; + + var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList(); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); + var data = (from x in db.CH_CheckItem + join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID + where projectids.Contains(y.ProjectId) + group x by new { x.Defects_Definition, y.ProjectId } + into g + select new + { + UnitId = thisUnitId, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ProjectId = g.Key.ProjectId, + ReportDate = DateTime.Now.Date, + DefectName = g.Key.Defects_Definition, + DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition) + }).ToList(); + DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有 + var projectHjglDataDefect = new List(); + foreach (var item in data + ) { - StatisticalData(item.ProjectId); + var table = new Project_HJGLData_Defect + { + Id = SQLHelper.GetNewID(), + UnitId = item.UnitId, + CollCropCode = item.CollCropCode, + UnitName = item.UnitName, + ProjectId = item.ProjectId, + ReportDate = item.ReportDate, + DefectName = item.DefectName, + DefectNum = item.DefectNum + }; + projectHjglDataDefect.Add(table); } + + AddBulkProject_HJGLData_Defect(projectHjglDataDefect); //批量增加 } + /// /// 统计数据 /// /// public static void StatisticalData(string projectid) { - string thisUnitId = BLL.Const.UnitId_CD; - var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var base_Unit = UnitService.GetUnitByUnitId(thisUnitId); var list = from x in db.CH_CheckItem - join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID - where y.ProjectId == projectid - select x; + join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID + where y.ProjectId == projectid + select x; var types = (from x in list select x.Defects_Definition).Distinct().ToList(); foreach (var t in types) - { if (!string.IsNullOrEmpty(t)) { - Model.Project_HJGLData_Defect table = new Model.Project_HJGLData_Defect + var table = new Project_HJGLData_Defect { UnitId = thisUnitId, CollCropCode = base_Unit.CollCropCode, @@ -221,7 +276,7 @@ namespace BLL ProjectId = projectid, ReportDate = DateTime.Now.Date, DefectName = t, - DefectNum = list.Count(x => x.Defects_Definition == t), + DefectNum = list.Count(x => x.Defects_Definition == t) }; if (IsReportByToday(projectid, t)) { @@ -234,27 +289,26 @@ namespace BLL AddProject_HJGLData_Defect(table); } } - } } + /// /// 获取缺陷名称 /// /// public static string GetDefectName(string projectid) { - string result = ""; + var result = ""; return result; } + /// /// 获取缺陷数量 /// /// public static int GetDefectNum(string projectid) { - int result = 0; + var result = 0; return result; } - - } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs index f3e021c9..862989e1 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs @@ -228,7 +228,12 @@ namespace BLL /// 数据类型 public static void StatisticalData(string projectid,HJGLDateType hJGLDateType) { - string thisUnitId = BLL.Const.UnitId_CD; + string thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) + { + thisUnitId = thisUnit.UnitId; + } var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL(); if (IsReportByToday(projectid)) @@ -265,7 +270,7 @@ namespace BLL } if (hJGLDateType == HJGLDateType.DefectAnalysis || hJGLDateType == HJGLDateType.All) { - Project_HJGLData_DefectService.StatisticalData(projectid); + // Project_HJGLData_DefectService.StatisticalData(projectid); } if (IsReportByToday(projectid)) @@ -298,7 +303,7 @@ namespace BLL { int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo where x.ProjectId == projectid - select x.JOT_Size).ToList().Sum(x=>x.Value)); + select x.JOT_Size).ToList().Sum()); return result; } /// @@ -309,7 +314,7 @@ namespace BLL { int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo where x.ProjectId == projectid - select x.JOT_DoneDin ).ToList().Sum(x => x.Value)); + select x.JOT_DoneDin ).ToList().Sum()); return result; } /// @@ -318,10 +323,10 @@ namespace BLL /// public static int GetTotalFilmNum(string projectid) { - int result = (from x in Funs.DB.CH_CheckItem + int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID where y.ProjectId == projectid - select x.CHT_TotalFilm ).ToList().Sum(x => x.Value); + select x.CHT_TotalFilm ).ToList().Sum()); return result; } /// @@ -330,10 +335,10 @@ namespace BLL /// public static int GetOKFilmNum(string projectid) { - int result = (from x in Funs.DB.CH_CheckItem + int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID where y.ProjectId == projectid - select x.CHT_PassFilm).ToList().Sum(x => x.Value); + select x.CHT_PassFilm).ToList().Sum()); return result; } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs index 5d700c0e..ed78e015 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs @@ -1,424 +1,327 @@ -using FineUIPro; -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Text; +using FineUIPro; using Model; -using Newtonsoft.Json; -using static BLL.Project_HJGLData_HJGLService; namespace BLL { - public static class Project_HSSEData_HSSEService { - public static Model.SGGLDB db = Funs.DB; /// - /// HSSE数据类型 + /// HSSE数据类型 /// public enum HSSEDateType { - /// - /// 全部数据 + /// 全部数据 /// All, + /// - /// 项目信息数据 + /// 项目信息数据 /// ProjectInformation, + /// - /// 工时数据 + /// 工时数据 /// WorkingHours, + /// - /// 教育培训数据 + /// 教育培训数据 /// EducationAndTraining, + /// - /// 环保数据 + /// 环保数据 /// Environmental, + /// - /// 安监人员数据 + /// 安监人员数据 /// OfSafetySupervisors, + /// - /// 安全会议数据 + /// 安全会议数据 /// SafetyMeeting, + /// - /// 监督检查数据 + /// 监督检查数据 /// SupervisionAndInspection, + /// - /// 事故事件数据 + /// 事故事件数据 /// AccidentEvent, + /// - /// 应急管理数据 + /// 应急管理数据 /// EmergencyManagement, + /// - /// 安全费用数据 + /// 安全费用数据 /// SecurityCost, + /// - /// 施工机具数据 + /// 施工机具数据 /// ConstructionEquipment, + /// - /// 作业许可数据 + /// 作业许可数据 /// WorkPermit, + /// - /// 隐患排查数据 + /// 隐患排查数据 /// HiddenDangerTroubleshooting, + /// - /// 安全风险数据 + /// 安全风险数据 /// SecurityRisk, + /// - /// 隐患类别数据 + /// 隐患类别数据 /// HiddenDangerCategory, + /// - /// 危大工程数据 + /// 危大工程数据 /// DangerousProject - }; - #region 获取列表 + } + + public static SGGLDB db = Funs.DB; + /// - /// 记录数 - /// - public static int count - { - get; - set; - } - public static List GetProject_HSSEData_HSSEByModle(Model.Project_HSSEData_HSSE table) - { - var q = from x in db.Project_HSSEData_HSSE - where - (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && - (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && - (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) - select x - ; - - return q.ToList(); - } - - /// 获取分页列表 - /// - /// 页码 - /// 每页数量 - /// - public static IEnumerable getListData(Model.Project_HSSEData_HSSE table, Grid Grid1) - { - var q = GetProject_HSSEData_HSSEByModle(table); - count = q.Count(); - if (count == 0) - { - return null; - } - // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); - return from x in q - select new - { - x.Id, - x.ProjectId, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.BeUnderConstructionNum, - x.ShutdownNum, - x.JoinConstructionPersonNum, - x.MajorProjectsUnderConstructionNum, - x.TotalWorkingHour, - x.LostWorkingHour, - x.SafeWorkingHour, - x.SafeTrainNum, - x.SpecialTrainNum, - x.SpecialOperationTrainNum, - x.TotalEnergyConsumption, - x.IncomeComprehensiveEnergyConsumption, - x.NewWaterConsumption, - x.HeadOfficeInspectorGeneralNum, - x.HeadOfficeFullTimeNum, - x.BranchInspectorGeneralNum, - x.BranchFullTimeNum, - x.ProjectInspectorGeneralNum, - x.ProjectFullTimeNum, - x.ProjectSafetyMonitorNum, - x.SafetyInjectionEngineer, - x.CertificateANum, - x.CertificateBNum, - x.CertificateCNum, - x.SafetyCommitteeMeetingNum, - x.EnterpriseTopicsMeetingNum, - x.ProjectSafetyLeadingGroupMeetingNum, - x.ProjectSafetyMeetingNum, - x.CompanyLeadShiftCheckNum, - x.CompanyComprehensiveCheckNum, - x.CompanySpecialCheckNum, - x.ProjectLeadShiftCheckNum, - x.ProjectSpecialCheckNum, - x.ProjectMajorCheckNum, - x.NearMissNum, - x.RecordableEventNum, - x.GeneralAccidentNum, - x.MajorAccidentNum, - x.SeriousAccidentNum, - x.SpecialSeriousAccidentNum, - x.CompanyComprehensivePlanNum, - x.CompanySpecialPlanNum, - x.CompanyOnSiteDisposalPlan, - x.CompanyDrillNum, - x.ProjectComprehensivePlanNum, - x.ProjectSpecialPlanNum, - x.ProjectOnSiteDisposalPlan, - x.ProjectDrillNum, - x.CostExtract, - x.CostUse, - x.UseEquipmentNum, - x.SpecialEquipmentNum, - x.LicensesNum, - x.LicensesCloseNum, - x.GeneralClosedNum, - x.GeneralNotClosedNum, - x.MajorClosedNum, - x.MajorNotClosedNum, - x.GeneralRiskNum, - x.LowRiskNum, - x.MediumRiskNum, - x.HighRiskNum, - x.CompletedNum, - x.TrainPersonNum, - x.ConstructionNum, - x.FinishedNum, - x.SuperCompletedNum, - x.SuperTrainPersonNum, - x.SuperConstructionNum, - x.SuperFinishedNum, - - }; - } - #endregion - /// - /// 新增实体 + /// 新增实体 /// /// - public static void AddProject_HSSEData_HSSE(Model.Project_HSSEData_HSSE newtable) + public static void AddProject_HSSEData_HSSE(Project_HSSEData_HSSE newtable) { - - Model.Project_HSSEData_HSSE table = new Model.Project_HSSEData_HSSE + using (var db = new SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - ProjectId = newtable.ProjectId, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - BeUnderConstructionNum = newtable.BeUnderConstructionNum, - ShutdownNum = newtable.ShutdownNum, - JoinConstructionPersonNum = newtable.JoinConstructionPersonNum, - MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum, - TotalWorkingHour = newtable.TotalWorkingHour, - LostWorkingHour = newtable.LostWorkingHour, - SafeWorkingHour = newtable.SafeWorkingHour, - SafeTrainNum = newtable.SafeTrainNum, - SpecialTrainNum = newtable.SpecialTrainNum, - SpecialOperationTrainNum = newtable.SpecialOperationTrainNum, - TotalEnergyConsumption = newtable.TotalEnergyConsumption, - IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, - NewWaterConsumption = newtable.NewWaterConsumption, - HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum, - HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum, - BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum, - BranchFullTimeNum = newtable.BranchFullTimeNum, - ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum, - ProjectFullTimeNum = newtable.ProjectFullTimeNum, - ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum, - SafetyInjectionEngineer = newtable.SafetyInjectionEngineer, - CertificateANum = newtable.CertificateANum, - CertificateBNum = newtable.CertificateBNum, - CertificateCNum = newtable.CertificateCNum, - SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum, - EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum, - ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum, - ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum, - CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum, - CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum, - CompanySpecialCheckNum = newtable.CompanySpecialCheckNum, - ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum, - ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum, - ProjectMajorCheckNum = newtable.ProjectMajorCheckNum, - NearMissNum = newtable.NearMissNum, - RecordableEventNum = newtable.RecordableEventNum, - GeneralAccidentNum = newtable.GeneralAccidentNum, - MajorAccidentNum = newtable.MajorAccidentNum, - SeriousAccidentNum = newtable.SeriousAccidentNum, - SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum, - CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum, - CompanySpecialPlanNum = newtable.CompanySpecialPlanNum, - CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan, - CompanyDrillNum = newtable.CompanyDrillNum, - ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum, - ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum, - ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan, - ProjectDrillNum = newtable.ProjectDrillNum, - CostExtract = newtable.CostExtract, - CostUse = newtable.CostUse, - UseEquipmentNum = newtable.UseEquipmentNum, - SpecialEquipmentNum = newtable.SpecialEquipmentNum, - LicensesNum = newtable.LicensesNum, - LicensesCloseNum = newtable.LicensesCloseNum, - GeneralClosedNum = newtable.GeneralClosedNum, - GeneralNotClosedNum = newtable.GeneralNotClosedNum, - MajorClosedNum = newtable.MajorClosedNum, - MajorNotClosedNum = newtable.MajorNotClosedNum, - GeneralRiskNum = newtable.GeneralRiskNum, - LowRiskNum = newtable.LowRiskNum, - MediumRiskNum = newtable.MediumRiskNum, - HighRiskNum = newtable.HighRiskNum, - CompletedNum = newtable.CompletedNum, - TrainPersonNum = newtable.TrainPersonNum, - ConstructionNum = newtable.ConstructionNum, - FinishedNum = newtable.FinishedNum, - SuperCompletedNum = newtable.SuperCompletedNum, - SuperTrainPersonNum = newtable.SuperTrainPersonNum, - SuperConstructionNum = newtable.SuperConstructionNum, - SuperFinishedNum = newtable.SuperFinishedNum, - }; - db.Project_HSSEData_HSSE.InsertOnSubmit(table); - db.SubmitChanges(); + var table = new Project_HSSEData_HSSE + { + Id = newtable.Id, + ProjectId = newtable.ProjectId, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + BeUnderConstructionNum = newtable.BeUnderConstructionNum, + ShutdownNum = newtable.ShutdownNum, + JoinConstructionPersonNum = newtable.JoinConstructionPersonNum, + MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum, + TotalWorkingHour = newtable.TotalWorkingHour, + LostWorkingHour = newtable.LostWorkingHour, + SafeWorkingHour = newtable.SafeWorkingHour, + SafeTrainNum = newtable.SafeTrainNum, + SpecialTrainNum = newtable.SpecialTrainNum, + SpecialOperationTrainNum = newtable.SpecialOperationTrainNum, + TotalEnergyConsumption = newtable.TotalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, + NewWaterConsumption = newtable.NewWaterConsumption, + HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum, + HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum, + BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum, + BranchFullTimeNum = newtable.BranchFullTimeNum, + ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum, + ProjectFullTimeNum = newtable.ProjectFullTimeNum, + ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum, + SafetyInjectionEngineer = newtable.SafetyInjectionEngineer, + CertificateANum = newtable.CertificateANum, + CertificateBNum = newtable.CertificateBNum, + CertificateCNum = newtable.CertificateCNum, + SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum, + EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum, + ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum, + ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum, + CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum, + CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum, + CompanySpecialCheckNum = newtable.CompanySpecialCheckNum, + ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum, + ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum, + ProjectMajorCheckNum = newtable.ProjectMajorCheckNum, + NearMissNum = newtable.NearMissNum, + RecordableEventNum = newtable.RecordableEventNum, + GeneralAccidentNum = newtable.GeneralAccidentNum, + MajorAccidentNum = newtable.MajorAccidentNum, + SeriousAccidentNum = newtable.SeriousAccidentNum, + SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum, + CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum, + CompanySpecialPlanNum = newtable.CompanySpecialPlanNum, + CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan, + CompanyDrillNum = newtable.CompanyDrillNum, + ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum, + ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum, + ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan, + ProjectDrillNum = newtable.ProjectDrillNum, + CostExtract = newtable.CostExtract, + CostUse = newtable.CostUse, + UseEquipmentNum = newtable.UseEquipmentNum, + SpecialEquipmentNum = newtable.SpecialEquipmentNum, + LicensesNum = newtable.LicensesNum, + LicensesCloseNum = newtable.LicensesCloseNum, + GeneralClosedNum = newtable.GeneralClosedNum, + GeneralNotClosedNum = newtable.GeneralNotClosedNum, + MajorClosedNum = newtable.MajorClosedNum, + MajorNotClosedNum = newtable.MajorNotClosedNum, + GeneralRiskNum = newtable.GeneralRiskNum, + LowRiskNum = newtable.LowRiskNum, + MediumRiskNum = newtable.MediumRiskNum, + HighRiskNum = newtable.HighRiskNum, + CompletedNum = newtable.CompletedNum, + TrainPersonNum = newtable.TrainPersonNum, + ConstructionNum = newtable.ConstructionNum, + FinishedNum = newtable.FinishedNum, + SuperCompletedNum = newtable.SuperCompletedNum, + SuperTrainPersonNum = newtable.SuperTrainPersonNum, + SuperConstructionNum = newtable.SuperConstructionNum, + SuperFinishedNum = newtable.SuperFinishedNum + }; + db.Project_HSSEData_HSSE.InsertOnSubmit(table); + db.SubmitChanges(); + } } + /// - /// 删除实体 + /// 删除实体 /// /// public static void DeleteProject_HSSEData_HSSEById(string Id) { - - Model.Project_HSSEData_HSSE table = db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (var db = new SGGLDB(Funs.ConnString)) { - db.Project_HSSEData_HSSE.DeleteOnSubmit(table); - db.SubmitChanges(); + var table = db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.Project_HSSEData_HSSE.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } + /// - /// 根据id获取实体 + /// 根据id获取实体 /// /// /// - public static Model.Project_HSSEData_HSSE GetProject_HSSEData_HSSEById(string Id) + public static Project_HSSEData_HSSE GetProject_HSSEData_HSSEById(string Id) { return db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); } - public static List GetProject_HSSEData_HSSEByProjectid(string Projectid) - { - var q = (from x in db.Project_HSSEData_HSSE - where x.ProjectId == Projectid - select x).ToList(); - return q; - } - public static void UpdateProject_HSSEData_HSSE(Model.Project_HSSEData_HSSE newtable) + public static List GetProject_HSSEData_HSSEByProjectid(string Projectid) { - - Model.Project_HSSEData_HSSE table = db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + using (var db = new SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - table.ProjectId = newtable.ProjectId; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.BeUnderConstructionNum = newtable.BeUnderConstructionNum; - table.ShutdownNum = newtable.ShutdownNum; - table.JoinConstructionPersonNum = newtable.JoinConstructionPersonNum; - table.MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum; - table.TotalWorkingHour = newtable.TotalWorkingHour; - table.LostWorkingHour = newtable.LostWorkingHour; - table.SafeWorkingHour = newtable.SafeWorkingHour; - table.SafeTrainNum = newtable.SafeTrainNum; - table.SpecialTrainNum = newtable.SpecialTrainNum; - table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum; - table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; - table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; - table.NewWaterConsumption = newtable.NewWaterConsumption; - table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum; - table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum; - table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum; - table.BranchFullTimeNum = newtable.BranchFullTimeNum; - table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum; - table.ProjectFullTimeNum = newtable.ProjectFullTimeNum; - table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum; - table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer; - table.CertificateANum = newtable.CertificateANum; - table.CertificateBNum = newtable.CertificateBNum; - table.CertificateCNum = newtable.CertificateCNum; - table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum; - table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum; - table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum; - table.ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum; - table.CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum; - table.CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum; - table.CompanySpecialCheckNum = newtable.CompanySpecialCheckNum; - table.ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum; - table.ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum; - table.ProjectMajorCheckNum = newtable.ProjectMajorCheckNum; - table.NearMissNum = newtable.NearMissNum; - table.RecordableEventNum = newtable.RecordableEventNum; - table.GeneralAccidentNum = newtable.GeneralAccidentNum; - table.MajorAccidentNum = newtable.MajorAccidentNum; - table.SeriousAccidentNum = newtable.SeriousAccidentNum; - table.SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum; - table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum; - table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum; - table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan; - table.CompanyDrillNum = newtable.CompanyDrillNum; - table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum; - table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum; - table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan; - table.ProjectDrillNum = newtable.ProjectDrillNum; - table.CostExtract = newtable.CostExtract; - table.CostUse = newtable.CostUse; - table.UseEquipmentNum = newtable.UseEquipmentNum; - table.SpecialEquipmentNum = newtable.SpecialEquipmentNum; - table.LicensesNum = newtable.LicensesNum; - table.LicensesCloseNum = newtable.LicensesCloseNum; - table.GeneralClosedNum = newtable.GeneralClosedNum; - table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; - table.MajorClosedNum = newtable.MajorClosedNum; - table.MajorNotClosedNum = newtable.MajorNotClosedNum; - table.GeneralRiskNum = newtable.GeneralRiskNum; - table.LowRiskNum = newtable.LowRiskNum; - table.MediumRiskNum = newtable.MediumRiskNum; - table.HighRiskNum = newtable.HighRiskNum; - table.CompletedNum = newtable.CompletedNum; - table.TrainPersonNum = newtable.TrainPersonNum; - table.ConstructionNum = newtable.ConstructionNum; - table.FinishedNum = newtable.FinishedNum; - table.SuperCompletedNum = newtable.SuperCompletedNum; - table.SuperTrainPersonNum = newtable.SuperTrainPersonNum; - table.SuperConstructionNum = newtable.SuperConstructionNum; - table.SuperFinishedNum = newtable.SuperFinishedNum; - db.SubmitChanges(); + var q = (from x in db.Project_HSSEData_HSSE + where x.ProjectId == Projectid + select x).ToList(); + return q; } - } + + public static void UpdateProject_HSSEData_HSSE(Project_HSSEData_HSSE newtable) + { + using (var db = new SGGLDB(Funs.ConnString)) + { + var table = db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.ProjectId = newtable.ProjectId; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.BeUnderConstructionNum = newtable.BeUnderConstructionNum; + table.ShutdownNum = newtable.ShutdownNum; + table.JoinConstructionPersonNum = newtable.JoinConstructionPersonNum; + table.MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum; + table.TotalWorkingHour = newtable.TotalWorkingHour; + table.LostWorkingHour = newtable.LostWorkingHour; + table.SafeWorkingHour = newtable.SafeWorkingHour; + table.SafeTrainNum = newtable.SafeTrainNum; + table.SpecialTrainNum = newtable.SpecialTrainNum; + table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum; + table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; + table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; + table.NewWaterConsumption = newtable.NewWaterConsumption; + table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum; + table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum; + table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum; + table.BranchFullTimeNum = newtable.BranchFullTimeNum; + table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum; + table.ProjectFullTimeNum = newtable.ProjectFullTimeNum; + table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum; + table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer; + table.CertificateANum = newtable.CertificateANum; + table.CertificateBNum = newtable.CertificateBNum; + table.CertificateCNum = newtable.CertificateCNum; + table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum; + table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum; + table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum; + table.ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum; + table.CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum; + table.CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum; + table.CompanySpecialCheckNum = newtable.CompanySpecialCheckNum; + table.ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum; + table.ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum; + table.ProjectMajorCheckNum = newtable.ProjectMajorCheckNum; + table.NearMissNum = newtable.NearMissNum; + table.RecordableEventNum = newtable.RecordableEventNum; + table.GeneralAccidentNum = newtable.GeneralAccidentNum; + table.MajorAccidentNum = newtable.MajorAccidentNum; + table.SeriousAccidentNum = newtable.SeriousAccidentNum; + table.SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum; + table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum; + table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum; + table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan; + table.CompanyDrillNum = newtable.CompanyDrillNum; + table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum; + table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum; + table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan; + table.ProjectDrillNum = newtable.ProjectDrillNum; + table.CostExtract = newtable.CostExtract; + table.CostUse = newtable.CostUse; + table.UseEquipmentNum = newtable.UseEquipmentNum; + table.SpecialEquipmentNum = newtable.SpecialEquipmentNum; + table.LicensesNum = newtable.LicensesNum; + table.LicensesCloseNum = newtable.LicensesCloseNum; + table.GeneralClosedNum = newtable.GeneralClosedNum; + table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; + table.MajorClosedNum = newtable.MajorClosedNum; + table.MajorNotClosedNum = newtable.MajorNotClosedNum; + table.GeneralRiskNum = newtable.GeneralRiskNum; + table.LowRiskNum = newtable.LowRiskNum; + table.MediumRiskNum = newtable.MediumRiskNum; + table.HighRiskNum = newtable.HighRiskNum; + table.CompletedNum = newtable.CompletedNum; + table.TrainPersonNum = newtable.TrainPersonNum; + table.ConstructionNum = newtable.ConstructionNum; + table.FinishedNum = newtable.FinishedNum; + table.SuperCompletedNum = newtable.SuperCompletedNum; + table.SuperTrainPersonNum = newtable.SuperTrainPersonNum; + table.SuperConstructionNum = newtable.SuperConstructionNum; + table.SuperFinishedNum = newtable.SuperFinishedNum; + db.SubmitChanges(); + } + } + } + /// - /// 判断该项目的该日期是否统计数据 + /// 判断该项目的该日期是否统计数据 /// /// /// @@ -427,103 +330,102 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.Project_HSSEData_HSSE - where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date) && x.ProjectId == projectid - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date && + x.ProjectId == projectid + select x).ToList(); + if (q != null && q.Count > 0) result = true; return result; } + /// - /// 判断当天是否已上报 + /// 判断当天是否已上报 /// /// public static bool IsReportByToday(string projectid) { var result = false; var q = (from x in Funs.DB.Project_HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && + x.ProjectId == projectid + select x).ToList(); + if (q != null && q.Count > 0) result = true; return result; } + /// - /// 根据projectid,获取该项目当天的统计数据 + /// 根据projectid,获取该项目当天的统计数据 /// /// /// - public static Model.Project_HSSEData_HSSE getProject_HSSEData_HSSEByDate(string projectid) + public static Project_HSSEData_HSSE getProject_HSSEData_HSSEByDate(string projectid) { var q = (from x in Funs.DB.Project_HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && + x.ProjectId == projectid + select x).FirstOrDefault(); return q; } /// - /// 统计所有在建项目数据 + /// 统计所有在建项目数据 /// public static void StatisticalAllProjectData() { var projectlist = ProjectService.GetProjectWorkList(); - foreach (var item in projectlist) - { - StatisticalData(item.ProjectId, HSSEDateType.All); - } + foreach (var item in projectlist) StatisticalData(item.ProjectId, HSSEDateType.All); } + /// - /// 统计数据 + /// 统计数据 /// /// - public static void StatisticalData(string projectid, HSSEDateType hSSEDateType) + /// + public static void StatisticalData(string projectid, HSSEDateType hSseDateType) { - string thisUnitId = BLL.Const.UnitId_CD; - var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); - Model.Project_HSSEData_HSSE table = new Model.Project_HSSEData_HSSE(); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); + var table = new Project_HSSEData_HSSE(); if (IsReportByToday(projectid)) - { table = getProject_HSSEData_HSSEByDate(projectid); - } else - { table.Id = SQLHelper.GetNewID(); - } table.UnitId = thisUnitId; - table.CollCropCode = base_Unit.CollCropCode; - table.UnitName = base_Unit.UnitName; + table.CollCropCode = baseUnit.CollCropCode; + table.UnitName = baseUnit.UnitName; table.ProjectId = projectid; table.ReportDate = DateTime.Now.Date; - if (hSSEDateType == HSSEDateType.ProjectInformation || hSSEDateType == HSSEDateType.All) + if (hSseDateType == HSSEDateType.ProjectInformation || hSseDateType == HSSEDateType.All) { table.BeUnderConstructionNum = GetBeUnderConstructionNum(projectid); table.ShutdownNum = GetShutdownNum(projectid); table.JoinConstructionPersonNum = GetJoinConstructionPersonNum(projectid); table.MajorProjectsUnderConstructionNum = GetMajorProjectsUnderConstructionNum(projectid); } - if (hSSEDateType == HSSEDateType.WorkingHours || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.WorkingHours || hSseDateType == HSSEDateType.All) { table.TotalWorkingHour = GetTotalWorkingHour(projectid); table.LostWorkingHour = GetLostWorkingHour(projectid); table.SafeWorkingHour = GetSafeWorkingHour(projectid); } - if (hSSEDateType == HSSEDateType.EducationAndTraining || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.EducationAndTraining || hSseDateType == HSSEDateType.All) { table.SafeTrainNum = GetSafeTrainNum(projectid); table.SpecialTrainNum = GetSpecialTrainNum(projectid); table.SpecialOperationTrainNum = GetSpecialOperationTrainNum(projectid); } - if (hSSEDateType == HSSEDateType.Environmental || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.Environmental || hSseDateType == HSSEDateType.All) { table.TotalEnergyConsumption = GetTotalEnergyConsumption(projectid); table.IncomeComprehensiveEnergyConsumption = GetIncomeComprehensiveEnergyConsumption(projectid); table.NewWaterConsumption = GetNewWaterConsumption(projectid); - } - if (hSSEDateType == HSSEDateType.OfSafetySupervisors || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.OfSafetySupervisors || hSseDateType == HSSEDateType.All) { table.HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneralNum(projectid); table.HeadOfficeFullTimeNum = GetHeadOfficeFullTimeNum(projectid); @@ -537,14 +439,16 @@ namespace BLL table.CertificateBNum = GetCertificateBNum(projectid); table.CertificateCNum = GetCertificateCNum(projectid); } - if (hSSEDateType == HSSEDateType.SafetyMeeting || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.SafetyMeeting || hSseDateType == HSSEDateType.All) { table.SafetyCommitteeMeetingNum = GetSafetyCommitteeMeetingNum(projectid); table.EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(projectid); table.ProjectSafetyLeadingGroupMeetingNum = GetProjectSafetyLeadingGroupMeetingNum(projectid); table.ProjectSafetyMeetingNum = GetProjectSafetyMeetingNum(projectid); } - if (hSSEDateType == HSSEDateType.SupervisionAndInspection || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.SupervisionAndInspection || hSseDateType == HSSEDateType.All) { table.CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheckNum(projectid); table.CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheckNum(projectid); @@ -552,9 +456,9 @@ namespace BLL table.ProjectLeadShiftCheckNum = GetProjectLeadShiftCheckNum(projectid); table.ProjectSpecialCheckNum = GetProjectSpecialCheckNum(projectid); table.ProjectMajorCheckNum = GetProjectMajorCheckNum(projectid); - } - if (hSSEDateType == HSSEDateType.AccidentEvent || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.AccidentEvent || hSseDateType == HSSEDateType.All) { table.NearMissNum = GetNearMissNum(projectid); table.RecordableEventNum = GetRecordableEventNum(projectid); @@ -563,7 +467,8 @@ namespace BLL table.SeriousAccidentNum = GetSeriousAccidentNum(projectid); table.SpecialSeriousAccidentNum = GetSpecialSeriousAccidentNum(projectid); } - if (hSSEDateType == HSSEDateType.EmergencyManagement || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.EmergencyManagement || hSseDateType == HSSEDateType.All) { table.CompanyComprehensivePlanNum = GetCompanyComprehensivePlanNum(projectid); table.CompanySpecialPlanNum = GetCompanySpecialPlanNum(projectid); @@ -574,40 +479,84 @@ namespace BLL table.ProjectOnSiteDisposalPlan = GetProjectOnSiteDisposalPlan(projectid); table.ProjectDrillNum = GetProjectDrillNum(projectid); } - if (hSSEDateType == HSSEDateType.SecurityCost || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.SecurityCost || hSseDateType == HSSEDateType.All) { table.CostExtract = GetCostExtract(projectid); table.CostUse = GetCostUse(projectid); } - if (hSSEDateType == HSSEDateType.ConstructionEquipment || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.ConstructionEquipment || hSseDateType == HSSEDateType.All) { table.UseEquipmentNum = GetUseEquipmentNum(projectid); table.SpecialEquipmentNum = GetSpecialEquipmentNum(projectid); } - if (hSSEDateType == HSSEDateType.WorkPermit || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.WorkPermit || hSseDateType == HSSEDateType.All) { table.LicensesNum = GetLicensesNum(projectid); table.LicensesCloseNum = GetLicensesCloseNum(projectid); } - if (hSSEDateType == HSSEDateType.HiddenDangerTroubleshooting || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.HiddenDangerTroubleshooting || hSseDateType == HSSEDateType.All) { table.GeneralClosedNum = GetGeneralClosedNum(projectid); table.GeneralNotClosedNum = GetGeneralNotClosedNum(projectid); table.MajorClosedNum = GetMajorClosedNum(projectid); table.MajorNotClosedNum = GetMajorNotClosedNum(projectid); } - if (hSSEDateType == HSSEDateType.SecurityRisk || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.SecurityRisk || hSseDateType == HSSEDateType.All) { table.GeneralRiskNum = GetGeneralRiskNum(projectid); table.LowRiskNum = GetLowRiskNum(projectid); table.MediumRiskNum = GetMediumRiskNum(projectid); table.HighRiskNum = GetHighRiskNum(projectid); } - if (hSSEDateType == HSSEDateType.HiddenDangerCategory || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.HiddenDangerCategory || hSseDateType == HSSEDateType.All) { - Project_HSSEData_HiddenDangerDetailService.StatisticalData(projectid); + string thisUnitId1 = string.Empty; + var thisUnit1 = CommonService.GetIsThisUnit(); + if (thisUnit1 != null) + { + thisUnitId1 = thisUnit1.UnitId; + } + var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId1); + DateTime date = DateTime.Now; + Model.SGGLDB db1 = Funs.DB; + var list = from x in db1.HSSE_Hazard_HazardRegister + select x; + var types = (from x in db1.HSSE_Hazard_HazardRegisterTypes + join y in list on x.RegisterTypesId equals y.RegisterTypesId + select new { x.RegisterTypesId, x.RegisterTypesName }).Distinct().ToList(); + foreach (var type in types) + { + Model.Project_HSSEData_HiddenDangerDetail table1 = new Model.Project_HSSEData_HiddenDangerDetail + { + UnitId = thisUnitId1, + CollCropCode = base_Unit.CollCropCode, + UnitName = base_Unit.UnitName, + ProjectId = projectid, + ReportDate = DateTime.Now.Date, + TypeName = type.RegisterTypesName, + TotalNum = list.Count(x => x.RegisterTypesId == type.RegisterTypesId), + NeedRectifyNum = list.Count(x => x.RegisterTypesId == type.RegisterTypesId && (x.States == "1" )), + }; + if (Project_HSSEData_HiddenDangerDetailService.IsReportByToday(projectid, type.RegisterTypesName)) + { + table1.Id = Project_HSSEData_HiddenDangerDetailService.GetTodayModelByProjectAndType(projectid, type.RegisterTypesName).Id; + Project_HSSEData_HiddenDangerDetailService.UpdateProject_HSSEData_HiddenDangerDetail(table1); + } + else + { + table1.Id = SQLHelper.GetNewID(); + Project_HSSEData_HiddenDangerDetailService.AddProject_HSSEData_HiddenDangerDetail(table1); + } + } } - if (hSSEDateType == HSSEDateType.DangerousProject || hSSEDateType == HSSEDateType.All) + + if (hSseDateType == HSSEDateType.DangerousProject || hSseDateType == HSSEDateType.All) { table.CompletedNum = GetCompletedNum(projectid); table.TrainPersonNum = GetTrainPersonNum(projectid); @@ -618,785 +567,1003 @@ namespace BLL table.SuperConstructionNum = GetSuperConstructionNum(projectid); table.SuperFinishedNum = GetSuperFinishedNum(projectid); } - if (IsReportByToday(projectid)) - { - UpdateProject_HSSEData_HSSE(table); - } - else - { - AddProject_HSSEData_HSSE(table); - } - HSSEData_HSSEService.UpdateTodyData_State(); + if (IsReportByToday(projectid)) + UpdateProject_HSSEData_HSSE(table); + else + AddProject_HSSEData_HSSE(table); + HSSEData_HSSEService.UpdateTodyData_State(); } + /// - /// 获取在建项目数 + /// 获取在建项目数 /// /// public static int GetBeUnderConstructionNum(string projectid) { - int result = (from x in Funs.DB.Base_Project where x.ProjectState == "1" && x.ProjectId == projectid select x).Count(); + var result = (from x in Funs.DB.Base_Project + where x.ProjectState == "1" && x.ProjectId == projectid + select x).Count(); return result; } + /// - /// 获取停工项目数 + /// 获取停工项目数 /// /// public static int GetShutdownNum(string projectid) { - int result = (from x in Funs.DB.Base_Project where x.ProjectState == "2" && x.ProjectId == projectid select x).Count(); + var result = (from x in Funs.DB.Base_Project + where x.ProjectState == "2" && x.ProjectId == projectid + select x).Count(); return result; } + /// - /// 获取参建人数 + /// 获取参建人数 /// /// public static int GetJoinConstructionPersonNum(string projectid) { - int result = (from x in Funs.DB.SitePerson_Person where x.ProjectId == projectid && x.IsUsed == 1 select x).Count(); + var result = (from x in Funs.DB.SitePerson_Person + where x.ProjectId == projectid && x.IsUsed == 1 + select x).Count(); return result; } + /// - /// 获取在施危大工程数 + /// 获取在施危大工程数 /// /// public static int GetMajorProjectsUnderConstructionNum(string projectid) { - int result = (from x in Funs.DB.Solution_LargerHazard where x.ProjectId == projectid && x.States == "2" select x).Count(); + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "2" && x.RecordTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取总工时数 + /// 获取总工时数 /// /// public static int GetTotalWorkingHour(string projectid) { - DateTime date = DateTime.Now; var result = (from x in Funs.DB.SitePerson_DayReportDetail - join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId - where y.ProjectId == projectid && y.CompileDate.Value.Year == date.Year && y.CompileDate.Value.Month == date.Month && y.CompileDate.Value.Day == date.Day - select x.PersonWorkTime ).ToList().Sum(x=>x.Value); - var q = Funs.GetNewIntOrZero(result.ToString()); + join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId + where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime + select x.PersonWorkTime ?? 0).ToList().Sum(); + var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); + return q; } + /// - /// 获取损失工时数 + /// 获取损失工时数 /// /// public static int GetLostWorkingHour(string projectid) { - DateTime date = DateTime.Now; - var result = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day select x.WorkHoursLoss).ToList().Sum(x => x.Value) - + (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day select x.WorkingHoursLoss).ToList().Sum(x => x.Value); - var q = Funs.GetNewIntOrZero(result.ToString()); + var result = + (from x in Funs.DB.Accident_AccidentHandle + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x.WorkHoursLoss) + .ToList().Sum(x => x.Value) + + (from x in Funs.DB.Accident_AccidentReport + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x.WorkingHoursLoss) + .ToList().Sum(x => x.Value); + var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); return q; } + /// - /// 获取安全工时数 + /// 获取安全工时数 /// /// public static int GetSafeWorkingHour(string projectid) { - DateTime date = DateTime.Now; var result1 = (from x in Funs.DB.SitePerson_DayReportDetail - join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId - where y.ProjectId == projectid && y.CompileDate.Value.Year == date.Year && y.CompileDate.Value.Month == date.Month && y.CompileDate.Value.Day == date.Day - select x.PersonWorkTime).ToList().Sum(x => x.Value); - var result2 = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day select x.WorkHoursLoss).ToList().Sum(x => x.Value) - + (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day select x.WorkingHoursLoss).ToList().Sum(x => x.Value); + join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId + where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime + select x.PersonWorkTime ?? 0).ToList().Sum(); + var result2 = + (from x in Funs.DB.Accident_AccidentHandle + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x.WorkHoursLoss) + .ToList().Sum(x => x.Value) + + (from x in Funs.DB.Accident_AccidentReport + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x.WorkingHoursLoss) + .ToList().Sum(x => x.Value); var result = result1 - result2; - var q = Funs.GetNewIntOrZero(result.ToString()); + var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); return q; } + /// - /// 获取三级安全教育培训数 + /// 获取三级安全教育培训数 /// /// public static int GetSafeTrainNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.EduTrain_TrainRecord - // join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId - // where x.ProjectId == projectid && x.TrainStartDate.Value.Year == date.Year && x.TrainStartDate.Value.Month == date.Month && x.TrainStartDate.Value.Day == date.Day && y.TrainType == "1" - // select x).Count(); - return 0; + var result = (from x in Funs.DB.EduTrain_TrainRecord + join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId + where x.ProjectId == projectid && y.TrainType == "1" && x.TrainStartDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取专项培训数 + /// 获取专项培训数 /// /// public static int GetSpecialTrainNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.EduTrain_TrainRecord - // join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId - // where x.ProjectId == projectid && x.TrainStartDate.Value.Year == date.Year && x.TrainStartDate.Value.Month == date.Month && x.TrainStartDate.Value.Day == date.Day && y.TrainType == "2" - // select x).Count(); - return 0; + var result = (from x in Funs.DB.EduTrain_TrainRecord + join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId + where x.ProjectId == projectid && y.TrainType == "2" && x.TrainStartDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取特种作业培训数 + /// 获取特种作业培训数 /// /// public static int GetSpecialOperationTrainNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.EduTrain_TrainRecord - // join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId - // where x.ProjectId == projectid && x.TrainStartDate.Value.Year == date.Year && x.TrainStartDate.Value.Month == date.Month && x.TrainStartDate.Value.Day == date.Day && y.TrainType == "3" - // select x).Count(); - return 0; + var result = (from x in Funs.DB.EduTrain_TrainRecord + join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId + where x.ProjectId == projectid && y.TrainType == "3" && x.TrainStartDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取能耗总量 + /// 获取能耗总量 /// /// public static int GetTotalEnergyConsumption(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取万元营业收入综合能耗 + /// 获取万元营业收入综合能耗 /// /// public static int GetIncomeComprehensiveEnergyConsumption(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取用新水量 + /// 获取二氧化碳 /// /// public static int GetNewWaterConsumption(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业总部总监人数 + /// 获取企业总部总监人数 /// /// public static int GetHeadOfficeInspectorGeneralNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业总部专职人数 + /// 获取企业总部专职人数 /// /// public static int GetHeadOfficeFullTimeNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取分支机构总监人数 + /// 获取分支机构总监人数 /// /// public static int GetBranchInspectorGeneralNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取分支机构专职人数 + /// 获取分支机构专职人数 /// /// public static int GetBranchFullTimeNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取项目总监人数 + /// 获取项目总监人数 /// /// public static int GetProjectInspectorGeneralNum(string projectid) { - //int result = (from x in Funs.DB.SitePerson_Person - // where x.ProjectId == projectid && x.WorkPostId == BLL.Const.WorkPost_ProjectHSSEDirector && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.SitePerson_Person + where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.IsUsed == 1 + select x).Count(); + return result; } + /// - /// 获取项目专职人数 + /// 获取项目专职人数 /// /// public static int GetProjectFullTimeNum(string projectid) { - int result = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.ProjectId == projectid && y.IsHsse == true && x.IsUsed == 1 - select x).Count(); + var result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.ProjectId == projectid && y.IsHsse == true && x.IsUsed == 1 + select x).Count(); return result; } + /// - /// 获取项目安全监护人数 + /// 获取项目安全监护人数 /// /// public static int GetProjectSafetyMonitorNum(string projectid) { - //int result = (from x in Funs.DB.SitePerson_Person - // where x.ProjectId == projectid && x.IsSafetyMonitoring == true && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.SitePerson_Person + where x.ProjectId == projectid && x.IsSafetyMonitoring == true && x.IsUsed == 1 + select x).Count(); + return result; } + /// - /// 获取在岗执业注安师 + /// 获取在岗执业注安师 /// /// public static int GetSafetyInjectionEngineer(string projectid) { - //int result = (from x in Funs.DB.SitePerson_Person - // join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - // where x.ProjectId == projectid && y.IsRegisterHSSE == true && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId + where x.ProjectId == projectid && y.IsRegisterHSSE == true && x.IsUsed == 1 + select x).Count(); + return result; } + /// - /// 获取A证人员 + /// 获取A证人员 /// /// public static int GetCertificateANum(string projectid) { - //int result = (from x in Funs.DB.SitePerson_Person - // join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - // where x.ProjectId == projectid && y.CertificateType == "A" && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId + where x.ProjectId == projectid && y.CertificateType == "A" && x.IsUsed == 1 + select x).Count(); + return result; } + /// - /// 获取B证人员 + /// 获取B证人员 /// /// public static int GetCertificateBNum(string projectid) { - //int result = (from x in Funs.DB.SitePerson_Person - // join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - // where x.ProjectId == projectid && y.CertificateType == "B" && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId + where x.ProjectId == projectid && y.CertificateType == "B" && x.IsUsed == 1 + select x).Count(); + return result; } + /// - /// 获取C证人员 + /// 获取C证人员 /// /// public static int GetCertificateCNum(string projectid) { - //int result = (from x in Funs.DB.SitePerson_Person - // join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - // where x.ProjectId == projectid && y.CertificateType == "C" && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.SitePerson_Person + join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId + where x.ProjectId == projectid && y.CertificateType == "C" && x.IsUsed == 1 + select x).Count(); + return result; } + /// - /// 获取企业安委会会议数 + /// 获取企业安委会会议数 /// /// public static int GetSafetyCommitteeMeetingNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业专题会议数 + /// 获取企业专题会议数 /// /// public static int GetEnterpriseTopicsMeetingNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取项目安全领导小组会议数 + /// 获取项目安全领导小组会议数 /// /// public static int GetProjectSafetyLeadingGroupMeetingNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting where x.ProjectId == projectid && x.SafetyLeaderGroupMeetingDate.Value.Year == date.Year && x.SafetyLeaderGroupMeetingDate.Value.Month == date.Month && x.SafetyLeaderGroupMeetingDate.Value.Day == date.Day select x).Count(); - return 0; + var result = (from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x) + .Count(); + return result; } + /// - /// 获取项目安全例会数 + /// 获取项目安全例会数 /// /// public static int GetProjectSafetyMeetingNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Meeting_WeekMeeting where x.ProjectId == projectid && x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day select x).Count() - + (from x in Funs.DB.Meeting_MonthMeeting where x.ProjectId == projectid && x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day select x).Count(); + var result = (from x in Funs.DB.Meeting_WeekMeeting + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x).Count() + + (from x in Funs.DB.Meeting_MonthMeeting + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取企业负责人带班检查次数 + /// 获取企业负责人带班检查次数 /// /// public static int GetCompanyLeadShiftCheckNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业综合检查次数 - /// + /// 获取企业综合检查次数 + /// /// public static int GetCompanyComprehensiveCheckNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业专项检查次数 + /// 获取企业专项检查次数 /// /// public static int GetCompanySpecialCheckNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取项目负责人带班检查次数 + /// 获取项目负责人带班检查次数 /// /// public static int GetProjectLeadShiftCheckNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Check_ProjectLeaderCheck where x.ProjectId == projectid && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count(); - return 0; + var result = (from x in Funs.DB.Check_ProjectLeaderCheck + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取项目专项检查次数 + /// 获取项目专项检查次数 /// /// public static int GetProjectSpecialCheckNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Check_CheckSpecial where x.ProjectId == projectid && x.CheckTime.Value.Year == date.Year && x.CheckTime.Value.Month == date.Month && x.CheckTime.Value.Day == date.Day select x).Count(); + var result = (from x in Funs.DB.Check_CheckSpecial + where x.ProjectId == projectid && x.CheckTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取项目专业检查次数 + /// 获取项目专业检查次数 /// /// public static int GetProjectMajorCheckNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.ProjectId == projectid && x.CheckTime.Value.Year == date.Year && x.CheckTime.Value.Month == date.Month && x.CheckTime.Value.Day == date.Day select x).Count(); + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.CheckTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取未遂事件数 + /// 获取未遂事件数 /// /// public static int GetNearMissNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Accident_AccidentPersonRecord - join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId - where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day && y.AccidentTypeName.Contains("未遂") - select x).Count(); + var result = (from x in Funs.DB.Accident_AccidentPersonRecord + join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId + where x.ProjectId == projectid && x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取可记录事件数 + /// 获取可记录事件数 /// /// public static int GetRecordableEventNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Accident_AccidentPersonRecord - join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId - where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day && !y.AccidentTypeName.Contains("未遂") - select x).Count(); + var result = (from x in Funs.DB.Accident_AccidentPersonRecord + join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取一般事故数 + /// 获取一般事故数 /// /// public static int GetGeneralAccidentNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "1" select x).Count(); - return 0; + var result = (from x in Funs.DB.Accident_AccidentReport + where x.ProjectId == projectid && x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取较大事故数 + /// 获取较大事故数 /// /// public static int GetMajorAccidentNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "2" select x).Count(); - return 0; + var result = (from x in Funs.DB.Accident_AccidentReport + where x.ProjectId == projectid && x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取重大事故数 + /// 获取重大事故数 /// /// public static int GetSeriousAccidentNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "3" select x).Count(); - return 0; + var result = (from x in Funs.DB.Accident_AccidentReport + where x.ProjectId == projectid && x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取特别重大事故数 + /// 获取特别重大事故数 /// /// public static int GetSpecialSeriousAccidentNum(string projectid) { - //DateTime date = DateTime.Now; - //int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "4" select x).Count(); - return 0; + var result = (from x in Funs.DB.Accident_AccidentReport + where x.ProjectId == projectid && x.AccidentDegree == "4" + select x).Count(); + return result; } + /// - /// 获取企业级综合预案数 + /// 获取企业级综合预案数 /// /// public static int GetCompanyComprehensivePlanNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业级专项预案数 + /// 获取企业级专项预案数 /// /// public static int GetCompanySpecialPlanNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业级现场处置预案 + /// 获取企业级现场处置预案 /// /// public static int GetCompanyOnSiteDisposalPlan(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取企业级演练次数 + /// 获取企业级演练次数 /// /// public static int GetCompanyDrillNum(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取项目级综合预案 + /// 获取项目级综合预案 /// /// public static int GetProjectComprehensivePlanNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Emergency_EmergencyList - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where x.ProjectId == projectid && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month - && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("综合") - select x).Count(); + var result = (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where x.ProjectId == projectid && y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取项目级专项预案数 + /// 获取项目级专项预案数 /// /// public static int GetProjectSpecialPlanNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Emergency_EmergencyList - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where x.ProjectId == projectid && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month - && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("专项") - select x).Count(); + var result = (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where x.ProjectId == projectid && y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取项目级现场处置预案 + /// 获取项目级现场处置预案 /// /// public static int GetProjectOnSiteDisposalPlan(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Emergency_EmergencyList - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where x.ProjectId == projectid && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month - && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("现场处置") - select x).Count(); + var result = (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where x.ProjectId == projectid && y.EmergencyTypeName.Contains("现场处置") && + x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取项目级演练次数 + /// 获取项目级演练次数 /// /// public static int GetProjectDrillNum(string projectid) { - DateTime date = DateTime.Now; - int result = (from x in Funs.DB.Emergency_DrillRecordList - where x.ProjectId == projectid && x.DrillRecordDate.Value.Year == date.Year && x.DrillRecordDate.Value.Month == date.Month - && x.DrillRecordDate.Value.Day == date.Day - select x).Count(); + var result = (from x in Funs.DB.Emergency_DrillRecordList + where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取费用提取(万元) + /// 获取费用提取(万元) /// - /// + /// public static int GetCostExtract(string projectid) { - int result = 0; + var result = 0; return result; } + /// - /// 获取费用使用(万元) + /// 获取费用使用(万元) /// /// public static int GetCostUse(string projectid) { - int result = 0; + var result = 0; + var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem + join y in Funs.DB.CostGoods_CostSmallDetail + on x.CostSmallDetailId equals y.CostSmallDetailId + where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime + select x.CostMoney ?? 0).ToList().Sum(); + result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]); return result; } + /// - /// 获取施工机具在用数 + /// 获取施工机具在用数 /// /// public static int GetUseEquipmentNum(string projectid) { - //int result = (from x in Funs.DB.InApproveManager_EquipmentInItem - // join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId - // where y.ProjectId == projectid && x.IsUsed == true - // select x).Count() + - // (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem - // join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y.GeneralEquipmentInId - // where y.ProjectId == projectid && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.InApproveManager_EquipmentInItem + join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId + where y.ProjectId == projectid && x.IsUsed == true + select x).Count() + + (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem + join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y + .GeneralEquipmentInId + where y.ProjectId == projectid && x.IsUsed == true + select x).Count(); + return result; } + /// - /// 获取施工机具特种设备数 + /// 获取施工机具特种设备数 /// /// public static int GetSpecialEquipmentNum(string projectid) { - //int result = (from x in Funs.DB.InApproveManager_EquipmentInItem - // join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId - // where y.ProjectId == projectid && x.IsUsed == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.InApproveManager_EquipmentInItem + join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId + where y.ProjectId == projectid && x.IsUsed == true + select x).Count(); + return result; } + /// - /// 获取作业许可项数 + /// 获取作业许可项数 /// /// public static int GetLicensesNum(string projectid) { - //int result = (from x in Funs.DB.License_LicenseManager - // where x.ProjectId == projectid && x.IsHighRisk == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.License_LicenseManager + where x.ProjectId == projectid && x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取作业许可关闭项数 + /// 获取作业许可关闭项数 /// /// public static int GetLicensesCloseNum(string projectid) { - //int result = (from x in Funs.DB.License_LicenseManager - // where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" - // select x).Count(); - return 0; + var result = (from x in Funs.DB.License_LicenseManager + where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" && + x.CompileDate > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取一般隐患整改闭环项 + /// 获取一般隐患整改闭环项 /// /// public static int GetGeneralClosedNum(string projectid) { - int result = (from x in Funs.DB.Check_RectifyNoticesItem - join y in Funs.DB.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId - where y.ProjectId == projectid && y.HiddenHazardType == "1" && x.IsRectify == true - select x).Count(); + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.Risk_Level == "一般" && x.States == "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取一般隐患未整改完成项 + /// 获取一般隐患未整改完成项 /// /// public static int GetGeneralNotClosedNum(string projectid) { - int result = (from x in Funs.DB.Check_RectifyNoticesItem - join y in Funs.DB.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId - where y.ProjectId == projectid && y.HiddenHazardType == "1" && (x.IsRectify == false || x.IsRectify == null) - select x).Count(); + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.Risk_Level == "一般" && x.States != "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取重大隐患整改闭环项 + /// 获取重大隐患整改闭环项 /// /// public static int GetMajorClosedNum(string projectid) { - int result = (from x in Funs.DB.Check_RectifyNoticesItem - join y in Funs.DB.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId - where y.ProjectId == projectid && y.HiddenHazardType == "3" && x.IsRectify == true - select x).Count(); + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.Risk_Level == "重大" && x.States == "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取重大隐患未整改完成项 + /// 获取重大隐患未整改完成项 /// /// public static int GetMajorNotClosedNum(string projectid) { - int result = (from x in Funs.DB.Check_RectifyNoticesItem - join y in Funs.DB.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId - where y.ProjectId == projectid && y.HiddenHazardType == "3" && (x.IsRectify == false || x.IsRectify == null) - select x).Count(); + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == projectid && x.Risk_Level == "重大" && x.States != "3" && + x.CheckTime > Const.DtmarkTime + select x).Count(); return result; } + /// - /// 获取一般风险数 + /// 获取一般风险数 /// /// public static int GetGeneralRiskNum(string projectid) { - //int result = (from x in Funs.DB.Hazard_HazardSelectedItem - // join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - // where x.ProjectId == projectid && y.RiskLevel == 2 && x.IsStart == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where x.ProjectId == projectid && y.RiskLevel == 2 && x.IsStart == true + select x).Count(); + return result; } + /// - /// 获取低风险数 + /// 获取低风险数 /// /// public static int GetLowRiskNum(string projectid) { - //int result = (from x in Funs.DB.Hazard_HazardSelectedItem - // join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - // where x.ProjectId == projectid && y.RiskLevel == 1 && x.IsStart == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where x.ProjectId == projectid && y.RiskLevel == 1 && x.IsStart == true + select x).Count(); + return result; } + /// - /// 获取中风险数 + /// 获取中风险数 /// /// public static int GetMediumRiskNum(string projectid) { - //int result = (from x in Funs.DB.Hazard_HazardSelectedItem - // join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - // where x.ProjectId == projectid && y.RiskLevel == 3 && x.IsStart == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where x.ProjectId == projectid && y.RiskLevel == 3 && x.IsStart == true + select x).Count(); + return result; } + /// - /// 获取高风险数 + /// 获取高风险数 /// /// public static int GetHighRiskNum(string projectid) { - //int result = (from x in Funs.DB.Hazard_HazardSelectedItem - // join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - // where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Hazard_HazardSelectedItem + join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId + where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true + select x).Count(); + return result; } + /// - /// 获取危大工程审批完成数 + /// 获取危大工程审批完成数 /// /// public static int GetCompletedNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == false - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取危大工程培训人次数 + /// 获取危大工程培训人次数 /// /// public static int GetTrainPersonNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.IsSuperLargerHazard == false - // select x.TrainPersonNum ).ToList().Sum(x=>x.Value); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; } + /// - /// 获取危大工程施工个数 + /// 获取危大工程施工个数 /// /// public static int GetConstructionNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == false - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取危大工程完工个数 + /// 获取危大工程完工个数 /// /// public static int GetFinishedNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == false - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取超危大工程审批完成数 + /// 获取超危大工程审批完成数 /// /// public static int GetSuperCompletedNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取超危大工程培训人次数 + /// 获取超危大工程培训人次数 /// /// public static int GetSuperTrainPersonNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard where x.ProjectId == projectid && x.IsSuperLargerHazard == true select x.TrainPersonNum).ToList().Sum(x => x.Value); - return 0; + var result = + (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; } + /// - /// 获取超危大工程施工个数 + /// 获取超危大工程施工个数 /// /// public static int GetSuperConstructionNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; } + /// - /// 获取超危大工程完工个数 + /// 获取超危大工程完工个数 /// /// public static int GetSuperFinishedNum(string projectid) { - //int result = (from x in Funs.DB.Solution_LargerHazard - // where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == true - // select x).Count(); - return 0; + var result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; } + #region 获取列表 + + /// + /// 记录数 + /// + public static int Count { get; set; } + + public static List GetProject_HSSEData_HSSEByModle(Project_HSSEData_HSSE table) + { + var q = from x in db.Project_HSSEData_HSSE + where + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && + (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && + (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + select x + ; + + return q.ToList(); + } + + /// 获取分页列表 + /// + /// + /// + public static IEnumerable GetListData(Project_HSSEData_HSSE table, Grid grid1) + { + var q = GetProject_HSSEData_HSSEByModle(table); + Count = q.Count(); + if (Count == 0) return null; + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in q + select new + { + x.Id, + x.ProjectId, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.BeUnderConstructionNum, + x.ShutdownNum, + x.JoinConstructionPersonNum, + x.MajorProjectsUnderConstructionNum, + x.TotalWorkingHour, + x.LostWorkingHour, + x.SafeWorkingHour, + x.SafeTrainNum, + x.SpecialTrainNum, + x.SpecialOperationTrainNum, + x.TotalEnergyConsumption, + x.IncomeComprehensiveEnergyConsumption, + x.NewWaterConsumption, + x.HeadOfficeInspectorGeneralNum, + x.HeadOfficeFullTimeNum, + x.BranchInspectorGeneralNum, + x.BranchFullTimeNum, + x.ProjectInspectorGeneralNum, + x.ProjectFullTimeNum, + x.ProjectSafetyMonitorNum, + x.SafetyInjectionEngineer, + x.CertificateANum, + x.CertificateBNum, + x.CertificateCNum, + x.SafetyCommitteeMeetingNum, + x.EnterpriseTopicsMeetingNum, + x.ProjectSafetyLeadingGroupMeetingNum, + x.ProjectSafetyMeetingNum, + x.CompanyLeadShiftCheckNum, + x.CompanyComprehensiveCheckNum, + x.CompanySpecialCheckNum, + x.ProjectLeadShiftCheckNum, + x.ProjectSpecialCheckNum, + x.ProjectMajorCheckNum, + x.NearMissNum, + x.RecordableEventNum, + x.GeneralAccidentNum, + x.MajorAccidentNum, + x.SeriousAccidentNum, + x.SpecialSeriousAccidentNum, + x.CompanyComprehensivePlanNum, + x.CompanySpecialPlanNum, + x.CompanyOnSiteDisposalPlan, + x.CompanyDrillNum, + x.ProjectComprehensivePlanNum, + x.ProjectSpecialPlanNum, + x.ProjectOnSiteDisposalPlan, + x.ProjectDrillNum, + x.CostExtract, + x.CostUse, + x.UseEquipmentNum, + x.SpecialEquipmentNum, + x.LicensesNum, + x.LicensesCloseNum, + x.GeneralClosedNum, + x.GeneralNotClosedNum, + x.MajorClosedNum, + x.MajorNotClosedNum, + x.GeneralRiskNum, + x.LowRiskNum, + x.MediumRiskNum, + x.HighRiskNum, + x.CompletedNum, + x.TrainPersonNum, + x.ConstructionNum, + x.FinishedNum, + x.SuperCompletedNum, + x.SuperTrainPersonNum, + x.SuperConstructionNum, + x.SuperFinishedNum + }; + } + + #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs index 9ae886c4..7df3c5e8 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs @@ -1,5 +1,6 @@ using FineUIPro; using Microsoft.SqlServer.Dts.Runtime; +using Model; using System; using System.Collections; using System.Collections.Generic; @@ -83,59 +84,73 @@ namespace BLL /// public static List GetProject_HSSEData_HiddenDangerDetailByDate(DateTime? reportDate, string projectid) { - var q = from x in db.Project_HSSEData_HiddenDangerDetail - where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid - select x; - return q.ToList(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var q = from x in db.Project_HSSEData_HiddenDangerDetail + where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid + select x; + return q.ToList(); + } } public static void AddProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable) { - - Model.Project_HSSEData_HiddenDangerDetail table = new Model.Project_HSSEData_HiddenDangerDetail + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - ProjectId = newtable.ProjectId, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - TypeName = newtable.TypeName, - TotalNum = newtable.TotalNum, - NeedRectifyNum = newtable.NeedRectifyNum, - }; - db.Project_HSSEData_HiddenDangerDetail.InsertOnSubmit(table); - db.SubmitChanges(); + Model.Project_HSSEData_HiddenDangerDetail table = new Model.Project_HSSEData_HiddenDangerDetail + { + Id = newtable.Id, + ProjectId = newtable.ProjectId, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + TypeName = newtable.TypeName, + TotalNum = newtable.TotalNum, + NeedRectifyNum = newtable.NeedRectifyNum, + }; + db.Project_HSSEData_HiddenDangerDetail.InsertOnSubmit(table); + db.SubmitChanges(); + } } - - public static void UpdateProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable) + public static void AddBulkProject_HSSEData_HiddenDangerDetails(List newtables) { - Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables); + db.SubmitChanges(); + } + public static void UpdateProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - table.ProjectId = table.ProjectId; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.TypeName = newtable.TypeName; - table.TotalNum = newtable.TotalNum; - table.NeedRectifyNum = newtable.NeedRectifyNum; - db.SubmitChanges(); + + Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.ProjectId = table.ProjectId; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.TypeName = newtable.TypeName; + table.TotalNum = newtable.TotalNum; + table.NeedRectifyNum = newtable.NeedRectifyNum; + db.SubmitChanges(); + } } } public static void DeleteProject_HSSEData_HiddenDangerDetailById(string Id) { - - Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Project_HSSEData_HiddenDangerDetail.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.Project_HSSEData_HiddenDangerDetail.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } /// /// 根据项目id和日期删除隐患类别数据 @@ -144,14 +159,24 @@ namespace BLL /// public static void DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime? reportDate, string projectid) { - - var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { + + var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid); db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); db.SubmitChanges(); } + } + public static void DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime? reportDate) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + + var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 ); + db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } } /// /// 根据projectid判断当天项目是否已统计数据 @@ -198,53 +223,57 @@ namespace BLL } public static void StatisticalAllProjectData() { - var projectlist = ProjectService.GetProjectWorkList(); - foreach (var item in projectlist) + var db = Funs.DB; + + var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList(); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) { - StatisticalData(item.ProjectId); + thisUnitId = thisUnit.UnitId; } + var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var list = from x in db.HSSE_Hazard_HazardRegister where projectids.Contains(x.ProjectId) + select x; + var data = (from x in list + join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId + group x by new + { x.ProjectId, x.RegisterTypesId ,y.RegisterTypesName} + into g + select new + { + UnitId = thisUnitId, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ProjectId= g.Key.ProjectId, + ReportDate = DateTime.Now.Date, + TypeName=g.Key.RegisterTypesName, + TotalNum = g.Count(), + NeedRectifyNum = g.Count(x => x.States == "1"), + }).ToList(); + DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime.Now.Date); + var projectHsseDataHiddenDangerDetails = new List(); + foreach (var item in data) + { + Project_HSSEData_HiddenDangerDetail table = new Project_HSSEData_HiddenDangerDetail + { + Id = SQLHelper.GetNewID(), + UnitId = item.UnitId, + CollCropCode = item.CollCropCode, + UnitName = item.UnitName, + ProjectId = item.ProjectId, + ReportDate = item.ReportDate, + TypeName = item.TypeName, + TotalNum = item.TotalNum, + NeedRectifyNum = item.NeedRectifyNum, + + }; + projectHsseDataHiddenDangerDetails.Add(table); + } + AddBulkProject_HSSEData_HiddenDangerDetails(projectHsseDataHiddenDangerDetails); + } - /// - /// 统计数据 - /// - /// - public static void StatisticalData(string projectid) - { - //var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CD); - //DateTime date = DateTime.Now; - //Model.SGGLDB db = Funs.DB; - //var list = from x in db.Check_RectifyNoticesItem - // join y in db.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId - // where y.ProjectId == projectid && y.CheckedDate.Value.Year == date.Year && y.CheckedDate.Value.Month == date.Month && y.CheckedDate.Value.Day == date.Day - // select x; - //var types = (from x in db.Technique_Rectify - // join y in list on x.RectifyId equals y.RectifyId - // select new { x.RectifyId, x.RectifyName }).Distinct().ToList(); - //foreach (var type in types) - //{ - // Model.Project_HSSEData_HiddenDangerDetail table = new Model.Project_HSSEData_HiddenDangerDetail - // { - // UnitId = BLL.Const.UnitId_CD, - // CollCropCode = base_Unit.CollCropCode, - // UnitName = base_Unit.UnitName, - // ProjectId = projectid, - // ReportDate = DateTime.Now.Date, - // TypeName = type.RectifyName, - // TotalNum = list.Count(x => x.RectifyId == type.RectifyId), - // NeedRectifyNum = list.Count(x => x.RectifyId == type.RectifyId && (x.IsRectify == null || x.IsRectify == false)), - // }; - // if (IsReportByToday(projectid, type.RectifyName)) - // { - // table.Id = GetTodayModelByProjectAndType(projectid, type.RectifyName).Id; - // UpdateProject_HSSEData_HiddenDangerDetail(table); - // } - // else - // { - // table.Id = SQLHelper.GetNewID(); - // AddProject_HSSEData_HiddenDangerDetail(table); - // } - //} - } + /// /// 获取类别名称 /// diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs index 247517ef..189d7baa 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs @@ -297,7 +297,12 @@ namespace BLL /// public static void StatisticalData(string projectid,SYHSESDateType sYHSESDateType) { - string thisUnitId = BLL.Const.UnitId_CD; + string thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) + { + thisUnitId = thisUnit.UnitId; + } var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE(); if (IsReportByToday(projectid)) diff --git a/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs b/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs index a6035ce3..ad280ff4 100644 --- a/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs @@ -143,18 +143,19 @@ namespace BLL }; APIDataList_Risk.Add(q); } + var thisUnit = CommonService.GetIsThisUnit(); NewSYHSEDataItem Item = new NewSYHSEDataItem(); Item.Id = data.Id; Item.ReportDate=data.ReportDate.ToString(); - Item.UnitId = Const.UnitId_CD; - Item.CollCropCode = UnitService.GetUnitByUnitId(Const.UnitId_CD).CollCropCode; - Item.UnitName= UnitService.GetUnitByUnitId(Const.UnitId_CD).UnitName; + Item.UnitId = thisUnit.UnitId; + Item.CollCropCode = thisUnit.CollCropCode; + Item.UnitName= thisUnit.UnitName; Item.FactoryId = data.FactoryId; - Item.FactoryCode = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).FactoryCode; - Item.FactoryName = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).FactoryName; - Item.Address = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).Address; - Item.MapCoordinates= BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).MapCoordinates; + Item.FactoryCode = ProjectService.GetProjectByProjectId(data.FactoryId).ProjectCode; + Item.FactoryName = ProjectService.GetProjectByProjectId(data.FactoryId).ProjectName; + Item.Address = ProjectService.GetProjectByProjectId(data.FactoryId).ProjectAddress; + Item.MapCoordinates= ProjectService.GetProjectByProjectId(data.FactoryId).MapCoordinates; Item.SafetyMnaHours = data.SafetyMnaHours.HasValue ? data.SafetyMnaHours.Value : 0; Item.GeneralRiskNum = data.GeneralRiskNum.HasValue ? data.GeneralRiskNum.Value : 0; Item.LowRiskNum = data.LowRiskNum.HasValue ? data.LowRiskNum.Value : 0; diff --git a/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs b/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs index ce9678f5..31f91a76 100644 --- a/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs @@ -87,12 +87,14 @@ namespace BLL public static List GetSYHSEData_SYHSEByModle(Model.SYHSEData_SYHSE table) { + Model.SGGLDB db = Funs.DB; var q = from x in db.SYHSEData_SYHSE where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + orderby x.ReportDate descending select x ; @@ -102,6 +104,7 @@ namespace BLL public static void AddSYHSEData_SYHSE(Model.SYHSEData_SYHSE newtable) { + Model.SGGLDB db = Funs.DB; Model.SYHSEData_SYHSE table = new Model.SYHSEData_SYHSE { Id = newtable.Id, @@ -153,6 +156,7 @@ namespace BLL public static void DeleteSYHSEData_SYHSEById(string Id) { + Model.SGGLDB db = Funs.DB; Model.SYHSEData_SYHSE table = db.SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id); if (table != null) { @@ -269,6 +273,7 @@ namespace BLL public static Model.SYHSEData_SYHSE GetSYHSEData_SYHSEById(string Id) { + Model.SGGLDB db = Funs.DB; return db.SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id); } @@ -278,7 +283,8 @@ namespace BLL SYHSEData data = new SYHSEData(); if (q != null && q.State == Const.CNCEC_State_S) { - data = GetItemBySyhseData_SYHSE(q); + // data = GetItemBySyhseData_SYHSE(q); + data = StatisticalData(); } else { @@ -344,7 +350,13 @@ namespace BLL public static SYHSEData StatisticalData() { - var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CD); + string thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) + { + thisUnitId = thisUnit.UnitId; + } + var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); var ProjectData = (from x in Funs.DB.Project_SYHSEData_SYHSE where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date select x).ToList(); @@ -352,7 +364,7 @@ namespace BLL Model.SYHSEData_SYHSE table = new Model.SYHSEData_SYHSE { - UnitId = BLL.Const.UnitId_CD, + UnitId = thisUnitId, CollCropCode = base_Unit.CollCropCode, UnitName = base_Unit.UnitName, ReportDate = DateTime.Now.Date, @@ -412,6 +424,7 @@ namespace BLL } public static void UpdateSYHSEData_SYHSE(Model.SYHSEData_SYHSE newtable) { + Model.SGGLDB db = Funs.DB; Model.SYHSEData_SYHSE table = db.SYHSEData_SYHSE.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { diff --git a/SGGL/BLL/ZHGL/DataSync/ServerService.cs b/SGGL/BLL/ZHGL/DataSync/ServerService.cs index c20b47a9..77ad9f81 100644 --- a/SGGL/BLL/ZHGL/DataSync/ServerService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ServerService.cs @@ -22,8 +22,7 @@ namespace BLL client.Timeout = -1; var request = new RestRequest(Method.POST); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - var thisUnitId = BLL.Const.UnitId_CD; - var thisUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var thisUnit = CommonService.GetIsThisUnit(); request.AddParameter("UnitName", thisUnit.UnitName); request.AddParameter("CollCropCode", thisUnit.CollCropCode); //request.AddJsonBody(JsonBody); @@ -62,14 +61,14 @@ namespace BLL request.AddHeader("token", tokenItem.Token); request.AddJsonBody(JsonBody); IRestResponse response = client.Execute(request); - Console.WriteLine(response.Content); + APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content); var returnData = JsonConvert.DeserializeObject(response.Content.ToString()); if (returnData.code == 0) { responeData.code = 0; responeData.message = returnData.message; return responeData; - + } return responeData; } diff --git a/SGGL/BLL/ZHGL/Environmental/ChemicalReportItemService.cs b/SGGL/BLL/ZHGL/Environmental/ChemicalReportItemService.cs index 3bca7f98..20b0ffc7 100644 --- a/SGGL/BLL/ZHGL/Environmental/ChemicalReportItemService.cs +++ b/SGGL/BLL/ZHGL/Environmental/ChemicalReportItemService.cs @@ -9,6 +9,50 @@ namespace BLL { public static class ChemicalReportItemService { + public static decimal GetLatstTimeTotalEnergyConsumption() + { + var q1 = (from x in Funs.DB.Environmental_ChemicalReportItem where x.SortIndex == "01" select x); + decimal d1 = 0; + foreach (var item in q1) + { + d1 += Funs.GetNewDecimalOrZero(item.ThisYearValue); + } + var q2 = (from x in Funs.DB.Environmental_ArchitectureReportItem where x.SortIndex == "01" select x); + decimal d2 = 0; + foreach (var item in q2) + { + d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue); + } + return d1 + d2; + } + public static decimal GetLatstTimeIncomeComprehensiveEnergyConsumption() + { + var q2 = (from x in Funs.DB.Environmental_ArchitectureReportItem where x.SortIndex == "15" select x); + decimal d2 = 0; + foreach (var item in q2) + { + d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue); + } + return d2; + + } + public static decimal GetLatstTimeNewWaterConsumption() + { + var q1 = (from x in Funs.DB.Environmental_ChemicalReportItem where x.SortIndex == "70" select x); + decimal d1 = 0; + foreach (var item in q1) + { + d1 += Funs.GetNewDecimalOrZero(item.ThisYearValue); + } + var q2 = (from x in Funs.DB.Environmental_ArchitectureReportItem where x.SortIndex == "38" select x); + decimal d2 = 0; + foreach (var item in q2) + { + d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue); + } + return d1 + d2; + + } /// /// 化工行业能源节约与生态环境保护汇总明细表 /// diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx new file mode 100644 index 00000000..e412d33b --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx @@ -0,0 +1,298 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OnlineEditing.aspx.cs" Inherits="FineUIPro.Web.AttachFile.OnlineEditing" %> + + + + + + + + + + Spire.Office + + + + + + + + + + +
+
+ +
+
+ +
+
+
+
+ + + + diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs new file mode 100644 index 00000000..9632e4c5 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using BLL; + +namespace FineUIPro.Web.AttachFile +{ + public partial class OnlineEditing :PageBase + { + #region 定义参数 + public string Appid + { + get + { + var sysSet = (from x in Funs.DB.Sys_Set where x.SetName == "OnlineEditAppid" select x).ToList().FirstOrDefault(); + if (sysSet != null) + { + return sysSet.SetValue; + } + else + { + return ""; + } + } + } + public string Appkey + { + get + { + var sysSet = (from x in Funs.DB.Sys_Set where x.SetName == "OnlineEditAppkey" select x).ToList().FirstOrDefault(); + if (sysSet != null) + { + return sysSet.SetValue; + } + else + { + return ""; + } + } + } + public string CallBackUrl + { + get + { + var sysSet = (from x in Funs.DB.Sys_Set where x.SetName == "OnlineEditCallBackurl" select x).ToList().FirstOrDefault(); + if (sysSet != null) + { + return sysSet.SetValue; + } + else + { + return ""; + } + } + } + public string ReadOnly + { + get + { + return (string)ViewState["ReadOnly"]; + } + set + { + ViewState["ReadOnly"] = value; + } + } + public string PCUrl + { + get + { + return (string)ViewState["PCUrl"]; + } + set + { + ViewState["PCUrl"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + /*UserId = Request.Params["UserId"]; + AttachFileId = Request.Params["AttachFileId"]; + ReadOnly = Request.Params["ReadOnly"];*/ + PCUrl = Request.Params["fileUrl"]; + + + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs new file mode 100644 index 00000000..ec9d1dd5 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.AttachFile +{ + + + public partial class OnlineEditing + { + } +} diff --git a/SGGL/FineUIPro.Web/AttachFile/fileupload.ashx.cs b/SGGL/FineUIPro.Web/AttachFile/fileupload.ashx.cs index fed974ba..4ee5a822 100644 --- a/SGGL/FineUIPro.Web/AttachFile/fileupload.ashx.cs +++ b/SGGL/FineUIPro.Web/AttachFile/fileupload.ashx.cs @@ -42,6 +42,8 @@ namespace FineUIPro.Web.AttachFile ResponseError(context); return; } + // 定义允许上传的文件类型列表 + List allowExtensions = BLL.DropListService.allowExtensions; HttpPostedFile postedFile = context.Request.Files[0]; // 文件名完整路径 @@ -52,6 +54,15 @@ namespace FineUIPro.Web.AttachFile string shortFileName = GetFileName(fileName); string fileType = GetFileType(fileName); + if (!allowExtensions.Contains("." + fileType)) + { + // 出错了 + context.Response.StatusCode = 415; + context.Response.Write("不支持的文件类型"); + // ResponseError(context); + + return; + } int fileSize = postedFile.ContentLength; JObject fileObj = new JObject(); diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index 9b9029b0..eed414c7 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -734,3 +734,112 @@ IP地址:::1 出错时间:07/09/2023 11:29:41 + +错误信息开始=====> +错误类型:FileLoadException +错误信息:未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +错误堆栈: + 在 BLL.WeatherService.GetWeather(String projectId) + 在 FineUIPro.Web.index.Page_Load(Object sender, EventArgs e) 位置 D:\数据\诺必达\成达\SGGL_CD\SGGL\FineUIPro.Web\index.aspx.cs:行号 311 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:09/26/2023 14:49:46 +出错文件:http://localhost:1295/index.aspx +IP地址:::1 +操作人员:JT + +出错时间:09/26/2023 14:49:46 + + +错误信息开始=====> +错误类型:FileLoadException +错误信息:未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +错误堆栈: + 在 BLL.WeatherService.GetWeather(String projectId) + 在 FineUIPro.Web.common.mainProject.getWeatherValues() 位置 D:\数据\诺必达\成达\SGGL_CD\SGGL\FineUIPro.Web\common\mainProject.aspx.cs:行号 471 + 在 FineUIPro.Web.common.mainProject.Page_Load(Object sender, EventArgs e) 位置 D:\数据\诺必达\成达\SGGL_CD\SGGL\FineUIPro.Web\common\mainProject.aspx.cs:行号 62 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:09/26/2023 14:49:54 +出错文件:http://localhost:1295/common/mainProject.aspx +IP地址:::1 +操作人员:JT + +出错时间:09/26/2023 14:49:54 + + +错误信息开始=====> +错误类型:FileLoadException +错误信息:未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +错误堆栈: + 在 BLL.WeatherService.GetWeather(String projectId) + 在 FineUIPro.Web.index.Page_Load(Object sender, EventArgs e) 位置 D:\数据\诺必达\成达\SGGL_CD\SGGL\FineUIPro.Web\index.aspx.cs:行号 311 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:09/26/2023 14:51:17 +出错文件:http://localhost:1295/index.aspx +IP地址:::1 +操作人员:JT + +出错时间:09/26/2023 14:51:17 + + +错误信息开始=====> +错误类型:FileLoadException +错误信息:未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +错误堆栈: + 在 FineUIPro.Web.PageBase..cctor() +----错误类型:FileLoadException +----错误信息: +----未能加载文件或程序集“Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +----错误堆栈: + 出错时间:09/26/2023 14:51:48 +出错文件:http://localhost:1295/Login.aspx +IP地址:::1 + +出错时间:09/26/2023 14:51:48 + + +错误信息开始=====> +错误类型:FileLoadException +错误信息:未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +错误堆栈: + 在 FineUIPro.Web.PageBase..cctor() +----错误类型:FileLoadException +----错误信息: +----未能加载文件或程序集“Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +----错误堆栈: + 出错时间:09/26/2023 14:52:00 +出错文件:http://localhost:1295/Login.aspx +IP地址:::1 + +出错时间:09/26/2023 14:52:00 + + +错误信息开始=====> +错误类型:FileLoadException +错误信息:未能加载文件或程序集“Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) +错误堆栈: + 在 BLL.WeatherService.GetWeather(String projectId) + 在 FineUIPro.Web.index.Page_Load(Object sender, EventArgs e) 位置 D:\数据\诺必达\成达\SGGL_CD\SGGL\FineUIPro.Web\index.aspx.cs:行号 311 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:09/26/2023 14:53:21 +出错文件:http://localhost:1295/index.aspx +IP地址:::1 +操作人员:JT + +出错时间:09/26/2023 14:53:21 + diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 8e0a5f02..24b81645 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -212,6 +212,7 @@ + @@ -1546,6 +1547,7 @@ + @@ -1780,8 +1782,14 @@ + + + + + + @@ -6149,6 +6157,13 @@ fileupload.ashx + + OnlineEditing.aspx + ASPXCodeBehind + + + OnlineEditing.aspx + player.aspx ASPXCodeBehind @@ -15133,6 +15148,13 @@ Depart.aspx + + HttpLog.aspx + ASPXCodeBehind + + + HttpLog.aspx + MenuFlowOperateEdit.aspx ASPXCodeBehind @@ -15294,6 +15316,41 @@ TestRecord.aspx + + IFLogList.aspx + ASPXCodeBehind + + + IFLogList.aspx + + + InterFaceEdit.aspx + ASPXCodeBehind + + + InterFaceEdit.aspx + + + InterFaceSet.aspx + ASPXCodeBehind + + + InterFaceSet.aspx + + + InterFaceTask.aspx + ASPXCodeBehind + + + InterFaceTask.aspx + + + InterFaceTaskEdit.aspx + ASPXCodeBehind + + + InterFaceTaskEdit.aspx + BeforeTestRun.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index f3ec89b6..c413cd2c 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -60,7 +60,8 @@ } ////通用定时器 try - { + { + QuartzServices.Init(); BLL.MonitorService.StartMonitor(); BLL.MonitorService.StartMonitorEve(); BLL.MonitorService.StartPersonQuarterCheck(); diff --git a/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx b/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx new file mode 100644 index 00000000..d12bd83f --- /dev/null +++ b/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx @@ -0,0 +1,123 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HttpLog.aspx.cs" Inherits="FineUIPro.Web.SysManage.HttpLog" %> + + + + + + + HTTP请求日志表 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx.cs b/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx.cs new file mode 100644 index 00000000..0000509b --- /dev/null +++ b/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx.cs @@ -0,0 +1,167 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.SysManage +{ + public partial class HttpLog : PageBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); + // 绑定表格 + this.BindGrid(); + } + } + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + Model.Sys_HttpLog table = new Model.Sys_HttpLog(); + table.LogTime=txtLogTime.SelectedDate; + table.UserName=txtUserName.Text.Trim(); + table.HttpUrl=txtHttpUrl.Text.Trim(); + table.LogTxt=txtLogTxt.Text.Trim(); + table.MeThod=txtMeThod.Text.Trim(); + var tb = BLL.SysHttplogService.getListData(table, Grid1); + Grid1.RecordCount = SysHttplogService.count; + //tb = GetFilteredTable(Grid1.FilteredData, tb); + Grid1.DataSource = tb; + Grid1.DataBind(); + } + #endregion + + #region GV 数据操作 + /// + /// 过滤表头 + /// + /// + /// + //protected void Grid1_FilterChange(object sender, EventArgs e) + //{ + // this.BindGrid(); + //} + + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + this.Grid1.PageIndex = e.NewPageIndex; + this.BindGrid(); + } + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + this.Grid1.SortDirection = e.SortDirection; + this.Grid1.SortField = e.SortField; + this.BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue); + this.BindGrid(); + } + #endregion + + #region 关闭弹出窗 + /// + /// 关闭弹出窗 + /// + /// + /// + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } + #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("HTTP请求日志表" + 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; + } + sb.AppendFormat("", html); + } + + sb.Append(""); + } + + sb.Append("
{0}
{0}
"); + + return sb.ToString(); + } + #endregion + + protected void btSearch_Click(object sender, EventArgs e) + { + BindGrid(); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx.designer.cs b/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx.designer.cs new file mode 100644 index 00000000..6ba66945 --- /dev/null +++ b/SGGL/FineUIPro.Web/SysManage/HttpLog.aspx.designer.cs @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.SysManage +{ + + + public partial class HttpLog + { + + /// + /// 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; + + /// + /// txtLogTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtLogTime; + + /// + /// txtUserName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUserName; + + /// + /// txtHttpUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtHttpUrl; + + /// + /// txtLogTxt 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtLogTxt; + + /// + /// txtMeThod 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMeThod; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btSearch; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// 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; + } +} diff --git a/SGGL/FineUIPro.Web/SysManage/RoleListEdit.aspx.cs b/SGGL/FineUIPro.Web/SysManage/RoleListEdit.aspx.cs index 2207d0a0..06e8bba5 100644 --- a/SGGL/FineUIPro.Web/SysManage/RoleListEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/RoleListEdit.aspx.cs @@ -88,6 +88,10 @@ namespace FineUIPro.Web.SysManage /// protected void btnSave_Click(object sender, EventArgs e) { + if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.RoleMenuId, Const.BtnSave)) + { + return; + } if (BLL.RoleService.IsExistRoleName(this.RoleId, this.txtRoleName.Text.Trim())) { Alert.ShowInParent("角色名称已存在!", MessageBoxIcon.Warning); diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx index a38c1cbf..fb29b34c 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx @@ -116,6 +116,20 @@ + + + + + + + + + + + + + @@ -342,7 +356,7 @@ - + @@ -402,6 +416,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs index af736f74..4a40ae5a 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs @@ -369,6 +369,24 @@ namespace FineUIPro.Web.SysManage { txtSerVerUrl.Text = sysSet9.SetValue; } + var sysSet10 = (from x in Funs.DB.Sys_Const where x.ConstText == "集团ESB地址" select x).ToList().FirstOrDefault(); + if (sysSet10 != null) + { + txtESBSerVerUrl.Text = sysSet10.ConstValue; + } + var sysSet11 = (from x in Funs.DB.Sys_Const where x.ConstText == "ClientId" select x).ToList().FirstOrDefault(); + if (sysSet11 != null) + { + txtClientId.Text = sysSet11.ConstValue; + } + var sysSet18 = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_SafeReferer).Select(x => new { x.ConstText, x.ConstValue }).ToList(); + var txtReferer = ""; + foreach (var item in sysSet18) + { + string a = item.ConstText + "|" + item.ConstValue; + txtReferer += a + "&"; + } + txtRefererWhitelist.Text = txtReferer; } /// @@ -569,6 +587,68 @@ namespace FineUIPro.Web.SysManage Funs.DB.Sys_Set.InsertOnSubmit(newSysSet9); Funs.DB.SubmitChanges(); } + Model.Sys_Const sysSet10 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "集团ESB地址"); + if (sysSet10 != null) + { + if (!string.IsNullOrEmpty(this.txtESBSerVerUrl.Text.Trim())) + { + sysSet10.ConstValue = this.txtESBSerVerUrl.Text.Trim(); + } + db.SubmitChanges(); + } + else + { + Model.Sys_Const newSysSet10 = new Model.Sys_Const(); + newSysSet10.ID = SQLHelper.GetNewID(); + if (!string.IsNullOrEmpty(this.txtESBSerVerUrl.Text.Trim())) + { + newSysSet10.ConstValue = this.txtESBSerVerUrl.Text.Trim(); + } + newSysSet10.ConstText = "集团ESB地址"; + Funs.DB.Sys_Const.InsertOnSubmit(newSysSet10); + Funs.DB.SubmitChanges(); + } + Model.Sys_Const sysSet11 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "ClientId"); + if (sysSet11 != null) + { + if (!string.IsNullOrEmpty(this.txtClientId.Text.Trim())) + { + sysSet11.ConstValue = this.txtClientId.Text.Trim(); + } + db.SubmitChanges(); + } + else + { + Model.Sys_Const newSysSet11 = new Model.Sys_Const(); + newSysSet11.ID = SQLHelper.GetNewID(); + if (!string.IsNullOrEmpty(this.txtClientId.Text.Trim())) + { + newSysSet11.ConstValue = this.txtClientId.Text.Trim(); + } + newSysSet11.ConstText = "ClientId"; + Funs.DB.Sys_Const.InsertOnSubmit(newSysSet11); + Funs.DB.SubmitChanges(); + } + ConstValue.DeleteConstValueBygroupId(BLL.ConstValue.Group_SafeReferer); + var q = txtRefererWhitelist.Text.Split('&'); + foreach (var item in q) + { + var detail = item.Split('|'); + if (detail.Length == 2) + { + Model.Sys_Const newSys_Const = new Model.Sys_Const() + { + ID = SQLHelper.GetNewID(typeof(Model.Sys_Const)), + ConstText = detail[0].ToString(), + ConstValue = detail[1].ToString(), + SortIndex = 1, + GroupId = ConstValue.Group_SafeReferer + }; + Funs.DB.Sys_Const.InsertOnSubmit(newSys_Const); + Funs.DB.SubmitChanges(); + } + + } ShowNotify("保存成功!", MessageBoxIcon.Success); BLL.LogService.AddSys_Log(this.CurrUser, "修改系统环境设置!", string.Empty, BLL.Const.SysConstSetMenuId, BLL.Const.BtnModify); } @@ -944,6 +1024,94 @@ namespace FineUIPro.Web.SysManage } #endregion + #region TabOnLine加载页面方法 + + private void LoadTabOnlineEditData() + { + var db = Funs.DB; + var sysSet1 = (from x in db.Sys_Const where x.ConstText == "OnlineEditAppid" select x).ToList().FirstOrDefault(); + if (sysSet1 != null) + { + txtAppid.Text = sysSet1.ConstValue; + } + var sysSet2 = (from x in db.Sys_Const where x.ConstText == "OnlineEditAppkey" select x).ToList().FirstOrDefault(); + if (sysSet2 != null) + { + txtAppkey.Text = sysSet2.ConstValue; + } + var sysSet3 = (from x in db.Sys_Const where x.ConstText == "OnlineEditCallBackurl" select x).ToList().FirstOrDefault(); + if (sysSet3 != null) + { + txtCallBackapiurl.Text = sysSet3.ConstValue; + } + } + protected void OnlineMenuSetSave_OnClick(object sender, EventArgs e) + { + var db = Funs.DB; + Model.Sys_Const sysSey1 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "OnlineEditAppid"); + if (sysSey1 != null) + { + if (!string.IsNullOrEmpty(this.txtAppid.Text.Trim())) + { + sysSey1.ConstValue = this.txtAppid.Text.Trim(); + } + db.SubmitChanges(); + } + else + { + sysSey1 = new Model.Sys_Const(); + if (!string.IsNullOrEmpty(this.txtAppid.Text.Trim())) + { + sysSey1.ConstValue = this.txtAppid.Text.Trim(); + } + sysSey1.ConstText = "OnlineEditAppid"; + Funs.DB.Sys_Const.InsertOnSubmit(sysSey1); + Funs.DB.SubmitChanges(); + } + Model.Sys_Const sysSey2 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "OnlineEditAppkey"); + if (sysSey2 != null) + { + if (!string.IsNullOrEmpty(this.txtAppkey.Text.Trim())) + { + sysSey2.ConstValue = this.txtAppkey.Text.Trim(); + } + db.SubmitChanges(); + } + else + { + sysSey2 = new Model.Sys_Const(); + if (!string.IsNullOrEmpty(this.txtAppkey.Text.Trim())) + { + sysSey2.ConstValue = this.txtAppkey.Text.Trim(); + } + sysSey2.ConstText = "OnlineEditAppkey"; + Funs.DB.Sys_Const.InsertOnSubmit(sysSey2); + Funs.DB.SubmitChanges(); + } + Model.Sys_Const sysSet3 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "OnlineEditCallBackurl"); + if (sysSet3 != null) + { + if (!string.IsNullOrEmpty(this.txtCallBackapiurl.Text.Trim())) + { + sysSet3.ConstValue = this.txtCallBackapiurl.Text.Trim(); + } + db.SubmitChanges(); + } + else + { + sysSet3 = new Model.Sys_Const(); + if (!string.IsNullOrEmpty(this.txtCallBackapiurl.Text.Trim())) + { + sysSet3.ConstValue = this.txtCallBackapiurl.Text.Trim(); + } + sysSet3.ConstText = "OnlineEditCallBackurl"; + Funs.DB.Sys_Const.InsertOnSubmit(sysSet3); + Funs.DB.SubmitChanges(); + } + } + #endregion + + /// /// 选择菜单类型 /// @@ -1181,5 +1349,26 @@ namespace FineUIPro.Web.SysManage } + + protected void txtTestPost_OnClick(object sender, EventArgs e) + { + System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; + string CncecEsbPath = SysConstSetService.CncecEsbPath; + string ClientId = SysConstSetService.ClientId; + + string baseurl = CncecEsbPath + "/cn.cncec.group.qhsePROD.common.GetToken"; + var client = new RestClient(baseurl); + client.Timeout = -1; + var request = new RestRequest(Method.POST); + var thisUnit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CD); + request.AddHeader("ClientId", ClientId); + request.AddHeader("OperationCode", "cn.cncec.group.qhsePROD.common.GetToken"); + request.AddParameter("UnitName", thisUnit.UnitName); + request.AddParameter("CollCropCode", thisUnit.CollCropCode); + IRestResponse response = client.Execute(request); + + Alert.Show(response.Content); + } + } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs index 50258746..28e8de4f 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.SysManage { - - - public partial class SysConstSet { - +namespace FineUIPro.Web.SysManage +{ + + + public partial class SysConstSet + { + /// /// form1 控件。 /// @@ -20,7 +22,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -29,7 +31,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// Panel2 控件。 /// @@ -38,7 +40,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Panel Panel2; - + /// /// TabStrip1 控件。 /// @@ -47,7 +49,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TabStrip TabStrip1; - + /// /// Tab1 控件。 /// @@ -56,7 +58,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab1; - + /// /// SimpleForm1 控件。 /// @@ -65,7 +67,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm1; - + /// /// txtNumberBox 控件。 /// @@ -74,7 +76,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtNumberBox; - + /// /// Label9 控件。 /// @@ -83,7 +85,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label9; - + /// /// ckIsMonthReportGetAVG 控件。 /// @@ -92,7 +94,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckIsMonthReportGetAVG; - + /// /// Label10 控件。 /// @@ -101,7 +103,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label10; - + /// /// txtMonthReportFreezeDay 控件。 /// @@ -110,7 +112,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMonthReportFreezeDay; - + /// /// Label11 控件。 /// @@ -119,7 +121,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label11; - + /// /// frFlowOperate 控件。 /// @@ -128,7 +130,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.FormRow frFlowOperate; - + /// /// ckMenuFlowOperate 控件。 /// @@ -137,7 +139,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckMenuFlowOperate; - + /// /// Label12 控件。 /// @@ -146,7 +148,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label12; - + /// /// txtMarch 控件。 /// @@ -155,7 +157,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMarch; - + /// /// Label1 控件。 /// @@ -164,7 +166,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label1; - + /// /// txtMarchday 控件。 /// @@ -173,7 +175,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMarchday; - + /// /// Label2 控件。 /// @@ -182,7 +184,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label2; - + /// /// txtJune 控件。 /// @@ -191,7 +193,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJune; - + /// /// Label3 控件。 /// @@ -200,7 +202,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label3; - + /// /// txtJuneday 控件。 /// @@ -209,7 +211,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJuneday; - + /// /// Label4 控件。 /// @@ -218,7 +220,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label4; - + /// /// txtSeptember 控件。 /// @@ -227,7 +229,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSeptember; - + /// /// Label5 控件。 /// @@ -236,7 +238,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label5; - + /// /// txtSeptemberday 控件。 /// @@ -245,7 +247,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSeptemberday; - + /// /// Label6 控件。 /// @@ -254,7 +256,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label6; - + /// /// txtDecember 控件。 /// @@ -263,7 +265,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDecember; - + /// /// Label7 控件。 /// @@ -272,7 +274,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label7; - + /// /// txtDecemberday 控件。 /// @@ -281,7 +283,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDecemberday; - + /// /// Label13 控件。 /// @@ -290,7 +292,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label13; - + /// /// txtSerVerUrl 控件。 /// @@ -299,7 +301,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtSerVerUrl; - + /// /// btnApply 控件。 /// @@ -308,7 +310,43 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnApply; - + + /// + /// txtESBSerVerUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtESBSerVerUrl; + + /// + /// txtClientId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtClientId; + + /// + /// txtTestPost 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button txtTestPost; + + /// + /// txtRefererWhitelist 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextArea txtRefererWhitelist; + /// /// Toolbar1 控件。 /// @@ -317,7 +355,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar1; - + /// /// btnArrowRefresh 控件。 /// @@ -326,7 +364,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnArrowRefresh; - + /// /// btnSave 控件。 /// @@ -335,7 +373,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnSave; - + /// /// Tab2 控件。 /// @@ -344,7 +382,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab2; - + /// /// Toolbar3 控件。 /// @@ -353,7 +391,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar3; - + /// /// rblMenuType 控件。 /// @@ -362,7 +400,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rblMenuType; - + /// /// drpSuperMenu 控件。 /// @@ -371,7 +409,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpSuperMenu; - + /// /// drpMenu 控件。 /// @@ -380,7 +418,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownBox drpMenu; - + /// /// treeMenu 控件。 /// @@ -389,7 +427,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tree treeMenu; - + /// /// ToolbarFill1 控件。 /// @@ -398,7 +436,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnTab2Save 控件。 /// @@ -407,7 +445,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnTab2Save; - + /// /// TabStrip2 控件。 /// @@ -416,7 +454,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TabStrip TabStrip2; - + /// /// TabCode 控件。 /// @@ -425,7 +463,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab TabCode; - + /// /// SimpleForm2 控件。 /// @@ -434,7 +472,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm2; - + /// /// ckProjectCode 控件。 /// @@ -443,7 +481,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckProjectCode; - + /// /// txtPrefix 控件。 /// @@ -452,7 +490,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtPrefix; - + /// /// Label8 控件。 /// @@ -461,7 +499,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label8; - + /// /// ckUnitCode 控件。 /// @@ -470,7 +508,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckUnitCode; - + /// /// Label22 控件。 /// @@ -479,7 +517,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label22; - + /// /// txtDigit 控件。 /// @@ -488,7 +526,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDigit; - + /// /// Label23 控件。 /// @@ -497,7 +535,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label23; - + /// /// txtSymbol 控件。 /// @@ -506,7 +544,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtSymbol; - + /// /// Label24 控件。 /// @@ -515,7 +553,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label24; - + /// /// Tab4 控件。 /// @@ -524,7 +562,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab4; - + /// /// txtTemplate 控件。 /// @@ -533,7 +571,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.HtmlEditor txtTemplate; - + /// /// Tab5 控件。 /// @@ -542,7 +580,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab5; - + /// /// Grid1 控件。 /// @@ -551,7 +589,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid Grid1; - + /// /// Toolbar4 控件。 /// @@ -560,7 +598,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar4; - + /// /// btnFlowOperateNew 控件。 /// @@ -569,7 +607,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnFlowOperateNew; - + /// /// btnFlowOperateDelete 控件。 /// @@ -578,7 +616,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnFlowOperateDelete; - + /// /// Label27 控件。 /// @@ -587,7 +625,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label Label27; - + /// /// Tab3 控件。 /// @@ -596,7 +634,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab3; - + /// /// frTestSet 控件。 /// @@ -605,7 +643,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form frTestSet; - + /// /// lbTotalScore 控件。 /// @@ -614,7 +652,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTotalScore; - + /// /// lbTotalCount 控件。 /// @@ -623,7 +661,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTotalCount; - + /// /// txtDuration 控件。 /// @@ -632,7 +670,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDuration; - + /// /// Label14 控件。 /// @@ -641,7 +679,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label14; - + /// /// txtPassingScore 控件。 /// @@ -650,7 +688,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtPassingScore; - + /// /// Label21 控件。 /// @@ -659,7 +697,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label21; - + /// /// txtSValue 控件。 /// @@ -668,7 +706,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSValue; - + /// /// Label15 控件。 /// @@ -677,7 +715,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label15; - + /// /// txtMValue 控件。 /// @@ -686,7 +724,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMValue; - + /// /// Label16 控件。 /// @@ -695,7 +733,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label16; - + /// /// txtJValue 控件。 /// @@ -704,7 +742,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJValue; - + /// /// Label17 控件。 /// @@ -713,7 +751,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label17; - + /// /// txtSCount 控件。 /// @@ -722,7 +760,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSCount; - + /// /// Label18 控件。 /// @@ -731,7 +769,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label18; - + /// /// txtMCount 控件。 /// @@ -740,7 +778,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMCount; - + /// /// Label19 控件。 /// @@ -749,7 +787,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label19; - + /// /// txtJCount 控件。 /// @@ -758,7 +796,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJCount; - + /// /// Label20 控件。 /// @@ -767,7 +805,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label20; - + /// /// Toolbar2 控件。 /// @@ -776,7 +814,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar2; - + /// /// btnTab3Save 控件。 /// @@ -785,7 +823,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnTab3Save; - + /// /// Tab6 控件。 /// @@ -794,7 +832,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab6; - + /// /// Form2 控件。 /// @@ -803,7 +841,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form Form2; - + /// /// drpYear 控件。 /// @@ -812,7 +850,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpYear; - + /// /// txtYearPlanOutPutValue 控件。 /// @@ -821,7 +859,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtYearPlanOutPutValue; - + /// /// txtYearActualOutPutValue 控件。 /// @@ -830,7 +868,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtYearActualOutPutValue; - + /// /// btnYearOutPutValue 控件。 /// @@ -839,7 +877,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnYearOutPutValue; - + /// /// GridOutPut 控件。 /// @@ -848,7 +886,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid GridOutPut; - + /// /// Toolbar6 控件。 /// @@ -857,7 +895,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar6; - + /// /// drpMonth 控件。 /// @@ -866,7 +904,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpMonth; - + /// /// btnOutPutAdd 控件。 /// @@ -875,7 +913,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnOutPutAdd; - + /// /// btnOutPutDel 控件。 /// @@ -884,7 +922,79 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnOutPutDel; - + + /// + /// TabOnlineMenuSet 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tab TabOnlineMenuSet; + + /// + /// Form3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form Form3; + + /// + /// txtAppid 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAppid; + + /// + /// txtAppkey 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAppkey; + + /// + /// txtCallBackapiurl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCallBackapiurl; + + /// + /// Toolbar5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar5; + + /// + /// OnlineMenuSetSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button OnlineMenuSetSave; + + /// + /// TabHttpLog 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tab TabHttpLog; + /// /// Window1 控件。 /// @@ -893,7 +1003,7 @@ namespace FineUIPro.Web.SysManage { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window1; - + /// /// Window2 控件。 /// diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx new file mode 100644 index 00000000..dae759f9 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx @@ -0,0 +1,105 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IFLogList.aspx.cs" Inherits="FineUIPro.Web.InterFace.IFLogList" %> + + + + + + + + + + +
+ + + + + + + + + + + + <%-- + --%> + <%-- + --%> + + <%-- + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx.cs new file mode 100644 index 00000000..2b1b64da --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data.SqlClient; +using BLL; +using System.Data; + +namespace FineUIPro.Web.InterFace +{ + public partial class IFLogList : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + // BLL.ConstValue.InitConstValueDropDownList(this.drpDataType, "DataType", true); + BindGrid(); + } + } + + #region BindGrid + + private void BindGrid() + { + Model.InterFaceLog interFaceLog=new Model.InterFaceLog(); + interFaceLog.InterFaceName=txtUserName.Text; + var q= BLL.InterFaceLogService.GetInterFaceLogByModle(interFaceLog); + Grid1.RecordCount = InterFaceLogService.count; + Grid1.DataSource= InterFaceLogService.getListData(interFaceLog, Grid1); + Grid1.DataBind(); + + } + + #endregion + + protected string GetUnitName(object unitId) + { + string unitName = ""; + if (unitId != null) + { + unitName = BLL.UnitService.GetUnitNameByUnitId(unitId.ToString()); + } + return unitName; + } + /// + /// 分页下拉选择 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + + BindGrid(); + } + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx.designer.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx.designer.cs new file mode 100644 index 00000000..fb1941da --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/IFLogList.aspx.designer.cs @@ -0,0 +1,134 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.InterFace +{ + + + public partial class IFLogList + { + + /// + /// Head1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlHead Head1; + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// panelCenterRegion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel panelCenterRegion; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// txtUserName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUserName; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// Label4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label4; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx new file mode 100644 index 00000000..d2699d59 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx @@ -0,0 +1,96 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InterFaceEdit.aspx.cs" Inherits="FineUIPro.Web.InterFace.InterFaceEdit" %> + + + + + 编辑接口设置 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx.cs new file mode 100644 index 00000000..0ee18a24 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx.cs @@ -0,0 +1,222 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using BLL; + +namespace FineUIPro.Web.InterFace +{ + public partial class InterFaceEdit : PageBase + { + #region 定义项 + /// + /// 接口配置主键 + /// + public string InterFaceSetId + { + get + { + return (string)ViewState["InterFaceSetId"]; + } + set + { + ViewState["InterFaceSetId"] = value; + } + } + #endregion + + /// + /// 接口配置编辑页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + LoadData(); + ///权限 + this.GetButtonPower(); + this.InterFaceSetId = Request.Params["InterFaceSetId"]; + BLL.ConstValue.InitConstValueDropDownList(this.drpIsOpen, ConstValue.Group_0001, false); + BLL.InterFaceSetService.InitReqMethodDropDownList(this.DrpUrlReqMethod, false); + BLL.InterFaceSetService.InitReqMethodDropDownList(this.DrpForUrlReqMethod, false); + BLL.InterFaceSetService.InitReqMethodDropDownList(this.DrpCallBackUrlReqMethod, false); + this.drpUnit.DataTextField = "UnitName"; + this.drpUnit.DataValueField = "UnitId"; + this.drpUnit.DataSource = BLL.UnitService.GetUnitDropDownList(); + drpUnit.DataBind(); + Funs.FineUIPleaseSelect(this.drpUnit); + if (!string.IsNullOrEmpty(this.InterFaceSetId)) + { + this.drpUnit.SelectedValue = this.InterFaceSetId; + } + else + { + var unit = BLL.CommonService.GetIsThisUnit(); + if (unit != null) + { + this.drpUnit.SelectedValue = unit.UnitId; + } + } + + var list = (from x in Funs.DB.Base_Unit + orderby x.UnitName + select new { x.UnitName, x.UnitId }).ToList(); + foreach (var item in list) + { + this.rbAuthUnits.Items.Add(item.UnitName, item.UnitId); + } + + if (!string.IsNullOrEmpty(this.InterFaceSetId)) + { + var FaceSet = BLL.InterFaceSetService.GetInterFaceSetById(this.InterFaceSetId); + if (FaceSet != null) + { + + + if (!string.IsNullOrEmpty(FaceSet.UnitId)) + { + this.drpUnit.SelectedValue = FaceSet.UnitId; + } + this.txtFaceName.Text = FaceSet.InterFaceName; + this.txtFaceUrl.Text = FaceSet.InterFaceUrl; + this.txtFaceForUrl.Text = FaceSet.InterFaceForUrl; + this.txtCallBackUrl.Text=FaceSet.InterFaceCallBackUrl; + this.IsCallBack.Checked =(bool) FaceSet.IsCallBack; + if (!string.IsNullOrEmpty(FaceSet.AuthUnitIds)) + { + this.drpAuthUnit.Values = FaceSet.AuthUnitIds.Split(','); + } + + this.txtRemarks.Text = FaceSet.TxtRemarks; + if (FaceSet.IsOpen.HasValue) + { + this.drpIsOpen.SelectedValue = Convert.ToString(FaceSet.IsOpen); + } + if (!string.IsNullOrEmpty(FaceSet.UrlReqMethod)) + { + this.DrpUrlReqMethod.SelectedValue = FaceSet.UrlReqMethod; + } + if (!string.IsNullOrEmpty(FaceSet.ForUrlReqMethod)) + { + this.DrpForUrlReqMethod.SelectedValue = FaceSet.ForUrlReqMethod; + } + if (!string.IsNullOrEmpty(FaceSet.CallBackUrlReqMethod)) + { + this.DrpCallBackUrlReqMethod.SelectedValue = FaceSet.CallBackUrlReqMethod; + } + } + } + } + } + + /// + /// 加载页面 + /// + private void LoadData() + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + } + + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + //目标单位 + string AuthUnitId = string.Empty; + string AuthUnitName = string.Empty; + string UnitId = string.Empty; + foreach (var item in this.drpAuthUnit.Values) + { + if (item != "") + { + AuthUnitId += item + ","; + } + } + foreach (var item in this.drpAuthUnit.Texts) + { + if (item != "") + { + AuthUnitName += item + ","; + + } + } + AuthUnitId = AuthUnitId.Substring(0, AuthUnitId.LastIndexOf(",")); + AuthUnitName = AuthUnitName.Substring(0, AuthUnitName.LastIndexOf(",")); + if (this.drpUnit.SelectedValue != Const._Null) + { + UnitId = this.drpUnit.SelectedValue; + } + Model.InterFaceSet newSet = new Model.InterFaceSet + { + InterFaceName = this.txtFaceName.Text.Trim(), + InterFaceUrl = this.txtFaceUrl.Text.Trim(), + InterFaceForUrl = this.txtFaceForUrl.Text.Trim(), + IsOpen = Convert.ToBoolean(this.drpIsOpen.SelectedValue), + TxtRemarks = this.txtRemarks.Text.Trim(), + AuthUnitIds = AuthUnitId, + AuthUnitName = AuthUnitName, + UnitId = UnitId, + IsCallBack = IsCallBack.Checked, + InterFaceCallBackUrl = txtCallBackUrl.Text, + UrlReqMethod=DrpUrlReqMethod.SelectedValue.Trim(), + ForUrlReqMethod=DrpForUrlReqMethod.SelectedValue.Trim(), + CallBackUrlReqMethod=DrpCallBackUrlReqMethod.SelectedValue.Trim() + + }; + if (string.IsNullOrEmpty(this.InterFaceSetId)) + { + newSet.InterFaceSetId = SQLHelper.GetNewID(typeof(Model.InterFaceSet)); + BLL.InterFaceSetService.AddInterFaceSet(newSet); + BLL.LogService.AddLog(this.CurrUser.UserId, "添加接口设置-" + this.txtFaceName.Text.Trim()); + } + else + { + newSet.InterFaceSetId = this.InterFaceSetId; + BLL.InterFaceSetService.UpdateInterFaceSet(newSet); + BLL.LogService.AddLog(this.CurrUser.UserId, "修改接口设置" + this.txtFaceName.Text.Trim()); + } + + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + var buttonList = BLL.CommonService.GetAllButtonList(null,this.CurrUser.UserId, BLL.Const.InterFaceSetMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnSave)) + { + this.btnSave.Hidden = false; + } + } + } + #endregion + + protected void IsCallBack_CheckedChanged(object sender, CheckedEventArgs e) + { + if (IsCallBack.Checked==true) + { + this.txtCallBackUrl.Hidden = false; + } + else + { + this.txtCallBackUrl.Hidden = true; + } + + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx.designer.cs new file mode 100644 index 00000000..545c9116 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceEdit.aspx.designer.cs @@ -0,0 +1,206 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.InterFace +{ + + + public partial class InterFaceEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtFaceName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtFaceName; + + /// + /// drpUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpUnit; + + /// + /// txtFaceUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtFaceUrl; + + /// + /// DrpUrlReqMethod 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList DrpUrlReqMethod; + + /// + /// drpAuthUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox drpAuthUnit; + + /// + /// SimpleForm2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.SimpleForm SimpleForm2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// rbAuthUnits 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList rbAuthUnits; + + /// + /// txtFaceForUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtFaceForUrl; + + /// + /// DrpForUrlReqMethod 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList DrpForUrlReqMethod; + + /// + /// IsCallBack 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox IsCallBack; + + /// + /// txtCallBackUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCallBackUrl; + + /// + /// DrpCallBackUrlReqMethod 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList DrpCallBackUrlReqMethod; + + /// + /// drpIsOpen 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpIsOpen; + + /// + /// txtRemarks 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtRemarks; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx new file mode 100644 index 00000000..429f3687 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx @@ -0,0 +1,148 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InterFaceSet.aspx.cs" Inherits="FineUIPro.Web.InterFace.InterFaceSet" %> + + + + + 接口设置 + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx.cs new file mode 100644 index 00000000..4ed01138 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx.cs @@ -0,0 +1,325 @@ +namespace FineUIPro.Web.InterFace +{ + using System; + using System.Collections.Generic; + using System.Data; + using System.Data.SqlClient; + using System.Linq; + using BLL; + + public partial class InterFaceSet : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + ////权限按钮方法 + this.GetButtonPower(); + btnNew.OnClientClick = Window1.GetShowReference("InterFaceEdit.aspx") + "return false;"; + btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!"); + btnDelete.ConfirmText = String.Format("你确定要删除选中的  行数据吗?", Grid1.GetSelectedCountReference()); + + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + string strSql = "SELECT InterFaceSetId,InterFaceName,InterFaceForUrl,InterFaceUrl,Unit.UnitName as UnitId,AuthUnitName,IsOpen,ValidPeriod,TxtRemarks FROM InterFaceSet" ++ @" AS FaceSet LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = FaceSet.UnitId where 1=1 "; + + List listStr = new List(); + if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim())) + { + strSql += " AND InterFaceName LIKE @UserName"; + listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%")); + } + if (!string.IsNullOrEmpty(this.txtUnitName.Text.Trim())) + { + strSql += " AND UnitName LIKE @UnitName"; + listStr.Add(new SqlParameter("@UnitName", "%" + this.txtUnitName.Text.Trim() + "%")); + } + if (this.cbRoleCategory.Items[0].Selected) + { + strSql += " AND IsOpen = @IsOpen"; + listStr.Add(new SqlParameter("@IsOpen", this.cbRoleCategory.Items[0].Selected)); + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + // 2.获取当前分页数据 + //var table = this.GetPagedDataTable(Grid1, tb1); + Grid1.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (this.CurrUser != null) + { + var buttonList = BLL.CommonService.GetAllButtonList(null,this.CurrUser.UserId, BLL.Const.InterFaceSetMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnNew.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnEdit.Hidden = false; + this.btnMenuEdit.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnDelete.Hidden = false; + this.btnMenuDelete.Hidden = false; + } + } + } + } + #endregion + + #region 删除数据 + /// + /// 批量删除数据 + /// + /// + /// + protected void btnDelete_Click(object sender, EventArgs e) + { + this.DeleteData(); + } + protected void btnStart_Click(object sender, EventArgs e) + { + Model.SGGLDB db = Funs.DB; + List FaceList = db.InterFaceSet.Where(p=>p.IsOpen==true).ToList(); + foreach(var item in FaceList) + { + // if (!string.IsNullOrEmpty(item.InterFaceUrl)) + // APIServiceTimer.GetApiData(item.InterFaceSetId, item.InterFaceUrl); + } + } + + protected void btnFor_Click(object sender, EventArgs e) + { + Model.SGGLDB db = Funs.DB; + List FaceList = db.InterFaceSet.Where(p => p.IsOpen == true).ToList(); + foreach (var item in FaceList) + { + // if (!string.IsNullOrEmpty(item.InterFaceForUrl)) + // APIServiceTimer.UpApiData(item.InterFaceSetId, item.InterFaceForUrl, item.IsReqPost); + } + } + /// + /// 右键删除事件 + /// + /// + /// + 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(); + if (judgementDelete(rowID, false)) + { + BLL.InterFaceSetService.DeleteInterFaceSetById(rowID); + BLL.LogService.AddLog(this.CurrUser.UserId, "删除接口信息"); + } + } + BindGrid(); + ShowNotify("删除数据成功!(表格数据已重新绑定)"); + } + } + #endregion + + #region 分页 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + #endregion + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + + /// + /// 关闭窗口 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + BindGrid(); + } + + /// + /// 选择行事件 + /// + /// + /// + protected void btnSelectRows_Click(object sender, EventArgs e) + { + + } + + /// + /// 编辑 + /// + /// + /// + protected void btnEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + string Id = Grid1.SelectedRowID; + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InterFaceEdit.aspx?InterFaceSetId={0}", Id, "编辑 - "))); + } + + #region 判断是否可删除 + /// + /// 判断是否可以删除 + /// + /// + private bool judgementDelete(string id, bool isShow) + { + return false; + } + //private bool judgementDelete(string id, bool isShow) + //{ + // string content = string.Empty; + // if (Funs.DB.Law_LawRegulationList.FirstOrDefault(x => x.CompileMan == id) != null) + // { + // content = "该用户已在【法律法规】中使用,不能删除!"; + // } + // if (Funs.DB.Law_HSSEStandardsList.FirstOrDefault(x => x.CompileMan == id) != null) + // { + // content = "该用户已在【标准规范】中使用,不能删除!"; + // } + // if (Funs.DB.Edu_Online_Examinee.FirstOrDefault(x => x.UserId == id) != null) + // { + // content = "该用户已在【考生信息】中使用,不能删除!"; + // } + // if (string.IsNullOrEmpty(content)) + // { + // return true; + // } + // else + // { + // if (isShow) + // { + // Alert.ShowInTop(content); + // } + // return false; + // } + //} + #endregion + + #region 查询 + /// + /// 用户类别选择 + /// + /// + /// + protected void cbRoleCategory_SelectedIndexChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx.designer.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx.designer.cs new file mode 100644 index 00000000..96df2a77 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceSet.aspx.designer.cs @@ -0,0 +1,242 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.InterFace +{ + + + public partial class InterFaceSet + { + + /// + /// 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; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtUserName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUserName; + + /// + /// txtUnitName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUnitName; + + /// + /// cbRoleCategory 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBoxList cbRoleCategory; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button Button2; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// Label4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label4; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// lbContactInformation 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lbContactInformation; + + /// + /// 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; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx new file mode 100644 index 00000000..ff4b95d6 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx @@ -0,0 +1,111 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InterFaceTask.aspx.cs" Inherits="FineUIPro.Web.InterFace.InterFaceTask" %> + + + + + 接口数据信息 + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx.cs new file mode 100644 index 00000000..09f0a0d2 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx.cs @@ -0,0 +1,238 @@ +namespace FineUIPro.Web.InterFace +{ + using System; + using System.Collections.Generic; + using System.Data; + using System.Data.SqlClient; + using System.Linq; + using BLL; + + public partial class InterFaceTask : PageBase + { + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + btnNew.OnClientClick = Window1.GetShowReference("InterFaceTaskEdit.aspx", "接口任务新增") + "return false;"; + + ////权限按钮方法 + this.GetButtonPower(); + ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + BindGrid(); + } + } + + /// + /// 绑定数据 + /// + private void BindGrid() + { + Model.InterFaceTask interFaceTask=new Model.InterFaceTask(); + interFaceTask.InterFaceName = txtInterFaceName.Text; + var q= BLL.InterFaceTaskService.GetInterFaceTaskByModle(interFaceTask); + Grid1.DataSource = q; + Grid1.DataBind(); + } + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (this.CurrUser != null) + { + var buttonList = BLL.CommonService.GetAllButtonList(null,this.CurrUser.UserId, BLL.Const.InterFaceTaskMenuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnModify)) + { + //this.btnEdit.Hidden = false; + //this.btnMenuEdit.Hidden = false; + } + } + } + } + #endregion + + + + #region 分页 + /// + /// 分页 + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + Grid1.PageIndex = e.NewPageIndex; + BindGrid(); + } + + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + #endregion + + /// + /// 排序 + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + Grid1.SortDirection = e.SortDirection; + Grid1.SortField = e.SortField; + BindGrid(); + } + + /// + /// 关闭窗口 + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + BindGrid(); + } + + /// + /// 选择行事件 + /// + /// + /// + protected void btnSelectRows_Click(object sender, EventArgs e) + { + + } + + /// + /// 编辑 + /// + /// + /// + protected void btnEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + string Id = Grid1.SelectedRowID; + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InterFaceTaskEdit.aspx?InterFaceTaskId={0}", Id, "编辑 - "))); + } + + #region 判断是否可删除 + /// + /// 判断是否可以删除 + /// + /// + private bool judgementDelete(string id, bool isShow) + { + return false; + } + //private bool judgementDelete(string id, bool isShow) + //{ + // string content = string.Empty; + // if (Funs.DB.Law_LawRegulationList.FirstOrDefault(x => x.CompileMan == id) != null) + // { + // content = "该用户已在【法律法规】中使用,不能删除!"; + // } + // if (Funs.DB.Law_HSSEStandardsList.FirstOrDefault(x => x.CompileMan == id) != null) + // { + // content = "该用户已在【标准规范】中使用,不能删除!"; + // } + // if (Funs.DB.Edu_Online_Examinee.FirstOrDefault(x => x.UserId == id) != null) + // { + // content = "该用户已在【考生信息】中使用,不能删除!"; + // } + // if (string.IsNullOrEmpty(content)) + // { + // return true; + // } + // else + // { + // if (isShow) + // { + // Alert.ShowInTop(content); + // } + // return false; + // } + //} + #endregion + protected void btnStart_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + var Id = Grid1.SelectedRowID; + BLL.InterFaceTaskService.ExecuteTasks(Id); + } + #region 查询 + /// + /// 用户类别选择 + /// + /// + /// + protected void cbRoleCategory_SelectedIndexChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + } + #endregion + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx.designer.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx.designer.cs new file mode 100644 index 00000000..5e985529 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTask.aspx.designer.cs @@ -0,0 +1,161 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.InterFace +{ + + + public partial class InterFaceTask + { + + /// + /// 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; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// txtInterFaceName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtInterFaceName; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnEdit; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button Button1; + + /// + /// 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; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + } +} diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx new file mode 100644 index 00000000..c1a306e0 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx @@ -0,0 +1,80 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InterFaceTaskEdit.aspx.cs" Inherits="FineUIPro.Web.InterFace.InterFaceTaskEdit" %> + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx.cs new file mode 100644 index 00000000..5b830360 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx.cs @@ -0,0 +1,113 @@ +using BLL; +using Model; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.InterFace +{ + public partial class InterFaceTaskEdit : PageBase + { + public string InterFaceTaskId + { + get + { + return (string)ViewState["InterFaceTaskId"]; + } + set + { + ViewState["InterFaceTaskId"] = value; + } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) { + this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); + InterFaceTaskId = Request.Params["InterFaceTaskId"]; + InterFaceSetService.InitInterFaceDropDownList(DropInterFaceSet, false); + BindGrid(); + #region Grid1 + // 删除选中单元格的客户端脚本 + string deleteScript = GetDeleteScript(); + JObject defaultObj = new JObject(); + defaultObj.Add("InterFaceSetId", ""); + + + // 在第一行新增一条数据 + btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, true); + // 删除选中行按钮 + btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请选择一条记录!") + deleteScript; + #endregion + + + } + + } + private void BindGrid() + { + if (!string.IsNullOrEmpty(InterFaceTaskId)) + { + var model = BLL.InterFaceTaskService.GetInterFaceTaskById(InterFaceTaskId); + txtFrequency.Text= model.Frequency; + txtInterFaceName.Text= model.InterFaceName; + IsEnable.Checked = (bool)model.Enable; + var a = model.InterFaceSetLists.Split(','); + var q = (from x in a select new { id = Guid.NewGuid().ToString(), InterFaceSetId = x.ToString() }).ToList(); + Grid1.DataSource= q; + Grid1.DataBind(); + } + + + } + protected void btnSave_Click(object sender, EventArgs e) + { + List list = new List(); + JArray EditorArr = Grid1.GetMergedData(); + if (EditorArr.Count > 0) + { + for (int i = 0; i < EditorArr.Count; i++) + { + JObject objects = (JObject)EditorArr[i]; + + list.Add(objects["values"]["InterFaceSetId"].ToString()); + } + } + + if (!string.IsNullOrEmpty(InterFaceTaskId)) + { + var model=BLL.InterFaceTaskService.GetInterFaceTaskById(InterFaceTaskId); + model.InterFaceName=txtInterFaceName.Text; + model.Frequency = txtFrequency.Text; + model.InterFaceSetLists=string .Join(",", list); + model.CreateTime = DateTime.Now; + model.Enable = IsEnable.Checked; + InterFaceTaskService.UpdateInterFaceTask(model); + } + else + { + Model.InterFaceTask model =new Model.InterFaceTask(); + model.InterFaceTaskId = SQLHelper.GetNewID(typeof(Model.InterFaceTask)); + InterFaceTaskId = model.InterFaceTaskId; + model.InterFaceName = txtInterFaceName.Text; + model.Frequency = txtFrequency.Text; + model.InterFaceSetLists = string.Join(",", list); + model.CreateTime = DateTime.Now; + model.Enable = IsEnable.Checked; + InterFaceTaskService.AddInterFaceTask(model); + } + QuartzServices.SyncISchedulerById(InterFaceTaskId); + ShowNotify("保存成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + + } + private string GetDeleteScript() + { + return Confirm.GetShowReference("确定删除当前数据吗?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty); + } + } + +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx.designer.cs new file mode 100644 index 00000000..e9981a78 --- /dev/null +++ b/SGGL/FineUIPro.Web/TaskScheduling/InterFace/InterFaceTaskEdit.aspx.designer.cs @@ -0,0 +1,152 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.InterFace +{ + + + public partial class InterFaceTaskEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtInterFaceName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtInterFaceName; + + /// + /// txtFrequency 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtFrequency; + + /// + /// IsEnable 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox IsEnable; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDelete; + + /// + /// DropInterFaceSet 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList DropInterFaceSet; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index a09cbf61..32cfe479 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -1,4 +1,4 @@ - + -
+
- + - + - - - - - + + + + + - - - + + + - + - - - + + + - + - + - - - + + + - - + + - - - + + + - - + + - + - - + + - - + + - - - + + + - + - + - - + + - + - - - + + + - - - - + + + + - + - + - + - + - + - - - - + + + + - + - - + + - + @@ -153,24 +153,32 @@ - - + + - - + + - - + + - - + + - - + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/ZHGL/DataSync/CQMSData_CQMSEdit.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/DataSync/CQMSData_CQMSEdit.aspx.cs index 0286ed80..e86c7755 100644 --- a/SGGL/FineUIPro.Web/ZHGL/DataSync/CQMSData_CQMSEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/DataSync/CQMSData_CQMSEdit.aspx.cs @@ -288,7 +288,7 @@ namespace FineUIPro.Web.ZHGL.DataSync { if (!string.IsNullOrEmpty(this.Id)) { - var responedata= CQMSDataService.PushCNCEC(Id); + var responedata= CQMSDataService.PushCncec(Id); if (responedata.code==1) { ShowNotify("上报成功!"); diff --git a/SGGL/FineUIPro.Web/ZHGL/DataSync/HJGLData_HJGLEdit.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/DataSync/HJGLData_HJGLEdit.aspx.cs index 72a92bb5..a8d8a9bd 100644 --- a/SGGL/FineUIPro.Web/ZHGL/DataSync/HJGLData_HJGLEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/DataSync/HJGLData_HJGLEdit.aspx.cs @@ -188,7 +188,7 @@ namespace FineUIPro.Web.ZHGL.DataSync { if (!string.IsNullOrEmpty(this.Id)) { - var responedata = HJGLData_HJGLService.PushCNCEC(Id); + var responedata = HJGLData_HJGLService.PushCncec(Id); if (responedata.code == 1) { ShowNotify("上报成功!"); diff --git a/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSE.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSE.aspx.cs index 2fb03788..af38c236 100644 --- a/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSE.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSE.aspx.cs @@ -30,8 +30,8 @@ namespace FineUIPro.Web.ZHGL.DataSync private void BindGrid() { Model.HSSEData_HSSE table = new Model.HSSEData_HSSE(); - var tb = BLL.HSSEData_HSSEService.getListData(table, Grid1); - Grid1.RecordCount = HSSEData_HSSEService.count; + var tb = BLL.HSSEData_HSSEService.GetListData(table, Grid1); + Grid1.RecordCount = HSSEData_HSSEService.Count; //tb = GetFilteredTable(Grid1.FilteredData, tb); Grid1.DataSource = tb; Grid1.DataBind(); diff --git a/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSEEdit.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSEEdit.aspx.cs index a2dc5d17..3c94d8d1 100644 --- a/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSEEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/DataSync/HSSEData_HSSEEdit.aspx.cs @@ -513,7 +513,7 @@ namespace FineUIPro.Web.ZHGL.DataSync { if (!string.IsNullOrEmpty(this.Id)) { - var responedata = HSSEData_HSSEService.PushCNCEC(Id); + var responedata = HSSEData_HSSEService.PushCncec(Id); if (responedata.code == 1) { ShowNotify("上报成功!"); diff --git a/SGGL/FineUIPro.Web/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSE.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSE.aspx.cs index 51081620..a2fdadeb 100644 --- a/SGGL/FineUIPro.Web/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSE.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSE.aspx.cs @@ -31,8 +31,8 @@ namespace FineUIPro.Web.ZHGL.DataSync.ProjectDataSync { Model.Project_HSSEData_HSSE table = new Model.Project_HSSEData_HSSE(); table.ProjectId = this.CurrUser.LoginProjectId; - var tb = BLL.Project_HSSEData_HSSEService.getListData(table, Grid1); - Grid1.RecordCount = Project_HSSEData_HSSEService.count; + var tb = BLL.Project_HSSEData_HSSEService.GetListData(table, Grid1); + Grid1.RecordCount = Project_HSSEData_HSSEService.Count; //tb = GetFilteredTable(Grid1.FilteredData, tb); Grid1.DataSource = tb; Grid1.DataBind(); diff --git a/SGGL/FineUIPro.Web/common/Menu_HSSE.xml b/SGGL/FineUIPro.Web/common/Menu_HSSE.xml index 7215151c..59d7c933 100644 --- a/SGGL/FineUIPro.Web/common/Menu_HSSE.xml +++ b/SGGL/FineUIPro.Web/common/Menu_HSSE.xml @@ -37,7 +37,6 @@ - diff --git a/SGGL/FineUIPro.Web/common/PageBase.cs b/SGGL/FineUIPro.Web/common/PageBase.cs index 02f424ff..3cfaac58 100644 --- a/SGGL/FineUIPro.Web/common/PageBase.cs +++ b/SGGL/FineUIPro.Web/common/PageBase.cs @@ -46,6 +46,23 @@ namespace FineUIPro.Web protected override void OnInit(EventArgs e) { + string url = HttpContext.Current.Request.Path; + + string a = Request.ServerVariables["HTTP_REFERER"]; + string Referer = Request.Headers["Referer"]; + + if (a == null) + { + bool IsDataShowPage = ConstValue.drpConstItemList(ConstValue.Group_InterfacePopup).FirstOrDefault(x => url.Contains(x.ConstValue)) != null; + bool IsSafeReferer = ConstValue.drpConstItemList(ConstValue.Group_SafeReferer).FirstOrDefault(x => x.ConstValue == url) != null; + if (!IsDataShowPage && !IsSafeReferer) + { + if (this.Page.Request.AppRelativeCurrentExecutionFilePath != "~/Login.aspx") + Response.Redirect("~/Login.aspx"); + return; + } + + } var pm = PageManager.Instance; if (pm != null) { diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx b/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx index ca4138cc..32b20776 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx +++ b/SGGL/FineUIPro.Web/common/mainMenu_HJGL2.aspx @@ -4,742 +4,983 @@ - + 质量焊接数据看板 - - - + + + +
-