diff --git a/DataBase/版本日志/SGGLDB_WH_2023-05-09.sql b/DataBase/版本日志/SGGLDB_WH_2023-05-09.sql index 31901b92..0ce7c2dc 100644 --- a/DataBase/版本日志/SGGLDB_WH_2023-05-09.sql +++ b/DataBase/版本日志/SGGLDB_WH_2023-05-09.sql @@ -4,4 +4,63 @@ CREATE NONCLUSTERED INDEX [NonClusteredIndex-CostControlId-ProjectId] ON [dbo].[ [CostControlId] ASC, [ProjectId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -GO \ No newline at end of file +GO + + + +CREATE TABLE [dbo].[Information_EnvironmentalData]( + [Id] [varchar](50) NOT NULL, + [UnitId] [varchar](50) NULL, + [TotalEnergyConsumption] [int] NULL, + [IncomeComprehensiveEnergyConsumption] [int] NULL, + [NewWaterConsumption] [int] NULL, + [ReportDate] [date] NULL, + [CreateMan] [varchar](50) NULL, + [CreateDate] [datetime] NULL, + CONSTRAINT [PK_Information_EnvironmentalData] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] + +GO + +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'Information_EnvironmentalData', @level2type=N'COLUMN',@level2name=N'TotalEnergyConsumption' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ԪӪҵۺܺ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Information_EnvironmentalData', @level2type=N'COLUMN',@level2name=N'IncomeComprehensiveEnergyConsumption' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ˮ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Information_EnvironmentalData', @level2type=N'COLUMN',@level2name=N'NewWaterConsumption' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ϱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Information_EnvironmentalData', @level2type=N'COLUMN',@level2name=N'ReportDate' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Information_EnvironmentalData', @level2type=N'COLUMN',@level2name=N'CreateMan' +GO + +EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ʱ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Information_EnvironmentalData', @level2type=N'COLUMN',@level2name=N'CreateDate' +GO + + +alter table [dbo].[Accident_AccidentReport] add AccidentDegree char(1) null +GO + +alter table [dbo].Accident_AccidentPersonRecord add IsAttempt char(1) null +GO + +alter table [dbo].[License_LicenseManager] add [IsHighRisk] bit null +GO + +alter table [dbo].[Check_RectifyNoticesItem] add RectifyId nvarchar(50) null +GO + +alter table [dbo].[Base_TrainType] add TrainType nvarchar(50) null +GO + +alter table [dbo].SitePerson_Person add IsSafetyMonitoring bit null +GO diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 609d67d0..70cb028d 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -278,7 +278,10 @@ namespace BLL /// HSE工程师岗位Id /// public static string WorkPost_HSSEEngineer = "9b15af2e-6131-462c-9f8a-71533957ca0e"; - + /// + /// 项目安全总监岗位Id + /// + public static string WorkPost_ProjectHSSEDirector = "5e6e259e-ea0a-4a63-8f52-df4a19a6c9fa"; /// /// HSE经理岗位Id /// diff --git a/SGGL/BLL/HSSE/QualityAudit/SafetyDataItemService.cs b/SGGL/BLL/HSSE/QualityAudit/SafetyDataItemService.cs index ea89db6f..a62663ca 100644 --- a/SGGL/BLL/HSSE/QualityAudit/SafetyDataItemService.cs +++ b/SGGL/BLL/HSSE/QualityAudit/SafetyDataItemService.cs @@ -144,7 +144,7 @@ namespace BLL //public static void GollSafetyData(string projectId) //{ - // var thisUnit = BLL.CommonService.GetIsThisUnit(); + // var thisUnit = BLL.Const.UnitId_CWCEC; // if (CommonService.GetIsThisUnit(Const.UnitId_ECEC)) // { // ////判断单据是否 加入到企业管理资料 diff --git a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs index f0a1d912..c8ee9bfe 100644 --- a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs @@ -35,12 +35,14 @@ namespace BLL public static List GetCQMSData_CQMSByModle(Model.CQMSData_CQMS table) { + Model.SGGLDB 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)) + orderby x.ReportDate descending select x ; @@ -109,6 +111,7 @@ namespace BLL public static void AddCQMSData_CQMS(Model.CQMSData_CQMS newtable) { + Model.SGGLDB db = Funs.DB; Model.CQMSData_CQMS table = new Model.CQMSData_CQMS { Id = newtable.Id, @@ -155,6 +158,7 @@ namespace BLL public static void DeleteCQMSData_CQMSById(string Id) { + Model.SGGLDB db = Funs.DB; Model.CQMSData_CQMS table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); if (table != null) { @@ -165,6 +169,7 @@ namespace BLL public static Model.CQMSData_CQMS GetCQMSData_CQMSById(string Id) { + Model.SGGLDB db = Funs.DB; return db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); } @@ -295,7 +300,13 @@ namespace BLL public static CQMSData StatisticalData() { - var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CWCEC); + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } + var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Project_CQMSDataService.StatisticalAllProjectData(); var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS @@ -303,7 +314,7 @@ namespace BLL select x).ToList(); Model.CQMSData_CQMS table = new Model.CQMSData_CQMS { - UnitId = BLL.Const.UnitId_CWCEC, + UnitId = thisUnitId, CollCropCode = base_Unit.CollCropCode, UnitName = base_Unit.UnitName, ReportDate = DateTime.Now.Date, @@ -405,6 +416,7 @@ namespace BLL } public static void UpdateCQMSData_CQMS(Model.CQMSData_CQMS newtable) { + Model.SGGLDB db = Funs.DB; Model.CQMSData_CQMS table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs index a572d874..1e116b23 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs @@ -25,12 +25,14 @@ namespace BLL public static List GetHJGLData_HJGLByModle(Model.HJGLData_HJGL table) { + Model.SGGLDB 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)) + orderby x.ReportDate descending select x ; @@ -74,6 +76,7 @@ namespace BLL public static void AddHJGLData_HJGL(Model.HJGLData_HJGL newtable) { + Model.SGGLDB db = Funs.DB; Model.HJGLData_HJGL table = new Model.HJGLData_HJGL { Id = newtable.Id, @@ -96,6 +99,7 @@ namespace BLL public static void DeleteHJGLData_HJGLById(string Id) { + Model.SGGLDB db = Funs.DB; Model.HJGLData_HJGL table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); if (table != null) { @@ -106,6 +110,7 @@ namespace BLL public static Model.HJGLData_HJGL GetHJGLData_HJGLById(string Id) { + Model.SGGLDB db = Funs.DB; return db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); } @@ -234,7 +239,12 @@ namespace BLL public static HJGLData StatisticalData() { HJGLData data = new HJGLData(); - string thisUnitId = BLL.Const.UnitId_CWCEC; + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } var base_Unit = BLL.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 @@ -291,6 +301,7 @@ namespace BLL public static void UpdateHJGLData_HJGL(Model.HJGLData_HJGL newtable) { + Model.SGGLDB db = Funs.DB; Model.HJGLData_HJGL table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index e45d7b91..089ea2df 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -25,12 +25,14 @@ namespace BLL public static List GetHSSEData_HSSEByModle(Model.HSSEData_HSSE table) { + Model.SGGLDB 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 ; @@ -139,6 +141,7 @@ namespace BLL public static void AddHSSEData_HSSE(Model.HSSEData_HSSE newtable) { + Model.SGGLDB db = Funs.DB; Model.HSSEData_HSSE table = new Model.HSSEData_HSSE { Id = newtable.Id, @@ -226,6 +229,7 @@ namespace BLL public static void DeleteHSSEData_HSSEById(string Id) { + Model.SGGLDB db = Funs.DB; Model.HSSEData_HSSE table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); if (table != null) { @@ -236,6 +240,7 @@ namespace BLL public static Model.HSSEData_HSSE GetHSSEData_HSSEById(string Id) { + Model.SGGLDB db = Funs.DB; return db.HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); } public static Model.HSSEData GetItemById(string Id) @@ -521,7 +526,12 @@ namespace BLL public static HSSEData StatisticalData() { HSSEData data = new HSSEData(); - string thisUnitId = BLL.Const.UnitId_CWCEC; + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Project_HSSEData_HSSEService.StatisticalAllProjectData(); @@ -628,6 +638,7 @@ namespace BLL } public static void UpdateHSSEData_HSSE(Model.HSSEData_HSSE newtable) { + Model.SGGLDB db = Funs.DB; Model.HSSEData_HSSE table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { @@ -719,16 +730,16 @@ namespace BLL /// 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; + string unitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + unitId = thisUnit; + } + 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 result; } /// /// 获取企业总部专职人数 @@ -736,17 +747,17 @@ namespace BLL /// 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; + string unitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + unitId = thisUnit; + } + 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 result; } /// /// 获取分支机构总监人数 @@ -754,16 +765,16 @@ namespace BLL /// 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; + string unitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + unitId = thisUnit; + } + 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 result; } /// /// 获取分支机构专职人数 @@ -771,17 +782,17 @@ namespace BLL /// 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; + string unitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + unitId = thisUnit; + } + 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 result; } /// diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs index a9ece960..106e624b 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,15 +320,20 @@ namespace BLL /// /// 项目id /// 数据类型 - public static void StatisticalData(string projectid,CQMSDateType cQMSDateType) + public static void StatisticalData(string projectid, CQMSDateType cQMSDateType) { - string thisUnitId = BLL.Const.UnitId_CWCEC; + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } var base_Unit = 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 { @@ -339,7 +344,7 @@ namespace BLL table.UnitName = base_Unit.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); @@ -388,7 +393,7 @@ namespace BLL table.SubProjectNum = GetSubProjectNum(projectid); table.SubdivisionalWorksNum = GetSubdivisionalWorksNum(projectid); table.InspectionLotNum = GetInspectionLotNum(projectid); - } + } if (IsReportByToday(projectid)) { @@ -406,11 +411,11 @@ 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; + 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 result; } /// /// 获取技术交底人次数 @@ -418,12 +423,12 @@ 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; + 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 q; } /// /// 获取在用计量器具数 @@ -442,10 +447,10 @@ namespace BLL /// 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 + 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.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 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 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 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 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 select x).Count(); return result; } @@ -560,11 +565,11 @@ 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" + select x).Count(); + return result; } /// /// 获取关键工序验收合格数 @@ -572,12 +577,12 @@ namespace BLL /// 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 + select x).Count(); + return result; } /// /// 获取特殊过程验收数 @@ -585,11 +590,11 @@ 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" + select x).Count(); + return result; } /// /// 获取特殊过程验收合格数 @@ -597,12 +602,12 @@ namespace BLL /// 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; + 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 result; } /// /// 获取隐蔽工程验收数 @@ -610,11 +615,11 @@ 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" + select x).Count(); + return result; } /// /// 获取隐蔽工程验收合格数 @@ -622,12 +627,12 @@ namespace BLL /// 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 + 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" + 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 + 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" + 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 + 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 cb65cf95..fc8fd156 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs @@ -202,39 +202,44 @@ namespace BLL /// public static void StatisticalData(string projectid) { - //string thisUnitId = BLL.Const.UnitId_CWCEC; - //var base_Unit = BLL.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; - //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 - // { - // UnitId = thisUnitId, - // CollCropCode = base_Unit.CollCropCode, - // UnitName = base_Unit.UnitName, - // ProjectId = projectid, - // ReportDate = DateTime.Now.Date, - // DefectName = t, - // DefectNum = list.Count(x => x.Defects_Definition == t), - // }; - // if (IsReportByToday(projectid, t)) - // { - // table.Id = getTodayProject_HJGLData_Defect(projectid, t).Id; - // UpdateProject_HJGLData_Defect(table); - // } - // else - // { - // table.Id = SQLHelper.GetNewID(); - // AddProject_HJGLData_Defect(table); - // } - // } - //} + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } + var base_Unit = BLL.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; + 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 + { + UnitId = thisUnitId, + CollCropCode = base_Unit.CollCropCode, + UnitName = base_Unit.UnitName, + ProjectId = projectid, + ReportDate = DateTime.Now.Date, + DefectName = t, + DefectNum = list.Count(x => x.Defects_Definition == t), + }; + if (IsReportByToday(projectid, t)) + { + table.Id = getTodayProject_HJGLData_Defect(projectid, t).Id; + UpdateProject_HJGLData_Defect(table); + } + else + { + table.Id = SQLHelper.GetNewID(); + AddProject_HJGLData_Defect(table); + } + } + } } /// /// 获取缺陷名称 diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs index 66b55f9a..3756ab0b 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_CWCEC; + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL(); 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 0; } /// @@ -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 0; } /// @@ -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 0; } /// @@ -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 0; } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs index 357f23b5..9538b754 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs @@ -216,88 +216,90 @@ namespace BLL /// public static void AddProject_HSSEData_HSSE(Model.Project_HSSEData_HSSE newtable) { - - Model.Project_HSSEData_HSSE table = new Model.Project_HSSEData_HSSE + 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, - 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(); + Model.Project_HSSEData_HSSE table = new Model.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(); + } } /// /// 删除实体 @@ -305,14 +307,15 @@ namespace BLL /// 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 (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Project_HSSEData_HSSE.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.Project_HSSEData_HSSE table = db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.Project_HSSEData_HSSE.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } /// /// 根据id获取实体 @@ -325,97 +328,100 @@ namespace BLL } 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; - + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + 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) { - - Model.Project_HSSEData_HSSE table = db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + using (Model.SGGLDB db = new Model.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(); + Model.Project_HSSEData_HSSE 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(); + } } - } /// /// 判断该项目的该日期是否统计数据 @@ -481,7 +487,12 @@ namespace BLL /// public static void StatisticalData(string projectid, HSSEDateType hSSEDateType) { - string thisUnitId = BLL.Const.UnitId_CWCEC; + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); Model.Project_HSSEData_HSSE table = new Model.Project_HSSEData_HSSE(); if (IsReportByToday(projectid)) @@ -716,12 +727,12 @@ namespace BLL /// 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; + 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 result; } /// /// 获取专项培训数 @@ -729,12 +740,12 @@ namespace BLL /// 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; + 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 result; } /// /// 获取特种作业培训数 @@ -742,12 +753,12 @@ namespace BLL /// 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; + 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 result; } /// /// 获取能耗总量 @@ -818,10 +829,10 @@ namespace BLL /// 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; + 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 result; } /// /// 获取项目专职人数 @@ -841,10 +852,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.SitePerson_Person + where x.ProjectId == projectid && x.IsSafetyMonitoring == true && x.IsUsed == true + select x).Count(); + return result; } /// /// 获取在岗执业注安师 @@ -852,11 +863,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取A证人员 @@ -864,11 +875,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取B证人员 @@ -876,11 +887,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取C证人员 @@ -888,11 +899,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取企业安委会会议数 @@ -999,7 +1010,7 @@ namespace BLL 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("未遂") + where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day && x.IsAttempt=="1" select x).Count(); return result; } @@ -1012,7 +1023,7 @@ namespace BLL 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("未遂") + where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day && x.IsAttempt != "1" select x).Count(); return result; } @@ -1022,9 +1033,9 @@ namespace BLL /// 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; + 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 result; } /// /// 获取较大事故数 @@ -1032,9 +1043,9 @@ namespace BLL /// 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; + 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 result; } /// /// 获取重大事故数 @@ -1042,9 +1053,9 @@ namespace BLL /// 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; + 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 result; } /// /// 获取特别重大事故数 @@ -1052,9 +1063,9 @@ namespace BLL /// 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; + 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 result; } /// /// 获取企业级综合预案数 @@ -1171,15 +1182,15 @@ namespace BLL /// 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; + 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 result; } /// /// 获取施工机具特种设备数 @@ -1187,11 +1198,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取作业许可项数 @@ -1199,10 +1210,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.License_LicenseManager + where x.ProjectId == projectid && x.IsHighRisk == true + select x).Count(); + return result; } /// /// 获取作业许可关闭项数 @@ -1210,10 +1221,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.License_LicenseManager + where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" + select x).Count(); + return result; } /// /// 获取一般隐患整改闭环项 @@ -1269,11 +1280,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取低风险数 @@ -1281,11 +1292,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取中风险数 @@ -1293,11 +1304,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取高风险数 @@ -1305,11 +1316,11 @@ namespace BLL /// 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; + 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 result; } /// /// 获取危大工程审批完成数 @@ -1317,10 +1328,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == false + select x).Count(); + return result; } /// /// 获取危大工程培训人次数 @@ -1328,10 +1339,10 @@ namespace BLL /// 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; + 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 result; } /// /// 获取危大工程施工个数 @@ -1339,10 +1350,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == false + select x).Count(); + return result; } /// /// 获取危大工程完工个数 @@ -1350,10 +1361,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == false + select x).Count(); + return result; } /// /// 获取超危大工程审批完成数 @@ -1361,10 +1372,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == true + select x).Count(); + return result; } /// /// 获取超危大工程培训人次数 @@ -1372,8 +1383,8 @@ namespace BLL /// 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; + 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 result; } /// /// 获取超危大工程施工个数 @@ -1381,10 +1392,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == true + select x).Count(); + return result; } /// /// 获取超危大工程完工个数 @@ -1392,10 +1403,10 @@ namespace BLL /// 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; + int result = (from x in Funs.DB.Solution_LargerHazard + where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == true + select x).Count(); + return result; } } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs index 6bbcc4f8..38b7f292 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs @@ -210,40 +210,46 @@ namespace BLL /// public static void StatisticalData(string projectid) { - //var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CWCEC); - //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_CWCEC, - // 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); - // } - //} + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } + var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + 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 = thisUnitId, + 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 5ae5c611..b966a73e 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_CWCEC; + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } 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 ed26daa6..a9282e0d 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 = UnitService.GetUnitByUnitId(Const.UnitId_CWCEC); NewSYHSEDataItem Item = new NewSYHSEDataItem(); Item.Id = data.Id; Item.ReportDate=data.ReportDate.ToString(); - Item.UnitId = Const.UnitId_CWCEC; - Item.CollCropCode = UnitService.GetUnitByUnitId(Const.UnitId_CWCEC).CollCropCode; - Item.UnitName= UnitService.GetUnitByUnitId(Const.UnitId_CWCEC).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 7ed38391..92b91047 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); } @@ -344,7 +349,13 @@ namespace BLL public static SYHSEData StatisticalData() { - var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CWCEC); + string thisUnitId = string.Empty; + var thisUnit = Const.UnitId_CWCEC; + if (thisUnit != null) + { + thisUnitId = thisUnit; + } + 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 +363,7 @@ namespace BLL Model.SYHSEData_SYHSE table = new Model.SYHSEData_SYHSE { - UnitId = BLL.Const.UnitId_CWCEC, + UnitId = thisUnitId, CollCropCode = base_Unit.CollCropCode, UnitName = base_Unit.UnitName, ReportDate = DateTime.Now.Date, @@ -412,6 +423,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 a455b584..35047713 100644 --- a/SGGL/BLL/ZHGL/DataSync/ServerService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ServerService.cs @@ -20,8 +20,7 @@ namespace BLL var client = new RestClient(baseurl); client.Timeout = -1; var request = new RestRequest(Method.POST); - var thisUnitId = BLL.Const.UnitId_CWCEC; - var thisUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var thisUnit = UnitService.GetUnitByUnitId(Const.UnitId_CWCEC); request.AddParameter("UnitName", thisUnit.UnitName); request.AddParameter("CollCropCode", thisUnit.CollCropCode); //request.AddJsonBody(JsonBody); @@ -59,14 +58,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/Information/AnalyseResourceService.cs b/SGGL/BLL/ZHGL/Information/AnalyseResourceService.cs index 3f24880d..74f59f1a 100644 --- a/SGGL/BLL/ZHGL/Information/AnalyseResourceService.cs +++ b/SGGL/BLL/ZHGL/Information/AnalyseResourceService.cs @@ -21,7 +21,7 @@ namespace BLL } ///本单位 string thisUnitId = BLL.Const.UnitId_CWCEC; - //var unitThis = BLL.CommonService.GetIsThisUnit(); + //var unitThis = BLL.Const.UnitId_CWCEC; //if (unitThis != null) //{ // thisUnitId = unitThis.UnitId; diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 03bf4acc..0c6e832c 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -1064,6 +1064,9 @@ namespace Model partial void InsertInformation_DrillPlanHalfYearReportItem(Information_DrillPlanHalfYearReportItem instance); partial void UpdateInformation_DrillPlanHalfYearReportItem(Information_DrillPlanHalfYearReportItem instance); partial void DeleteInformation_DrillPlanHalfYearReportItem(Information_DrillPlanHalfYearReportItem instance); + partial void InsertInformation_EnvironmentalData(Information_EnvironmentalData instance); + partial void UpdateInformation_EnvironmentalData(Information_EnvironmentalData instance); + partial void DeleteInformation_EnvironmentalData(Information_EnvironmentalData instance); partial void InsertInformation_EPSummaryReport(Information_EPSummaryReport instance); partial void UpdateInformation_EPSummaryReport(Information_EPSummaryReport instance); partial void DeleteInformation_EPSummaryReport(Information_EPSummaryReport instance); @@ -5091,6 +5094,14 @@ namespace Model } } + public System.Data.Linq.Table Information_EnvironmentalData + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Information_EPSummaryReport { get @@ -10031,6 +10042,8 @@ namespace Model private string _States; + private string _IsAttempt; + private EntityRef _Base_AccidentType; private EntityRef _Base_Project; @@ -10077,6 +10090,8 @@ namespace Model partial void OnCompileDateChanged(); partial void OnStatesChanging(string value); partial void OnStatesChanged(); + partial void OnIsAttemptChanging(string value); + partial void OnIsAttemptChanged(); #endregion public Accident_AccidentPersonRecord() @@ -10429,6 +10444,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsAttempt", DbType="Char(1)")] + public string IsAttempt + { + get + { + return this._IsAttempt; + } + set + { + if ((this._IsAttempt != value)) + { + this.OnIsAttemptChanging(value); + this.SendPropertyChanging(); + this._IsAttempt = value; + this.SendPropertyChanged("IsAttempt"); + this.OnIsAttemptChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentPersonRecord_Base_AccidentType", Storage="_Base_AccidentType", ThisKey="AccidentTypeId", OtherKey="AccidentTypeId", IsForeignKey=true)] public Base_AccidentType Base_AccidentType { @@ -10684,6 +10719,8 @@ namespace Model private System.Nullable _NotConfirmed; + private string _AccidentDegree; + private EntityRef _Base_Project; private EntityRef _Base_Unit; @@ -10754,6 +10791,8 @@ namespace Model partial void OnNotConfirmEconomicOtherLossChanged(); partial void OnNotConfirmedChanging(System.Nullable value); partial void OnNotConfirmedChanged(); + partial void OnAccidentDegreeChanging(string value); + partial void OnAccidentDegreeChanged(); #endregion public Accident_AccidentReport() @@ -11361,6 +11400,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AccidentDegree", DbType="Char(1)")] + public string AccidentDegree + { + get + { + return this._AccidentDegree; + } + set + { + if ((this._AccidentDegree != value)) + { + this.OnAccidentDegreeChanging(value); + this.SendPropertyChanging(); + this._AccidentDegree = value; + this.SendPropertyChanged("AccidentDegree"); + this.OnAccidentDegreeChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentReport_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] public Base_Project Base_Project { @@ -35381,6 +35440,8 @@ namespace Model private System.Nullable _IsRepeat; + private string _TrainType; + private EntitySet _Base_TrainTypeItem; private EntitySet _EduTrain_TrainRecord; @@ -35405,6 +35466,8 @@ namespace Model partial void OnIsAboutSendCardChanged(); partial void OnIsRepeatChanging(System.Nullable value); partial void OnIsRepeatChanged(); + partial void OnTrainTypeChanging(string value); + partial void OnTrainTypeChanged(); #endregion public Base_TrainType() @@ -35536,6 +35599,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainType", DbType="NVarChar(50)")] + public string TrainType + { + get + { + return this._TrainType; + } + set + { + if ((this._TrainType != value)) + { + this.OnTrainTypeChanging(value); + this.SendPropertyChanging(); + this._TrainType = value; + this.SendPropertyChanged("TrainType"); + this.OnTrainTypeChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Base_TrainTypeItem_Base_TrainType", Storage="_Base_TrainTypeItem", ThisKey="TrainTypeId", OtherKey="TrainTypeId", DeleteRule="NO ACTION")] public EntitySet Base_TrainTypeItem { @@ -71157,6 +71240,8 @@ namespace Model private System.Nullable _IsRectify; + private string _RectifyId; + private EntityRef _Check_RectifyNotices; #region 可扩展性方法定义 @@ -71177,6 +71262,8 @@ namespace Model partial void OnRectifyResultsChanged(); partial void OnIsRectifyChanging(System.Nullable value); partial void OnIsRectifyChanged(); + partial void OnRectifyIdChanging(string value); + partial void OnRectifyIdChanged(); #endregion public Check_RectifyNoticesItem() @@ -71329,6 +71416,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RectifyId", DbType="NVarChar(50)")] + public string RectifyId + { + get + { + return this._RectifyId; + } + set + { + if ((this._RectifyId != value)) + { + this.OnRectifyIdChanging(value); + this.SendPropertyChanging(); + this._RectifyId = value; + this.SendPropertyChanged("RectifyId"); + this.OnRectifyIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_RectifyNoticesItem_Check_RectifyNotices", Storage="_Check_RectifyNotices", ThisKey="RectifyNoticesId", OtherKey="RectifyNoticesId", IsForeignKey=true)] public Check_RectifyNotices Check_RectifyNotices { @@ -170216,6 +170323,236 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Information_EnvironmentalData")] + public partial class Information_EnvironmentalData : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _Id; + + private string _UnitId; + + private System.Nullable _TotalEnergyConsumption; + + private System.Nullable _IncomeComprehensiveEnergyConsumption; + + private System.Nullable _NewWaterConsumption; + + private System.Nullable _ReportDate; + + private string _CreateMan; + + private System.Nullable _CreateDate; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnIdChanging(string value); + partial void OnIdChanged(); + partial void OnUnitIdChanging(string value); + partial void OnUnitIdChanged(); + partial void OnTotalEnergyConsumptionChanging(System.Nullable value); + partial void OnTotalEnergyConsumptionChanged(); + partial void OnIncomeComprehensiveEnergyConsumptionChanging(System.Nullable value); + partial void OnIncomeComprehensiveEnergyConsumptionChanged(); + partial void OnNewWaterConsumptionChanging(System.Nullable value); + partial void OnNewWaterConsumptionChanged(); + partial void OnReportDateChanging(System.Nullable value); + partial void OnReportDateChanged(); + partial void OnCreateManChanging(string value); + partial void OnCreateManChanged(); + partial void OnCreateDateChanging(System.Nullable value); + partial void OnCreateDateChanged(); + #endregion + + public Information_EnvironmentalData() + { + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="VarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string Id + { + get + { + return this._Id; + } + set + { + if ((this._Id != value)) + { + this.OnIdChanging(value); + this.SendPropertyChanging(); + this._Id = value; + this.SendPropertyChanged("Id"); + this.OnIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="VarChar(50)")] + public string UnitId + { + get + { + return this._UnitId; + } + set + { + if ((this._UnitId != value)) + { + this.OnUnitIdChanging(value); + this.SendPropertyChanging(); + this._UnitId = value; + this.SendPropertyChanged("UnitId"); + this.OnUnitIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalEnergyConsumption", DbType="Int")] + public System.Nullable TotalEnergyConsumption + { + get + { + return this._TotalEnergyConsumption; + } + set + { + if ((this._TotalEnergyConsumption != value)) + { + this.OnTotalEnergyConsumptionChanging(value); + this.SendPropertyChanging(); + this._TotalEnergyConsumption = value; + this.SendPropertyChanged("TotalEnergyConsumption"); + this.OnTotalEnergyConsumptionChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IncomeComprehensiveEnergyConsumption", DbType="Int")] + public System.Nullable IncomeComprehensiveEnergyConsumption + { + get + { + return this._IncomeComprehensiveEnergyConsumption; + } + set + { + if ((this._IncomeComprehensiveEnergyConsumption != value)) + { + this.OnIncomeComprehensiveEnergyConsumptionChanging(value); + this.SendPropertyChanging(); + this._IncomeComprehensiveEnergyConsumption = value; + this.SendPropertyChanged("IncomeComprehensiveEnergyConsumption"); + this.OnIncomeComprehensiveEnergyConsumptionChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_NewWaterConsumption", DbType="Int")] + public System.Nullable NewWaterConsumption + { + get + { + return this._NewWaterConsumption; + } + set + { + if ((this._NewWaterConsumption != value)) + { + this.OnNewWaterConsumptionChanging(value); + this.SendPropertyChanging(); + this._NewWaterConsumption = value; + this.SendPropertyChanged("NewWaterConsumption"); + this.OnNewWaterConsumptionChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReportDate", DbType="Date")] + public System.Nullable ReportDate + { + get + { + return this._ReportDate; + } + set + { + if ((this._ReportDate != value)) + { + this.OnReportDateChanging(value); + this.SendPropertyChanging(); + this._ReportDate = value; + this.SendPropertyChanged("ReportDate"); + this.OnReportDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateMan", DbType="VarChar(50)")] + public string CreateMan + { + get + { + return this._CreateMan; + } + set + { + if ((this._CreateMan != value)) + { + this.OnCreateManChanging(value); + this.SendPropertyChanging(); + this._CreateMan = value; + this.SendPropertyChanged("CreateMan"); + this.OnCreateManChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateDate", DbType="DateTime")] + public System.Nullable CreateDate + { + get + { + return this._CreateDate; + } + set + { + if ((this._CreateDate != value)) + { + this.OnCreateDateChanging(value); + this.SendPropertyChanging(); + this._CreateDate = value; + this.SendPropertyChanged("CreateDate"); + this.OnCreateDateChanged(); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Information_EPSummaryReport")] public partial class Information_EPSummaryReport : INotifyPropertyChanging, INotifyPropertyChanged { @@ -203877,6 +204214,8 @@ namespace Model private string _CNProfessionalId; + private System.Nullable _IsHighRisk; + private EntityRef _Base_LicenseType; private EntityRef _Base_Project; @@ -203921,6 +204260,8 @@ namespace Model partial void OnWorkStatesChanged(); partial void OnCNProfessionalIdChanging(string value); partial void OnCNProfessionalIdChanged(); + partial void OnIsHighRiskChanging(System.Nullable value); + partial void OnIsHighRiskChanged(); #endregion public License_LicenseManager() @@ -204268,6 +204609,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsHighRisk", DbType="Bit")] + public System.Nullable IsHighRisk + { + get + { + return this._IsHighRisk; + } + set + { + if ((this._IsHighRisk != value)) + { + this.OnIsHighRiskChanging(value); + this.SendPropertyChanging(); + this._IsHighRisk = value; + this.SendPropertyChanged("IsHighRisk"); + this.OnIsHighRiskChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_License_LicenseManager_Base_LicenseType", Storage="_Base_LicenseType", ThisKey="LicenseTypeId", OtherKey="LicenseTypeId", IsForeignKey=true)] public Base_LicenseType Base_LicenseType { @@ -294682,6 +295043,8 @@ namespace Model private string _RawPassword; + private System.Nullable _IsSafetyMonitoring; + private EntitySet _Accident_AccidentPersonRecord; private EntitySet _Accident_AccidentReportOtherItem; @@ -294864,6 +295227,8 @@ namespace Model partial void OnIsCardNoOKChanged(); partial void OnRawPasswordChanging(string value); partial void OnRawPasswordChanged(); + partial void OnIsSafetyMonitoringChanging(System.Nullable value); + partial void OnIsSafetyMonitoringChanged(); #endregion public SitePerson_Person() @@ -296132,6 +296497,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsSafetyMonitoring", DbType="Bit")] + public System.Nullable IsSafetyMonitoring + { + get + { + return this._IsSafetyMonitoring; + } + set + { + if ((this._IsSafetyMonitoring != value)) + { + this.OnIsSafetyMonitoringChanging(value); + this.SendPropertyChanging(); + this._IsSafetyMonitoring = value; + this.SendPropertyChanged("IsSafetyMonitoring"); + this.OnIsSafetyMonitoringChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentPersonRecord_SitePerson_Person", Storage="_Accident_AccidentPersonRecord", ThisKey="PersonId", OtherKey="PersonId", DeleteRule="NO ACTION")] public EntitySet Accident_AccidentPersonRecord {