diff --git a/DataBase/版本日志/SGGLDB_V2024-12-25.sql b/DataBase/版本日志/SGGLDB_V2024-12-25.sql new file mode 100644 index 00000000..61b00dcf --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2024-12-25.sql @@ -0,0 +1,119 @@ +--1ĿĿid +IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Base_Project' AND COLUMN_NAME = 'MasterSysId') +BEGIN + ALTER TABLE Base_Project ADD MasterSysId nvarchar(200); +END +GO + +create table dbo.EnvironmentalCheck +( + Id nvarchar(50) not null + constraint PK_Id + primary key, + ProjectId nvarchar(50), + Tsp float, + Temp float, + Noise float, + Humid float, + PmTwoPointFive float, + WindSpeed float, + PmTen float, + Time datetime, + CreateTime datetime +) +go + +exec sp_addextendedproperty 'MS_Description', N'', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck' +go + +exec sp_addextendedproperty 'MS_Description', 'tsp', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', 'Tsp' +go + +exec sp_addextendedproperty 'MS_Description', N'¶', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', 'Temp' +go + +exec sp_addextendedproperty 'MS_Description', N'', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', 'Noise' +go + +exec sp_addextendedproperty 'MS_Description', N'ʪ', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', 'Humid' +go + +exec sp_addextendedproperty 'MS_Description', 'PM2.5', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', + 'PmTwoPointFive' +go + +exec sp_addextendedproperty 'MS_Description', N'', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', + 'WindSpeed' +go + +exec sp_addextendedproperty 'MS_Description', 'pm10', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', 'PmTen' +go + +exec sp_addextendedproperty 'MS_Description', N'ʱ', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', + 'Time' +go + +exec sp_addextendedproperty 'MS_Description', N'ʱ', 'SCHEMA', 'dbo', 'TABLE', 'EnvironmentalCheck', 'COLUMN', + 'CreateTime' +go + +alter table HSSEData_HSSE add EnvironmentalTrainNum int null +GO +alter table License_LicenseManager add IsHighRisk bit null +GO + +ALTER VIEW [dbo].[View_License_LicenseManager] +AS +/*ֳȫ֤*/ +SELECT LicenseManager.LicenseManagerId, + LicenseManager.ProjectId, + LicenseManager.LicenseTypeId, + LicenseManager.LicenseManagerCode, + LicenseManager.LicenseManageName, + LicenseManager.UnitId, + LicenseManager.LicenseManageContents, + LicenseManager.CompileMan, + LicenseManager.CompileDate, + LicenseManager.States, + LicenseManager.IsHighRisk, + Project.ProjectCode, + Project.ProjectName, + Project.IsCNCECShow, + LicenseType.LicenseTypeName, + Unit.UnitName, + Users.PersonName, + LicenseManager.WorkAreaId, + --WorkArea.WorkAreaName, + LicenseManager.StartDate, + LicenseManager.EndDate, + LicenseManager.ApplicantMan, + WorkAreaName = STUFF(( SELECT ',' + UnitWorkName FROM WBS_UnitWork + where PATINDEX('%,' + RTRIM(WBS_UnitWork.UnitWorkId) + ',%',',' + LicenseManager.WorkAreaId + ',')>0 + ORDER BY PATINDEX('%,' + RTRIM(LicenseManager.WorkAreaId) + ',%',',' + LicenseManager.WorkAreaId + ',') + FOR XML PATH('')), 1, 1,'') +FROM dbo.License_LicenseManager AS LicenseManager +LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = LicenseManager.ProjectId +LEFT JOIN dbo.Base_LicenseType AS LicenseType ON LicenseType.LicenseTypeId = LicenseManager.LicenseTypeId +LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = LicenseManager.UnitId +LEFT JOIN dbo.Person_Persons AS Users ON Users.PersonId = LicenseManager.CompileMan +LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = LicenseManager.WorkAreaId + + +GO + +alter table CostGoods_CostSmallDetail add Extract decimal(18,0) null +GO +alter table Project_HSSEData_HSSE add EnvironmentalTrainNum int null +GO +alter table Meeting_CompanySafetyMeeting add ProjectId nvarchar(50) null +GO +alter table Meeting_CompanySpecialMeeting add UnitId nvarchar(50) null +GO +alter table Meeting_CompanySafetyMeeting add UnitId nvarchar(50) null +GO +alter table EnvironmentalCheck add IsPushed bit null +GO + + + + diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 4ab6dc37..b8b6283e 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -472,6 +472,7 @@ + @@ -736,6 +737,8 @@ + + diff --git a/SGGL/BLL/Common/CommonService.cs b/SGGL/BLL/Common/CommonService.cs index 300cec8a..2002b586 100644 --- a/SGGL/BLL/Common/CommonService.cs +++ b/SGGL/BLL/Common/CommonService.cs @@ -665,5 +665,31 @@ namespace BLL if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day)) age--; return age; } + + /// + ///根据userid获取当前人的单位类型(0总公司,1分公司,2其他) + /// + /// + /// + public static int GetUnitTypeByUserId(string userId) + { + int result = 0; + var user = Person_PersonsService.GetPerson_PersonsById(userId); + + + if ((userId == Const.hfnbdId || userId == Const.sysglyId) || (!string.IsNullOrEmpty(user.UnitId) && user.UnitId == BLL.Const.UnitId_SEDIN))//公司级别 + { + result = 0; + } + else if (!string.IsNullOrEmpty(user.UnitId) && UnitService.GetUnitByUnitId(user.UnitId).IsBranch == true && user.IsOffice == true) //子公司级数据 + { + result = 1; + } + else //外来账户 + { + result = 2; + } + return result; + } } } diff --git a/SGGL/BLL/Common/ConstValue.cs b/SGGL/BLL/Common/ConstValue.cs index 254f15b1..e316b5ee 100644 --- a/SGGL/BLL/Common/ConstValue.cs +++ b/SGGL/BLL/Common/ConstValue.cs @@ -397,6 +397,10 @@ namespace BLL /// 穿透界面Referer白名单 /// public const string Group_SafeReferer = "SafeReferer"; + /// + /// 项目细分状态 + /// + public const string GroupId_ProjectState = "ProjectState"; #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index 18bce4d6..06a92c99 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -1530,7 +1530,26 @@ namespace BLL return weekOfYear; } + private static string _SGGLApiUrl; + public static string SGGLApiUrl + { + get + { + var sysSet = (from x in DB.Sys_Const where x.ConstText == "ӿڷʵַ" select x).ToList().FirstOrDefault(); + if (sysSet != null) + { + _SGGLApiUrl = sysSet.ConstValue; + } + else + { + _SGGLApiUrl = ""; + } + + return _SGGLApiUrl; + } + set { _SGGLApiUrl = value; } + } } } diff --git a/SGGL/BLL/HSSE/Environmental/EnvironmentalCheckService.cs b/SGGL/BLL/HSSE/Environmental/EnvironmentalCheckService.cs new file mode 100644 index 00000000..bbfdfc2c --- /dev/null +++ b/SGGL/BLL/HSSE/Environmental/EnvironmentalCheckService.cs @@ -0,0 +1,57 @@ +using Model; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BLL +{ + /// + /// 环境监测数据 + /// + public static class EnvironmentalCheckService + { + public static Model.SGGLDB db = Funs.DB; + + #region 推送环境监测数据 + + /// + /// 推送环境监测数据 + /// + /// + public static ReturnData PushEnvironmentalCheckData() + { + var items = (from x in db.EnvironmentalCheck where x.IsPushed == false select x).ToList(); + Model.ReturnData responeData = new Model.ReturnData(); + if (items.Count() > 0) + { + var thisUnit = CommonService.GetIsThisUnit(); + var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; + var str = JsonConvert.SerializeObject(newItem); + var baseurl = "/api/Environmental/SaveEnvironmentalCheckData"; + responeData = ServerService.PushCNCEC(str, baseurl); + if (responeData.code == 1) + {//推送成功后,修改数据状态 + foreach (var item in items) + { + Model.EnvironmentalCheck envModel = db.EnvironmentalCheck.FirstOrDefault(e => e.Id == item.Id); + if (envModel != null) + { + envModel.IsPushed = true; + db.SubmitChanges(); + } + } + } + } + else + { + responeData.code = 0; + responeData.message = "当前没有环境监测数据"; + } + return responeData; + } + + #endregion + } +} diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs index 6f2cb1d5..e79c11b2 100644 --- a/SGGL/BLL/ProjectData/ProjectService.cs +++ b/SGGL/BLL/ProjectData/ProjectService.cs @@ -1,6 +1,7 @@ namespace BLL { using Model; + using Newtonsoft.Json; using NPOI.Util; using System; using System.Collections.Generic; @@ -127,6 +128,7 @@ EnglishRemark = project.EnglishRemark, ProjectRealCode = project.ProjectRealCode, IsCNCECShow = project.IsCNCECShow, + MasterSysId = project.MasterSysId, }; db.Base_Project.InsertOnSubmit(newProject); db.SubmitChanges(); @@ -173,6 +175,8 @@ newProject.EnglishRemark = project.EnglishRemark; newProject.ProjectRealCode = project.ProjectRealCode; newProject.IsCNCECShow = project.IsCNCECShow; + newProject.MasterSysId = project.MasterSysId; + db.SubmitChanges(); HSEDataCollectService.ProjectHSEDataCollectSubmission(newProject); CQMSDataCollectService.ProjectCQMSDataCollectSubmission(newProject); @@ -675,5 +679,59 @@ } return name; } + + /// + /// 获取主数据项目 + /// + /// + public static List GetMasterProjectInfos() + { + var thisUnit = CommonService.GetIsThisUnit(); + Dictionary dic = new Dictionary() + { + {"collCropCode", thisUnit.CollCropCode} + }; + List projectlist = new List(); + var returnData = ServerService.GerDataFromCncec("api/Common/GetMasterDataProjectByCollCropCode", dic, null); + if (returnData != null && returnData.code == 1) + { + projectlist = JsonConvert.DeserializeObject>(returnData.data.ToString()); + } + + return projectlist; + } + + /// + /// 获取主数据项目(下拉框) + /// + /// + /// + public static void InitMasterProjectDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) + { + dropName.DataValueField = "SysId"; + dropName.DataTextField = "PrjName"; + var thisUnit = CommonService.GetIsThisUnit(); + Dictionary dic = new Dictionary() + { + {"collCropCode", thisUnit.CollCropCode} + }; + List projectlist = new List(); + var returnData = ServerService.GerDataFromCncec("api/Common/GetMasterDataProjectByCollCropCode", dic, null); + if (returnData != null && returnData.code == 1) + { + projectlist = JsonConvert.DeserializeObject>(returnData.data.ToString()); + } + + dropName.DataSource = projectlist; + dropName.DataBind(); + if (projectlist.Count() == 0) + { + isShowPlease = true; + } + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/WebService/CNCECHSSEWebService.cs b/SGGL/BLL/WebService/CNCECHSSEWebService.cs index ccdee58c..ad440aba 100644 --- a/SGGL/BLL/WebService/CNCECHSSEWebService.cs +++ b/SGGL/BLL/WebService/CNCECHSSEWebService.cs @@ -1840,7 +1840,7 @@ } #endregion - #region 项目推送 新增方法 + #region 项目推送 /// /// 推送项目到集团 /// @@ -1858,6 +1858,7 @@ select new Model.BaseProjectItem { ProjectId = x.ProjectId, + MasterSysId = x.MasterSysId, UnitId = BLL.Const.UnitId_SEDIN, ProjectCode = x.ProjectCode, ProjectName = x.ProjectName, @@ -1885,12 +1886,12 @@ City = x.City, Telephone = x.Telephone, EnglishRemark = x.EnglishRemark, - //IsFace = x.IsFace, - //ProjectState2 = x.ProjectState2, - //Progress = x.Progress, - //MonitorPW = x.MonitorPW, - //MonitorId = x.MonitorId, - //ProjectAttribute = x.ProjectAttribute, + IsFace = false, + ProjectState2 = "", + Progress = 0, + MonitorPW = "", + MonitorId = "", + ProjectAttribute = "", SourceUnitId = BLL.Const.UnitId_SEDIN, } ); @@ -1925,7 +1926,6 @@ return responeData.code; } #endregion - #endregion diff --git a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs index 52805f65..2d552a87 100644 --- a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs @@ -49,105 +49,157 @@ namespace BLL // q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList(); // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q - select new - { - x.Id, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.TrainPersonNum, - x.TechnicalDisclosePersonNum, - x.UseNum, - x.OKNum, - x.CompanyPersonNum, - x.BranchPersonNum, - x.ProjectPersonNum, - x.ProblemNum, - x.ProblemCompletedNum, - x.ProblemNotCompletedNum, - x.SNum, - x.ANum, - x.BNum, - x.CNum, - x.KeyProcessNum, - x.KeyProcessOKNum, - x.SpecialProcessNum, - x.SpecialProcessOKNum, - x.ConcealedWorksNum, - x.ConcealedWorksOKNum, - x.UnitProjectOnesNum, - x.UnitProjectOnesOKNum, - x.MaterialInRecheckNum, - x.MaterialInRecheckOKNum, - x.SingleProjectNum, - x.UnitProjectNum, - x.SubProjectNum, - x.SubdivisionalWorksNum, - x.InspectionLotNum, - x.State, - x.CreateDate, - x.CreateMan - }; + select new + { + x.Id, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.TrainPersonNum, + x.TechnicalDisclosePersonNum, + x.UseNum, + x.OKNum, + x.CompanyPersonNum, + x.BranchPersonNum, + x.ProjectPersonNum, + x.ProblemNum, + x.ProblemCompletedNum, + x.ProblemNotCompletedNum, + x.SNum, + x.ANum, + x.BNum, + x.CNum, + x.KeyProcessNum, + x.KeyProcessOKNum, + x.SpecialProcessNum, + x.SpecialProcessOKNum, + x.ConcealedWorksNum, + x.ConcealedWorksOKNum, + x.UnitProjectOnesNum, + x.UnitProjectOnesOKNum, + x.MaterialInRecheckNum, + x.MaterialInRecheckOKNum, + x.SingleProjectNum, + x.UnitProjectNum, + x.SubProjectNum, + x.SubdivisionalWorksNum, + x.InspectionLotNum, + x.State, + x.CreateDate, + x.CreateMan + }; } #endregion 获取列表 public static void AddCQMSData_CQMS(CQMSData_CQMS newtable) { - var db = Funs.DB; - var table = new CQMSData_CQMS + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - TrainPersonNum = newtable.TrainPersonNum, - TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum, - UseNum = newtable.UseNum, - OKNum = newtable.OKNum, - CompanyPersonNum = newtable.CompanyPersonNum, - BranchPersonNum = newtable.BranchPersonNum, - ProjectPersonNum = newtable.ProjectPersonNum, - ProblemNum = newtable.ProblemNum, - ProblemCompletedNum = newtable.ProblemCompletedNum, - ProblemNotCompletedNum = newtable.ProblemNotCompletedNum, - SNum = newtable.SNum, - ANum = newtable.ANum, - BNum = newtable.BNum, - CNum = newtable.CNum, - KeyProcessNum = newtable.KeyProcessNum, - KeyProcessOKNum = newtable.KeyProcessOKNum, - SpecialProcessNum = newtable.SpecialProcessNum, - SpecialProcessOKNum = newtable.SpecialProcessOKNum, - ConcealedWorksNum = newtable.ConcealedWorksNum, - ConcealedWorksOKNum = newtable.ConcealedWorksOKNum, - UnitProjectOnesNum = newtable.UnitProjectOnesNum, - UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum, - MaterialInRecheckNum = newtable.MaterialInRecheckNum, - MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum, - SingleProjectNum = newtable.SingleProjectNum, - UnitProjectNum = newtable.UnitProjectNum, - SubProjectNum = newtable.SubProjectNum, - SubdivisionalWorksNum = newtable.SubdivisionalWorksNum, - InspectionLotNum = newtable.InspectionLotNum, - State = newtable.State, - CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan - }; - db.CQMSData_CQMS.InsertOnSubmit(table); - db.SubmitChanges(); + var table = new CQMSData_CQMS + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + TrainPersonNum = newtable.TrainPersonNum, + TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum, + UseNum = newtable.UseNum, + OKNum = newtable.OKNum, + CompanyPersonNum = newtable.CompanyPersonNum, + BranchPersonNum = newtable.BranchPersonNum, + ProjectPersonNum = newtable.ProjectPersonNum, + ProblemNum = newtable.ProblemNum, + ProblemCompletedNum = newtable.ProblemCompletedNum, + ProblemNotCompletedNum = newtable.ProblemNotCompletedNum, + SNum = newtable.SNum, + ANum = newtable.ANum, + BNum = newtable.BNum, + CNum = newtable.CNum, + KeyProcessNum = newtable.KeyProcessNum, + KeyProcessOKNum = newtable.KeyProcessOKNum, + SpecialProcessNum = newtable.SpecialProcessNum, + SpecialProcessOKNum = newtable.SpecialProcessOKNum, + ConcealedWorksNum = newtable.ConcealedWorksNum, + ConcealedWorksOKNum = newtable.ConcealedWorksOKNum, + UnitProjectOnesNum = newtable.UnitProjectOnesNum, + UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum, + MaterialInRecheckNum = newtable.MaterialInRecheckNum, + MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum, + SingleProjectNum = newtable.SingleProjectNum, + UnitProjectNum = newtable.UnitProjectNum, + SubProjectNum = newtable.SubProjectNum, + SubdivisionalWorksNum = newtable.SubdivisionalWorksNum, + InspectionLotNum = newtable.InspectionLotNum, + State = newtable.State, + CreateDate = newtable.CreateDate, + CreateMan = newtable.CreateMan + }; + db.CQMSData_CQMS.InsertOnSubmit(table); + db.SubmitChanges(); + } } + public static void UpdateCQMSData_CQMS(CQMSData_CQMS newtable) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.TrainPersonNum = newtable.TrainPersonNum; + table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum; + table.UseNum = newtable.UseNum; + table.OKNum = newtable.OKNum; + table.CompanyPersonNum = newtable.CompanyPersonNum; + table.BranchPersonNum = newtable.BranchPersonNum; + table.ProjectPersonNum = newtable.ProjectPersonNum; + table.ProblemNum = newtable.ProblemNum; + table.ProblemCompletedNum = newtable.ProblemCompletedNum; + table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum; + table.SNum = newtable.SNum; + table.ANum = newtable.ANum; + table.BNum = newtable.BNum; + table.CNum = newtable.CNum; + table.KeyProcessNum = newtable.KeyProcessNum; + table.KeyProcessOKNum = newtable.KeyProcessOKNum; + table.SpecialProcessNum = newtable.SpecialProcessNum; + table.SpecialProcessOKNum = newtable.SpecialProcessOKNum; + table.ConcealedWorksNum = newtable.ConcealedWorksNum; + table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum; + table.UnitProjectOnesNum = newtable.UnitProjectOnesNum; + table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum; + table.MaterialInRecheckNum = newtable.MaterialInRecheckNum; + table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum; + table.SingleProjectNum = newtable.SingleProjectNum; + table.UnitProjectNum = newtable.UnitProjectNum; + table.SubProjectNum = newtable.SubProjectNum; + table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum; + table.InspectionLotNum = newtable.InspectionLotNum; + table.State = newtable.State; + table.CreateMan = newtable.CreateMan; + table.CreateDate = newtable.CreateDate; + db.SubmitChanges(); + } + } + } public static void DeleteCQMSData_CQMSById(string id) { - var db = Funs.DB; - var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.CQMSData_CQMS.DeleteOnSubmit(table); - db.SubmitChanges(); + var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == id); + if (table != null) + { + db.CQMSData_CQMS.DeleteOnSubmit(table); + db.SubmitChanges(); + } } } @@ -232,11 +284,63 @@ namespace BLL public static CQMSData_CQMS GetTodayData() { var q = (from x in Funs.DB.CQMSData_CQMS - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } - + public static CQMSData_CQMS GetSubUnitCqmsDataByDate(string Unitid, DateTime? reportdate) + { + + var result = new Model.CQMSData_CQMS(); + if (reportdate == null) + { + return result; + } + var projectlist = BLL.ProjectService.GetProjectWorkList(); + var base_Unit = UnitService.GetUnitByUnitId(Unitid); + var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS + where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId) + select x).ToList(); + result = new CQMSData_CQMS + { + UnitId = Unitid, + CollCropCode = base_Unit.CollCropCode, + UnitName = base_Unit.UnitName, + ReportDate = DateTime.Now.Date, + TrainPersonNum = ProjectData.Sum(x => x.TrainPersonNum), + TechnicalDisclosePersonNum = ProjectData.Sum(x => x.TechnicalDisclosePersonNum), + UseNum = ProjectData.Sum(x => x.UseNum), + OKNum = ProjectData.Sum(x => x.OKNum), + CompanyPersonNum = GetCompanyPersonNum(), + BranchPersonNum = GetBranchPersonNum(), + ProjectPersonNum = ProjectData.Sum(x => x.ProjectPersonNum), + ProblemNum = ProjectData.Sum(x => x.ProblemNum), + ProblemCompletedNum = ProjectData.Sum(x => x.ProblemCompletedNum), + ProblemNotCompletedNum = ProjectData.Sum(x => x.ProblemNotCompletedNum), + SNum = ProjectData.Sum(x => x.SNum), + ANum = ProjectData.Sum(x => x.ANum), + BNum = ProjectData.Sum(x => x.BNum), + CNum = ProjectData.Sum(x => x.CNum), + KeyProcessNum = ProjectData.Sum(x => x.KeyProcessNum), + KeyProcessOKNum = ProjectData.Sum(x => x.KeyProcessOKNum), + SpecialProcessNum = ProjectData.Sum(x => x.SpecialProcessNum), + SpecialProcessOKNum = ProjectData.Sum(x => x.SpecialProcessOKNum), + ConcealedWorksNum = ProjectData.Sum(x => x.ConcealedWorksNum), + ConcealedWorksOKNum = ProjectData.Sum(x => x.ConcealedWorksOKNum), + UnitProjectOnesNum = ProjectData.Sum(x => x.UnitProjectOnesNum), + UnitProjectOnesOKNum = ProjectData.Sum(x => x.UnitProjectOnesOKNum), + MaterialInRecheckNum = ProjectData.Sum(x => x.MaterialInRecheckNum), + MaterialInRecheckOKNum = ProjectData.Sum(x => x.MaterialInRecheckOKNum), + SingleProjectNum = ProjectData.Sum(x => x.SingleProjectNum), + UnitProjectNum = ProjectData.Sum(x => x.UnitProjectNum), + SubProjectNum = ProjectData.Sum(x => x.SubProjectNum), + SubdivisionalWorksNum = ProjectData.Sum(x => x.SubdivisionalWorksNum), + InspectionLotNum = ProjectData.Sum(x => x.InspectionLotNum), + CreateMan = Const.sysglyId, + CreateDate = DateTime.Now + }; + return result; + } public static void UpdateTodyData_State() { var q = GetTodayData(); @@ -251,8 +355,8 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.CQMSData_CQMS - where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date - select x).ToList(); + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date + select x).ToList(); if (q.Count > 0) result = true; return result; } @@ -265,8 +369,8 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.CQMSData_CQMS - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); if (q.Count > 0) result = true; return result; } @@ -289,8 +393,8 @@ namespace BLL Project_CQMSDataService.StatisticalAllProjectData(); var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); var table = new CQMSData_CQMS { UnitId = thisUnitId, @@ -396,52 +500,6 @@ namespace BLL return data; } - public static void UpdateCQMSData_CQMS(CQMSData_CQMS newtable) - { - var db = Funs.DB; - var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) - { - table.Id = newtable.Id; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.TrainPersonNum = newtable.TrainPersonNum; - table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum; - table.UseNum = newtable.UseNum; - table.OKNum = newtable.OKNum; - table.CompanyPersonNum = newtable.CompanyPersonNum; - table.BranchPersonNum = newtable.BranchPersonNum; - table.ProjectPersonNum = newtable.ProjectPersonNum; - table.ProblemNum = newtable.ProblemNum; - table.ProblemCompletedNum = newtable.ProblemCompletedNum; - table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum; - table.SNum = newtable.SNum; - table.ANum = newtable.ANum; - table.BNum = newtable.BNum; - table.CNum = newtable.CNum; - table.KeyProcessNum = newtable.KeyProcessNum; - table.KeyProcessOKNum = newtable.KeyProcessOKNum; - table.SpecialProcessNum = newtable.SpecialProcessNum; - table.SpecialProcessOKNum = newtable.SpecialProcessOKNum; - table.ConcealedWorksNum = newtable.ConcealedWorksNum; - table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum; - table.UnitProjectOnesNum = newtable.UnitProjectOnesNum; - table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum; - table.MaterialInRecheckNum = newtable.MaterialInRecheckNum; - table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum; - table.SingleProjectNum = newtable.SingleProjectNum; - table.UnitProjectNum = newtable.UnitProjectNum; - table.SubProjectNum = newtable.SubProjectNum; - table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum; - table.InspectionLotNum = newtable.InspectionLotNum; - table.State = newtable.State; - table.CreateMan = newtable.CreateMan; - table.CreateDate = newtable.CreateDate; - db.SubmitChanges(); - } - } /// /// 获取企业总部人数 @@ -453,10 +511,10 @@ namespace BLL var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_Persons - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.IsPost == true && y.IsCQMS == true && x.UnitId == unitId - select x).Count(); - return 0; + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsPost == true && y.IsCQMS == true && x.UnitId == unitId + select x).Count(); + return result; } /// @@ -470,10 +528,9 @@ namespace BLL if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_Persons join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId - where x.IsPost == true && y.IsCQMS == true && x.UnitId != unitId && z.IsBranch== true - select x).Count(); - return 0; + where x.IsPost == true && y.IsCQMS == true && x.UnitId != unitId + select x).Count(); + return result; } } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs index 9eb9625c..f3eecb3a 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs @@ -31,7 +31,7 @@ namespace BLL (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && - (string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName)) + (string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName)) select x ; @@ -51,7 +51,7 @@ namespace BLL { return null; } - // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q select new { @@ -75,66 +75,71 @@ namespace BLL { var q = from x in db.HJGLData_Defect where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 - select x; + select x; return q.ToList(); } public static void AddHJGLData_Defect(Model.HJGLData_Defect newtable) { - - Model.HJGLData_Defect table = new Model.HJGLData_Defect + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - DefectName = newtable.DefectName, - DefectNum = newtable.DefectNum, - }; - db.HJGLData_Defect.InsertOnSubmit(table); - db.SubmitChanges(); + Model.HJGLData_Defect table = new Model.HJGLData_Defect + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + DefectName = newtable.DefectName, + DefectNum = newtable.DefectNum, + }; + db.HJGLData_Defect.InsertOnSubmit(table); + db.SubmitChanges(); + } } public static void UpdateHJGLData_Defect(Model.HJGLData_Defect newtable) { - - Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.DefectName = newtable.DefectName; - table.DefectNum = newtable.DefectNum; - db.SubmitChanges(); + Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.DefectName = newtable.DefectName; + table.DefectNum = newtable.DefectNum; + db.SubmitChanges(); + } } - } public static void DeleteHJGLData_DefectById(string Id) { - - Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HJGLData_Defect.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.HJGLData_Defect.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } public static void DeleteHJGLData_DefectByDate(DateTime? reportDate) { - - var table = db.HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HJGLData_Defect.DeleteAllOnSubmit(table); - db.SubmitChanges(); - } - + var table = db.HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.HJGLData_Defect.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } + } } } diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs index 9f3b2590..f164cb3f 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs @@ -6,7 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; - +using System.Net.PeerToPeer; namespace BLL { @@ -49,58 +49,64 @@ namespace BLL if (count == 0) return null; // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q - select new - { - x.Id, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.WelderNum, - x.TotalDineNum, - x.CompleteDineNum, - x.TotalFilmNum, - x.OKFilmNum, - x.State, - x.CreateDate, - x.CreateMan - }; + select new + { + x.Id, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.WelderNum, + x.TotalDineNum, + x.CompleteDineNum, + x.TotalFilmNum, + x.OKFilmNum, + x.State, + x.CreateDate, + x.CreateMan + }; } #endregion 获取列表 public static void AddHJGLData_HJGL(HJGLData_HJGL newtable) { - var db = Funs.DB; - var table = new HJGLData_HJGL + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - WelderNum = newtable.WelderNum, - TotalDineNum = newtable.TotalDineNum, - CompleteDineNum = newtable.CompleteDineNum, - TotalFilmNum = newtable.TotalFilmNum, - OKFilmNum = newtable.OKFilmNum, - State = newtable.State, - CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan - }; - db.HJGLData_HJGL.InsertOnSubmit(table); - db.SubmitChanges(); + var table = new HJGLData_HJGL + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + WelderNum = newtable.WelderNum, + TotalDineNum = newtable.TotalDineNum, + CompleteDineNum = newtable.CompleteDineNum, + TotalFilmNum = newtable.TotalFilmNum, + OKFilmNum = newtable.OKFilmNum, + State = newtable.State, + CreateDate = newtable.CreateDate, + CreateMan = newtable.CreateMan + }; + db.HJGLData_HJGL.InsertOnSubmit(table); + db.SubmitChanges(); + } + } public static void DeleteHJGLData_HJGLById(string Id) { - var db = Funs.DB; - var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HJGLData_HJGL.DeleteOnSubmit(table); - db.SubmitChanges(); + var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.HJGLData_HJGL.DeleteOnSubmit(table); + db.SubmitChanges(); + } } + } public static HJGLData_HJGL GetHJGLData_HJGLById(string Id) @@ -151,12 +157,17 @@ namespace BLL public static HJGLData GetTodayHJGLData_HJGL() { - var q = GetTodayData(); var data = new HJGLData(); - if (CommonService.GetIsThisUnit().CollCropCode == "91410200170644116B") + if (CommonService.GetIsThisUnit().CollCropCode== "91410200170644116B") { - return GetELECLTodayHJGLData_HJGL(); + return GetELECLTodayHJGLData_HJGL(); } + if (CommonService.GetIsThisUnit().CollCropCode == "914200001775697881") + { + return GetCNCEC_16TodayHJGLData_HJGL(); + + } + var q = GetTodayData(); if (q != null && q.State == Const.CNCEC_State_S) data = StatisticalData(); else @@ -174,23 +185,82 @@ namespace BLL string token = Const.sysglyId; string response = Funs.RequestPost(baseurl, token, ""); var json = JsonConvert.DeserializeObject(response) as JObject; + if (json != null && json["code"]?.ToString()=="1") + { + var str = json["data"]?.ToString(); + if (str != null) data = JsonConvert.DeserializeObject(str); + } + return data; + + } + /// + /// 获取十六化建焊接数据 + /// + /// + public static HJGLData GetCNCEC_16TodayHJGLData_HJGL() + { + var data = new HJGLData(); + string baseurl = "https://aq.cncec16.com.cn/hjglWebApi/api/CNCECServer/PostGetHJGLData"; + string token = Const.sysglyId; + string response = Funs.RequestPost(baseurl, token, ""); + if (string.IsNullOrEmpty(response)) + { + try + { + baseurl = "http://192.168.1.8/hjglwebapi/api/CNCECServer/PostGetHJGLData"; + response = Funs.RequestPost(baseurl, token, ""); + } + catch (Exception e) + { + APICommonService.SaveSysHttpLog("GetCNCEC_16TodayHJGLData_HJGL", baseurl, e.ToString()); + + } + + } + var json = JsonConvert.DeserializeObject(response) as JObject; if (json != null && json["code"]?.ToString() == "1") { var str = json["data"]?.ToString(); if (str != null) data = JsonConvert.DeserializeObject(str); } + APICommonService.SaveSysHttpLog("GetCNCEC_16TodayHJGLData_HJGL", baseurl, response); return data; - } - public static HJGLData_HJGL GetTodayData() { var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } - + public static HJGLData_HJGL GetSubUnitHjglDataByDate(string Unitid, DateTime? reportdate) + { + var result = new Model.HJGLData_HJGL(); + if (reportdate == null) + { + return result; + } + var projectlist = BLL.ProjectService.GetProjectWorkList(); + var baseUnit = UnitService.GetUnitByUnitId(Unitid); + var ProjectData = (from x in Funs.DB.Project_HJGLData_HJGL + where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId) + select x).ToList(); + result = new HJGLData_HJGL + { + UnitId = Unitid, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ReportDate = DateTime.Now.Date, + WelderNum = ProjectData.Sum(x => x.WelderNum), + TotalDineNum = ProjectData.Sum(x => x.TotalDineNum), + CompleteDineNum = ProjectData.Sum(x => x.CompleteDineNum), + TotalFilmNum = ProjectData.Sum(x => x.TotalFilmNum), + OKFilmNum = ProjectData.Sum(x => x.OKFilmNum), + CreateMan = Const.sysglyId, + CreateDate = DateTime.Now + }; + return result; + } public static void UpdateTodyData_State() { var q = GetTodayData(); @@ -205,8 +275,8 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date - select x).ToList(); + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date + select x).ToList(); if (q != null && q.Count > 0) result = true; return result; } @@ -219,8 +289,8 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); if (q.Count > 0) result = true; return result; } @@ -242,8 +312,8 @@ namespace BLL if (thisUnit != null) thisUnitId = thisUnit.UnitId; var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); var ProjectData = (from x in Funs.DB.Project_HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); Project_HJGLData_HJGLService.StatisticalAllProjectData(); Project_HJGLData_DefectService.StatisticalAllProjectData(); @@ -294,26 +364,29 @@ namespace BLL } public static void UpdateHJGLData_HJGL(HJGLData_HJGL newtable) - { - var db = Funs.DB; - var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.WelderNum = newtable.WelderNum; - table.TotalDineNum = newtable.TotalDineNum; - table.CompleteDineNum = newtable.CompleteDineNum; - table.TotalFilmNum = newtable.TotalFilmNum; - table.OKFilmNum = newtable.OKFilmNum; - table.State = newtable.State; - table.CreateMan = newtable.CreateMan; - table.CreateDate = newtable.CreateDate; - db.SubmitChanges(); - } + var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.WelderNum = newtable.WelderNum; + table.TotalDineNum = newtable.TotalDineNum; + table.CompleteDineNum = newtable.CompleteDineNum; + table.TotalFilmNum = newtable.TotalFilmNum; + table.OKFilmNum = newtable.OKFilmNum; + table.State = newtable.State; + table.CreateMan = newtable.CreateMan; + table.CreateDate = newtable.CreateDate; + db.SubmitChanges(); + } + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index e5cfebf5..4d433940 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -2,6 +2,11 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices.ComTypes; +using System.Runtime.Remoting.Contexts; +using System.Threading.Tasks; +using System.Web.UI.WebControls; +using Aspose.Words.Lists; using FineUIPro; using Model; using Newtonsoft.Json; @@ -12,6 +17,8 @@ namespace BLL { public static SGGLDB Db = Funs.DB; + public static List BeUnderConstructionList = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList(); + public static void AddHSSEData_HSSE(HSSEData_HSSE newtable) { using (var db = new SGGLDB(Funs.ConnString)) @@ -33,6 +40,7 @@ namespace BLL SafeTrainNum = newtable.SafeTrainNum, SpecialTrainNum = newtable.SpecialTrainNum, SpecialOperationTrainNum = newtable.SpecialOperationTrainNum, + EnvironmentalTrainNum = newtable.EnvironmentalTrainNum, TotalEnergyConsumption = newtable.TotalEnergyConsumption, IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, NewWaterConsumption = newtable.NewWaterConsumption, @@ -195,6 +203,7 @@ namespace BLL item.ShutdownNum = dataHsse.ShutdownNum; item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum; item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum; + item.EnvironmentalTrainNum = dataHsse.EnvironmentalTrainNum; item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum; item.SpecialTrainNum = dataHsse.SpecialTrainNum; item.SuperCompletedNum = dataHsse.SuperCompletedNum; @@ -299,6 +308,7 @@ namespace BLL item.ShutdownNum = dataHsse.ShutdownNum; item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum; item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum; + item.EnvironmentalTrainNum = dataHsse.EnvironmentalTrainNum; item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum; item.SpecialTrainNum = dataHsse.SpecialTrainNum; item.SuperCompletedNum = dataHsse.SuperCompletedNum; @@ -330,17 +340,11 @@ namespace BLL return data; } - public static HSSEData GetTodayHSSEData_HSSE() + public static async Task GetTodayHSSEData_HSSE() { - HSSEData data; - var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); - if (q != null && q.State == Const.CNCEC_State_S) - // data = GetItemByHSSEData_HSSE(q, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); ; - data = StatisticalData(); - else - data = StatisticalData(); + var modelTask = StatisticalDataAsync(); + var model = await modelTask; + HSSEData data = model; return data; } @@ -395,26 +399,22 @@ namespace BLL return responeData; } - public static HSSEData StatisticalData() + public static Model.HSSEData_HSSE GetSubUnitHsseDataByDate(string Unitid, DateTime? reportdate) { - var thisUnitId = string.Empty; - var thisUnit = CommonService.GetIsThisUnit(); - if (thisUnit != null) thisUnitId = thisUnit.UnitId; - var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); - Project_HSSEData_HSSEService.StatisticalAllProjectData(); - Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData(); - - var projectData = (from x in Funs.DB.Project_HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); - var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); - var incomeComprehensiveEnergyConsumption = - ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); - var newWaterConsumption = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); - - var table = new HSSEData_HSSE + var result = new Model.HSSEData_HSSE(); + if (reportdate == null) { - UnitId = thisUnitId, + return result; + } + + var projectlist = BLL.ProjectService.GetProjectWorkList(); + var baseUnit = UnitService.GetUnitByUnitId(Unitid); + var projectData = (from x in Funs.DB.Project_HSSEData_HSSE + where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId) + select x).ToList(); + result = new HSSEData_HSSE + { + UnitId = Unitid, CollCropCode = baseUnit.CollCropCode, UnitName = baseUnit.UnitName, ReportDate = DateTime.Now.Date, @@ -428,13 +428,13 @@ namespace BLL SafeTrainNum = projectData.Sum(x => x.SafeTrainNum), SpecialTrainNum = projectData.Sum(x => x.SpecialTrainNum), SpecialOperationTrainNum = projectData.Sum(x => x.SpecialOperationTrainNum), - TotalEnergyConsumption = totalEnergyConsumption, - IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, - NewWaterConsumption = newWaterConsumption, - HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneralNum(), - HeadOfficeFullTimeNum = GetHeadOfficeFullTimeNum(), - BranchInspectorGeneralNum = GetBranchInspectorGeneralNum(), - BranchFullTimeNum = GetBranchFullTimeNum(), + TotalEnergyConsumption = 0, + IncomeComprehensiveEnergyConsumption = 0, + NewWaterConsumption = 0, + HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneral().Count, + HeadOfficeFullTimeNum = GetHeadOfficeFullTime().Count, + BranchInspectorGeneralNum = GetBranchInspectorGeneral().Count, + BranchFullTimeNum = GetBranchFullTime().Count, ProjectInspectorGeneralNum = projectData.Sum(x => x.ProjectInspectorGeneralNum), ProjectFullTimeNum = projectData.Sum(x => x.ProjectFullTimeNum), ProjectSafetyMonitorNum = projectData.Sum(x => x.ProjectSafetyMonitorNum), @@ -442,13 +442,13 @@ namespace BLL CertificateANum = projectData.Sum(x => x.CertificateANum), CertificateBNum = projectData.Sum(x => x.CertificateBNum), CertificateCNum = projectData.Sum(x => x.CertificateCNum), - SafetyCommitteeMeetingNum = GetSafetyCommitteeMeetingNum(), + SafetyCommitteeMeetingNum = GetSafetyCommitteeMeeting().Count, EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(), ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum), ProjectSafetyMeetingNum = projectData.Sum(x => x.ProjectSafetyMeetingNum), - CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheckNum(), - CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheckNum(), - CompanySpecialCheckNum = GetCompanySpecialCheckNum(), + CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheck().Count, + CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheck().Count, + CompanySpecialCheckNum = GetCompanySpecialCheck().Count, ProjectLeadShiftCheckNum = projectData.Sum(x => x.ProjectLeadShiftCheckNum), ProjectSpecialCheckNum = projectData.Sum(x => x.ProjectSpecialCheckNum), ProjectMajorCheckNum = projectData.Sum(x => x.ProjectMajorCheckNum), @@ -458,10 +458,10 @@ namespace BLL MajorAccidentNum = projectData.Sum(x => x.MajorAccidentNum), SeriousAccidentNum = projectData.Sum(x => x.SeriousAccidentNum), SpecialSeriousAccidentNum = projectData.Sum(x => x.SpecialSeriousAccidentNum), - CompanyComprehensivePlanNum = GetCompanyComprehensivePlanNum(), - CompanySpecialPlanNum = GetCompanySpecialPlanNum(), - CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(), - CompanyDrillNum = GetCompanyDrillNum(), + // CompanyComprehensivePlanNum = GetCompanyComprehensivePlan(), + // CompanySpecialPlanNum = GetCompanySpecialPlan(), + // CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(), + // CompanyDrillNum = GetCompanyDrill(), ProjectComprehensivePlanNum = projectData.Sum(x => x.ProjectComprehensivePlanNum), ProjectSpecialPlanNum = projectData.Sum(x => x.ProjectSpecialPlanNum), ProjectOnSiteDisposalPlan = projectData.Sum(x => x.ProjectOnSiteDisposalPlan), @@ -491,6 +491,102 @@ namespace BLL CreateMan = Const.sysglyId, CreateDate = DateTime.Now }; + return result; + } + + public static HSSEData StatisticalData() + { + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); + Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData(); + + var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); + var incomeComprehensiveEnergyConsumption = + ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); + var newWaterConsumption = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); + + var table = new HSSEData_HSSE + { + UnitId = thisUnitId, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ReportDate = DateTime.Now.Date, + BeUnderConstructionNum = GetBeUnderConstruction().Count, + ShutdownNum = GetShutdown().Count, + JoinConstructionPersonNum = GetJoinConstructionPerson().Count, + MajorProjectsUnderConstructionNum = GetMajorProjectsUnderConstruction().Count, + TotalWorkingHour = GetTotalWorkingHour(), + LostWorkingHour = GetLostWorkingHour(), + SafeWorkingHour = GetSafeWorkingHour(), + SafeTrainNum = GetSafeTrain().Sum(x => x.TrainPersonNum), + SpecialTrainNum = GetSpecialTrain().Sum(x => x.TrainPersonNum), + SpecialOperationTrainNum = GetSpecialOperationTrain().Sum(x => x.TrainPersonNum), + EnvironmentalTrainNum = 0, + TotalEnergyConsumption = totalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, + NewWaterConsumption = newWaterConsumption, + HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneral().Count, + HeadOfficeFullTimeNum = GetHeadOfficeFullTime().Count, + BranchInspectorGeneralNum = GetBranchInspectorGeneral().Count, + BranchFullTimeNum = GetBranchFullTime().Count, + ProjectInspectorGeneralNum = GetProjectInspectorGeneral().Count, + ProjectFullTimeNum = GetProjectFullTime().Count, + ProjectSafetyMonitorNum = GetProjectSafetyMonitor().Count, + SafetyInjectionEngineer = GetSafetyInjectionEngineer().Count, + CertificateANum = GetCertificateA().Count, + CertificateBNum = GetCertificateB().Count, + CertificateCNum = GetCertificateC().Count, + SafetyCommitteeMeetingNum = GetSafetyCommitteeMeeting().Count, + EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeeting().Count, + ProjectSafetyLeadingGroupMeetingNum = GetProjectSafetyLeadingGroupMeeting().Count, + ProjectSafetyMeetingNum = GetProjectSafetyMeeting().Count, + CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheck().Count, + CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheck().Count, + CompanySpecialCheckNum = GetCompanySpecialCheck().Count, + ProjectLeadShiftCheckNum = GetProjectLeadShiftCheck().Count, + ProjectSpecialCheckNum = GetProjectSpecialCheck().Count, + ProjectMajorCheckNum = GetProjectMajorCheck().Count, + NearMissNum = GetNearMiss().Count, + RecordableEventNum = GetRecordableEvent().Count, + GeneralAccidentNum = GetGeneralAccident().Count, + MajorAccidentNum = GetMajorAccident().Count, + SeriousAccidentNum = GetSeriousAccident().Count, + SpecialSeriousAccidentNum = GetSpecialSeriousAccident().Count, + CompanyComprehensivePlanNum = GetCompanyComprehensivePlan().Count, + CompanySpecialPlanNum = GetCompanySpecialPlan().Count, + CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan().Count, + CompanyDrillNum = GetCompanyDrill().Count, + ProjectComprehensivePlanNum = GetProjectComprehensivePlan().Count, + ProjectSpecialPlanNum = GetProjectSpecialPlan().Count, + ProjectOnSiteDisposalPlan = GetProjectOnSiteDisposalPlan().Count, + ProjectDrillNum = GetProjectDrill().Count, + CostExtract = Convert.ToInt32(GetCostExtract().Sum(x => x.SUMCost)), + CostUse = Convert.ToInt32(GetCostUse().Sum(x => x.SUMCost)), + UseEquipmentNum = GetUseEquipment().Count, + SpecialEquipmentNum = GetSpecialEquipment().Count, + LicensesNum = GetLicenses().Count, + LicensesCloseNum = GetLicensesClose().Count, + GeneralClosedNum = GetGeneralHiddenRectificationOutputs().Sum(x => x.RecNum), + GeneralNotClosedNum = GetGeneralHiddenRectificationOutputs().Sum(x => x.NoRecNum), + MajorClosedNum = GetMajorHiddenRectificationOutputs().Sum(x => x.RecNum), + MajorNotClosedNum = GetMajorHiddenRectificationOutputs().Sum(x => x.NoRecNum), + GeneralRiskNum = GetSecurityRiskOutputs().Sum(x => x.GeneralRiskNum), + LowRiskNum = GetSecurityRiskOutputs().Sum(x => x.LowRiskNum), + MediumRiskNum = GetSecurityRiskOutputs().Sum(x => x.MediumRiskNum), + HighRiskNum = GetSecurityRiskOutputs().Sum(x => x.HighRiskNum), + CompletedNum = GetLargeEngineeringOutputs().Sum(x => x.CompletedNum), + TrainPersonNum = GetLargeEngineeringOutputs().Sum(x => x.TrainPersonNum), + ConstructionNum = GetLargeEngineeringOutputs().Sum(x => x.ConstructionNum), + FinishedNum = GetLargeEngineeringOutputs().Sum(x => x.FinishedNum), + SuperCompletedNum = GetLargeEngineeringOutputs().Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = GetLargeEngineeringOutputs().Sum(x => x.SuperTrainPersonNum), + SuperConstructionNum = GetLargeEngineeringOutputs().Sum(x => x.SuperConstructionNum), + SuperFinishedNum = GetLargeEngineeringOutputs().Sum(x => x.SuperFinishedNum), + CreateMan = Const.sysglyId, + CreateDate = DateTime.Now + }; if (IsReportByToday()) { table.Id = GetTodayData().Id; @@ -508,6 +604,489 @@ namespace BLL return data; } + public static async Task StatisticalDataAsync() + { + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); + Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData(); + + // 并行执行异步方法 + var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); + var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); + var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); + var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync(); + var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync(); + + var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync(); + var certificateATask = HSSEData_HSSEService.GetCertificateAAsync(); + var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync(); + var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync(); + var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync(); + var shutdownTask = HSSEData_HSSEService.GetShutdownAsync(); + var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync(); + var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync(); + var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync(); + var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync(); + var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync(); + var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync(); + var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync(); + var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync(); + var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync(); + var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync(); + var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync(); + var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync(); + var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync(); + var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync(); + var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync(); + var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync(); + var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync(); + var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync(); + var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync(); + var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync(); + var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync(); + var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync(); + var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync(); + var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync(); + var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync(); + var nearMissTask = HSSEData_HSSEService.GetNearMissAsync(); + var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync(); + var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync(); + var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync(); + var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync(); + var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync(); + var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync(); + var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync(); + var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync(); + var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync(); + var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync(); + var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync(); + var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync(); + var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync(); + var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync(); + var costUseTask = HSSEData_HSSEService.GetCostUseAsync(); + var useEquipmentTask = HSSEData_HSSEService.GetUseEquipmentAsync(); + var specialEquipmentTask = HSSEData_HSSEService.GetSpecialEquipmentAsync(); + var licensesTask = HSSEData_HSSEService.GetLicensesAsync(); + var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync(); + var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync(); + var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync(); + + // 等待所有异步方法执行完成 + await Task.WhenAll( + securityRiskOutputListTask, + largeEngineeringOutputsTask, + safetyInjectionEngineerTask, + certificateATask, + certificateBTask, + certificateCTask, + beUnderConstructionTask, + shutdownTask, + joinConstructionPersonTask, + majorProjectsUnderConstructionTask, + totalWorkingHourTask, + lostWorkingHourTask, + safeWorkingHourTask, + safeTrainTask, + specialTrainTask, + specialOperationTrainTask, + headOfficeInspectorGeneralTask, + headOfficeFullTimeTask, + branchInspectorGeneralTask, + branchFullTimeTask, + projectInspectorGeneralTask, + projectFullTimeTask, + projectSafetyMonitorTask, + safetyCommitteeMeetingTask, + enterpriseTopicsMeetingTask, + projectSafetyLeadingGroupMeetingTask, + projectSafetyMeetingTask, + companyLeadShiftCheckTask, + companyComprehensiveCheckTask, + companySpecialCheckTask, + projectLeadShiftCheckTask, + projectSpecialCheckTask, + projectMajorCheckTask, + nearMissTask, + recordableEventTask, + generalAccidentTask, + majorAccidentTask, + seriousAccidentTask, + specialSeriousAccidentTask, + companyComprehensivePlanTask, + companySpecialPlanTask, + companyOnSiteDisposalPlanTask, + companyDrillTask, + projectComprehensivePlanTask, + projectSpecialPlanTask, + projectOnSiteDisposalPlanTask, + projectDrillTask, + costExtractTask, + costUseTask, + useEquipmentTask, + specialEquipmentTask, + licensesTask, + licensesCloseTask, + generalHiddenRectificationOutputsTask, + majorHiddenRectificationOutputsTask + ); + + + // 统一获取异步方法的返回值 + var totalEnergyConsumption = totalEnergyConsumptionTask; + var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask; + var newWaterConsumption = newWaterConsumptionTask; + var safetyInjectionEngineerList = await safetyInjectionEngineerTask; + var certificateAList = await certificateATask; + var certificateBList = await certificateBTask; + var certificateCList = await certificateCTask; + var beUnderConstructionList = await beUnderConstructionTask; + var shutdownList = await shutdownTask; + var joinConstructionPersonList = await joinConstructionPersonTask; + var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask; + var totalWorkingHour = await totalWorkingHourTask; + var lostWorkingHour = await lostWorkingHourTask; + var safeWorkingHour = await safeWorkingHourTask; + var safeTrainList = await safeTrainTask; + var specialTrainList = await specialTrainTask; + var specialOperationTrainList = await specialOperationTrainTask; + var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask; + var headOfficeFullTimeList = await headOfficeFullTimeTask; + var branchInspectorGeneralList = await branchInspectorGeneralTask; + var branchFullTimeList = await branchFullTimeTask; + var projectInspectorGeneralList = await projectInspectorGeneralTask; + var projectFullTimeList = await projectFullTimeTask; + var projectSafetyMonitorList = await projectSafetyMonitorTask; + var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask; + var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask; + var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask; + var projectSafetyMeetingList = await projectSafetyMeetingTask; + var companyLeadShiftCheckList = await companyLeadShiftCheckTask; + var companyComprehensiveCheckList = await companyComprehensiveCheckTask; + var companySpecialCheckList = await companySpecialCheckTask; + var projectLeadShiftCheckList = await projectLeadShiftCheckTask; + var projectSpecialCheckList = await projectSpecialCheckTask; + var projectMajorCheckList = await projectMajorCheckTask; + var nearMissList = await nearMissTask; + var recordableEventList = await recordableEventTask; + var generalAccidentList = await generalAccidentTask; + var majorAccidentList = await majorAccidentTask; + var seriousAccidentList = await seriousAccidentTask; + var specialSeriousAccidentList = await specialSeriousAccidentTask; + var companyComprehensivePlanList = await companyComprehensivePlanTask; + var companySpecialPlanList = await companySpecialPlanTask; + var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask; + var companyDrillList = await companyDrillTask; + var projectComprehensivePlanList = await projectComprehensivePlanTask; + var projectSpecialPlanList = await projectSpecialPlanTask; + var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask; + var projectDrillList = await projectDrillTask; + var costExtract = await costExtractTask; + var costUseList = await costUseTask; + var useEquipmentList = await useEquipmentTask; + var specialEquipmentList = await specialEquipmentTask; + var licensesList = await licensesTask; + var licensesCloseList = await licensesCloseTask; + var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; + var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; + + // 构造结果对象 + var table = new HSSEData_HSSE + { + UnitId = thisUnitId, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ReportDate = DateTime.Now.Date, + BeUnderConstructionNum = beUnderConstructionList.Count(), + ShutdownNum = shutdownList.Count(), + SafetyInjectionEngineer = safetyInjectionEngineerList.Count(), + CertificateANum = certificateAList.Count(), + CertificateBNum = certificateBList.Count(), + CertificateCNum = certificateCList.Count(), + JoinConstructionPersonNum = joinConstructionPersonList.Count(), + MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(), + TotalWorkingHour = totalWorkingHour, + LostWorkingHour = lostWorkingHour, + SafeWorkingHour = safeWorkingHour, + SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum), + SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum), + SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum), + EnvironmentalTrainNum = 0, + TotalEnergyConsumption = totalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, + NewWaterConsumption = newWaterConsumption, + HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count, + HeadOfficeFullTimeNum = headOfficeFullTimeList.Count, + BranchInspectorGeneralNum = branchInspectorGeneralList.Count, + BranchFullTimeNum = branchFullTimeList.Count, + ProjectInspectorGeneralNum = projectInspectorGeneralList.Count, + ProjectFullTimeNum = projectFullTimeList.Count, + ProjectSafetyMonitorNum = projectSafetyMonitorList.Count, + SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(), + EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(), + ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(), + ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(), + CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(), + CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(), + CompanySpecialCheckNum = companySpecialCheckList.Count(), + ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(), + ProjectSpecialCheckNum = projectSpecialCheckList.Count(), + ProjectMajorCheckNum = projectMajorCheckList.Count(), + NearMissNum = nearMissList.Count(), + RecordableEventNum = recordableEventList.Count(), + GeneralAccidentNum = generalAccidentList.Count(), + MajorAccidentNum = majorAccidentList.Count(), + SeriousAccidentNum = seriousAccidentList.Count(), + SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(), + CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(), + CompanySpecialPlanNum = companySpecialPlanList.Count(), + CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(), + CompanyDrillNum = companyDrillList.Count(), + ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(), + ProjectSpecialPlanNum = projectSpecialPlanList.Count(), + ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(), + ProjectDrillNum = projectDrillList.Count(), + CostExtract = Convert.ToInt32(costExtract.Sum(x => x.SUMCost)), + CostUse = Convert.ToInt32(costUseList.Sum(x => x.SUMCost)), + UseEquipmentNum = useEquipmentList.Count(), + SpecialEquipmentNum = specialEquipmentList.Count(), + LicensesNum = licensesList.Count(), + LicensesCloseNum = licensesCloseList.Count(), + GeneralClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.RecNum), + GeneralNotClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.NoRecNum), + MajorClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.RecNum), + MajorNotClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.NoRecNum), + LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum), + GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum), + MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum), + HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum), + CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum), + TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum), + ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum), + FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum), + SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum), + SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum) + }; + + #region 添加项目统计数据 + + Project_HSSEData_HSSEService.DeleteProject_HSSEData_HSSEByDate(DateTime.Now.Date); + foreach (var projectid in BeUnderConstructionList) + { + var projectHsseData = new Project_HSSEData_HSSE + { + Id = SQLHelper.GetNewID(), + ProjectId = projectid, + UnitId = thisUnitId, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ReportDate = DateTime.Now.Date, + JoinConstructionPersonNum = joinConstructionPersonList.Count(x => x.ProjectId == projectid), + MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => x.ProjectId == projectid), + TotalWorkingHour = 0,//工时数据取自集团报表,项目无法提取 + LostWorkingHour = 0, + SafeWorkingHour = 0, + SafeTrainNum = safeTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), + SpecialTrainNum = specialTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), + SpecialOperationTrainNum = specialOperationTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), + EnvironmentalTrainNum = 0, + TotalEnergyConsumption = 0, + IncomeComprehensiveEnergyConsumption = 0, + NewWaterConsumption = 0, + HeadOfficeInspectorGeneralNum = 0, + HeadOfficeFullTimeNum = 0, + BranchInspectorGeneralNum = 0, + BranchFullTimeNum = 0, + SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => x.ProjectId == projectid), + EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => x.ProjectId == projectid), + CertificateANum = certificateAList.Count(x => x.ProjectId == projectid), + CertificateBNum = certificateBList.Count(x => x.ProjectId == projectid), + CertificateCNum = certificateCList.Count(x => x.ProjectId == projectid), + ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => x.ProjectId == projectid), + ProjectFullTimeNum = projectFullTimeList.Count(x => x.ProjectId == projectid), + ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => x.ProjectId == projectid), + ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => x.ProjectId == projectid), + ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => x.ProjectId == projectid), + CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => x.ProjectId == projectid), + CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => x.ProjectId == projectid), + CompanySpecialCheckNum = companySpecialCheckList.Count(x => x.ProjectId == projectid), + ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => x.ProjectId == projectid), + ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => x.ProjectId == projectid), + ProjectMajorCheckNum = projectMajorCheckList.Count(x => x.ProjectId == projectid), + NearMissNum = nearMissList.Count(x => x.ProjectId == projectid), + RecordableEventNum = recordableEventList.Count(x => x.ProjectId == projectid), + GeneralAccidentNum = generalAccidentList.Count(x => x.ProjectId == projectid), + MajorAccidentNum = majorAccidentList.Count(x => x.ProjectId == projectid), + SeriousAccidentNum = seriousAccidentList.Count(x => x.ProjectId == projectid), + SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => x.ProjectId == projectid), + CompanyComprehensivePlanNum = 0, + CompanySpecialPlanNum = 0, + CompanyOnSiteDisposalPlan = 0, + CompanyDrillNum = 0, + ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => x.ProjectId == projectid), + ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => x.ProjectId == projectid), + ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => x.ProjectId == projectid), + ProjectDrillNum = projectDrillList.Count(x => x.ProjectId == projectid), + CostExtract = Convert.ToInt32(costExtract.Where(x => x.ProjectId == projectid).Sum(x => x.SUMCost)), + CostUse = Convert.ToInt32(costUseList.Where(x => x.ProjectId == projectid).Sum(x => x.SUMCost)), + UseEquipmentNum = useEquipmentList.Count(x => x.ProjectId == projectid), + SpecialEquipmentNum = specialEquipmentList.Count(x => x.ProjectId == projectid), + LicensesNum = licensesList.Count(x => x.ProjectId == projectid), + LicensesCloseNum = licensesCloseList.Count(x => x.ProjectId == projectid), + GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.RecNum), + GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.NoRecNum), + MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.RecNum), + MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.NoRecNum), + LowRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.LowRiskNum), + GeneralRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.GeneralRiskNum), + MediumRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.MediumRiskNum), + HighRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.HighRiskNum), + CompletedNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.CompletedNum), + TrainPersonNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum), + ConstructionNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.ConstructionNum), + FinishedNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.FinishedNum), + SuperCompletedNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.SuperTrainPersonNum), + SuperConstructionNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.SuperConstructionNum) + }; + Project_HSSEData_HSSEService.AddProject_HSSEData_HSSE(projectHsseData); + } + + #endregion + + if (IsReportByToday()) + { + table.Id = GetTodayData().Id; + table.State = Const.CNCEC_State_1; + UpdateHSSEData_HSSE(table); + } + else + { + table.Id = SQLHelper.GetNewID(); + table.State = Const.CNCEC_State_0; + AddHSSEData_HSSE(table); + } + + var data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); + return data; + } + + //public static HSSEData StatisticalDataOld() + //{ + // var thisUnitId = string.Empty; + // var thisUnit = CommonService.GetIsThisUnit(); + // if (thisUnit != null) thisUnitId = thisUnit.UnitId; + // var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); + // Project_HSSEData_HSSEService.StatisticalAllProjectData(); + // Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData(); + + // var projectData = (from x in Funs.DB.Project_HSSEData_HSSE + // where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + // select x).ToList(); + // var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); + // var incomeComprehensiveEnergyConsumption = + // ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); + // var newWaterConsumption = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); + + // var table = new HSSEData_HSSE + // { + // UnitId = thisUnitId, + // CollCropCode = baseUnit.CollCropCode, + // UnitName = baseUnit.UnitName, + // ReportDate = DateTime.Now.Date, + // BeUnderConstructionNum = projectData.Sum(x => x.BeUnderConstructionNum), + // ShutdownNum = projectData.Sum(x => x.ShutdownNum), + // JoinConstructionPersonNum = projectData.Sum(x => x.JoinConstructionPersonNum), + // MajorProjectsUnderConstructionNum = projectData.Sum(x => x.MajorProjectsUnderConstructionNum), + // TotalWorkingHour = projectData.Sum(x => x.TotalWorkingHour), + // LostWorkingHour = projectData.Sum(x => x.LostWorkingHour), + // SafeWorkingHour = projectData.Sum(x => x.SafeWorkingHour), + // SafeTrainNum = projectData.Sum(x => x.SafeTrainNum), + // SpecialTrainNum = projectData.Sum(x => x.SpecialTrainNum), + // SpecialOperationTrainNum = projectData.Sum(x => x.SpecialOperationTrainNum), + // EnvironmentalTrainNum = projectData.Sum(x => x.EnvironmentalTrainNum), + // TotalEnergyConsumption = totalEnergyConsumption, + // IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, + // NewWaterConsumption = newWaterConsumption, + // HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneralNum(), + // HeadOfficeFullTimeNum = GetHeadOfficeFullTimeNum(), + // BranchInspectorGeneralNum = GetBranchInspectorGeneralNum(), + // BranchFullTimeNum = GetBranchFullTimeNum(), + // ProjectInspectorGeneralNum = projectData.Sum(x => x.ProjectInspectorGeneralNum), + // ProjectFullTimeNum = projectData.Sum(x => x.ProjectFullTimeNum), + // ProjectSafetyMonitorNum = projectData.Sum(x => x.ProjectSafetyMonitorNum), + // SafetyInjectionEngineer = projectData.Sum(x => x.SafetyInjectionEngineer), + // CertificateANum = projectData.Sum(x => x.CertificateANum), + // CertificateBNum = projectData.Sum(x => x.CertificateBNum), + // CertificateCNum = projectData.Sum(x => x.CertificateCNum), + // SafetyCommitteeMeetingNum = GetSafetyCommitteeMeetingNum(), + // EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(), + // ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum), + // ProjectSafetyMeetingNum = projectData.Sum(x => x.ProjectSafetyMeetingNum), + // // CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheckNum(), + // // CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheckNum(), + // // CompanySpecialCheckNum = GetCompanySpecialCheckNum(), + // ProjectLeadShiftCheckNum = projectData.Sum(x => x.ProjectLeadShiftCheckNum), + // ProjectSpecialCheckNum = projectData.Sum(x => x.ProjectSpecialCheckNum), + // ProjectMajorCheckNum = projectData.Sum(x => x.ProjectMajorCheckNum), + // NearMissNum = projectData.Sum(x => x.NearMissNum), + // RecordableEventNum = projectData.Sum(x => x.RecordableEventNum), + // GeneralAccidentNum = projectData.Sum(x => x.GeneralAccidentNum), + // MajorAccidentNum = projectData.Sum(x => x.MajorAccidentNum), + // SeriousAccidentNum = projectData.Sum(x => x.SeriousAccidentNum), + // SpecialSeriousAccidentNum = projectData.Sum(x => x.SpecialSeriousAccidentNum), + // //CompanyComprehensivePlanNum = GetCompanyComprehensivePlan(), + // // CompanySpecialPlanNum = GetCompanySpecialPlan(), + // // CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(), + // // CompanyDrillNum = GetCompanyDrill(), + // ProjectComprehensivePlanNum = projectData.Sum(x => x.ProjectComprehensivePlanNum), + // ProjectSpecialPlanNum = projectData.Sum(x => x.ProjectSpecialPlanNum), + // ProjectOnSiteDisposalPlan = projectData.Sum(x => x.ProjectOnSiteDisposalPlan), + // ProjectDrillNum = projectData.Sum(x => x.ProjectDrillNum), + // CostExtract = projectData.Sum(x => x.CostExtract), + // CostUse = projectData.Sum(x => x.CostUse), + // UseEquipmentNum = projectData.Sum(x => x.UseEquipmentNum), + // SpecialEquipmentNum = projectData.Sum(x => x.SpecialEquipmentNum), + // LicensesNum = projectData.Sum(x => x.LicensesNum), + // LicensesCloseNum = projectData.Sum(x => x.LicensesCloseNum), + // GeneralClosedNum = projectData.Sum(x => x.GeneralClosedNum), + // GeneralNotClosedNum = projectData.Sum(x => x.GeneralNotClosedNum), + // MajorClosedNum = projectData.Sum(x => x.MajorClosedNum), + // MajorNotClosedNum = projectData.Sum(x => x.MajorNotClosedNum), + // GeneralRiskNum = projectData.Sum(x => x.GeneralRiskNum), + // LowRiskNum = projectData.Sum(x => x.LowRiskNum), + // MediumRiskNum = projectData.Sum(x => x.MediumRiskNum), + // HighRiskNum = projectData.Sum(x => x.HighRiskNum), + // CompletedNum = projectData.Sum(x => x.CompletedNum), + // TrainPersonNum = projectData.Sum(x => x.TrainPersonNum), + // ConstructionNum = projectData.Sum(x => x.ConstructionNum), + // FinishedNum = projectData.Sum(x => x.FinishedNum), + // SuperCompletedNum = projectData.Sum(x => x.SuperCompletedNum), + // SuperTrainPersonNum = projectData.Sum(x => x.SuperTrainPersonNum), + // SuperConstructionNum = projectData.Sum(x => x.SuperConstructionNum), + // SuperFinishedNum = projectData.Sum(x => x.SuperFinishedNum), + // CreateMan = Const.sysglyId, + // CreateDate = DateTime.Now + // }; + // if (IsReportByToday()) + // { + // table.Id = GetTodayData().Id; + // table.State = Const.CNCEC_State_1; + // UpdateHSSEData_HSSE(table); + // } + // else + // { + // table.Id = SQLHelper.GetNewID(); + // table.State = Const.CNCEC_State_0; + // AddHSSEData_HSSE(table); + // } + + // var data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); + // return data; + //} + public static void UpdateHSSEData_HSSE(HSSEData_HSSE newtable) { using (var db = new SGGLDB(Funs.ConnString)) @@ -530,6 +1109,7 @@ namespace BLL table.SafeTrainNum = newtable.SafeTrainNum; table.SpecialTrainNum = newtable.SpecialTrainNum; table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum; + table.EnvironmentalTrainNum = newtable.EnvironmentalTrainNum; table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; table.NewWaterConsumption = newtable.NewWaterConsumption; @@ -598,82 +1178,591 @@ namespace BLL } } + + + + #region 安监人员数据 /// - /// 获取企业总部总监人数 + /// 获取企业总部总监人数 /// /// - public static int GetHeadOfficeInspectorGeneralNum() + public static List GetHeadOfficeInspectorGeneral() { var unitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_Persons + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() where x.IsPost == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId - select x).Count(); + select new Model.OfSafetySupervisorsOutput + { + ProjectId = "", + ProjectName = "", + UnitName = u.UnitName, + Name = x.PersonName, + Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = x.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); return result; } + /// + /// 获取企业总部总监人数(异步) + /// + /// + public static async Task> GetHeadOfficeInspectorGeneralAsync() + { + return await Task.Run(GetHeadOfficeInspectorGeneral); + } + /// /// 获取企业总部专职人数 /// /// - public static int GetHeadOfficeFullTimeNum() + public static List GetHeadOfficeFullTime() { var unitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_Persons + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId where x.IsPost == true && y.IsHsse == true && x.UnitId == unitId - select x).Count(); + select new Model.OfSafetySupervisorsOutput + { + ProjectName = "", + UnitName = u.UnitName, + Name = x.PersonName, + Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = x.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); return result; } - /// - /// 获取分支机构总监人数 + /// 获取企业总部专职人数(异步) /// /// - public static int GetBranchInspectorGeneralNum() + public static async Task> GetHeadOfficeFullTimeAsync() { - var unitId = string.Empty; - var thisUnit = CommonService.GetIsThisUnit(); - if (thisUnit != null) unitId = thisUnit.UnitId; - var result = (from x in Funs.DB.Person_Persons - join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId - where x.IsPost == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId && y.IsBranch==true - select x).Count(); - return 0; + return await Task.Run(GetHeadOfficeFullTime); } /// /// 获取分支机构专职人数 /// /// - public static int GetBranchFullTimeNum() + public static List GetBranchFullTime() { var unitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_Persons + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - join z in Funs.DB.Base_Unit on x.UnitId equals z.UnitId + where x.IsPost == true && y.IsHsse == true && x.UnitId != unitId && u.IsBranch == true + select new Model.OfSafetySupervisorsOutput + { + ProjectName = "", + UnitName = u.UnitName, + Name = x.PersonName, + Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = x.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取分支机构专职人数(异步) + /// + /// + public static async Task> GetBranchFullTimeAsync() + { - where x.IsPost == true && y.IsHsse == true && x.UnitId != unitId && z.IsBranch == true - select x).Count(); - return 0; + return await Task.Run(GetBranchFullTime); } /// - /// 获取企业安委会会议数 + /// 获取分支机构总监人数 /// /// - public static int GetSafetyCommitteeMeetingNum() + public static List GetBranchInspectorGeneral() { - var result = - (from x in Funs.DB.Meeting_CompanySafetyMeeting where x.CompileDate > Const.DtmarkTime select x) - .Count(); + var unitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) unitId = thisUnit.UnitId; + var result = (from x in Funs.DB.Person_Persons + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + where x.IsPost == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId && u.IsBranch == true + select new Model.OfSafetySupervisorsOutput + { + ProjectName = "", + UnitName = u.UnitName, + Name = x.PersonName, + Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = x.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); return result; } + /// + /// 获取分支机构总监人数(异步) + /// + /// + public static async Task> GetBranchInspectorGeneralAsync() + { + + return await Task.Run(GetBranchInspectorGeneral); + } + /// + /// 获取项目总监人数 + /// + /// + public static List GetProjectInspectorGeneral() + { + var result = (from x in Funs.DB.SitePerson_Person + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + join z in Funs.DB.Person_Persons on x.PersonId equals z.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) && + x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.States == "1" && x.IdentityCard != null + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = z.Sex == null ? "" : (z.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = z.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取项目总监人数(异步) + /// + /// + public static async Task> GetProjectInspectorGeneralAsync() + { + return await Task.Run(GetProjectInspectorGeneral); + } + + /// + /// 获取项目专职人数 + /// + /// + public static List GetProjectFullTime() + { + var result = (from x in Funs.DB.SitePerson_Person + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + join z in Funs.DB.Person_Persons on x.PersonId equals z.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) && y.IsHsse == true && x.States == "1" && x.IdentityCard != null + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = z.Sex == null ? "" : (z.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = z.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取项目专职人数(异步) + /// + /// + public static async Task> GetProjectFullTimeAsync() + { + return await Task.Run(GetProjectFullTime); + } + + /// + /// 获取项目安全监护人数 + /// + /// + public static List GetProjectSafetyMonitor() + { + var result = (from x in Funs.DB.SitePerson_Person + where x.IsSafetyMonitoring == true && x.States == "1" && x.IdentityCard != null + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join post in Funs.DB.Base_WorkPost on x.WorkPostId equals post.WorkPostId into postGroup + from post in postGroup.DefaultIfEmpty() + join z in Funs.DB.Person_Persons on x.PersonId equals z.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = z.Sex == null ? "" : (z.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = post.WorkPostName, + Phone = z.Telephone + }).ToList(); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取项目安全监护人数(异步) + /// + /// + public static async Task> GetProjectSafetyMonitorAsync() + { + return await Task.Run(GetProjectSafetyMonitor); + + } + + /// + /// 获取在岗执业注安师 + /// + /// + public static List GetSafetyInjectionEngineer() + { + var result = (from x in Funs.DB.SitePerson_Person + + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + join a in Funs.DB.Person_Persons on x.PersonId equals a.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) && z.IsRegisterHSSE == true && x.States == "1" && x.IdentityCard != null + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = a.Sex == null ? "" : (a.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = a.Telephone + }).ToList(); + + //var query2 = (from x in Funs.DB.Sys_User + // join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + // from p in pGroup.DefaultIfEmpty() + // join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + // from u in uGroup.DefaultIfEmpty() + // join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId + // join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + // where z.IsRegisterHSSE == true && x.IdentityCard != null && x.IsPost == true + // select new Model.OfSafetySupervisorsOutput + // { + // ProjectId = x.ProjectId, + // ProjectName = p.ProjectName, + // UnitName = u.UnitName, + // Name = x.UserName, + // Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + // IdentityCard = x.IdentityCard, + // WorkPostName = PostService.GetPostNameById(x.WorkPostId), + // Phone = x.Telephone + // }).ToList(); + + //result.AddRange(query2); + result = result + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取在岗执业注安师(异步) + /// + /// + public static async Task> GetSafetyInjectionEngineerAsync() + { + return await Task.Run(GetSafetyInjectionEngineer); + + } + + /// + /// 获取A证人员 + /// + /// + public static List GetCertificateA() + { + var result = new List(); + var query1 = (from x in Funs.DB.SitePerson_Person + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + join a in Funs.DB.Person_Persons on x.PersonId equals a.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "A" && x.States == "1" && x.IdentityCard != null + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = a.Sex == null ? "" : (a.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = a.Telephone + }).ToList(); + //var query2 = (from x in Funs.DB.Sys_User + // join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + // from p in pGroup.DefaultIfEmpty() + // join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + // from u in uGroup.DefaultIfEmpty() + // join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId + // join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + // where z.CertificateType == "A" && x.IdentityCard != null && x.IsPost == true + // select new Model.OfSafetySupervisorsOutput + // { + // ProjectId = x.ProjectId, + // ProjectName = p.ProjectName, + // UnitName = u.UnitName, + // Name = x.UserName, + // Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + // IdentityCard = x.IdentityCard, + // WorkPostName = PostService.GetPostNameById(x.WorkPostId), + // Phone = x.Telephone + // }).ToList(); + //query1.AddRange(query2); + result = query1 + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取A证人员(异步) + /// + /// + public static async Task> GetCertificateAAsync() + { + return await Task.Run(GetCertificateA); + } + + /// + /// 获取B证人员 + /// + /// + public static List GetCertificateB() + { + var result = new List(); + var query1 = (from x in Funs.DB.SitePerson_Person + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + join a in Funs.DB.Person_Persons on x.PersonId equals a.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "B" && x.States == "1" && x.IdentityCard != null + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = a.Sex == null ? "" : (a.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = a.Telephone + }).ToList(); + //var query2 = (from x in Funs.DB.Sys_User + // join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + // from p in pGroup.DefaultIfEmpty() + // join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + // from u in uGroup.DefaultIfEmpty() + // join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId + // join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + // where z.CertificateType == "B" && x.IdentityCard != null && x.IsPost == true + // select new Model.OfSafetySupervisorsOutput + // { + // ProjectId = x.ProjectId, + // ProjectName = p.ProjectName, + // UnitName = u.UnitName, + // Name = x.UserName, + // Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + // IdentityCard = x.IdentityCard, + // WorkPostName = PostService.GetPostNameById(x.WorkPostId), + // Phone = x.Telephone + // }).ToList(); + //query1.AddRange(query2); + result = query1 + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + /// + /// 获取B证人员(异步) + /// + /// + public static async Task> GetCertificateBAsync() + { + return await Task.Run(GetCertificateB); + + } + + /// + /// 获取C证人员 + /// + /// + public static List GetCertificateC() + { + var result = new List(); + var query1 = (from x in Funs.DB.SitePerson_Person + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + join a in Funs.DB.Person_Persons on x.PersonId equals a.PersonId + where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "C" && x.States == "1" && x.IdentityCard != null + select new Model.OfSafetySupervisorsOutput + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = u.UnitId, + UnitName = u.UnitName, + Name = x.PersonName, + Sex = a.Sex == null ? "" : (a.Sex == "1" ? "男" : "女"), + IdentityCard = x.IdentityCard, + WorkPostName = WorkPostService.getWorkPostNameById(x.WorkPostId), + Phone = a.Telephone + }).ToList(); + //var query2 = (from x in Funs.DB.Sys_User + // join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + // from p in pGroup.DefaultIfEmpty() + // join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + // from u in uGroup.DefaultIfEmpty() + // join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId + // join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + // where z.CertificateType == "C" && x.IdentityCard != null && x.IsPost == true + // select new Model.OfSafetySupervisorsOutput + // { + // ProjectId = x.ProjectId, + // ProjectName = p.ProjectName, + // UnitName = u.UnitName, + // Name = x.UserName, + // Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"), + // IdentityCard = x.IdentityCard, + // WorkPostName = PostService.GetPostNameById(x.WorkPostId), + // Phone = x.Telephone + // }).ToList(); + //query1.AddRange(query2); + result = query1 + .GroupBy(x => x.IdentityCard) + .Select(g => g.FirstOrDefault()) + .ToList(); + return result; + } + + /// + /// 获取C证人员(异步) + /// + /// + public static async Task> GetCertificateCAsync() + { + return await Task.Run(GetCertificateC); + } + #endregion + + #region 安全会议数据 + /// + /// 获取企业安委会会数据 + /// + /// + public static List GetSafetyCommitteeMeeting() + { + var result = + (from x in Funs.DB.Meeting_CompanySafetyMeeting + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + where x.CompileDate > Const.DtmarkTime + select new MeetingOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = x.UnitId, + UnitName = u.UnitName, + Id = x.CompanySafetyMeetingId, + MeetingName = x.CompanySafetyMeetingName, + MeetingDate = x.CompanySafetyMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }); + return result.ToList(); + } + /// + /// 获取企业安委会会数据(异步) + /// + /// + public static async Task> GetSafetyCommitteeMeetingAsync() + { + return await Task.Run(GetSafetyCommitteeMeeting); + } + /// /// 获取企业专题会议数 @@ -686,94 +1775,1871 @@ namespace BLL select x).Count(); return result; } + /// + /// 获取企业专题会议 + /// + /// + public static List GetEnterpriseTopicsMeeting() + { + var result = + (from x in Funs.DB.Meeting_CompanySpecialMeeting + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + where x.CompileDate > Const.DtmarkTime + select new MeetingOutput() + { + + UnitId = x.UnitId, + UnitName = u.UnitName, + Id = x.CompanySpecialMeetingId, + MeetingName = x.CompanySpecialMeetingName, + MeetingDate = x.CompanySpecialMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }); + return result.ToList(); + } + /// + /// 获取企业专题会议(异步) + /// + /// + public static async Task> GetEnterpriseTopicsMeetingAsync() + { + return await Task.Run(GetEnterpriseTopicsMeeting); + } + + /// + /// 获取项目班前会 + /// + /// + public static List GetProjectClassMeeting() + { + var result = + ( + from x in Funs.DB.Meeting_ClassMeeting + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where x.CompileDate > Const.DtmarkTime && BeUnderConstructionList.Contains(p.ProjectId) + select new MeetingOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + Id = x.ClassMeetingId, + MeetingName = x.ClassMeetingName, + MeetingDate = x.ClassMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }); + return result.ToList(); + } + /// + /// 获取项目班前会议(异步) + /// + /// + public static async Task> GetProjectClassMeetingAsync() + { + return await Task.Run(GetProjectClassMeeting); + } + + /// + /// 获取项目专题会议 + /// + /// + public static List GetProjectSpecialMeeting() + { + var result = + ( + from x in Funs.DB.Meeting_SpecialMeeting + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where x.CompileDate > Const.DtmarkTime && BeUnderConstructionList.Contains(p.ProjectId) + select new MeetingOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + Id = x.SpecialMeetingId, + MeetingName = x.SpecialMeetingName, + MeetingDate = x.SpecialMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }); + return result.ToList(); + } + /// + /// 获取项目专题会议(异步) + /// + /// + public static async Task> GetProjectSpecialMeetingAsync() + { + return await Task.Run(GetProjectSpecialMeeting); + } + + /// + /// 获取项目安全领导小组会议 + /// + /// + public static List GetProjectSafetyLeadingGroupMeeting() + { + var result = + ( + from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where x.CompileDate > Const.DtmarkTime && BeUnderConstructionList.Contains(p.ProjectId) + select new MeetingOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + Id = x.SafetyLeaderGroupMeetingId, + MeetingName = x.SafetyLeaderGroupMeetingName, + MeetingDate = x.SafetyLeaderGroupMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }); + return result.ToList(); + } + /// + /// 获取项目安全领导小组会议(异步) + /// + /// + public static async Task> GetProjectSafetyLeadingGroupMeetingAsync() + { + return await Task.Run(GetProjectSafetyLeadingGroupMeeting); + } + /// + /// 获取项目安全例会数 + /// + /// + public static List GetProjectSafetyMeeting() + { + var result = (from x in Funs.DB.Meeting_WeekMeeting + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(p.ProjectId) && x.CompileDate > Const.DtmarkTime + select new MeetingOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + Id = x.WeekMeetingId, + MeetingName = x.WeekMeetingName, + MeetingDate = x.WeekMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }).Union + (from x in Funs.DB.Meeting_MonthMeeting + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + select new MeetingOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + Id = x.MonthMeetingId, + MeetingName = x.MonthMeetingName, + MeetingDate = x.MonthMeetingDate, + MeetingHours = x.MeetingHours, + HostMan = x.MeetingHostMan, + AttentPerson = x.AttentPerson, + AttentPersonNum = x.AttentPersonNum, + }); + return result.ToList(); + + } + /// + /// 获取项目安全例会数(异步) + /// + /// + public static async Task> GetProjectSafetyMeetingAsync() + { + return await Task.Run(GetProjectSafetyMeeting); + + } + + #endregion + + #region 安全监督检查数据 /// /// 获取企业负责人带班检查次数 /// /// - public static int GetCompanyLeadShiftCheckNum() + public static List GetCompanyLeadShiftCheck() { var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime - select x).Count(); - return result; + select new Model.CheckOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = x.UnitId, + UnitName = u.UnitName, + Id = x.SuperviseCheckReportId, + CheckTeam = x.CheckTeam, + CheckDate = x.CheckDate, + }); + return result.ToList(); } + /// + /// 获取企业负责人带班检查次数(异步) + /// + /// + public static async Task> GetCompanyLeadShiftCheckAsync() + { + return await Task.Run(GetCompanyLeadShiftCheck); + } + + /// /// 获取企业综合检查次数 /// /// - public static int GetCompanyComprehensiveCheckNum() + public static List GetCompanyComprehensiveCheck() { var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime - select x).Count(); - return result; + select new Model.CheckOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = x.UnitId, + UnitName = u.UnitName, + Id = x.SuperviseCheckReportId, + CheckTeam = x.CheckTeam, + CheckDate = x.CheckDate, + }); + return result.ToList(); + } + /// + /// 获取企业综合检查次数(异步) + /// + /// + public static async Task> GetCompanyComprehensiveCheckAsync() + { + return await Task.Run(GetCompanyComprehensiveCheck); } /// /// 获取企业专项检查次数 /// /// - public static int GetCompanySpecialCheckNum() + public static List GetCompanySpecialCheck() { var result = (from x in Funs.DB.Supervise_SuperviseCheckReport + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime - select x).Count(); - return result; + select new Model.CheckOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = x.UnitId, + UnitName = u.UnitName, + Id = x.SuperviseCheckReportId, + CheckTeam = x.CheckTeam, + CheckDate = x.CheckDate, + }); + return result.ToList(); + } + /// + /// 获取企业专项检查次数(异步) + /// + /// + public static async Task> GetCompanySpecialCheckAsync() + { + return await Task.Run(GetCompanySpecialCheck); + } + /// + /// 获取项目负责人带班检查次数 + /// + /// + public static List GetProjectLeadShiftCheck() + { + var result = (from x in Funs.DB.Check_ProjectLeaderCheck + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(p.ProjectId) && x.CheckDate > Const.DtmarkTime + select new Model.CheckOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds), + Id = x.ProjectLeaderCheckId, + CheckTeam = Person_PersonsService.getPersonsNamesPersonIds(x.LeaderIds), + CheckDate = x.CheckDate, + }); + return result.ToList(); + } + /// + /// 获取项目负责人带班检查次数(异步) + /// + /// + public static async Task> GetProjectLeadShiftCheckAsync() + { + return await Task.Run(GetProjectLeadShiftCheck); } + /// + /// 获取项目专项检查次数 + /// + /// + public static List GetProjectSpecialCheck() + { + var result = (from x in Funs.DB.Check_CheckSpecial + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(p.ProjectId) && x.CheckTime > Const.DtmarkTime + select new Model.CheckOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitName = UnitService.getUnitNamesUnitIds(x.PartInUnits), + Id = x.CheckSpecialId, + CheckTeam = x.PartInPersonNames, + CheckDate = x.CheckTime, + }); + return result.ToList(); + } + /// + /// 获取项目专项检查次数(异步) + /// + /// + public static async Task> GetProjectSpecialCheckAsync() + { + return await Task.Run(GetProjectSpecialCheck); + } + + /// + /// 获取项目专业检查次数 + /// + /// + public static List GetProjectMajorCheck() + { + var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join u in Funs.DB.Base_Unit on x.ResponsibleUnit equals u.UnitId into uGroup + from u in uGroup.DefaultIfEmpty() + join user in Funs.DB.Person_Persons on x.CheckManId equals user.PersonId into userGroup + from user in userGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(p.ProjectId) && x.CheckTime > Const.DtmarkTime + select new Model.CheckOutput() + { + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitId = x.ResponsibleUnit, + UnitName = u.UnitName, + Id = x.HazardRegisterId, + CheckTeam = user.PersonName, + CheckDate = x.CheckTime, + }); + return result.ToList(); + } + /// + /// 获取项目专业检查次数(异步) + /// + /// + public static async Task> GetProjectMajorCheckAsync() + { + return await Task.Run(GetProjectMajorCheck); + } + #endregion + + #region 应急管理数据 /// /// 获取企业级综合预案数 /// /// - public static int GetCompanyComprehensivePlanNum() + public static List GetCompanyComprehensivePlan() { var result = (from x in Funs.DB.Emergency_EmergencyList_Unit join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime - select x).Count(); + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + Id = x.EmergencyListId, + EmergencyName = x.EmergencyName, + EmergencyTypeName = y.EmergencyTypeName, + VersionCode = x.VersionCode, + Date = x.CompileDate, + }).ToList(); return result; } + /// + /// 获取企业级综合预案数(异步) + /// + /// + public static async Task> GetCompanyComprehensivePlanAsync() + { + return await Task.Run(GetCompanyComprehensivePlan); + } /// /// 获取企业级专项预案数 /// /// - public static int GetCompanySpecialPlanNum() + public static List GetCompanySpecialPlan() { var result = (from x in Funs.DB.Emergency_EmergencyList_Unit join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime - select x).Count(); + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + Id = x.EmergencyListId, + EmergencyName = x.EmergencyName, + EmergencyTypeName = y.EmergencyTypeName, + VersionCode = x.VersionCode, + Date = x.CompileDate, + }).ToList(); return result; } + /// + /// 获取企业级专项预案数(异步) + /// + /// + public static async Task> GetCompanySpecialPlanAsync() + { + return await Task.Run(GetCompanySpecialPlan); + } /// /// 获取企业级现场处置预案 /// /// - public static int GetCompanyOnSiteDisposalPlan() + public static List GetCompanyOnSiteDisposalPlan() { var result = (from x in Funs.DB.Emergency_EmergencyList_Unit join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime - select x).Count(); + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + Id = x.EmergencyListId, + EmergencyName = x.EmergencyName, + EmergencyTypeName = y.EmergencyTypeName, + VersionCode = x.VersionCode, + Date = x.CompileDate, + }).ToList(); return result; } + /// + /// 获取企业级现场处置预案(异步) + /// + /// + public static async Task> GetCompanyOnSiteDisposalPlanAsync() + { + return await Task.Run(GetCompanyOnSiteDisposalPlan); + } /// /// 获取企业级演练次数 /// /// - public static int GetCompanyDrillNum() + public static List GetCompanyDrill() { var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit + join y in Funs.DB.Sys_Const on x.DrillRecordType equals y.ConstValue + where y.GroupId == "DrillRecordType" where x.CompileDate > Const.DtmarkTime + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitIds, + UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds), + Id = x.DrillRecordListId, + EmergencyName = x.DrillRecordName, + EmergencyTypeName = y.ConstText, + Date = x.DrillRecordDate, + DrillCost = x.DrillCost, + JointPersonNum = x.JointPersonNum, + }).ToList(); + return result; + } + /// + /// 获取企业级演练次数(异步) + /// + /// + public static async Task> GetCompanyDrillAsync() + { + return await Task.Run(GetCompanyDrill); + } + + /// + /// 获取项目级综合预案 + /// + /// + public static List GetProjectComprehensivePlan() + { + var result = (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where BeUnderConstructionList.Contains(x.ProjectId) && y.EmergencyTypeName.Contains("综合") && + x.CompileDate > Const.DtmarkTime + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + Id = x.EmergencyListId, + EmergencyName = x.EmergencyName, + EmergencyTypeName = y.EmergencyTypeName, + VersionCode = x.VersionCode, + Date = x.CompileDate, + }).ToList(); + return result; + } + /// + /// 获取项目级综合预案(异步) + /// + /// + public static async Task> GetProjectComprehensivePlanAsync() + { + return await Task.Run(GetProjectComprehensivePlan); + } + + /// + /// 获取项目级专项预案数 + /// + /// + public static List GetProjectSpecialPlan() + { + var result = (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where BeUnderConstructionList.Contains(x.ProjectId) && y.EmergencyTypeName.Contains("专项") && + x.CompileDate > Const.DtmarkTime + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + Id = x.EmergencyListId, + EmergencyName = x.EmergencyName, + EmergencyTypeName = y.EmergencyTypeName, + VersionCode = x.VersionCode, + Date = x.CompileDate, + }).ToList(); + return result; + } + /// + /// 获取项目级专项预案数(异步) + /// + /// + public static async Task> GetProjectSpecialPlanAsync() + { + return await Task.Run(GetProjectSpecialPlan); + } + + /// + /// 获取项目级现场处置预案 + /// + /// + public static List GetProjectOnSiteDisposalPlan() + { + var result = (from x in Funs.DB.Emergency_EmergencyList + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where BeUnderConstructionList.Contains(x.ProjectId) && y.EmergencyTypeName.Contains("现场处置") && + x.CompileDate > Const.DtmarkTime + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + Id = x.EmergencyListId, + EmergencyName = x.EmergencyName, + EmergencyTypeName = y.EmergencyTypeName, + VersionCode = x.VersionCode, + Date = x.CompileDate, + }).ToList(); + return result; + } + /// + /// 获取项目级现场处置预案(异步) + /// + /// + public static async Task> GetProjectOnSiteDisposalPlanAsync() + { + return await Task.Run(GetProjectOnSiteDisposalPlan); + } + + /// + /// 获取项目级演练次数 + /// + /// + public static List GetProjectDrill() + { + var result = (from x in Funs.DB.Emergency_DrillRecordList + join y in Funs.DB.Sys_Const on x.DrillRecordType equals y.ConstValue + where y.GroupId == "DrillRecordType" + where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + select new Model.EmergencyOutput + { + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitIds, + UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds), + Id = x.DrillRecordListId, + EmergencyName = x.DrillRecordName, + EmergencyTypeName = y.ConstText, + Date = x.DrillRecordDate, + DrillCost = x.DrillCost, + JointPersonNum = x.JointPersonNum, + }).ToList(); + return result; + } + /// + /// 获取项目级演练次数(异步) + /// + /// + public static async Task> GetProjectDrillAsync() + { + return await Task.Run(GetProjectDrill); + } + #endregion + + #region 基础信息 + /// + /// 获取在建项目数 + /// + /// + public static List GetBeUnderConstruction() + { + var projectInfos = from project in Funs.DB.Base_Project + join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin + from unit in unitJoin.DefaultIfEmpty() + join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin + from projectType in projectTypeJoin.DefaultIfEmpty() + join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin + from sysConst in sysConstJoin.DefaultIfEmpty() + where project.ProjectState == "1" + select new ProjectOutput + { + ProjectId = project.ProjectId, + ProjectCode = project.ProjectCode, + ProjectName = project.ProjectName, + UnitId = project.UnitId, + UnitName = unit.UnitName, + StartDate = project.StartDate, + EndDate = project.EndDate, + ProjectAddress = project.ProjectAddress, + ShortName = project.ShortName, + ConstructionMoney = project.ConstructionMoney, + ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"), + ProjectState = project.ProjectState, + ProjectAttributeName = "工程", + ProjectMoney = project.ProjectMoney, + DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, + ProjectTypeName = projectType.ProjectTypeName, + ProjectStateName2 = sysConst.ConstText + }; + var result = projectInfos.ToList(); + return result; + } + /// + /// 获取在建项目数(异步) + /// + /// + public static async Task> GetBeUnderConstructionAsync() + { + return await Task.Run(GetBeUnderConstruction); + } + + + /// + /// 获取停工项目数 + /// + /// + public static List GetShutdown() + { + var projectInfos = from project in Funs.DB.Base_Project + join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin + from unit in unitJoin.DefaultIfEmpty() + join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin + from projectType in projectTypeJoin.DefaultIfEmpty() + join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin + from sysConst in sysConstJoin.DefaultIfEmpty() + where project.ProjectState == "2" + select new ProjectOutput + { + ProjectId = project.ProjectId, + ProjectCode = project.ProjectCode, + ProjectName = project.ProjectName, + UnitId = project.UnitId, + UnitName = unit.UnitName, + StartDate = project.StartDate, + EndDate = project.EndDate, + ProjectAddress = project.ProjectAddress, + ShortName = project.ShortName, + ConstructionMoney = project.ConstructionMoney, + ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"), + ProjectState = project.ProjectState, + ProjectAttributeName = "工程", + ProjectMoney = project.ProjectMoney, + DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, + ProjectTypeName = projectType.ProjectTypeName, + ProjectStateName2 = sysConst.ConstText + }; + var result = projectInfos.ToList(); + return result; + } + /// + /// 获取停工项目数(异步) + /// + /// + public static async Task> GetShutdownAsync() + { + return await Task.Run(GetShutdown); + } + /// + /// 获取完工项目数 + /// + /// + public static List GetCompletedProject() + { + var projectInfos = from project in Funs.DB.Base_Project + join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin + from unit in unitJoin.DefaultIfEmpty() + join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin + from projectType in projectTypeJoin.DefaultIfEmpty() + join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin + from sysConst in sysConstJoin.DefaultIfEmpty() + where project.ProjectState == "3" + select new ProjectOutput + { + ProjectId = project.ProjectId, + ProjectCode = project.ProjectCode, + ProjectName = project.ProjectName, + UnitId = project.UnitId, + UnitName = unit.UnitName, + StartDate = project.StartDate, + EndDate = project.EndDate, + ProjectAddress = project.ProjectAddress, + ShortName = project.ShortName, + ConstructionMoney = project.ConstructionMoney, + ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"), + ProjectState = project.ProjectState, + ProjectAttributeName = "工程", + ProjectMoney = project.ProjectMoney, + DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, + ProjectTypeName = projectType.ProjectTypeName, + ProjectStateName2 = sysConst.ConstText + }; + var result = projectInfos.ToList(); + return result; + } + /// + /// 获取所有项目数 + /// + /// + public static List GetALLProject() + { + var projectInfos = from project in Funs.DB.Base_Project + join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin + from unit in unitJoin.DefaultIfEmpty() + join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin + from projectType in projectTypeJoin.DefaultIfEmpty() + join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin + from sysConst in sysConstJoin.DefaultIfEmpty() + select new ProjectOutput + { + ProjectId = project.ProjectId, + ProjectCode = project.ProjectCode, + ProjectName = project.ProjectName, + UnitId = project.UnitId, + UnitName = unit.UnitName, + StartDate = project.StartDate, + EndDate = project.EndDate, + ProjectAddress = project.ProjectAddress, + ShortName = project.ShortName, + ConstructionMoney = project.ConstructionMoney, + ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"), + ProjectState = project.ProjectState, + ProjectAttributeName = "工程", + ProjectMoney = project.ProjectMoney, + DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, + ProjectTypeName = projectType.ProjectTypeName, + ProjectStateName2 = sysConst.ConstText + }; + var result = projectInfos.ToList(); + return result; + } + + /// + /// 获取参建人数 + /// + /// + public static List GetJoinConstructionPerson() + { + var result = (from x in Funs.DB.SitePerson_Person + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "1" + select new Model.BaseEntities + { + Id = x.PersonId, + ProjectId = x.ProjectId, + UnitId = x.UnitId + }).ToList(); + return result; + } + /// + /// 获取参建人数(异步) + /// + /// + public static async Task> GetJoinConstructionPersonAsync() + { + return await Task.Run(GetJoinConstructionPerson); + } + + + /// + /// 获取在施危大工程数 + /// + /// + public static List GetMajorProjectsUnderConstruction() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "2" && + x.RecordTime > Const.DtmarkTime + select new Model.BaseEntities + { + Id = x.HazardId, + ProjectId = x.ProjectId, + }).ToList(); + return result; + } + /// + /// 获取在施危大工程数(异步) + /// + /// + public static async Task> GetMajorProjectsUnderConstructionAsync() + { + return await Task.Run(GetMajorProjectsUnderConstruction); + } + + #endregion + + #region 工时数据 + /// + /// 获取总工时数 + /// + /// + public static int GetTotalWorkingHour() + { + + var thisUnitid = BLL.Const.UnitId_SEDIN; + var yearSumItems = (from x in Funs.DB.Information_MillionsMonthlyReportItem + join y in Funs.DB.Information_MillionsMonthlyReport + on x.MillionsMonthlyReportId equals y.MillionsMonthlyReportId + where y.UnitId == thisUnitid && y.Year == DateTime.Now.Year && y.Month <= DateTime.Now.Month + && x.Affiliation == "本月合计" + select x).Distinct().ToList(); + var result = Convert.ToInt32(yearSumItems.Sum(x => x.TotalWorkNum ?? 0)); + return result; + /*var result = (from x in Funs.DB.SitePerson_DayReportDetail + join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId + where BeUnderConstructionList.Contains(y.ProjectId) && y.CompileDate > Const.DtmarkTime + select x.PersonWorkTime ?? 0).ToList().Sum(); + var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); + */ + + } + /// + /// 获取总工时数(异步) + /// + /// + public static async Task GetTotalWorkingHourAsync() + { + return await Task.Run(GetTotalWorkingHour); + + } + + /// + /// 获取损失工时数 + /// + /// + public static int GetLostWorkingHour() + { + //var result = + // (from x in Funs.DB.Accident_AccidentHandle + // where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + // select x.WorkHoursLoss) + // .ToList().Sum(x => x.Value) + // + (from x in Funs.DB.Accident_AccidentReport + // where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + // select x.WorkingHoursLoss) + // .ToList().Sum(x => x.Value); + //var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); + var q = 0; + return q; + } + /// + /// 获取损失工时数(异步) + /// + /// + public static async Task GetLostWorkingHourAsync() + { + return await Task.Run(GetLostWorkingHour); + } + + /// + /// 获取安全工时数 + /// + /// + public static int GetSafeWorkingHour() + { + /*var result1 = (from x in Funs.DB.SitePerson_DayReportDetail + join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId + where BeUnderConstructionList.Contains(y.ProjectId) && y.CompileDate > Const.DtmarkTime + select x.PersonWorkTime ?? 0).ToList().Sum(); + var result2 = + (from x in Funs.DB.Accident_AccidentHandle + where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + select x.WorkHoursLoss) + .ToList().Sum(x => x.Value) + + (from x in Funs.DB.Accident_AccidentReport + where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + select x.WorkingHoursLoss) + .ToList().Sum(x => x.Value); + var result = result1 - result2; + var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); + + return q;*/ + var thisUnitid = BLL.Const.UnitId_SEDIN; + var yearSumItems = (from x in Funs.DB.Information_MillionsMonthlyReportItem + join y in Funs.DB.Information_MillionsMonthlyReport + on x.MillionsMonthlyReportId equals y.MillionsMonthlyReportId + where y.UnitId == thisUnitid && y.Year == DateTime.Now.Year && y.Month <= DateTime.Now.Month + && x.Affiliation == "本月合计" + select x).Distinct().ToList(); + var result = Convert.ToInt32(yearSumItems.Sum(x => x.TotalWorkNum ?? 0)); + return result; + } + /// + /// 获取安全工时数(异步) + /// + /// + public static async Task GetSafeWorkingHourAsync() + { + return await Task.Run(GetSafeWorkingHour); + } + + #endregion + + #region 安全教育培训 + + /// + /// 获取三级安全教育培训数 + /// + /// + public static List GetSafeTrain() + { + var result = (from x in Funs.DB.EduTrain_TrainRecord + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId + where BeUnderConstructionList.Contains(p.ProjectId) && y.TrainType == "1" && + x.TrainStartDate > Const.DtmarkTime + select new Model.EduTrainOutput() + { + + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds), + Id = x.TrainingId, + TrainTitle = x.TrainTitle, + TrainStartDate = x.TrainStartDate, + TrainEndDate = x.TrainEndDate, + TrainPersonNum = x.TrainPersonNum ?? 0, + }).ToList(); + return result; + } + /// + /// 获取三级安全教育培训数(异步) + /// + /// + public static async Task> GetSafeTrainAsync() + { + return await Task.Run(GetSafeTrain); + } + + /// + /// 获取专项培训数 + /// + /// + public static List GetSpecialTrain() + { + var result = (from x in Funs.DB.EduTrain_TrainRecord + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId + where BeUnderConstructionList.Contains(p.ProjectId) && y.TrainType == "2" && + x.TrainStartDate > Const.DtmarkTime + select new Model.EduTrainOutput() + { + + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds), + Id = x.TrainingId, + TrainTitle = x.TrainTitle, + TrainStartDate = x.TrainStartDate, + TrainEndDate = x.TrainEndDate, + TrainPersonNum = x.TrainPersonNum ?? 0, + }).ToList(); + return result; + } + /// + /// 获取专项培训数(异步) + /// + /// + public static async Task> GetSpecialTrainAsync() + { + return await Task.Run(GetSpecialTrain); + } + + /// + /// 获取特种作业培训数 + /// + /// + public static List GetSpecialOperationTrain() + { + var result = (from x in Funs.DB.EduTrain_TrainRecord + join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId + where BeUnderConstructionList.Contains(p.ProjectId) && y.TrainType == "3" && + x.TrainStartDate > Const.DtmarkTime + select new Model.EduTrainOutput() + { + + ProjectId = x.ProjectId, + ProjectName = p.ProjectName, + UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds), + Id = x.TrainingId, + TrainTitle = x.TrainTitle, + TrainStartDate = x.TrainStartDate, + TrainEndDate = x.TrainEndDate, + TrainPersonNum = x.TrainPersonNum ?? 0, + }).ToList(); + return result; + } + + public static async Task> GetSpecialOperationTrainAsync() + { + return await Task.Run(GetSpecialOperationTrain); + } + + #endregion + + + + /// + /// 获取能耗总量 + /// + /// + public static int GetTotalEnergyConsumption() + { + var result = 0; + return result; + } + + /// + /// 获取万元营业收入综合能耗 + /// + /// + public static int GetIncomeComprehensiveEnergyConsumption() + { + var result = 0; + return result; + } + + /// + /// 获取二氧化碳 + /// + /// + public static int GetNewWaterConsumption() + { + var result = 0; + return result; + } + + + #region 事故事件数据 + + /// + /// 获取未遂事件数 + /// + /// + public static List GetNearMiss() + { + var result = (from Record in Funs.DB.Accident_AccidentPersonRecord + join AccidentType in Funs.DB.Base_AccidentType on Record.AccidentTypeId equals AccidentType.AccidentTypeId into AccidentTypeGroup + from AccidentType in AccidentTypeGroup.DefaultIfEmpty() + join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup + from Project in ProjectGroup.DefaultIfEmpty() + join Person in Funs.DB.SitePerson_Person on Record.PersonId equals Person.PersonId into PersonGroup + from Person in PersonGroup.DefaultIfEmpty() + join Unit in Funs.DB.Base_Unit on Person.UnitId equals Unit.UnitId into UnitGroup + from Unit in UnitGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(Record.ProjectId) && Record.IsAttempt == "1" && Record.AccidentDate > Const.DtmarkTime + select new AccidentOutput + { + Id = Record.AccidentPersonRecordId, + ProjectId = Record.ProjectId, + ProjectCode = Project.ProjectCode, + ProjectName = Project.ProjectName, + AccidentTypeName = AccidentType.AccidentTypeName, + AccidentDate = Record.AccidentDate, + UnitId = Unit.UnitId, + UnitName = Unit.UnitName, + PeopleNum = 1, + Info = Record.Injury == "1" ? "死亡" : (Record.Injury == "2" ? "重伤" : "轻伤") + }).ToList(); + return result; + } + + public static async Task> GetNearMissAsync() + { + return await Task.Run(GetNearMiss); + } + + /// + /// 获取可记录事件数 + /// + /// + public static List GetRecordableEvent() + { + var result = (from Record in Funs.DB.Accident_AccidentPersonRecord + join AccidentType in Funs.DB.Base_AccidentType on Record.AccidentTypeId equals AccidentType.AccidentTypeId into AccidentTypeGroup + from AccidentType in AccidentTypeGroup.DefaultIfEmpty() + join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup + from Project in ProjectGroup.DefaultIfEmpty() + join Person in Funs.DB.SitePerson_Person on Record.PersonId equals Person.PersonId into PersonGroup + from Person in PersonGroup.DefaultIfEmpty() + join Unit in Funs.DB.Base_Unit on Person.UnitId equals Unit.UnitId into UnitGroup + from Unit in UnitGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDate > Const.DtmarkTime + select new AccidentOutput + { + Id = Record.AccidentPersonRecordId, + ProjectId = Record.ProjectId, + ProjectCode = Project.ProjectCode, + ProjectName = Project.ProjectName, + AccidentTypeName = AccidentType.AccidentTypeName, + AccidentDate = Record.AccidentDate, + UnitId = Unit.UnitId, + UnitName = Unit.UnitName, + PeopleNum = 1, + Info = Record.Injury == "1" ? "死亡" : (Record.Injury == "2" ? "重伤" : "轻伤") + }).ToList(); + return result; + } + + public static async Task> GetRecordableEventAsync() + { + return await Task.Run(GetRecordableEvent); + } + + /// + /// 获取一般事故数 + /// + /// + public static List GetGeneralAccident() + { + var query = from Record in Funs.DB.Accident_AccidentReport + join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup + from AccidentType in AccidentTypeGroup.DefaultIfEmpty() + join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup + from Project in ProjectGroup.DefaultIfEmpty() + join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup + from Unit in UnitGroup.DefaultIfEmpty() + where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "1" + select new AccidentOutput + { + Id = Record.AccidentReportId, + ProjectId = Record.ProjectId, + ProjectCode = Project.ProjectCode, + ProjectName = Project.ProjectName, + AccidentTypeName = AccidentType.ConstText, + AccidentDate = Record.AccidentDate, + UnitId = Unit.UnitId, + UnitName = Unit.UnitName, + PeopleNum = Record.PeopleNum, + Info = Record.Abstract + }; + + var result = query.ToList(); + + + return result; + } + + public static async Task> GetGeneralAccidentAsync() + { + return await Task.Run(GetGeneralAccident); + } + + /// + /// 获取较大事故数 + /// + /// + public static List GetMajorAccident() + { + var query = from Record in Funs.DB.Accident_AccidentReport + join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup + from AccidentType in AccidentTypeGroup.DefaultIfEmpty() + join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup + from Project in ProjectGroup.DefaultIfEmpty() + join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup + from Unit in UnitGroup.DefaultIfEmpty() + where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "2" + select new AccidentOutput + { + Id = Record.AccidentReportId, + ProjectId = Record.ProjectId, + ProjectCode = Project.ProjectCode, + ProjectName = Project.ProjectName, + AccidentTypeName = AccidentType.ConstText, + AccidentDate = Record.AccidentDate, + UnitId = Unit.UnitId, + UnitName = Unit.UnitName, + PeopleNum = Record.PeopleNum, + Info = Record.Abstract + }; + + var result = query.ToList(); + return result; + } + + public static async Task> GetMajorAccidentAsync() + { + return await Task.Run(GetMajorAccident); + } + + /// + /// 获取重大事故数 + /// + /// + public static List GetSeriousAccident() + { + var query = from Record in Funs.DB.Accident_AccidentReport + join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup + from AccidentType in AccidentTypeGroup.DefaultIfEmpty() + join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup + from Project in ProjectGroup.DefaultIfEmpty() + join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup + from Unit in UnitGroup.DefaultIfEmpty() + where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "3" + select new AccidentOutput + { + Id = Record.AccidentReportId, + ProjectId = Record.ProjectId, + ProjectCode = Project.ProjectCode, + ProjectName = Project.ProjectName, + AccidentTypeName = AccidentType.ConstText, + AccidentDate = Record.AccidentDate, + UnitId = Unit.UnitId, + UnitName = Unit.UnitName, + PeopleNum = Record.PeopleNum, + Info = Record.Abstract + }; + + var result = query.ToList(); + return result; + } + + public static async Task> GetSeriousAccidentAsync() + { + return await Task.Run(GetSeriousAccident); + } + /// + /// 获取特别重大事故数 + /// + /// + public static List GetSpecialSeriousAccident() + { + var query = from Record in Funs.DB.Accident_AccidentReport + join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup + from AccidentType in AccidentTypeGroup.DefaultIfEmpty() + join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup + from Project in ProjectGroup.DefaultIfEmpty() + join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup + from Unit in UnitGroup.DefaultIfEmpty() + where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "4" + select new AccidentOutput + { + Id = Record.AccidentReportId, + ProjectId = Record.ProjectId, + ProjectCode = Project.ProjectCode, + ProjectName = Project.ProjectName, + AccidentTypeName = AccidentType.ConstText, + AccidentDate = Record.AccidentDate, + UnitId = Unit.UnitId, + UnitName = Unit.UnitName, + PeopleNum = Record.PeopleNum, + Info = Record.Abstract + }; + + var result = query.ToList(); + return result; + } + + public static async Task> GetSpecialSeriousAccidentAsync() + { + return await Task.Run(GetSpecialSeriousAccident); + } + + + #endregion + + #region 安全费用 + + /// + /// 获取费用提取(万元) + /// + /// + public static List GetCostExtract() + { + var query = from cost in Funs.DB.CostGoods_CostSmallDetail + join p in Funs.DB.Base_Project on cost.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on cost.UnitId equals unit.UnitId into unitGroup + from unit in unitGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(p.ProjectId) + select new CostSmallDetailOutput + { + Id = cost.CostSmallDetailId, + ProjectId = p.ProjectId, + ProjectCode = p.ProjectCode, + ProjectName = p.ProjectName, + UnitId = cost.UnitId, + UnitName = unit.UnitName, + Months = cost.Months, + SUMCost = cost.Extract//Math.Round(sumCost, 2) + }; + return query.ToList(); + } + public static async Task> GetCostExtractAsync() + { + return await Task.Run(GetCostExtract); + } + + /// + /// 获取费用使用(万元) + /// + /// + public static List GetCostUse() + { + var query = from cost in Funs.DB.CostGoods_CostSmallDetail + join p in Funs.DB.Base_Project on cost.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on cost.UnitId equals unit.UnitId into unitGroup + from unit in unitGroup.DefaultIfEmpty() + let sumCost = (from item in Funs.DB.CostGoods_CostSmallDetailItem + where item.CostSmallDetailId == cost.CostSmallDetailId + select item.CostMoney).Sum() * 1.0m // 10000 + where BeUnderConstructionList.Contains(p.ProjectId) + select new CostSmallDetailOutput + { + Id = cost.CostSmallDetailId, + ProjectId = p.ProjectId, + ProjectCode = p.ProjectCode, + ProjectName = p.ProjectName, + UnitId = cost.UnitId, + UnitName = unit.UnitName, + Months = cost.Months, + SUMCost = sumCost//Math.Round(sumCost, 2) + }; + /*var result = 0; + var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem + join y in Funs.DB.CostGoods_CostSmallDetail + on x.CostSmallDetailId equals y.CostSmallDetailId + where BeUnderConstructionList.Contains(y.ProjectId) && y.CompileDate > Const.DtmarkTime + select x.CostMoney ?? 0).ToList().Sum(); + result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]);*/ + return query.ToList(); + } + public static async Task> GetCostUseAsync() + { + return await Task.Run(GetCostUse); + } + + #endregion + + #region 施工机具 + + /// + /// 获取施工机具在用数 + /// + /// + public static List GetUseEquipment() + { + var query = (from item in Funs.DB.InApproveManager_EquipmentInItem + join eq in Funs.DB.InApproveManager_EquipmentIn on item.EquipmentInId equals eq.EquipmentInId into eqGroup + from eq in eqGroup.DefaultIfEmpty() + join spe in Funs.DB.Base_SpecialEquipment on item.SpecialEquipmentId equals spe.SpecialEquipmentId into speGroup + from spe in speGroup.DefaultIfEmpty() + join p in Funs.DB.Base_Project on eq.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on eq.UnitId equals unit.UnitId into unitGroup + from unit in unitGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(eq.ProjectId) + select new ConstructionEquipmentOutput + { + Id = item.EquipmentInItemId, + ProjectId = eq.ProjectId, + //ProjectCode = p.ProjectCode, + ProjectName = p.ProjectName, + //UnitId = eq.UnitId, + UnitName = unit.UnitName, + //SpecialEquipmentId = item.SpecialEquipmentId, + SpecialEquipmentName = spe.SpecialEquipmentName, + SizeModel = item.SizeModel, + OwnerCheck = item.OwnerCheck, + CertificateNum = item.CertificateNum, + IsUsed = true, + CompileDate = eq.CompileDate, + EQType = "特种设备" + }) + .Union( + from item in Funs.DB.InApproveManager_GeneralEquipmentInItem + join eq in Funs.DB.InApproveManager_GeneralEquipmentIn on item.GeneralEquipmentInId equals eq.GeneralEquipmentInId into eqGroup + from eq in eqGroup.DefaultIfEmpty() + join spe in Funs.DB.Base_SpecialEquipment on item.SpecialEquipmentId equals spe.SpecialEquipmentId into speGroup + from spe in speGroup.DefaultIfEmpty() + join p in Funs.DB.Base_Project on eq.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on eq.UnitId equals unit.UnitId into unitGroup + from unit in unitGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(eq.ProjectId) + select new ConstructionEquipmentOutput + { + Id = item.GeneralEquipmentInItemId, + ProjectId = eq.ProjectId, + // ProjectCode = p.ProjectCode, + ProjectName = p.ProjectName, + // UnitId = eq.UnitId, + UnitName = unit.UnitName, + // SpecialEquipmentId = item.SpecialEquipmentId, + SpecialEquipmentName = spe.SpecialEquipmentName, + SizeModel = item.SizeModel, + OwnerCheck = item.OwnerCheck, + CertificateNum = item.CertificateNum, + IsUsed = true, + CompileDate = eq.CompileDate, + EQType = "一般设备" + } + ); + + return query.ToList(); + } + public static async Task> GetUseEquipmentAsync() + { + return await Task.Run(GetUseEquipment); + } + + + + /// + /// 获取施工机具特种设备数 + /// + /// + public static List GetSpecialEquipment() + { + var query = (from item in Funs.DB.InApproveManager_EquipmentInItem + join eq in Funs.DB.InApproveManager_EquipmentIn on item.EquipmentInId equals eq.EquipmentInId into + eqGroup + from eq in eqGroup.DefaultIfEmpty() + join spe in Funs.DB.Base_SpecialEquipment on item.SpecialEquipmentId equals spe.SpecialEquipmentId into + speGroup + from spe in speGroup.DefaultIfEmpty() + join p in Funs.DB.Base_Project on eq.ProjectId equals p.ProjectId into pGroup + from p in pGroup.DefaultIfEmpty() + join unit in Funs.DB.Base_Unit on eq.UnitId equals unit.UnitId into unitGroup + from unit in unitGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(eq.ProjectId) + select new ConstructionEquipmentOutput + { + Id = item.EquipmentInItemId, + ProjectId = eq.ProjectId, + //ProjectCode = p.ProjectCode, + ProjectName = p.ProjectName, + //UnitId = eq.UnitId, + UnitName = unit.UnitName, + //SpecialEquipmentId = item.SpecialEquipmentId, + SpecialEquipmentName = spe.SpecialEquipmentName, + SizeModel = item.SizeModel, + OwnerCheck = item.OwnerCheck, + CertificateNum = item.CertificateNum, + IsUsed = true, + CompileDate = eq.CompileDate, + EQType = "特种设备" + }); + return query.ToList(); + } + public static async Task> GetSpecialEquipmentAsync() + { + return await Task.Run(GetSpecialEquipment); + } + + #endregion + + #region 高风险作业许可 + + + /// + /// 获取作业许可项数 + /// + /// + public static List GetLicenses() + { + var result = (from x in Funs.DB.View_License_LicenseManager + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true && + x.CompileDate > Const.DtmarkTime + select new Model.LicenseOutput + { + Id = x.LicenseManagerId, + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + LicenseTypeName = x.LicenseTypeName, + UnitTypeName = "", + IsHighRisk = x.IsHighRisk, + WorkAreaName = "", + CompileDate = x.CompileDate, + StartDate = x.StartDate, + EndDate = x.EndDate, + WorkStatesStr = "" + }).ToList(); + return result; + } + public static async Task> GetLicensesAsync() + { + + return await Task.Run(GetLicenses); + } + + /// + /// 获取作业许可关闭项数 + /// + /// + public static List GetLicensesClose() + { + var result = (from x in Funs.DB.View_License_LicenseManager + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true && + x.CompileDate > Const.DtmarkTime + select new Model.LicenseOutput + { + Id = x.LicenseManagerId, + ProjectId = x.ProjectId, + ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), + UnitId = x.UnitId, + UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), + LicenseTypeName = x.LicenseTypeName, + UnitTypeName = "", + IsHighRisk = x.IsHighRisk, + WorkAreaName = "", + CompileDate = x.CompileDate, + StartDate = x.StartDate, + EndDate = x.EndDate, + WorkStatesStr = "" + }).ToList(); + return result; + } + public static async Task> GetLicensesCloseAsync() + { + return await Task.Run(GetLicensesClose); + } + + #endregion + + #region 隐患整改 + + /// + /// 获取一般隐患数据 + /// + /// + public static List GetGeneralHiddenRectificationOutputs() + { + + var query = (from x in Funs.DB.Base_Project + join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup + from y in yGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && (y.HazardValue == "0.3" || y.HazardValue == "1" || y.HazardValue == null) && y.CheckTime > Const.DtmarkTime + group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg + select new HiddenRectificationOutput + { + ProjectId = gg.Key.ProjectId, + ProjectName = gg.Key.ProjectName, + ProjectCode = gg.Key.ProjectCode, + ProNum = gg.Count(y => y.States != "4" && y.States != "-1"), + RecNum = gg.Count(y => y.States == "3"), + NoRecNum = gg.Count(y => y.States != "3" && y.States != "-1"), + RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" : + Math.Round(Convert.ToDecimal(gg.Count(y => y.States == "3") / + gg.Count(y => y.States != "4" && y.States != "-1") * 100), 2, MidpointRounding.AwayFromZero).ToString() + }).ToList(); + + foreach (var item in query) + { + item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数 + } + return query; + } + public static async Task> GetGeneralHiddenRectificationOutputsAsync() + { + return await Task.Run(GetGeneralHiddenRectificationOutputs); + } + + /// + /// 获取重大隐患数据 + /// + /// + public static List GetMajorHiddenRectificationOutputs() + { + var query = (from x in Funs.DB.Base_Project + join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup + from y in yGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.HazardValue == "3" && y.CheckTime > Const.DtmarkTime + group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg + select new HiddenRectificationOutput + { + ProjectId = gg.Key.ProjectId, + ProjectName = gg.Key.ProjectName, + ProjectCode = gg.Key.ProjectCode, + ProNum = gg.Count(y => y.States != "4" && y.States != "-1"), + RecNum = gg.Count(y => y.States == "3"), + NoRecNum = gg.Count(y => y.States != "3" && y.States != "-1"), + RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" : + Math.Round((decimal)gg.Count(y => y.States == "3") / + gg.Count(y => y.States != "4" && y.States != "-1") * 100, 2, MidpointRounding.AwayFromZero).ToString() + }).ToList(); + foreach (var item in query) + { + item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数 + } + return query; + } + public static async Task> GetMajorHiddenRectificationOutputsAsync() + { + return await Task.Run(GetMajorHiddenRectificationOutputs); + } + + #endregion + + #region 风险数据 + /// + /// 获取风险数据 + /// + /// + public static List GetSecurityRiskOutputs() + { + var query = (from x in Funs.DB.Base_Project + join y in Funs.DB.Hazard_HazardSelectedItem on x.ProjectId equals y.ProjectId into yGroup + from y in yGroup.DefaultIfEmpty() + join z in Funs.DB.Base_RiskLevel on y.HazardLevel equals z.RiskLevelId into zGroup + from z in zGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && y.IsStart == true + group new { y, z } by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg + select new SecurityRiskOutput + { + ProjectId = gg.Key.ProjectId, + ProjectName = gg.Key.ProjectName, + ProjectCode = gg.Key.ProjectCode, + LowRiskNum = gg.Sum(g => (g.z.RiskLevel == 1 || g.y.HazardLevel == "1") ? 1 : 0), + GeneralRiskNum = gg.Sum(g => (g.z.RiskLevel == 2 || g.y.HazardLevel == "2") ? 1 : 0), + MediumRiskNum = gg.Sum(g => (g.z.RiskLevel == 3 || g.y.HazardLevel == "3") ? 1 : 0), + HighRiskNum = gg.Sum(g => g.z.RiskLevel == 4 ? 1 : 0), + }).ToList(); + return query; + } + public static async Task> GetSecurityRiskOutputsAsync() + { + return await Task.Run(GetSecurityRiskOutputs); + } + #endregion + + #region 危大工程数据 + /// + /// 获取危大工程数据 + /// + /// + public static List GetLargeEngineeringOutputs() + { + var query = (from x in Funs.DB.Base_Project + join y in Funs.DB.Solution_LargerHazard on x.ProjectId equals y.ProjectId into yGroup + from y in yGroup.DefaultIfEmpty() + where BeUnderConstructionList.Contains(x.ProjectId) && y.RecordTime > Const.DtmarkTime + group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg + select new LargeEngineeringOutput + { + ProjectId = gg.Key.ProjectId, + ProjectName = gg.Key.ProjectName, + ProjectCode = gg.Key.ProjectCode, + CompletedNum = gg.Count(x => x.States == "1" && x.IsSuperLargerHazard == false), + TrainPersonNum = gg.Where(x => x.IsSuperLargerHazard == false).Sum(x => x.TrainPersonNum) ?? 0, + ConstructionNum = gg.Count(x => x.States == "2" && x.IsSuperLargerHazard == false), + FinishedNum = gg.Count(x => x.States == "3" && x.IsSuperLargerHazard == false), + SuperCompletedNum = gg.Count(x => x.States == "1" && x.IsSuperLargerHazard == true), + SuperTrainPersonNum = gg.Where(x => x.IsSuperLargerHazard == true).Sum(x => x.TrainPersonNum) ?? 0, + SuperConstructionNum = gg.Count(x => x.States == "2" && x.IsSuperLargerHazard == true), + SuperFinishedNum = gg.Count(x => x.States == "3" && x.IsSuperLargerHazard == true), + + }).ToList(); + return query; + } + public static async Task> GetLargeEngineeringOutputsAsync() + { + return await Task.Run(GetLargeEngineeringOutputs); + } + + /// + /// 获取危大工程审批完成数 + /// + /// + public static int GetCompletedNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "1" && + x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime select x).Count(); return result; } + /// + /// 获取危大工程培训人次数 + /// + /// + public static int GetTrainPersonNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; + } + + /// + /// 获取危大工程施工个数 + /// + /// + public static int GetConstructionNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "2" && + x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取危大工程完工个数 + /// + /// + public static int GetFinishedNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "3" && + x.IsSuperLargerHazard == false && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程审批完成数 + /// + /// + public static int GetSuperCompletedNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "1" && + x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程培训人次数 + /// + /// + public static int GetSuperTrainPersonNum() + { + var result = + (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x.TrainPersonNum).ToList().Sum(x => x.Value); + return result; + } + + /// + /// 获取超危大工程施工个数 + /// + /// + public static int GetSuperConstructionNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "2" && + x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + /// + /// 获取超危大工程完工个数 + /// + /// + public static int GetSuperFinishedNum() + { + var result = (from x in Funs.DB.Solution_LargerHazard + where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "3" && + x.IsSuperLargerHazard == true && + x.RecordTime > Const.DtmarkTime + select x).Count(); + return result; + } + + #endregion + + #region 获取列表 /// @@ -824,6 +3690,7 @@ namespace BLL x.SafeTrainNum, x.SpecialTrainNum, x.SpecialOperationTrainNum, + x.EnvironmentalTrainNum, x.TotalEnergyConsumption, x.IncomeComprehensiveEnergyConsumption, x.NewWaterConsumption, diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs index 7b8cfb2c..9677c589 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs @@ -31,7 +31,7 @@ namespace BLL (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && - (string.IsNullOrEmpty(table.TypeName) || x.TypeName.Contains(table.TypeName)) + (string.IsNullOrEmpty(table.TypeName) || x.TypeName.Contains(table.TypeName)) select x ; @@ -51,7 +51,7 @@ namespace BLL { return null; } - // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q select new { @@ -82,62 +82,67 @@ namespace BLL } public static void AddHSSEData_HiddenDangerDetail(Model.HSSEData_HiddenDangerDetail newtable) { - - Model.HSSEData_HiddenDangerDetail table = new Model.HSSEData_HiddenDangerDetail + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - TypeName = newtable.TypeName, - TotalNum = newtable.TotalNum, - NeedRectifyNum = newtable.NeedRectifyNum, - }; - db.HSSEData_HiddenDangerDetail.InsertOnSubmit(table); - db.SubmitChanges(); + Model.HSSEData_HiddenDangerDetail table = new Model.HSSEData_HiddenDangerDetail + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + TypeName = newtable.TypeName, + TotalNum = newtable.TotalNum, + NeedRectifyNum = newtable.NeedRectifyNum, + }; + db.HSSEData_HiddenDangerDetail.InsertOnSubmit(table); + db.SubmitChanges(); + } } public static void UpdateHSSEData_HiddenDangerDetail(Model.HSSEData_HiddenDangerDetail newtable) { - - Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - table.UnitId = newtable.UnitId; - table.CollCropCode = newtable.CollCropCode; - table.UnitName = newtable.UnitName; - table.ReportDate = newtable.ReportDate; - table.TypeName = newtable.TypeName; - table.TotalNum = newtable.TotalNum; - table.NeedRectifyNum = newtable.NeedRectifyNum; - db.SubmitChanges(); + Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + table.UnitId = newtable.UnitId; + table.CollCropCode = newtable.CollCropCode; + table.UnitName = newtable.UnitName; + table.ReportDate = newtable.ReportDate; + table.TypeName = newtable.TypeName; + table.TotalNum = newtable.TotalNum; + table.NeedRectifyNum = newtable.NeedRectifyNum; + db.SubmitChanges(); + } } - } public static void DeleteHSSEData_HiddenDangerDetailById(string Id) { - - Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HSSEData_HiddenDangerDetail.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.HSSEData_HiddenDangerDetail.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } public static void DeleteHSSEData_HiddenDangerDetailByDate(DateTime? reportDate) { - - var table = db.HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); - db.SubmitChanges(); + var table = db.HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } } - } } diff --git a/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs b/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs index 597cc39c..50a51306 100644 --- a/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs +++ b/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs @@ -61,7 +61,7 @@ namespace BLL (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.Value) || x.Value.Contains(table.Value)) && (string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) && - (string.IsNullOrEmpty(table.ReceiveDate) || x.ReceiveDate.Contains(table.ReceiveDate)) + (string.IsNullOrEmpty(table.ReceiveDate) || x.ReceiveDate.Contains(table.ReceiveDate)) select x ; @@ -136,124 +136,134 @@ namespace BLL public static void AddHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable) { - - Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - ID = newtable.ID, - UnitId = newtable.UnitId, - UnitName = newtable.UnitName, - HazardName = newtable.HazardName, - HazardLevel = newtable.HazardLevel, - DeviceCode = newtable.DeviceCode, - DeviceName = newtable.DeviceName, - DeviceType = newtable.DeviceType, - SphereType = newtable.SphereType, - TemperatureType = newtable.TemperatureType, - DesignTemperantureMax = newtable.DesignTemperantureMax, - DesignTemperantureMin = newtable.DesignTemperantureMin, - PressureType = newtable.PressureType, - DesignPressure = newtable.DesignPressure, - DesignPressureMax = newtable.DesignPressureMax, - Medium = newtable.Medium, - MediumForm = newtable.MediumForm, - MediumLevelMax = newtable.MediumLevelMax, - Reserves = newtable.Reserves, - StandardCode = newtable.StandardCode, - StandardName = newtable.StandardName, - StandardType = newtable.StandardType, - StandardDes = newtable.StandardDes, - MeasurementUnit = newtable.MeasurementUnit, - MeterMax = newtable.MeterMax, - MeterMin = newtable.MeterMin, - ThresholdLow1 = newtable.ThresholdLow1, - ThresholdLow2 = newtable.ThresholdLow2, - ThresholdMax1 = newtable.ThresholdMax1, - ThresholdMax2 = newtable.ThresholdMax2, - BitNum = newtable.BitNum, - DateTime = newtable.DateTime, - ProjectId = newtable.ProjectId, - Value = newtable.Value, - FactoryId = newtable.FactoryId, - ReportDate = newtable.ReportDate, - ReceiveDate = newtable.ReceiveDate, - }; - db.Hazard_RealTimeDevice.InsertOnSubmit(table); - db.SubmitChanges(); + Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice + { + ID = newtable.ID, + UnitId = newtable.UnitId, + UnitName = newtable.UnitName, + HazardName = newtable.HazardName, + HazardLevel = newtable.HazardLevel, + DeviceCode = newtable.DeviceCode, + DeviceName = newtable.DeviceName, + DeviceType = newtable.DeviceType, + SphereType = newtable.SphereType, + TemperatureType = newtable.TemperatureType, + DesignTemperantureMax = newtable.DesignTemperantureMax, + DesignTemperantureMin = newtable.DesignTemperantureMin, + PressureType = newtable.PressureType, + DesignPressure = newtable.DesignPressure, + DesignPressureMax = newtable.DesignPressureMax, + Medium = newtable.Medium, + MediumForm = newtable.MediumForm, + MediumLevelMax = newtable.MediumLevelMax, + Reserves = newtable.Reserves, + StandardCode = newtable.StandardCode, + StandardName = newtable.StandardName, + StandardType = newtable.StandardType, + StandardDes = newtable.StandardDes, + MeasurementUnit = newtable.MeasurementUnit, + MeterMax = newtable.MeterMax, + MeterMin = newtable.MeterMin, + ThresholdLow1 = newtable.ThresholdLow1, + ThresholdLow2 = newtable.ThresholdLow2, + ThresholdMax1 = newtable.ThresholdMax1, + ThresholdMax2 = newtable.ThresholdMax2, + BitNum = newtable.BitNum, + DateTime = newtable.DateTime, + ProjectId = newtable.ProjectId, + Value = newtable.Value, + FactoryId = newtable.FactoryId, + ReportDate = newtable.ReportDate, + ReceiveDate = newtable.ReceiveDate, + }; + db.Hazard_RealTimeDevice.InsertOnSubmit(table); + db.SubmitChanges(); + } } public static void AddBulkHazard_RealTimeDevice(List newtables) { - - db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables); - db.SubmitChanges(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables); + db.SubmitChanges(); + } } public static void UpdateHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable) { - - Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.ID = newtable.ID; - table.UnitId = newtable.UnitId; - table.UnitName = newtable.UnitName; - table.HazardName = newtable.HazardName; - table.HazardLevel = newtable.HazardLevel; - table.DeviceCode = newtable.DeviceCode; - table.DeviceName = newtable.DeviceName; - table.DeviceType = newtable.DeviceType; - table.SphereType = newtable.SphereType; - table.TemperatureType = newtable.TemperatureType; - table.DesignTemperantureMax = newtable.DesignTemperantureMax; - table.DesignTemperantureMin = newtable.DesignTemperantureMin; - table.PressureType = newtable.PressureType; - table.DesignPressure = newtable.DesignPressure; - table.DesignPressureMax = newtable.DesignPressureMax; - table.Medium = newtable.Medium; - table.MediumForm = newtable.MediumForm; - table.MediumLevelMax = newtable.MediumLevelMax; - table.Reserves = newtable.Reserves; - table.StandardCode = newtable.StandardCode; - table.StandardName = newtable.StandardName; - table.StandardType = newtable.StandardType; - table.StandardDes = newtable.StandardDes; - table.MeasurementUnit = newtable.MeasurementUnit; - table.MeterMax = newtable.MeterMax; - table.MeterMin = newtable.MeterMin; - table.ThresholdLow1 = newtable.ThresholdLow1; - table.ThresholdLow2 = newtable.ThresholdLow2; - table.ThresholdMax1 = newtable.ThresholdMax1; - table.ThresholdMax2 = newtable.ThresholdMax2; - table.BitNum = newtable.BitNum; - table.DateTime = newtable.DateTime; - table.ProjectId = newtable.ProjectId; - table.Value = newtable.Value; - table.FactoryId = newtable.FactoryId; - table.ReportDate = newtable.ReportDate; - table.ReceiveDate = newtable.ReceiveDate; - db.SubmitChanges(); + Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID); + if (table != null) + { + table.ID = newtable.ID; + table.UnitId = newtable.UnitId; + table.UnitName = newtable.UnitName; + table.HazardName = newtable.HazardName; + table.HazardLevel = newtable.HazardLevel; + table.DeviceCode = newtable.DeviceCode; + table.DeviceName = newtable.DeviceName; + table.DeviceType = newtable.DeviceType; + table.SphereType = newtable.SphereType; + table.TemperatureType = newtable.TemperatureType; + table.DesignTemperantureMax = newtable.DesignTemperantureMax; + table.DesignTemperantureMin = newtable.DesignTemperantureMin; + table.PressureType = newtable.PressureType; + table.DesignPressure = newtable.DesignPressure; + table.DesignPressureMax = newtable.DesignPressureMax; + table.Medium = newtable.Medium; + table.MediumForm = newtable.MediumForm; + table.MediumLevelMax = newtable.MediumLevelMax; + table.Reserves = newtable.Reserves; + table.StandardCode = newtable.StandardCode; + table.StandardName = newtable.StandardName; + table.StandardType = newtable.StandardType; + table.StandardDes = newtable.StandardDes; + table.MeasurementUnit = newtable.MeasurementUnit; + table.MeterMax = newtable.MeterMax; + table.MeterMin = newtable.MeterMin; + table.ThresholdLow1 = newtable.ThresholdLow1; + table.ThresholdLow2 = newtable.ThresholdLow2; + table.ThresholdMax1 = newtable.ThresholdMax1; + table.ThresholdMax2 = newtable.ThresholdMax2; + table.BitNum = newtable.BitNum; + table.DateTime = newtable.DateTime; + table.ProjectId = newtable.ProjectId; + table.Value = newtable.Value; + table.FactoryId = newtable.FactoryId; + table.ReportDate = newtable.ReportDate; + table.ReceiveDate = newtable.ReceiveDate; + db.SubmitChanges(); + } } - } public static void DeleteHazard_RealTimeDeviceById(string ID) { - - Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Hazard_RealTimeDevice.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID); + if (table != null) + { + db.Hazard_RealTimeDevice.DeleteOnSubmit(table); + db.SubmitChanges(); + } } } public static void DeleteALLHazard_RealTimeDevice() { - if (db.Hazard_RealTimeDevice != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice); - db.SubmitChanges(); + if (db.Hazard_RealTimeDevice != null) + { + db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice); + db.SubmitChanges(); + } } } public static List GetHazard_RealTimeDeviceByDate(DateTime? reportDate) @@ -265,14 +275,15 @@ namespace BLL } public static void DeleteHazard_RealTimeDeviceByDate(DateTime? reportDate) { - - var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table); - db.SubmitChanges(); + var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } } - } } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/LotAPIService.cs b/SGGL/BLL/ZHGL/DataSync/LotAPIService.cs new file mode 100644 index 00000000..d5ab1821 --- /dev/null +++ b/SGGL/BLL/ZHGL/DataSync/LotAPIService.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BLL +{ + public class LotAPIService + { + /// + /// 保存环境监测 + /// + /// + /// + public static string saveEnvironmentCheck(Model.EnvironmentalCheckInput input) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + //使用Emitmapper 将input 映射到实体类db.ZJ_EnvironmentCheck + var entity = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper().Map(input); + entity.Id = Guid.NewGuid().ToString(); + entity.CreateTime = DateTime.Now; + db.EnvironmentalCheck.InsertOnSubmit(entity); + db.SubmitChanges(); + return entity.Id; + + } + } + + } +} diff --git a/SGGL/BLL/ZHGL/DataSync/MainSevice.cs b/SGGL/BLL/ZHGL/DataSync/MainSevice.cs new file mode 100644 index 00000000..220e857b --- /dev/null +++ b/SGGL/BLL/ZHGL/DataSync/MainSevice.cs @@ -0,0 +1,360 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BLL { + +public class MainSevice +{ + + /// + /// 在建项目集合 + /// + private List _beUnderConstructionList; + private HSSEData_HSSE _hsseData; + private string _unitId; + private int _unitType; + + public MainSevice(string userid) + { + var userModel = Person_PersonsService.GetPerson_PersonsById(userid); + int unitType = CommonService.GetUnitTypeByUserId(userid); + var projectList = ProjectService.GetProjectWorkList().Select(x => new { x.ProjectId, x.UnitId }).ToList(); + _unitId = userModel.UnitId; + _unitType = unitType; + if (unitType == 0) + { + _beUnderConstructionList = projectList.Select(x => x.ProjectId).ToList(); + _unitId = BLL.Const.UnitId_SEDIN; + } + else if (unitType == 1) + { + _beUnderConstructionList = projectList.Where(x => x.UnitId == userModel.UnitId).Select(x => x.ProjectId).ToList(); + } + else if (unitType == 2) + { + _beUnderConstructionList = new List() { "0" }; + } + + } + public async Task GetHsseDataAsync() + { + try + { + + + // 并行执行异步方法 + var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); + var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); + var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); + var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync() + .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId))); + var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync() + .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId))); + var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync(); + var certificateATask = HSSEData_HSSEService.GetCertificateAAsync(); + var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync(); + var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync(); + var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync(); + var shutdownTask = HSSEData_HSSEService.GetShutdownAsync(); + var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync(); + var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync(); + var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync(); + var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync(); + var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync(); + var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync(); + var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync(); + var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync(); + var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync(); + var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync(); + var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync(); + var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync(); + var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync(); + var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync(); + var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync(); + var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync(); + var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync(); + var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync(); + var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync(); + var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync(); + var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync(); + var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync(); + var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync(); + var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync(); + var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync(); + var nearMissTask = HSSEData_HSSEService.GetNearMissAsync(); + var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync(); + var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync(); + var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync(); + var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync(); + var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync(); + var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync(); + var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync(); + var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync(); + var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync(); + var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync(); + var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync(); + var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync(); + var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync(); + var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync(); + var costUseTask = HSSEData_HSSEService.GetCostUseAsync(); + var useEquipmentTask = HSSEData_HSSEService.GetUseEquipmentAsync(); + var specialEquipmentTask = HSSEData_HSSEService.GetSpecialEquipmentAsync(); + var licensesTask = HSSEData_HSSEService.GetLicensesAsync(); + var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync(); + var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync(); + var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync(); + + // 等待所有异步方法执行完成 + await Task.WhenAll( + securityRiskOutputListTask, + largeEngineeringOutputsTask, + safetyInjectionEngineerTask, + certificateATask, + certificateBTask, + certificateCTask, + beUnderConstructionTask, + shutdownTask, + joinConstructionPersonTask, + majorProjectsUnderConstructionTask, + totalWorkingHourTask, + lostWorkingHourTask, + safeWorkingHourTask, + safeTrainTask, + specialTrainTask, + specialOperationTrainTask, + headOfficeInspectorGeneralTask, + headOfficeFullTimeTask, + branchInspectorGeneralTask, + branchFullTimeTask, + projectInspectorGeneralTask, + projectFullTimeTask, + projectSafetyMonitorTask, + safetyCommitteeMeetingTask, + enterpriseTopicsMeetingTask, + projectSafetyLeadingGroupMeetingTask, + projectSafetyMeetingTask, + companyLeadShiftCheckTask, + companyComprehensiveCheckTask, + companySpecialCheckTask, + projectLeadShiftCheckTask, + projectSpecialCheckTask, + projectMajorCheckTask, + nearMissTask, + recordableEventTask, + generalAccidentTask, + majorAccidentTask, + seriousAccidentTask, + specialSeriousAccidentTask, + companyComprehensivePlanTask, + companySpecialPlanTask, + companyOnSiteDisposalPlanTask, + companyDrillTask, + projectComprehensivePlanTask, + projectSpecialPlanTask, + projectOnSiteDisposalPlanTask, + projectDrillTask, + costExtractTask, + costUseTask, + useEquipmentTask, + specialEquipmentTask, + licensesTask, + licensesCloseTask, + generalHiddenRectificationOutputsTask, + majorHiddenRectificationOutputsTask + ); + + + // 统一获取异步方法的返回值 + var totalEnergyConsumption = totalEnergyConsumptionTask; + var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask; + var newWaterConsumption = newWaterConsumptionTask; + var safetyInjectionEngineerList = await safetyInjectionEngineerTask; + var certificateAList = await certificateATask; + var certificateBList = await certificateBTask; + var certificateCList = await certificateCTask; + var beUnderConstructionList = await beUnderConstructionTask; + var shutdownList = await shutdownTask; + var joinConstructionPersonList = await joinConstructionPersonTask; + var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask; + var totalWorkingHour = await totalWorkingHourTask; + var lostWorkingHour = await lostWorkingHourTask; + var safeWorkingHour = await safeWorkingHourTask; + var safeTrainList = await safeTrainTask; + var specialTrainList = await specialTrainTask; + var specialOperationTrainList = await specialOperationTrainTask; + var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask; + var headOfficeFullTimeList = await headOfficeFullTimeTask; + var branchInspectorGeneralList = await branchInspectorGeneralTask; + var branchFullTimeList = await branchFullTimeTask; + var projectInspectorGeneralList = await projectInspectorGeneralTask; + var projectFullTimeList = await projectFullTimeTask; + var projectSafetyMonitorList = await projectSafetyMonitorTask; + var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask; + var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask; + var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask; + var projectSafetyMeetingList = await projectSafetyMeetingTask; + var companyLeadShiftCheckList = await companyLeadShiftCheckTask; + var companyComprehensiveCheckList = await companyComprehensiveCheckTask; + var companySpecialCheckList = await companySpecialCheckTask; + var projectLeadShiftCheckList = await projectLeadShiftCheckTask; + var projectSpecialCheckList = await projectSpecialCheckTask; + var projectMajorCheckList = await projectMajorCheckTask; + var nearMissList = await nearMissTask; + var recordableEventList = await recordableEventTask; + var generalAccidentList = await generalAccidentTask; + var majorAccidentList = await majorAccidentTask; + var seriousAccidentList = await seriousAccidentTask; + var specialSeriousAccidentList = await specialSeriousAccidentTask; + var companyComprehensivePlanList = await companyComprehensivePlanTask; + var companySpecialPlanList = await companySpecialPlanTask; + var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask; + var companyDrillList = await companyDrillTask; + var projectComprehensivePlanList = await projectComprehensivePlanTask; + var projectSpecialPlanList = await projectSpecialPlanTask; + var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask; + var projectDrillList = await projectDrillTask; + var costExtractList = await costExtractTask; + var costUseList = await costUseTask; + var useEquipmentList = await useEquipmentTask; + var specialEquipmentList = await specialEquipmentTask; + var licensesList = await licensesTask; + var licensesCloseList = await licensesCloseTask; + var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; + var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; + + // 构造结果对象 + var table = new HSSEData_HSSE + { + JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + TotalWorkingHour = totalWorkingHour, + LostWorkingHour = lostWorkingHour, + SafeWorkingHour = safeWorkingHour, + SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), + SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), + SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), + EnvironmentalTrainNum = 0, + TotalEnergyConsumption = totalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, + NewWaterConsumption = newWaterConsumption, + HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(), + HeadOfficeFullTimeNum = headOfficeFullTimeList.Count, + BranchInspectorGeneralNum = branchInspectorGeneralList.Count, + BranchFullTimeNum = branchFullTimeList.Count, + ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId), + CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId), + CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId), + CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)), + ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectDrillNum = projectDrillList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CostExtract = Convert.ToInt32(costExtractList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)), + CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)), + UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + LicensesCloseNum = licensesCloseList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), + GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), + MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), + MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), + LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum), + GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum), + MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum), + HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum), + CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum), + TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum), + ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum), + FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum), + SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum), + SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum) + }; + + if (_unitType == 0) + { + table.BeUnderConstructionNum = beUnderConstructionList.Count(); + table.ShutdownNum = shutdownList.Count(); + table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(); + table.EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(); + table.CertificateANum = certificateAList.Count(); + table.CertificateBNum = certificateBList.Count(); + table.CertificateCNum = certificateCList.Count(); + table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(); + + } + else if (_unitType == 1) + { + table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId); + table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId); + table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(x => x.UnitId == _unitId); + table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + } + + _hsseData = table; + return _hsseData; + } + catch (Exception ex) + { + + throw; + } + } + + public List GetDataHiddenDangerDetailItems() + { + var db = Funs.DB; + var list = from x in db.HSSE_Hazard_HazardRegister + where _beUnderConstructionList.Contains(x.ProjectId) + select x; + var data = (from x in list + join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId + group x by new + { x.ProjectId, x.RegisterTypesId, y.RegisterTypesName } + into g + select new + { + UnitId = _unitId, + ProjectId = g.Key.ProjectId, + TypeName = g.Key.RegisterTypesName, + TotalNum = g.Count(), + NeedRectifyNum = g.Count(x => x.States == "1"), + }).ToList(); + + var result = (from x in data + group x by x.TypeName into g + select new Model.HSSEDataHiddenDangerDetailItem + { + Id = SQLHelper.GetNewID(), + TypeName = g.Key, + NeedRectifyNum = g.Sum(p => p.NeedRectifyNum), + TotalNum = g.Sum(p => p.TotalNum) + }).ToList(); + return result; + } +} } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs index 32b4ef3a..30c6f34d 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs @@ -156,7 +156,7 @@ namespace BLL /// public static void AddProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS { @@ -200,7 +200,6 @@ namespace BLL db.SubmitChanges(); } - } /// /// 修改 @@ -208,8 +207,7 @@ namespace BLL /// public static void UpdateProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable) { - - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) @@ -252,7 +250,6 @@ namespace BLL db.SubmitChanges(); } } - } /// @@ -261,8 +258,7 @@ namespace BLL /// public static void DeleteProject_CQMSData_CQMSById(string Id) { - - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id); if (table != null) @@ -271,7 +267,6 @@ namespace BLL db.SubmitChanges(); } } - } /// @@ -321,7 +316,7 @@ namespace BLL } public static void StatisticalAllProjectData() { - var projectlist = ProjectService.GetCNCECShowProjectList(); + var projectlist = ProjectService.GetProjectWorkList(); foreach (var item in projectlist) { StatisticalData(item.ProjectId, CQMSDateType.All); @@ -490,7 +485,7 @@ namespace BLL { int result = (from x in Funs.DB.SitePerson_Person join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.ProjectId == projectid && y.IsCQMS == true && x.States=="1" + where x.ProjectId == projectid && y.IsCQMS == true && x.States == "1" select x).Count(); return result; } @@ -703,8 +698,8 @@ namespace BLL public static int GetSingleProjectNum(string projectid) { int result = (from x in Funs.DB.WBS_UnitWork - where x.ProjectId == projectid - select x).Count(); + where x.ProjectId == projectid + select x).Count(); return result; } /// @@ -753,5 +748,34 @@ namespace BLL } + #region 推送项目质量数据 + + /// + /// 推送项目质量数据 + /// + /// + public static ReturnData PushProjectCQMSData() + { + var items = (from x in db.Project_CQMSData_CQMS + where x.ReportDate == DateTime.Now.Date + select x).ToList(); + Model.ReturnData responeData = new Model.ReturnData(); + if (items.Count() > 0) + { + var thisUnit = CommonService.GetIsThisUnit(); + var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items }; + var str = JsonConvert.SerializeObject(newItem); + var baseurl = "/api/CQMSData/SaveProjectCQMSData"; + responeData = ServerService.PushCNCEC(str, baseurl); + } + else + { + responeData.code = 0; + responeData.message = "当前没有项目质量数据"; + } + return responeData; + } + + #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs index 991485c3..7fbfa110 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs @@ -1,39 +1,39 @@ using FineUIPro; -using Model; +using Microsoft.SqlServer.Dts.Runtime; +using NPOI.SS.Formula.Functions; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; +using Model; + namespace BLL { - public static class Project_HJGLData_DefectService { - public static Model.SGGLDB db = Funs.DB; + public static SGGLDB db = Funs.DB; #region 获取列表 + /// /// 记录数 /// - public static int count - { - get; - set; - } - public static List GetProject_HJGLData_DefectByModle(Model.Project_HJGLData_Defect table) + public static int count { get; set; } + + public static List GetProject_HJGLData_DefectByModle(Project_HJGLData_Defect table) { var q = from x in db.Project_HJGLData_Defect where - (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && - (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && - (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && - (string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName)) + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && + (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && + (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && + (string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName)) select x - ; + ; return q.ToList(); } @@ -43,76 +43,83 @@ namespace BLL /// 页码 /// 每页数量 /// - public static IEnumerable getListData(Model.Project_HJGLData_Defect table, Grid Grid1) + public static IEnumerable getListData(Project_HJGLData_Defect table, Grid Grid1) { var q = GetProject_HJGLData_DefectByModle(table); count = q.Count(); - if (count == 0) - { - return null; - } + if (count == 0) return null; // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q - select new - { - x.Id, - x.ProjectId, - x.UnitId, - x.CollCropCode, - x.UnitName, - x.ReportDate, - x.DefectName, - x.DefectNum, - - }; + select new + { + x.Id, + x.ProjectId, + x.UnitId, + x.CollCropCode, + x.UnitName, + x.ReportDate, + x.DefectName, + x.DefectNum + }; } + #endregion - public static Model.Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id) + public static Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id) { return db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id); } + /// /// 获取项目该日期的缺陷分析数据 /// /// /// /// - public static List GetProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid) + public static List GetProject_HJGLData_DefectByDate(DateTime? reportDate, + string projectid) { var q = from x in db.Project_HJGLData_Defect - where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid - select x; + where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid + select x; return q.ToList(); } - public static void AddProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable) + public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Model.Project_HJGLData_Defect table = new Model.Project_HJGLData_Defect - { - Id = newtable.Id, - ProjectId = newtable.ProjectId, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - DefectName = newtable.DefectName, - DefectNum = newtable.DefectNum, - }; - db.Project_HJGLData_Defect.InsertOnSubmit(table); - db.SubmitChanges(); } - + var table = new Project_HJGLData_Defect + { + Id = newtable.Id, + ProjectId = newtable.ProjectId, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + DefectName = newtable.DefectName, + DefectNum = newtable.DefectNum + }; + db.Project_HJGLData_Defect.InsertOnSubmit(table); + db.SubmitChanges(); } - public static void UpdateProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable) + public static void AddBulkProject_HJGLData_Defect(List newtables) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); + } + db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables); + db.SubmitChanges(); + } + + public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) { table.Id = newtable.Id; @@ -125,39 +132,50 @@ namespace BLL table.DefectNum = newtable.DefectNum; db.SubmitChanges(); } - } + } } public static void DeleteProject_HJGLData_DefectById(string Id) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id); + var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id); if (table != null) { db.Project_HJGLData_Defect.DeleteOnSubmit(table); db.SubmitChanges(); } } - - - } - public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid) + + public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - var table = db.Project_HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid); + var table = db.Project_HJGLData_Defect.Where(x => + x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); if (table != null) { db.Project_HJGLData_Defect.DeleteAllOnSubmit(table); db.SubmitChanges(); } } - - - } + + public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var table = db.Project_HJGLData_Defect.Where(x => + x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid); + if (table != null) + { + db.Project_HJGLData_Defect.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } + } + } + /// /// 判断当天是否已统计数据 /// @@ -166,37 +184,76 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.Project_HJGLData_Defect - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid && x.DefectName == type - select x).ToList(); - if (q != null && q.Count > 0) - { - result = true; - } + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && + x.ProjectId == projectid && x.DefectName == type + select x).ToList(); + if (q != null && q.Count > 0) result = true; return result; } + /// /// 根据projectid,获取当天的统计后的数据 /// /// /// - public static Model.Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type) + public static Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type) { var q = (from x in Funs.DB.Project_HJGLData_Defect - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid && x.DefectName == type - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && + x.ProjectId == projectid && x.DefectName == type + select x).FirstOrDefault(); return q; } - public static List getTodayProject_HJGLData_Defect() + + public static List getTodayProject_HJGLData_Defect() { var q = (from x in Funs.DB.Project_HJGLData_Defect - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - group x by x.DefectName into g - select new Model.HJGLDataDefectItems - { - Id = SQLHelper.GetNewID(), - DefectName = g.Key, - DefectNum=g.Sum (p=>p.DefectNum) - }).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + group x by x.DefectName + into g + select new HJGLDataDefectItems + { + Id = SQLHelper.GetNewID(), + DefectName = g.Key, + DefectNum = g.Sum(p => p.DefectNum) + }).ToList(); + return q; + } + public static List GetModelByUnitIdAndReportDate(string Unitid, DateTime? reportdate) + { + if (!reportdate.HasValue) + { + return new List(); + } + var projectlist = BLL.ProjectService.GetProjectWorkList(); + var q = (from x in Funs.DB.Project_HJGLData_Defect + where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId) + group x by x.DefectName + into g + select new HJGLDataDefectItems + { + Id = SQLHelper.GetNewID(), + DefectName = g.Key, + DefectNum = g.Sum(p => p.DefectNum) + }).ToList(); + return q; + } + public static List GetModelByReportDate( DateTime? reportdate) + { + if (!reportdate.HasValue) + { + return new List(); + } + var q = (from x in Funs.DB.Project_HJGLData_Defect + where x.ReportDate == reportdate + group x by x.DefectName + into g + select new HJGLDataDefectItems + { + Id = SQLHelper.GetNewID(), + DefectName = g.Key, + DefectNum = g.Sum(p => p.DefectNum) + }).ToList(); return q; } /// @@ -209,15 +266,60 @@ namespace BLL { StatisticalData(item.ProjectId); } + //var db = Funs.DB; + + //var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList(); + //var thisUnitId = string.Empty; + //var thisUnit = CommonService.GetIsThisUnit(); + //if (thisUnit != null) thisUnitId = thisUnit.UnitId; + //var baseUnit = UnitService.GetUnitByUnitId(thisUnitId); + //var data = (from x in db.CH_CheckItem + // join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID + // where projectids.Contains(y.ProjectId) + // group x by new { x.Defects_Definition, y.ProjectId } + // into g + // select new + // { + // UnitId = thisUnitId, + // CollCropCode = baseUnit.CollCropCode, + // UnitName = baseUnit.UnitName, + // ProjectId = g.Key.ProjectId, + // ReportDate = DateTime.Now.Date, + // DefectName = g.Key.Defects_Definition, + // DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition) + // }).ToList(); + //DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有 + //var projectHjglDataDefect = new List(); + //foreach (var item in data + // ) + //{ + // var table = new Project_HJGLData_Defect + // { + // Id = SQLHelper.GetNewID(), + // UnitId = item.UnitId, + // CollCropCode = item.CollCropCode, + // UnitName = item.UnitName, + // ProjectId = item.ProjectId, + // ReportDate = item.ReportDate, + // DefectName = item.DefectName, + // DefectNum = item.DefectNum + // }; + // projectHjglDataDefect.Add(table); + //} + + //AddBulkProject_HJGLData_Defect(projectHjglDataDefect); //批量增加 } + /// /// 统计数据 /// /// public static void StatisticalData(string projectid) { - string thisUnitId = BLL.Const.UnitId_SEDIN; - var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId); + var thisUnitId = string.Empty; + var thisUnit = CommonService.GetIsThisUnit(); + if (thisUnit != null) thisUnitId = thisUnit.UnitId; + var base_Unit = UnitService.GetUnitByUnitId(thisUnitId); var list = from x in db.HJGL_Batch_NDEItem join y in db.HJGL_Batch_NDE on x.NDEID equals y.NDEID where y.ProjectId == projectid @@ -250,25 +352,25 @@ namespace BLL } } } + /// /// 获取缺陷名称 /// /// public static string GetDefectName(string projectid) { - string result = ""; + var result = ""; return result; } + /// /// 获取缺陷数量 /// /// public static int GetDefectNum(string projectid) { - int result = 0; + var result = 0; return result; } - - } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs index 138313e1..ee830ff3 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs @@ -114,7 +114,7 @@ namespace BLL } public static void AddProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL { @@ -133,11 +133,10 @@ namespace BLL db.Project_HJGLData_HJGL.InsertOnSubmit(table); db.SubmitChanges(); } - } public static void UpdateProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); if (table != null) @@ -156,11 +155,10 @@ namespace BLL db.SubmitChanges(); } } - } public static void DeleteProject_HJGLData_HJGLById(string Id) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); if (table != null) @@ -169,8 +167,6 @@ namespace BLL db.SubmitChanges(); } } - - } /// /// 判断该项目的该日期是否统计数据 @@ -223,7 +219,7 @@ namespace BLL /// public static void StatisticalAllProjectData() { - var projectlist = ProjectService.GetCNCECShowProjectList(); + var projectlist = ProjectService.GetProjectWorkList(); foreach (var item in projectlist) { StatisticalData(item.ProjectId, HJGLDateType.All); @@ -311,7 +307,7 @@ namespace BLL { int result = Convert.ToInt32((from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == projectid - select x.Size).ToList().Sum(x=>x.Value)); + select x.Size).ToList().Sum(x => x.Value)); return result; } /// @@ -333,7 +329,7 @@ namespace BLL { int result = (from x in Funs.DB.HJGL_Batch_NDEItem join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID - where y.ProjectId == projectid + where y.ProjectId == projectid select x.TotalFilm).ToList().Sum(x => x.Value); return result; } @@ -345,10 +341,43 @@ namespace BLL { int result = (from x in Funs.DB.HJGL_Batch_NDEItem join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID - where y.ProjectId == projectid + where y.ProjectId == projectid select x.PassFilm).ToList().Sum(x => x.Value); return result; } + + #region 推送项目焊接数据 + + /// + /// 推送项目焊接数据 + /// + /// + public static ReturnData PushProjectHJGLData() + { + var items = (from x in db.Project_HJGLData_HJGL + where x.ReportDate == DateTime.Now.Date + select x).ToList(); + var defectItems = (from x in db.Project_HJGLData_Defect + where x.ReportDate == DateTime.Now.Date + select x).ToList(); + Model.ReturnData responeData = new Model.ReturnData(); + if (items.Count() > 0 || defectItems.Count() > 0) + { + var thisUnit = CommonService.GetIsThisUnit(); + var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items, DefectItems = defectItems }; + var str = JsonConvert.SerializeObject(newItem); + var baseurl = "/api/HJGLData/SaveProjectHJGLData"; + responeData = ServerService.PushCNCEC(str, baseurl); + } + else + { + responeData.code = 0; + responeData.message = "当前没有项目焊接数据"; + } + return responeData; + } + + #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs index 7fbb5bec..1e03bd4e 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using FineUIPro; using Model; +using Newtonsoft.Json; namespace BLL { @@ -320,6 +321,19 @@ namespace BLL } } + public static void DeleteProject_HSSEData_HSSEByDate(DateTime? reportDate) + { + using (var db = new SGGLDB(Funs.ConnString)) + { + var table = db.Project_HSSEData_HSSE.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.Project_HSSEData_HSSE.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } + } + } + /// /// 判断该项目的该日期是否统计数据 /// @@ -371,7 +385,7 @@ namespace BLL /// public static void StatisticalAllProjectData() { - var projectlist = ProjectService.GetCNCECShowProjectList(); + var projectlist = ProjectService.GetProjectWorkList(); foreach (var item in projectlist) StatisticalData(item.ProjectId, HSSEDateType.All); } @@ -606,7 +620,7 @@ namespace BLL public static int GetJoinConstructionPersonNum(string projectid) { var result = (from x in Funs.DB.SitePerson_Person - where x.ProjectId == projectid && x.States=="1" + where x.ProjectId == projectid && x.States == "1" select x).Count(); return result; } @@ -629,11 +643,10 @@ namespace BLL /// public static int GetTotalWorkingHour(string projectid) { - var result = (from x in Funs.DB.SeDin_MonthReport2 - join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId - where y.ProjectId == projectid - orderby y.ReporMonth descending - select x.ProjectWorkTime ?? 0).FirstOrDefault(); + var result = (from x in Funs.DB.SitePerson_DayReportDetail + join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId + where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime + select x.PersonWorkTime ?? 0).ToList().Sum(); var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]); return q; @@ -665,11 +678,10 @@ namespace BLL /// public static int GetSafeWorkingHour(string projectid) { - var result1 = (from x in Funs.DB.SeDin_MonthReport2 - join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId - where y.ProjectId == projectid - orderby y.ReporMonth descending - select x.ProjectWorkTime ?? 0).FirstOrDefault(); + var result1 = (from x in Funs.DB.SitePerson_DayReportDetail + join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId + where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime + select x.PersonWorkTime ?? 0).ToList().Sum(); var result2 = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime @@ -694,7 +706,7 @@ namespace BLL var result = (from x in Funs.DB.EduTrain_TrainRecord join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId where x.ProjectId == projectid && y.TrainType == "1" && x.TrainStartDate > Const.DtmarkTime - select x).Count(); + select x.TrainPersonNum ?? 0).ToList().Sum(); return result; } @@ -707,7 +719,7 @@ namespace BLL var result = (from x in Funs.DB.EduTrain_TrainRecord join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId where x.ProjectId == projectid && y.TrainType == "2" && x.TrainStartDate > Const.DtmarkTime - select x).Count(); + select x.TrainPersonNum ?? 0).ToList().Sum(); return result; } @@ -720,7 +732,7 @@ namespace BLL var result = (from x in Funs.DB.EduTrain_TrainRecord join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId where x.ProjectId == projectid && y.TrainType == "3" && x.TrainStartDate > Const.DtmarkTime - select x).Count(); + select x.TrainPersonNum ?? 0).ToList().Sum(); return result; } @@ -801,7 +813,7 @@ namespace BLL public static int GetProjectInspectorGeneralNum(string projectid) { var result = (from x in Funs.DB.SitePerson_Person - where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.States=="1" + where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.States == "1" select x).Count(); return result; } @@ -851,8 +863,9 @@ namespace BLL public static int GetCertificateANum(string projectid) { var result = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - where x.ProjectId == projectid && y.CertificateType == "A" && x.States == "1" + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + where x.ProjectId == projectid && z.CertificateType == "A" && x.States == "1" select x).Count(); return result; } @@ -864,8 +877,9 @@ namespace BLL public static int GetCertificateBNum(string projectid) { var result = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - where x.ProjectId == projectid && y.CertificateType == "B" && x.States == "1" + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + where x.ProjectId == projectid && z.CertificateType == "B" && x.States == "1" select x).Count(); return result; } @@ -877,8 +891,9 @@ namespace BLL public static int GetCertificateCNum(string projectid) { var result = (from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId - where x.ProjectId == projectid && y.CertificateType == "C" && x.States == "1" + join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId + join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId + where x.ProjectId == projectid && z.CertificateType == "C" && x.States == "1" select x).Count(); return result; } @@ -968,7 +983,7 @@ namespace BLL public static int GetProjectLeadShiftCheckNum(string projectid) { var result = (from x in Funs.DB.Check_ProjectLeaderCheck - where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime select x).Count(); return result; } @@ -1202,7 +1217,7 @@ namespace BLL (from x in Funs.DB.InApproveManager_GeneralEquipmentInItem join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y .GeneralEquipmentInId - where y.ProjectId == projectid + where y.ProjectId == projectid select x).Count(); return result; } @@ -1227,34 +1242,9 @@ namespace BLL public static int GetLicensesNum(string projectid) { var result = (from x in Funs.DB.License_LicenseManager - where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime + where x.ProjectId == projectid && x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime select x).Count(); - var result1 = (from x in Funs.DB.License_BreakGround - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result2 = (from x in Funs.DB.License_FireWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result3 = (from x in Funs.DB.License_HeightWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result4 = (from x in Funs.DB.License_LiftingWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result5 = (from x in Funs.DB.License_LimitedSpace - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result6 = (from x in Funs.DB.License_NightWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result7 = (from x in Funs.DB.License_OpenCircuit - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - var result8 = (from x in Funs.DB.License_RadialWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime - select x).Count(); - - return (result+ result1+ result2+ result3+ result4+ result5+ result6+ result7+ result8); + return result; } /// @@ -1264,36 +1254,10 @@ namespace BLL public static int GetLicensesCloseNum(string projectid) { var result = (from x in Funs.DB.License_LicenseManager - where x.ProjectId == projectid && x.WorkStates == "3" && + where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" && x.CompileDate > Const.DtmarkTime select x).Count(); - - var result1 = (from x in Funs.DB.License_BreakGround - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result2 = (from x in Funs.DB.License_FireWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result3 = (from x in Funs.DB.License_HeightWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result4 = (from x in Funs.DB.License_LiftingWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result5 = (from x in Funs.DB.License_LimitedSpace - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result6 = (from x in Funs.DB.License_NightWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result7 = (from x in Funs.DB.License_OpenCircuit - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - var result8 = (from x in Funs.DB.License_RadialWork - where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3" - select x).Count(); - - return (result + result1 + result2 + result3 + result4 + result5 + result6 + result7 + result8); + return result; } /// @@ -1303,7 +1267,8 @@ namespace BLL public static int GetGeneralClosedNum(string projectid) { var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" && x.CheckTime > Const.DtmarkTime + where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" && + x.CheckTime > Const.DtmarkTime select x).Count(); return result; } @@ -1315,7 +1280,7 @@ namespace BLL public static int GetGeneralNotClosedNum(string projectid) { var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" && + where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" && x.States != "-1" && x.CheckTime > Const.DtmarkTime select x).Count(); return result; @@ -1328,7 +1293,7 @@ namespace BLL public static int GetMajorClosedNum(string projectid) { var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.ProjectId == projectid && x.HazardValue == "3" && x.States == "3" && + where x.ProjectId == projectid && x.HazardValue == "3" && x.States == "3" && x.CheckTime > Const.DtmarkTime select x).Count(); return result; @@ -1341,7 +1306,7 @@ namespace BLL public static int GetMajorNotClosedNum(string projectid) { var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister - where x.ProjectId == projectid && x.HazardValue == "3" && x.States != "3" && + where x.ProjectId == projectid && x.HazardValue == "3" && x.States != "3" && x.States != "-1" && x.CheckTime > Const.DtmarkTime select x).Count(); return result; @@ -1355,8 +1320,7 @@ namespace BLL { var result = (from x in Funs.DB.Hazard_HazardSelectedItem join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId - where z.ProjectId == projectid && y.RiskLevel == 2 && z.CompileDate.Value.Year >= 2023 + where x.ProjectId == projectid && (y.RiskLevel == 2 || x.HazardLevel == "2") && x.IsStart == true select x).Count(); return result; } @@ -1369,8 +1333,7 @@ namespace BLL { var result = (from x in Funs.DB.Hazard_HazardSelectedItem join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId - where z.ProjectId == projectid && y.RiskLevel == 1 && z.CompileDate.Value.Year >= 2023 + where x.ProjectId == projectid && (y.RiskLevel == 1 || x.HazardLevel == "1") && x.IsStart == true select x).Count(); return result; } @@ -1383,8 +1346,7 @@ namespace BLL { var result = (from x in Funs.DB.Hazard_HazardSelectedItem join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId - where z.ProjectId == projectid && y.RiskLevel == 3 && z.CompileDate.Value.Year >= 2023 + where x.ProjectId == projectid && (y.RiskLevel == 3 || x.HazardLevel == "3") && x.IsStart == true select x).Count(); return result; } @@ -1397,8 +1359,7 @@ namespace BLL { var result = (from x in Funs.DB.Hazard_HazardSelectedItem join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId - join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId - where z.ProjectId == projectid && y.RiskLevel == 4 && z.CompileDate.Value.Year >= 2023 + where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true select x).Count(); return result; } @@ -1621,5 +1582,38 @@ namespace BLL } #endregion + + #region 推送项目安全隐患风险数据 + + /// + /// 推送项目安全隐患风险数据 + /// + /// + public static ReturnData PushProjectHSSEData() + { + var items = (from x in db.Project_HSSEData_HSSE + where x.ReportDate == DateTime.Now.Date + select x).ToList(); + var detailItems = (from x in db.Project_HSSEData_HiddenDangerDetail + where x.ReportDate == DateTime.Now.Date + select x).ToList(); + Model.ReturnData responeData = new Model.ReturnData(); + if (items.Count() > 0 || detailItems.Count() > 0) + { + var thisUnit = CommonService.GetIsThisUnit(); + var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items, DetailItems = detailItems }; + var str = JsonConvert.SerializeObject(newItem); + var baseurl = "/api/HSSEData/SaveProjectHSSEData"; + responeData = ServerService.PushCNCEC(str, baseurl); + } + else + { + responeData.code = 0; + responeData.message = "当前没有项目安全隐患风险数据"; + } + return responeData; + } + + #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs index 1ca5bff8..bea0cf00 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs @@ -1,4 +1,5 @@ using FineUIPro; +using Microsoft.SqlServer.Dts.Runtime; using Model; using System; using System.Collections; @@ -113,8 +114,9 @@ namespace BLL } public static void AddBulkProject_HSSEData_HiddenDangerDetails(List newtables) { - using (var db = new SGGLDB(Funs.ConnString)) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { + db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables); db.SubmitChanges(); } @@ -174,7 +176,7 @@ namespace BLL using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 ); db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); db.SubmitChanges(); } @@ -208,10 +210,68 @@ namespace BLL select x).FirstOrDefault(); return q; } + /// + /// 获取当天的隐患类别数据 + /// + /// public static List GetTodayModel() { var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + group x by x.TypeName into g + select new Model.HSSEDataHiddenDangerDetailItem + { + Id = SQLHelper.GetNewID(), + TypeName= g.Key, + NeedRectifyNum= g.Sum(p => p.NeedRectifyNum), + TotalNum= g.Sum(p => p.TotalNum) + }).ToList(); + return q; + } + /// + /// 根据单位id和日期 获取单位关联项目次日期的数据 + /// + /// + /// + /// + public static List GetModelByUnitIdAndReportDate(string Unitid, DateTime? reportdate) + { + var projectlist = BLL.ProjectService.GetProjectWorkList(); + var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail + where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId) + group x by x.TypeName into g + select new Model.HSSEDataHiddenDangerDetailItem + { + Id = SQLHelper.GetNewID(), + TypeName = g.Key, + NeedRectifyNum = g.Sum(p => p.NeedRectifyNum), + TotalNum = g.Sum(p => p.TotalNum) + }).ToList(); + return q; + } + /// + /// 根据日期 获取隐患类别数据 + /// + /// + /// + public static List GetModelByReportDate( DateTime? reportdate) + { + var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail + where x.ReportDate == reportdate + group x by x.TypeName into g + select new Model.HSSEDataHiddenDangerDetailItem + { + Id = SQLHelper.GetNewID(), + TypeName = g.Key, + NeedRectifyNum = g.Sum(p => p.NeedRectifyNum), + TotalNum = g.Sum(p => p.TotalNum) + }).ToList(); + return q; + } + public static List GetModelByReportDate(DateTime? reportdate,string projectid) + { + var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail + where x.ReportDate == reportdate && x.ProjectId==projectid group x by x.TypeName into g select new Model.HSSEDataHiddenDangerDetailItem { @@ -226,7 +286,7 @@ namespace BLL { var db = Funs.DB; - var projectids = ProjectService.GetCNCECShowProjectList().Select(x => x.ProjectId).ToList(); + var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList(); var thisUnitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) @@ -234,25 +294,24 @@ namespace BLL thisUnitId = thisUnit.UnitId; } var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId); - var list = from x in db.HSSE_Hazard_HazardRegister - where projectids.Contains(x.ProjectId) - select x; + var list = from x in db.HSSE_Hazard_HazardRegister where projectids.Contains(x.ProjectId) + select x; var data = (from x in list - join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId - group x by new - { x.ProjectId, x.RegisterTypesId, y.RegisterTypesName } + join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId + group x by new + { x.ProjectId, x.RegisterTypesId ,y.RegisterTypesName} into g - select new - { - UnitId = thisUnitId, - CollCropCode = baseUnit.CollCropCode, - UnitName = baseUnit.UnitName, - ProjectId = g.Key.ProjectId, - ReportDate = DateTime.Now.Date, - TypeName = g.Key.RegisterTypesName, - TotalNum = g.Count(), - NeedRectifyNum = g.Count(x => x.States == "1"), - }).ToList(); + select new + { + UnitId = thisUnitId, + CollCropCode = baseUnit.CollCropCode, + UnitName = baseUnit.UnitName, + ProjectId= g.Key.ProjectId, + ReportDate = DateTime.Now.Date, + TypeName=g.Key.RegisterTypesName, + TotalNum = g.Count(), + NeedRectifyNum = g.Count(x => x.States == "1"), + }).ToList(); DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime.Now.Date); var projectHsseDataHiddenDangerDetails = new List(); foreach (var item in data) diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs index 543892ba..a6cef0c4 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs @@ -57,7 +57,7 @@ namespace BLL public static int count { get; - set; + set; } public static List GetProject_SYHSEData_SYHSEByModle(Model.Project_SYHSEData_SYHSE table) { @@ -67,7 +67,7 @@ namespace BLL (string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) && - (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) + (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) select x ; @@ -81,13 +81,13 @@ namespace BLL /// public static IEnumerable getListData(Model.Project_SYHSEData_SYHSE table, Grid Grid1) { - var q = GetProject_SYHSEData_SYHSEByModle(table); + var q = GetProject_SYHSEData_SYHSEByModle(table); count = q.Count(); if (count == 0) { return null; } - //q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + //q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q select new { @@ -142,113 +142,120 @@ namespace BLL } public static void AddProject_SYHSEData_SYHSE(Model.Project_SYHSEData_SYHSE newtable) { - - Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE + 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, - GeneralRiskNum = newtable.GeneralRiskNum, - LowRiskNum = newtable.LowRiskNum, - MediumRiskNum = newtable.MediumRiskNum, - HighRiskNum = newtable.HighRiskNum, - GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum, - ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum, - DesignQuantity = newtable.DesignQuantity, - RunningCapacity = newtable.RunningCapacity, - InterlockSettingValue = newtable.InterlockSettingValue, - VideoSurveillanceNum = newtable.VideoSurveillanceNum, - TotalWorkinghours = newtable.TotalWorkinghours, - SafeWorkinghours = newtable.SafeWorkinghours, - LostWorkinghours = newtable.LostWorkinghours, - TotalEnergyConsumption = newtable.TotalEnergyConsumption, - IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, - NewWaterConsumption = newtable.NewWaterConsumption, - GeneralClosedNum = newtable.GeneralClosedNum, - GeneralNotClosedNum = newtable.GeneralNotClosedNum, - MajorClosedNum = newtable.MajorClosedNum, - MajorNotClosedNum = newtable.MajorNotClosedNum, - HotWorkPermitNum = newtable.HotWorkPermitNum, - HotWorkClosedNum = newtable.HotWorkClosedNum, - HighPermitNum = newtable.HighPermitNum, - HighClosedNum = newtable.HighClosedNum, - TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum, - TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum, - BlindPlatePermitNum = newtable.BlindPlatePermitNum, - BlindPlateClosedNum = newtable.BlindPlateClosedNum, - GroundbreakingPermitNum = newtable.GroundbreakingPermitNum, - GroundbreakingClosedNum = newtable.GroundbreakingClosedNum, - OpenCircuitPermitNum = newtable.OpenCircuitPermitNum, - OpenCircuitClosedNum = newtable.OpenCircuitClosedNum, - HoistingPermitNum = newtable.HoistingPermitNum, - HoistingClosedNum = newtable.HoistingClosedNum, - }; - db.Project_SYHSEData_SYHSE.InsertOnSubmit(table); - db.SubmitChanges(); + Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE + { + Id = newtable.Id, + ProjectId = newtable.ProjectId, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + GeneralRiskNum = newtable.GeneralRiskNum, + LowRiskNum = newtable.LowRiskNum, + MediumRiskNum = newtable.MediumRiskNum, + HighRiskNum = newtable.HighRiskNum, + GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum, + ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum, + DesignQuantity = newtable.DesignQuantity, + RunningCapacity = newtable.RunningCapacity, + InterlockSettingValue = newtable.InterlockSettingValue, + VideoSurveillanceNum = newtable.VideoSurveillanceNum, + TotalWorkinghours = newtable.TotalWorkinghours, + SafeWorkinghours = newtable.SafeWorkinghours, + LostWorkinghours = newtable.LostWorkinghours, + TotalEnergyConsumption = newtable.TotalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption, + NewWaterConsumption = newtable.NewWaterConsumption, + GeneralClosedNum = newtable.GeneralClosedNum, + GeneralNotClosedNum = newtable.GeneralNotClosedNum, + MajorClosedNum = newtable.MajorClosedNum, + MajorNotClosedNum = newtable.MajorNotClosedNum, + HotWorkPermitNum = newtable.HotWorkPermitNum, + HotWorkClosedNum = newtable.HotWorkClosedNum, + HighPermitNum = newtable.HighPermitNum, + HighClosedNum = newtable.HighClosedNum, + TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum, + TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum, + BlindPlatePermitNum = newtable.BlindPlatePermitNum, + BlindPlateClosedNum = newtable.BlindPlateClosedNum, + GroundbreakingPermitNum = newtable.GroundbreakingPermitNum, + GroundbreakingClosedNum = newtable.GroundbreakingClosedNum, + OpenCircuitPermitNum = newtable.OpenCircuitPermitNum, + OpenCircuitClosedNum = newtable.OpenCircuitClosedNum, + HoistingPermitNum = newtable.HoistingPermitNum, + HoistingClosedNum = newtable.HoistingClosedNum, + }; + db.Project_SYHSEData_SYHSE.InsertOnSubmit(table); + db.SubmitChanges(); + } + + } public static void UpdateProject_SYHSEData_SYHSE(Model.Project_SYHSEData_SYHSE newtable) { - - Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.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.GeneralRiskNum = newtable.GeneralRiskNum; - table.LowRiskNum = newtable.LowRiskNum; - table.MediumRiskNum = newtable.MediumRiskNum; - table.HighRiskNum = newtable.HighRiskNum; - table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum; - table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum; - table.DesignQuantity = newtable.DesignQuantity; - table.RunningCapacity = newtable.RunningCapacity; - table.InterlockSettingValue = newtable.InterlockSettingValue; - table.VideoSurveillanceNum = newtable.VideoSurveillanceNum; - table.TotalWorkinghours = newtable.TotalWorkinghours; - table.SafeWorkinghours = newtable.SafeWorkinghours; - table.LostWorkinghours = newtable.LostWorkinghours; - table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; - table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; - table.NewWaterConsumption = newtable.NewWaterConsumption; - table.GeneralClosedNum = newtable.GeneralClosedNum; - table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; - table.MajorClosedNum = newtable.MajorClosedNum; - table.MajorNotClosedNum = newtable.MajorNotClosedNum; - table.HotWorkPermitNum = newtable.HotWorkPermitNum; - table.HotWorkClosedNum = newtable.HotWorkClosedNum; - table.HighPermitNum = newtable.HighPermitNum; - table.HighClosedNum = newtable.HighClosedNum; - table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum; - table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum; - table.BlindPlatePermitNum = newtable.BlindPlatePermitNum; - table.BlindPlateClosedNum = newtable.BlindPlateClosedNum; - table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum; - table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum; - table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum; - table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum; - table.HoistingPermitNum = newtable.HoistingPermitNum; - table.HoistingClosedNum = newtable.HoistingClosedNum; - db.SubmitChanges(); - } + Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.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.GeneralRiskNum = newtable.GeneralRiskNum; + table.LowRiskNum = newtable.LowRiskNum; + table.MediumRiskNum = newtable.MediumRiskNum; + table.HighRiskNum = newtable.HighRiskNum; + table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum; + table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum; + table.DesignQuantity = newtable.DesignQuantity; + table.RunningCapacity = newtable.RunningCapacity; + table.InterlockSettingValue = newtable.InterlockSettingValue; + table.VideoSurveillanceNum = newtable.VideoSurveillanceNum; + table.TotalWorkinghours = newtable.TotalWorkinghours; + table.SafeWorkinghours = newtable.SafeWorkinghours; + table.LostWorkinghours = newtable.LostWorkinghours; + table.TotalEnergyConsumption = newtable.TotalEnergyConsumption; + table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption; + table.NewWaterConsumption = newtable.NewWaterConsumption; + table.GeneralClosedNum = newtable.GeneralClosedNum; + table.GeneralNotClosedNum = newtable.GeneralNotClosedNum; + table.MajorClosedNum = newtable.MajorClosedNum; + table.MajorNotClosedNum = newtable.MajorNotClosedNum; + table.HotWorkPermitNum = newtable.HotWorkPermitNum; + table.HotWorkClosedNum = newtable.HotWorkClosedNum; + table.HighPermitNum = newtable.HighPermitNum; + table.HighClosedNum = newtable.HighClosedNum; + table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum; + table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum; + table.BlindPlatePermitNum = newtable.BlindPlatePermitNum; + table.BlindPlateClosedNum = newtable.BlindPlateClosedNum; + table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum; + table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum; + table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum; + table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum; + table.HoistingPermitNum = newtable.HoistingPermitNum; + table.HoistingClosedNum = newtable.HoistingClosedNum; + db.SubmitChanges(); + } + } } public static void DeleteProject_SYHSEData_SYHSEById(string Id) { - - Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Project_SYHSEData_SYHSE.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.Project_SYHSEData_SYHSE.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } /// /// 判断当天是否统计过数据 @@ -284,7 +291,7 @@ namespace BLL /// public static void StatisticalAllProjectData() { - var projectlist = ProjectService.GetCNCECShowProjectList(); + var projectlist = ProjectService.GetProjectWorkList(); foreach (var item in projectlist) { StatisticalData(item.ProjectId, SYHSESDateType.All); @@ -295,7 +302,7 @@ namespace BLL /// /// /// - public static void StatisticalData(string projectid, SYHSESDateType sYHSESDateType) + public static void StatisticalData(string projectid,SYHSESDateType sYHSESDateType) { string thisUnitId = string.Empty; var thisUnit = CommonService.GetIsThisUnit(); @@ -319,7 +326,7 @@ namespace BLL table.ProjectId = projectid; table.ReportDate = DateTime.Now.Date; - if (sYHSESDateType == SYHSESDateType.RiskControl || sYHSESDateType == SYHSESDateType.All) + if (sYHSESDateType== SYHSESDateType.RiskControl || sYHSESDateType == SYHSESDateType.All) { table.GeneralRiskNum = GetGeneralRiskNum(projectid); table.LowRiskNum = GetLowRiskNum(projectid); diff --git a/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs b/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs index cadc7971..ad280ff4 100644 --- a/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/SYHSEData_DataService.cs @@ -30,7 +30,7 @@ namespace BLL var q = from x in db.SYHSEData_Data where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && - (string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) + (string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) select x ; @@ -89,31 +89,31 @@ namespace BLL } public static Model.NewSYHSEData GetItemById(string Id) { - var data = GetSYHSEData_DataById(Id); + var data=GetSYHSEData_DataById(Id); var data_realtime = HazardRealtimedeviceService.GetHazard_RealTimeDeviceByDate(data.ReportDate); - var data_hidden = SyhsedataHiddendangercheckService.GetSYHSEData_HiddenDangerCheckByDate(data.ReportDate); - var data_risk = SyhsedataRiskcontrolService.GetSYHSEData_RiskControlByDate(data.ReportDate); + var data_hidden= SyhsedataHiddendangercheckService.GetSYHSEData_HiddenDangerCheckByDate(data.ReportDate); + var data_risk= SyhsedataRiskcontrolService.GetSYHSEData_RiskControlByDate(data.ReportDate); NewSYHSEData APIData = new NewSYHSEData(); - var APIDataList_Item = new List(); - var APIDataList_Relatime = new List(); - var APIDataList_Hidden = new List(); - var APIDataList_Risk = new List(); + var APIDataList_Item= new List(); + var APIDataList_Relatime= new List(); + var APIDataList_Hidden= new List(); + var APIDataList_Risk= new List(); foreach (var tb in data_realtime) { var q = new NewSYHSEDataRealTimeDeviceItem() { - Id = tb.ID, - HazardName = tb.HazardName, - HazardLevel = tb.HazardLevel, - DeviceName = tb.DeviceName, - Medium = tb.Medium, - MeasurementUnit = tb.MeasurementUnit, - DateTime = tb.DateTime.ToString(), - Value = tb.Value, - + Id=tb.ID, + HazardName=tb.HazardName, + HazardLevel=tb.HazardLevel, + DeviceName=tb.DeviceName, + Medium=tb.Medium, + MeasurementUnit=tb.MeasurementUnit, + DateTime=tb.DateTime.ToString(), + Value=tb.Value, + }; APIDataList_Relatime.Add(q); @@ -123,10 +123,10 @@ namespace BLL { var q = new NewSYHSEDataHiddenDangerCheckItem() { - Id = tb.Id, - HiddenDangerName = tb.HiddenDangerName, - TotalNum = tb.TotalNum.HasValue ? tb.TotalNum.Value : 0, - OKNum = tb.OKNum.HasValue ? tb.OKNum.Value : 0, + Id=tb.Id, + HiddenDangerName=tb.HiddenDangerName, + TotalNum=tb.TotalNum.HasValue ? tb.TotalNum.Value:0, + OKNum=tb.OKNum.HasValue ? tb.OKNum.Value : 0, }; APIDataList_Hidden.Add(q); @@ -136,31 +136,31 @@ namespace BLL { var q = new NewSYHSEDataRiskControlItem() - { - Id = tb.Id, - RiskControlName = tb.RiskControlName, - - }; + { + Id=tb.Id, + RiskControlName=tb.RiskControlName, + + }; APIDataList_Risk.Add(q); } var thisUnit = CommonService.GetIsThisUnit(); NewSYHSEDataItem Item = new NewSYHSEDataItem(); Item.Id = data.Id; - Item.ReportDate = data.ReportDate.ToString(); + Item.ReportDate=data.ReportDate.ToString(); Item.UnitId = thisUnit.UnitId; Item.CollCropCode = thisUnit.CollCropCode; - Item.UnitName = thisUnit.UnitName; + Item.UnitName= thisUnit.UnitName; Item.FactoryId = data.FactoryId; - Item.FactoryCode = ProjectService.GetProjectByProjectId(data.FactoryId).ProjectCode; + 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; - Item.MoreRiskNum = data.MoreRiskNum.HasValue ? data.MoreRiskNum.Value : 0; - Item.GreatRiskNum = data.GreatRiskNum.HasValue ? data.GreatRiskNum.Value : 0; + 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; + Item.MoreRiskNum = data.MoreRiskNum.HasValue ? data.MoreRiskNum.Value : 0; + Item.GreatRiskNum = data.GreatRiskNum.HasValue ? data.GreatRiskNum.Value : 0; Item.NewSYHSEDataRiskControlItems = APIDataList_Risk; Item.NewSYHSEDataRealTimeDeviceItems = APIDataList_Relatime; Item.NewSYHSEDataHiddenDangerCheckItems = APIDataList_Hidden; @@ -168,7 +168,7 @@ namespace BLL APIDataList_Item.Add(Item); APIData.NewSYHSEDataItems = APIDataList_Item; - + return APIData; } diff --git a/SGGL/BLL/ZHGL/DataSync/SYHSEData_HiddenDangerCheckService.cs b/SGGL/BLL/ZHGL/DataSync/SYHSEData_HiddenDangerCheckService.cs index e275e37a..1c17e777 100644 --- a/SGGL/BLL/ZHGL/DataSync/SYHSEData_HiddenDangerCheckService.cs +++ b/SGGL/BLL/ZHGL/DataSync/SYHSEData_HiddenDangerCheckService.cs @@ -29,7 +29,7 @@ namespace BLL where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) && - (string.IsNullOrEmpty(table.HiddenDangerName) || x.HiddenDangerName.Contains(table.HiddenDangerName)) + (string.IsNullOrEmpty(table.HiddenDangerName) || x.HiddenDangerName.Contains(table.HiddenDangerName)) select x ; diff --git a/SGGL/BLL/ZHGL/DataSync/SYHSEData_RiskControlService.cs b/SGGL/BLL/ZHGL/DataSync/SYHSEData_RiskControlService.cs index 030ba134..cf013d66 100644 --- a/SGGL/BLL/ZHGL/DataSync/SYHSEData_RiskControlService.cs +++ b/SGGL/BLL/ZHGL/DataSync/SYHSEData_RiskControlService.cs @@ -29,7 +29,7 @@ namespace BLL where (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) && - (string.IsNullOrEmpty(table.RiskControlName) || x.RiskControlName.Contains(table.RiskControlName)) + (string.IsNullOrEmpty(table.RiskControlName) || x.RiskControlName.Contains(table.RiskControlName)) select x ; diff --git a/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs b/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs index be7ec9bd..31f91a76 100644 --- a/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/SYHSEData_SYHSEService.cs @@ -307,7 +307,7 @@ namespace BLL q.State = Const.CNCEC_State_1; UpdateSYHSEData_SYHSE(q); } - + } public static bool IsReportByDate(DateTime dateTime) { diff --git a/SGGL/BLL/ZHGL/DataSync/ServerService.cs b/SGGL/BLL/ZHGL/DataSync/ServerService.cs index bcde99ae..029ab842 100644 --- a/SGGL/BLL/ZHGL/DataSync/ServerService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ServerService.cs @@ -1,25 +1,34 @@ using Model; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using RestSharp; using System; using System.Collections.Generic; using System.Linq; using System.Net; +using System.Net.Configuration; using System.Security.Policy; using System.Text; using System.Threading.Tasks; +using ResponeData = Model.ResponeData; namespace BLL { + /// + /// 集团服务类 + /// public static class ServerService { + /// + /// 获取集团token + /// + /// public static Model.TokenItem GetCNCECToken() { string CNCECPath = SysConstSetService.CNCECPath; - string baseurl = CNCECPath + "/api/Common/GetToken"; var client = new RestClient(baseurl); - client.Timeout = -1; + client.Timeout = 2000;//获取token设置超时时间为3秒 var request = new RestRequest(Method.POST); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var thisUnit = CommonService.GetIsThisUnit(); @@ -28,45 +37,73 @@ namespace BLL //request.AddJsonBody(JsonBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); - var responeData = JsonConvert.DeserializeObject(response.Content.ToString()); TokenItem tokenItem = new TokenItem(); - if (responeData.code == 1 && string.IsNullOrEmpty(responeData.message)) + + try { - var token = JsonConvert.DeserializeObject(responeData.data.ToString()); - tokenItem.Token = token.Token.ToString(); - tokenItem.ExpiryTime = token.ExpiryTime.ToString(); - SysConstSetService.SetToken(tokenItem.Token); - SysConstSetService.SetTokenExpirationTime(tokenItem.ExpiryTime); + var responeData = JsonConvert.DeserializeObject(response.Content.ToString()); + if (responeData != null && responeData.code == 1 && string.IsNullOrEmpty(responeData.message)) + { + var token = JsonConvert.DeserializeObject(responeData.data.ToString()); + tokenItem.Token = token.Token.ToString(); + tokenItem.ExpiryTime = token.ExpiryTime.ToString(); + SysConstSetService.SetToken(tokenItem.Token); + SysConstSetService.SetTokenExpirationTime(tokenItem.ExpiryTime); + } + } + catch (Exception e) + { + } + return tokenItem; } + /// + /// 推送数据至集团(post接口) + /// + /// + /// + /// public static Model.ReturnData PushCNCEC(string JsonBody, string apiurl) { - Model.ReturnData responeData = new Model.ReturnData(); - string CNCECPath = SysConstSetService.CNCECPath; - if (string.IsNullOrEmpty(CNCECPath)) + try { - responeData.code = 0; - responeData.message = "接口地址为空,请配置!"; - return responeData; + Model.ReturnData responeData = new Model.ReturnData(); + string CNCECPath = SysConstSetService.CNCECPath; + //CNCECPath = "http://localhost:7143"; + if (string.IsNullOrEmpty(CNCECPath)) + { + responeData.code = 0; + responeData.message = "接口地址为空,请配置!"; + return responeData; + } + string baseurl = CNCECPath + apiurl; + var client = new RestClient(baseurl); + client.Timeout = -1; + var request = new RestRequest(Method.POST); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + var tokenItem = GetToken(); + request.AddHeader("token", tokenItem.Token); + request.AddJsonBody(JsonBody); + IRestResponse response = client.Execute(request); + APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content); + var returnData = JsonConvert.DeserializeObject(response.Content.ToString()); + responeData.code = returnData.code; + responeData.message = returnData.message; + return responeData; + } + catch (Exception ex) + { + + throw; } - string baseurl = CNCECPath + apiurl; - var client = new RestClient(baseurl); - client.Timeout = -1; - var request = new RestRequest(Method.POST); - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - var tokenItem = GetToken(); - request.AddHeader("token", tokenItem.Token); - request.AddJsonBody(JsonBody); - IRestResponse response = client.Execute(request); - APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content); - var returnData = JsonConvert.DeserializeObject(response.Content.ToString()); - responeData.code = returnData.code; - responeData.message = returnData.message; - return responeData; } + /// + /// 获取token + /// + /// public static Model.TokenItem GetToken() { Model.TokenItem tokenItem = new Model.TokenItem(); @@ -84,6 +121,182 @@ namespace BLL } return tokenItem; } + /// + /// 从集团获取数据(Get接口) + /// + /// 接口地址 + /// parameters参数 + /// 超时时间 + /// + public static Model.ResponeData GerDataFromCncec(string apiurl, Dictionary parameters, int? timeout = null) + { + Model.ResponeData responeData = new Model.ResponeData(); + try + { + + string CNCECPath = SysConstSetService.CNCECPath; + if (string.IsNullOrEmpty(CNCECPath)) + { + responeData.code = 0; + responeData.message = "接口地址为空,请配置!"; + return responeData; + + } + string baseurl = CNCECPath + apiurl; + var client = new RestClient(baseurl); + client.Timeout = timeout ?? -1; + var request = new RestRequest(Method.GET); + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + var tokenItem = GetToken(); + if (tokenItem == null || string.IsNullOrEmpty(tokenItem.Token)) + { + responeData.code = 0; + responeData.message = "token 不存在!"; + return responeData; + } + + request.AddHeader("token", tokenItem.Token); + if (parameters != null) + { + foreach (var parameter in parameters) + { + request.AddParameter(parameter.Key, parameter.Value); + } + } + + IRestResponse response = client.Execute(request); + APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content); + var returnData = JsonConvert.DeserializeObject(response.Content.ToString()); + if (returnData != null) + { + responeData.code = returnData.code; + responeData.message = returnData.message; + responeData.data = returnData.data; + + } + else + { + responeData.code = -1; + responeData.message = "接口有误"; + } + + return responeData; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.ToString(); + return responeData; + } + } + + + /// + /// 获取安全合规列表 + /// + /// 类型(1-法律法规;2-标准规范;3-规章制度;4-管理规定) + /// + public static async Task> GetSafeLawListByTypeAsync(string type) + { + // 使用 lambda 表达式来调用 getSafeLawListByType + return await Task.Run(() => GetSafeLawListByType(type)); + } + /// + /// 获取安全合规列表 + /// + /// 类型(1-法律法规;2-标准规范;3-规章制度;4-管理规定) + /// + public static List GetSafeLawListByType(string type) + { + List result = new List(); + string baseurl = "/api/Resources/getSafeLawListByType"; + Dictionary dic = new Dictionary() + { + {"type",type}, + {"pageIndex","0"} + + }; + var returnData = GerDataFromCncec(baseurl, dic, 3000); + if (returnData != null && returnData.code == 1) + { + JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject(returnData.data.ToString()); + var data = jt["getDataList"].ToString(); + result = JsonConvert.DeserializeObject>(data); + + } + return result; + } + /// + /// 获取公告列表 + /// + /// + public static List GetNoticeList() + { + List result = new List(); + string baseurl = "/api/Notice/getNoticeList"; + Dictionary dic = new Dictionary() + { + {"pageIndex","0"} + + }; + var returnData = GerDataFromCncec(baseurl, dic, 4000); + if (returnData != null && returnData.code == 1) + { + JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject(returnData.data.ToString()); + var data = jt["getDataList"].ToString(); + result = JsonConvert.DeserializeObject>(data); + + } + return result; + } + /// + /// 获取公告列表 + /// + /// + public static async Task> GetNoticeListAsync() + { + return await Task.Run(() => GetNoticeList()); + } + /// + /// 获取新闻列表 + /// + /// + public static List GetNewsList() + { + List result = new List(); + string baseurl = "/api/Notice/getNewsList"; + Dictionary dic = new Dictionary() + { + {"pageIndex","0"} + + }; + var returnData = GerDataFromCncec(baseurl, dic, 3000); + if (returnData != null && returnData.code == 1) + { + JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject(returnData.data.ToString()); + var data = jt["getDataList"].ToString(); + result = JsonConvert.DeserializeObject>(data); + + } + return result; + } + /// + /// 获取新闻列表 + /// + /// + public static async Task> GetNewsListAsync() + { + return await Task.Run(() => GetNewsList()); + } + /// + /// 获取QHSEUrl + /// + /// + public static string GetQHSEUrl() + { + var result = GerDataFromCncec("/api/Data/GetWebUrl", null, 3000).data?.ToString(); + return result; + } } } diff --git a/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx b/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx new file mode 100644 index 00000000..6ddd9d52 --- /dev/null +++ b/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx @@ -0,0 +1,23 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UnitProjectTControl.ascx.cs" Inherits="FineUIPro.Web.Controls.UnitProjectTControl" %> + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx.cs b/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx.cs new file mode 100644 index 00000000..fe3b7f15 --- /dev/null +++ b/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx.cs @@ -0,0 +1,190 @@ +using BLL; +using Org.BouncyCastle.Asn1.Cms; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.Controls +{ + public partial class UnitProjectTControl : System.Web.UI.UserControl + { + + #region 定义页面项 + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + + /// + /// 菜单ID + /// + public string UnitId + { + get + { + return (string)ViewState["UnitId"]; + } + set + { + ViewState["UnitId"] = value; + } + } + #endregion + + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.UnitId = this.UnitId ?? BLL.Const.UnitId_SEDIN; + this.ProjectId=this.ProjectId; + ////加载树 + SetSubUnitProjectTree(this.tvProject); + } + } + #endregion + + /// + /// + /// + /// + /// + protected void tvProject_NodeCommand(object sender, TreeCommandEventArgs e) + { + this.UnitId = string.Empty; + this.ProjectId = string.Empty; + if (this.tvProject != null && !string.IsNullOrEmpty(this.tvProject.SelectedNodeID)) + { + if (this.tvProject.SelectedNode.ParentNode == null) + { + this.UnitId = this.tvProject.SelectedNodeID; + } + else + { + this.UnitId=this.tvProject.SelectedNode.ParentNode.NodeID; + this.ProjectId = this.tvProject.SelectedNodeID; + } + if (this.change != null) + { + this.change(this, e); + } + + } + } + + public delegate void userEvent(object sender, EventArgs arg); + + public event userEvent change; + + + #region 绑定分公司 单位-项目树 + /// + /// 绑定分公司 单位-项目树 + /// + /// + /// + public void SetSubUnitProjectTree(FineUIPro.Tree tvProject) + { + tvProject.Nodes.Clear(); + if (BLL.Const.UnitId_SEDIN == this.UnitId) + { + var getSubUnit = from x in Funs.DB.Base_Unit + where x.UnitId == this.UnitId || x.IsBranch == true + orderby x.IsBranch, x.UnitCode + select x; + foreach (var item in getSubUnit) + { + bool isHideUPTCode = false; + var sysSet17 = (from x in Funs.DB.Sys_Const where x.ConstText == "是否隐藏公司项目树单位编码" select x).ToList().FirstOrDefault(); + if (sysSet17 != null) + { + isHideUPTCode = true; + } + FineUIPro.TreeNode crootNode = new FineUIPro.TreeNode + { + + // Text =item.UnitCode+":"+ item.UnitName, + NodeID = item.UnitId, + EnableClickEvent = true + }; + if (isHideUPTCode) + { + crootNode.Text = item.UnitName; + } + else + { + crootNode.Text = item.UnitCode + ":" + item.UnitName; + } + tvProject.Nodes.Add(crootNode); + + var getSProjects = ProjectService.GetProjectWorkList(); + foreach (var sitem in getSProjects) + { + FineUIPro.TreeNode scrootNode = new FineUIPro.TreeNode + { + Text = sitem.ProjectName, + NodeID = sitem.ProjectId, + EnableClickEvent = true + }; + if (sitem.ProjectId == this.ProjectId) + { + scrootNode.Checked = true; + } + crootNode.Nodes.Add(scrootNode); + } + } + } + else + { + var getSubUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == this.UnitId); + if (getSubUnit != null) + { + FineUIPro.TreeNode crootNode = new FineUIPro.TreeNode + { + Text = getSubUnit.UnitName, + NodeID = getSubUnit.UnitId, + EnableClickEvent = true + }; + tvProject.Nodes.Add(crootNode); + + var getSProjects = ProjectService.GetProjectWorkList(); + foreach (var sitem in getSProjects) + { + FineUIPro.TreeNode scrootNode = new FineUIPro.TreeNode + { + Text = sitem.ProjectName, + NodeID = sitem.ProjectId, + EnableClickEvent = true + }; + if (sitem.ProjectId == this.ProjectId) + { + scrootNode.Checked = true; + } + crootNode.Nodes.Add(scrootNode); + } + } + } + } + #endregion + + protected void ckState_SelectedIndexChanged(object sender, EventArgs e) + { + ////加载树 + SetSubUnitProjectTree(this.tvProject); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx.designer.cs b/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx.designer.cs new file mode 100644 index 00000000..c277f36f --- /dev/null +++ b/SGGL/FineUIPro.Web/Controls/UnitProjectTControl.ascx.designer.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.Controls +{ + + + public partial class UnitProjectTControl + { + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// ckState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList ckState; + + /// + /// tvProject 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tree tvProject; + } +} diff --git a/SGGL/FineUIPro.Web/File/Word/HSSE/环境监测数据接口.docx b/SGGL/FineUIPro.Web/File/Word/HSSE/环境监测数据接口.docx new file mode 100644 index 00000000..f661aa24 Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Word/HSSE/环境监测数据接口.docx differ diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 0ddf8466..b25b7fdc 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -369,6 +369,7 @@ + @@ -1760,6 +1761,7 @@ + @@ -3576,6 +3578,7 @@ + @@ -8323,6 +8326,13 @@ ProjectWBSControl.ascx + + UnitProjectTControl.ascx + ASPXCodeBehind + + + UnitProjectTControl.ascx + WBSControl.ascx ASPXCodeBehind @@ -12008,6 +12018,13 @@ EnvironmentalMonitoring.aspx + + EnvironmentalMonitoringApiView.aspx + ASPXCodeBehind + + + EnvironmentalMonitoringApiView.aspx + EnvironmentalMonitoringEdit.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoring.aspx b/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoring.aspx index 5f592f03..1628dc6f 100644 --- a/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoring.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoring.aspx @@ -1,108 +1,136 @@ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnvironmentalMonitoring.aspx.cs" Inherits="FineUIPro.Web.HSSE.Environmental.EnvironmentalMonitoring" %> - +<%@ Register Src="~/Controls/UnitProjectTControl.ascx" TagName="UnitProjectTControl" TagPrefix="uc1" %> - - - 环境监测数据 - + + + + + + 环境监测 + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiView.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiView.aspx.cs new file mode 100644 index 00000000..b2d9e7c7 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiView.aspx.cs @@ -0,0 +1,41 @@ +using BLL; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.OleDb; +using System.IO; +using System.Linq; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.HSSE.Environmental +{ + public partial class EnvironmentalMonitoringApiView : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + txtUrl.Text = Funs.SGGLApiUrl; + txtProjectid.Text = this.Request.Params["Projectid"]; + } + + } + protected void imgbtnUpload_Click(object sender, EventArgs e) + { + + string rootPath = Server.MapPath("~/"); + string filePath = "File\\Word\\HSSE\\环境监测数据接口.docx"; + string uploadfilepath = rootPath + filePath; + string fileName = Path.GetFileName(filePath); + FileInfo info = new FileInfo(uploadfilepath); + long fileSize = info.Length; + System.Web.HttpContext.Current.Response.Clear(); + System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed"; + System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString()); + System.Web.HttpContext.Current.Response.TransmitFile(uploadfilepath, 0, fileSize); + System.Web.HttpContext.Current.Response.Flush(); + System.Web.HttpContext.Current.Response.Close(); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiView.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiView.aspx.designer.cs new file mode 100644 index 00000000..9fe978d5 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiView.aspx.designer.cs @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.Environmental +{ + + + public partial class EnvironmentalMonitoringApiView + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtUrl; + + /// + /// txtProjectid 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectid; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// imgbtnUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button imgbtnUpload; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx index 157fb801..528b8db0 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx @@ -40,6 +40,12 @@ AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="200px" LabelWidth="50px"> + + + + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs index 27e059a0..f26eae13 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs @@ -61,6 +61,14 @@ namespace FineUIPro.Web.ProjectData { strSql += " AND IsCNCECShow=1 "; } + if (this.ckMaster.SelectedValue == "0") + { + strSql += " AND MasterSysId IS NULL "; + } + else if (this.ckMaster.SelectedValue == "1") + { + strSql += " AND MasterSysId IS NOT NULL "; + } if (!string.IsNullOrEmpty(this.txtProjectName.Text.Trim())) { @@ -460,5 +468,6 @@ namespace FineUIPro.Web.ProjectData } } #endregion + } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs index 856951de..d4f8cbbb 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs @@ -84,6 +84,15 @@ namespace FineUIPro.Web.ProjectData { /// protected global::FineUIPro.CheckBox rbIsCNCECShow; + /// + /// ckMaster 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList ckMaster; + /// /// btnNew 控件。 /// diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx index 6e048f5c..c99d5495 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx @@ -138,6 +138,48 @@ + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs index 76a3c877..e00d7a24 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs @@ -4,6 +4,7 @@ using System; using System.Linq; using System.ServiceModel; using System.Text.RegularExpressions; +using System.Data; namespace FineUIPro.Web.ProjectData { @@ -45,6 +46,10 @@ namespace FineUIPro.Web.ProjectData var project = BLL.ProjectService.GetProjectByProjectId(this.ProjectId); if (project != null) { + if (!string.IsNullOrEmpty(project.MasterSysId)) + { + this.drpMasterBox1.Value = project.MasterSysId; + } this.txtProjectCode.Text = project.ProjectCode; this.txtProjectName.Text = project.ProjectName; this.txtProjectAddress.Text = project.ProjectAddress; @@ -153,7 +158,10 @@ namespace FineUIPro.Web.ProjectData ProjectRealCode = this.txtProjectRealCode.Text.Trim(), IsCNCECShow = Convert.ToBoolean(this.rbIsCNCECShow.SelectedValue), }; - + if (!string.IsNullOrWhiteSpace(this.drpMasterBox1.Text)) + { + project.MasterSysId = this.drpMasterBox1.Value; + } if (!string.IsNullOrEmpty(txtStartDate.Text.Trim())) { project.StartDate = Funs.GetNewDateTime(this.txtStartDate.Text.Trim()); @@ -296,5 +304,56 @@ namespace FineUIPro.Web.ProjectData ///安全经理 Person_PersonsService.InitUserProjectIdUnitIdRoleIdDropDownList(this.drpHSSEManager, null, unitId, null, true); } + + private void BindGrid() + { + var list = ProjectService.GetMasterProjectInfos(); + string code = ttbCodeSearch.Text.Trim(); + string name = ttbNameSearch.Text.Trim(); + if (!string.IsNullOrWhiteSpace(code)) + { + list = list.Where(x => x.PrjCode.Contains(code)).ToList(); + } + if (!string.IsNullOrWhiteSpace(name)) + { + list = list.Where(x => x.PrjName.Contains(name)).ToList(); + } + + // 1.设置总项数(特别注意:数据库分页一定要设置总记录数RecordCount) + Grid1.RecordCount = list.Count(); + // 2.获取当前分页数据 + DataTable table = Funs.LINQToDataTable(list); + + // 3.绑定到Grid + Grid1.DataSource = table; + Grid1.DataBind(); + } + + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + BindGrid(); + } + protected void ttbCodeSearch_Trigger1Click(object sender, EventArgs e) + { + ttbCodeSearch.Text = string.Empty; + ttbCodeSearch.ShowTrigger1 = false; + BindGrid(); + } + protected void ttbCodeSearch_Trigger2Click(object sender, EventArgs e) + { + ttbCodeSearch.ShowTrigger1 = true; + BindGrid(); + } + protected void ttbNameSearch_Trigger1Click(object sender, EventArgs e) + { + ttbNameSearch.Text = string.Empty; + ttbNameSearch.ShowTrigger1 = false; + BindGrid(); + } + protected void ttbNameSearch_Trigger2Click(object sender, EventArgs e) + { + ttbNameSearch.ShowTrigger1 = true; + BindGrid(); + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs index f1eef492..512678d6 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs @@ -7,13 +7,11 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.ProjectData -{ - - - public partial class ProjectSetSave - { - +namespace FineUIPro.Web.ProjectData { + + + public partial class ProjectSetSave { + /// /// form1 控件。 /// @@ -22,7 +20,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -31,7 +29,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// SimpleForm1 控件。 /// @@ -40,7 +38,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm1; - + /// /// txtProjectName 控件。 /// @@ -49,7 +47,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtProjectName; - + /// /// txtProjectCode 控件。 /// @@ -58,7 +56,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtProjectCode; - + /// /// txtShortName 控件。 /// @@ -67,7 +65,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtShortName; - + /// /// drpProjectType 控件。 /// @@ -76,7 +74,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpProjectType; - + /// /// drpProjectState 控件。 /// @@ -85,7 +83,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpProjectState; - + /// /// txtStartDate 控件。 /// @@ -94,7 +92,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtStartDate; - + /// /// txtEndDate 控件。 /// @@ -103,7 +101,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtEndDate; - + /// /// txtContractNo 控件。 /// @@ -112,7 +110,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtContractNo; - + /// /// txtDuration 控件。 /// @@ -121,7 +119,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDuration; - + /// /// drpUnit 控件。 /// @@ -130,7 +128,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpUnit; - + /// /// ckbIsForeign 控件。 /// @@ -139,7 +137,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckbIsForeign; - + /// /// drpProjectManager 控件。 /// @@ -148,7 +146,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpProjectManager; - + /// /// drpConstructionManager 控件。 /// @@ -157,7 +155,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpConstructionManager; - + /// /// drpHSSEManager 控件。 /// @@ -166,7 +164,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpHSSEManager; - + /// /// txtProjectAddress 控件。 /// @@ -175,7 +173,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtProjectAddress; - + /// /// txtWorkRange 控件。 /// @@ -184,7 +182,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextArea txtWorkRange; - + /// /// txtRemark 控件。 /// @@ -193,7 +191,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextArea txtRemark; - + /// /// txtProjectMoney 控件。 /// @@ -202,7 +200,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtProjectMoney; - + /// /// txtConstructionMoney 控件。 /// @@ -211,7 +209,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtConstructionMoney; - + /// /// txtTelephone 控件。 /// @@ -220,7 +218,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtTelephone; - + /// /// txtCountry 控件。 /// @@ -229,7 +227,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCountry; - + /// /// drpProvince 控件。 /// @@ -238,7 +236,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpProvince; - + /// /// txtCity 控件。 /// @@ -247,7 +245,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCity; - + /// /// txtMapCoordinates 控件。 /// @@ -256,7 +254,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtMapCoordinates; - + /// /// bottomPanel 控件。 /// @@ -265,7 +263,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ContentPanel bottomPanel; - + /// /// txtEnglishRemark 控件。 /// @@ -274,7 +272,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtEnglishRemark; - + /// /// txtProjectRealCode 控件。 /// @@ -283,7 +281,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtProjectRealCode; - + /// /// rbIsCNCECShow 控件。 /// @@ -292,7 +290,61 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rbIsCNCECShow; - + + /// + /// drpMasterBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownBox drpMasterBox1; + + /// + /// Panel7 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel7; + + /// + /// Form5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form Form5; + + /// + /// ttbCodeSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TwinTriggerBox ttbCodeSearch; + + /// + /// ttbNameSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TwinTriggerBox ttbNameSearch; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + /// /// Toolbar1 控件。 /// @@ -301,7 +353,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar1; - + /// /// ckIsUpTotalMonth 控件。 /// @@ -310,7 +362,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckIsUpTotalMonth; - + /// /// btnSave 控件。 /// @@ -319,7 +371,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnSave; - + /// /// btnClose 控件。 /// @@ -328,7 +380,7 @@ namespace FineUIPro.Web.ProjectData /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnClose; - + /// /// hdCompileMan 控件。 /// diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx index 1837ca84..c5c79db6 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx @@ -113,6 +113,11 @@ + + + + + diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs index 675988a1..9689f640 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.cs @@ -134,6 +134,11 @@ namespace FineUIPro.Web.SysManage { txtSerVerUrl.Text = sysSet9.ConstValue; } + var sysSet6_Api = (from x in Funs.DB.Sys_Const where x.ConstText == "程序接口访问地址" select x).ToList().FirstOrDefault(); + if (sysSet6_Api != null) + { + this.txtSGGLApiUrl.Text = sysSet6_Api.ConstValue; + } var sysSet10 = (from x in Funs.DB.Sys_Const where x.ConstText == "集团ESB地址" select x).ToList().FirstOrDefault(); if (sysSet10 != null) { @@ -353,6 +358,27 @@ namespace FineUIPro.Web.SysManage Funs.DB.Sys_Const.InsertOnSubmit(newSysSet9); Funs.DB.SubmitChanges(); } + Model.Sys_Const sysSet6_Api = db.Sys_Const.FirstOrDefault(x => x.ConstText == "程序接口访问地址"); + if (sysSet6_Api != null) + { + if (!string.IsNullOrEmpty(this.txtSGGLApiUrl.Text.Trim())) + { + sysSet6_Api.ConstValue = this.txtSGGLApiUrl.Text.Trim(); + } + db.SubmitChanges(); + } + else + { + Model.Sys_Const newsysSet6_Api = new Model.Sys_Const(); + newsysSet6_Api.ID = SQLHelper.GetNewID(); + if (!string.IsNullOrEmpty(this.txtSGGLApiUrl.Text.Trim())) + { + newsysSet6_Api.ConstValue = this.txtSGGLApiUrl.Text.Trim(); + } + newsysSet6_Api.ConstText = "程序接口访问地址"; + Funs.DB.Sys_Const.InsertOnSubmit(newsysSet6_Api); + Funs.DB.SubmitChanges(); + } Model.Sys_Const sysSet10 = db.Sys_Const.FirstOrDefault(x => x.ConstText == "集团ESB地址"); if (sysSet10 != null) { diff --git a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs index 33bca25f..7a3eb6f2 100644 --- a/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/SysManage/SysConstSet.aspx.designer.cs @@ -7,13 +7,11 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.SysManage -{ - - - public partial class SysConstSet - { - +namespace FineUIPro.Web.SysManage { + + + public partial class SysConstSet { + /// /// form1 控件。 /// @@ -22,7 +20,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -31,7 +29,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// Panel2 控件。 /// @@ -40,7 +38,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Panel Panel2; - + /// /// TabStrip1 控件。 /// @@ -49,7 +47,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TabStrip TabStrip1; - + /// /// Tab1 控件。 /// @@ -58,7 +56,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab1; - + /// /// SimpleForm1 控件。 /// @@ -67,7 +65,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm1; - + /// /// txtNumberBox 控件。 /// @@ -76,7 +74,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtNumberBox; - + /// /// Label9 控件。 /// @@ -85,7 +83,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label9; - + /// /// ckIsMonthReportGetAVG 控件。 /// @@ -94,7 +92,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckIsMonthReportGetAVG; - + /// /// Label10 控件。 /// @@ -103,7 +101,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label10; - + /// /// txtMonthReportFreezeDay 控件。 /// @@ -112,7 +110,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMonthReportFreezeDay; - + /// /// Label11 控件。 /// @@ -121,7 +119,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label11; - + /// /// frFlowOperate 控件。 /// @@ -130,7 +128,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.FormRow frFlowOperate; - + /// /// ckMenuFlowOperate 控件。 /// @@ -139,7 +137,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckMenuFlowOperate; - + /// /// Label12 控件。 /// @@ -148,7 +146,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label12; - + /// /// txtMarch 控件。 /// @@ -157,7 +155,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMarch; - + /// /// Label1 控件。 /// @@ -166,7 +164,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label1; - + /// /// txtMarchday 控件。 /// @@ -175,7 +173,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMarchday; - + /// /// Label2 控件。 /// @@ -184,7 +182,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label2; - + /// /// txtJune 控件。 /// @@ -193,7 +191,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJune; - + /// /// Label3 控件。 /// @@ -202,7 +200,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label3; - + /// /// txtJuneday 控件。 /// @@ -211,7 +209,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJuneday; - + /// /// Label4 控件。 /// @@ -220,7 +218,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label4; - + /// /// txtSeptember 控件。 /// @@ -229,7 +227,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSeptember; - + /// /// Label5 控件。 /// @@ -238,7 +236,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label5; - + /// /// txtSeptemberday 控件。 /// @@ -247,7 +245,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSeptemberday; - + /// /// Label6 控件。 /// @@ -256,7 +254,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label6; - + /// /// txtDecember 控件。 /// @@ -265,7 +263,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDecember; - + /// /// Label7 控件。 /// @@ -274,7 +272,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label7; - + /// /// txtDecemberday 控件。 /// @@ -283,7 +281,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDecemberday; - + /// /// Label13 控件。 /// @@ -292,7 +290,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label13; - + /// /// txtSerVerUrl 控件。 /// @@ -301,7 +299,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtSerVerUrl; - + /// /// btnApply 控件。 /// @@ -310,7 +308,16 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnApply; - + + /// + /// txtSGGLApiUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSGGLApiUrl; + /// /// txtESBSerVerUrl 控件。 /// @@ -319,7 +326,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtESBSerVerUrl; - + /// /// txtClientId 控件。 /// @@ -328,7 +335,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtClientId; - + /// /// txtTestPost 控件。 /// @@ -337,7 +344,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button txtTestPost; - + /// /// txtRefererWhitelist 控件。 /// @@ -346,7 +353,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextArea txtRefererWhitelist; - + /// /// Toolbar1 控件。 /// @@ -355,7 +362,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar1; - + /// /// btnSave 控件。 /// @@ -364,7 +371,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnSave; - + /// /// btnArrowRefresh 控件。 /// @@ -373,7 +380,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnArrowRefresh; - + /// /// Tab2 控件。 /// @@ -382,7 +389,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab2; - + /// /// Toolbar3 控件。 /// @@ -391,7 +398,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar3; - + /// /// rblMenuType 控件。 /// @@ -400,7 +407,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rblMenuType; - + /// /// drpSuperMenu 控件。 /// @@ -409,7 +416,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpSuperMenu; - + /// /// drpMenu 控件。 /// @@ -418,7 +425,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownBox drpMenu; - + /// /// treeMenu 控件。 /// @@ -427,7 +434,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tree treeMenu; - + /// /// ToolbarFill1 控件。 /// @@ -436,7 +443,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnReport 控件。 /// @@ -445,7 +452,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnReport; - + /// /// btnTab2Save 控件。 /// @@ -454,7 +461,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnTab2Save; - + /// /// TabStrip2 控件。 /// @@ -463,7 +470,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TabStrip TabStrip2; - + /// /// TabCode 控件。 /// @@ -472,7 +479,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab TabCode; - + /// /// SimpleForm2 控件。 /// @@ -481,7 +488,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form SimpleForm2; - + /// /// ckProjectCode 控件。 /// @@ -490,7 +497,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckProjectCode; - + /// /// txtPrefix 控件。 /// @@ -499,7 +506,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtPrefix; - + /// /// Label8 控件。 /// @@ -508,7 +515,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label8; - + /// /// ckUnitCode 控件。 /// @@ -517,7 +524,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.CheckBox ckUnitCode; - + /// /// Label22 控件。 /// @@ -526,7 +533,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label22; - + /// /// txtDigit 控件。 /// @@ -535,7 +542,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDigit; - + /// /// Label23 控件。 /// @@ -544,7 +551,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label23; - + /// /// txtSymbol 控件。 /// @@ -553,7 +560,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtSymbol; - + /// /// Label24 控件。 /// @@ -562,7 +569,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label24; - + /// /// Tab4 控件。 /// @@ -571,7 +578,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab4; - + /// /// txtTemplate 控件。 /// @@ -580,7 +587,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.HtmlEditor txtTemplate; - + /// /// Tab5 控件。 /// @@ -589,7 +596,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab5; - + /// /// Grid1 控件。 /// @@ -598,7 +605,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid Grid1; - + /// /// Toolbar4 控件。 /// @@ -607,7 +614,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar4; - + /// /// btnFlowOperateNew 控件。 /// @@ -616,7 +623,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnFlowOperateNew; - + /// /// btnFlowOperateDelete 控件。 /// @@ -625,7 +632,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnFlowOperateDelete; - + /// /// Label27 控件。 /// @@ -634,7 +641,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label Label27; - + /// /// Tab3 控件。 /// @@ -643,7 +650,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab3; - + /// /// frTestSet 控件。 /// @@ -652,7 +659,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form frTestSet; - + /// /// lbTotalScore 控件。 /// @@ -661,7 +668,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTotalScore; - + /// /// lbTotalCount 控件。 /// @@ -670,7 +677,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lbTotalCount; - + /// /// txtDuration 控件。 /// @@ -679,7 +686,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtDuration; - + /// /// Label14 控件。 /// @@ -688,7 +695,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label14; - + /// /// txtPassingScore 控件。 /// @@ -697,7 +704,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtPassingScore; - + /// /// Label21 控件。 /// @@ -706,7 +713,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label21; - + /// /// txtSValue 控件。 /// @@ -715,7 +722,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSValue; - + /// /// Label15 控件。 /// @@ -724,7 +731,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label15; - + /// /// txtMValue 控件。 /// @@ -733,7 +740,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMValue; - + /// /// Label16 控件。 /// @@ -742,7 +749,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label16; - + /// /// txtJValue 控件。 /// @@ -751,7 +758,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJValue; - + /// /// Label17 控件。 /// @@ -760,7 +767,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label17; - + /// /// txtSCount 控件。 /// @@ -769,7 +776,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtSCount; - + /// /// Label18 控件。 /// @@ -778,7 +785,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label18; - + /// /// txtMCount 控件。 /// @@ -787,7 +794,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtMCount; - + /// /// Label19 控件。 /// @@ -796,7 +803,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label19; - + /// /// txtJCount 控件。 /// @@ -805,7 +812,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtJCount; - + /// /// Label20 控件。 /// @@ -814,7 +821,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label Label20; - + /// /// Toolbar2 控件。 /// @@ -823,7 +830,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar2; - + /// /// btnTab3Save 控件。 /// @@ -832,7 +839,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnTab3Save; - + /// /// Tab6 控件。 /// @@ -841,7 +848,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab Tab6; - + /// /// Form2 控件。 /// @@ -850,7 +857,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form Form2; - + /// /// drpYear 控件。 /// @@ -859,7 +866,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpYear; - + /// /// txtYearPlanOutPutValue 控件。 /// @@ -868,7 +875,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtYearPlanOutPutValue; - + /// /// txtYearActualOutPutValue 控件。 /// @@ -877,7 +884,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtYearActualOutPutValue; - + /// /// btnYearOutPutValue 控件。 /// @@ -886,7 +893,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnYearOutPutValue; - + /// /// GridOutPut 控件。 /// @@ -895,7 +902,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid GridOutPut; - + /// /// Toolbar6 控件。 /// @@ -904,7 +911,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar6; - + /// /// drpMonth 控件。 /// @@ -913,7 +920,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpMonth; - + /// /// btnOutPutAdd 控件。 /// @@ -922,7 +929,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnOutPutAdd; - + /// /// btnOutPutDel 控件。 /// @@ -931,7 +938,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnOutPutDel; - + /// /// TabOnlineMenuSet 控件。 /// @@ -940,7 +947,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab TabOnlineMenuSet; - + /// /// Form3 控件。 /// @@ -949,7 +956,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Form Form3; - + /// /// txtAppid 控件。 /// @@ -958,7 +965,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtAppid; - + /// /// txtAppkey 控件。 /// @@ -967,7 +974,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtAppkey; - + /// /// txtCallBackapiurl 控件。 /// @@ -976,7 +983,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtCallBackapiurl; - + /// /// Toolbar5 控件。 /// @@ -985,7 +992,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar5; - + /// /// OnlineMenuSetSave 控件。 /// @@ -994,7 +1001,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button OnlineMenuSetSave; - + /// /// TabHttpLog 控件。 /// @@ -1003,7 +1010,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Tab TabHttpLog; - + /// /// Window1 控件。 /// @@ -1012,7 +1019,7 @@ namespace FineUIPro.Web.SysManage /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window1; - + /// /// Window2 控件。 /// diff --git a/SGGL/Model/APIItem/BaseProjectItem.cs b/SGGL/Model/APIItem/BaseProjectItem.cs index 123c3e89..bf1001c5 100644 --- a/SGGL/Model/APIItem/BaseProjectItem.cs +++ b/SGGL/Model/APIItem/BaseProjectItem.cs @@ -20,6 +20,15 @@ namespace Model set; } + /// + /// 主数据项目数据id + /// + public string MasterSysId + { + get; + set; + } + /// /// 分公司单位 /// diff --git a/SGGL/Model/APIItem/CNCEC_MasterData_PcEp.cs b/SGGL/Model/APIItem/CNCEC_MasterData_PcEp.cs new file mode 100644 index 00000000..96c5803c --- /dev/null +++ b/SGGL/Model/APIItem/CNCEC_MasterData_PcEp.cs @@ -0,0 +1,77 @@ +using System; + +namespace Model +{ + /// + /// 安全合规类 + /// + [Serializable] + public class CNCEC_MasterData_PcEp + { + public string SysId { get; set; } + + public string SysMender { get; set; } + + public string SysModifydate { get; set; } + + public string SysState { get; set; } + + public string SysCreatedate { get; set; } + + public string SysCreator { get; set; } + + public string PrjCode { get; set; } + + public string PrjName { get; set; } + + public string PrjContType { get; set; } + + public string PrjFinType { get; set; } + + public string PrjStatus { get; set; } + + public string PrjType { get; set; } + + public string AdOrgCode { get; set; } + + public string BlgGroup { get; set; } + + public string BlgMainPrj { get; set; } + + public string BusiArea { get; set; } + + public string CustCode { get; set; } + + public string FactBeginDate { get; set; } + + public string FactEndDate { get; set; } + + public string FinOrgCode { get; set; } + + public string GroupPrjCode { get; set; } + + public string GroupPrjName { get; set; } + + public string InitDate { get; set; } + + public string IsEnable { get; set; } + + public string IsFore { get; set; } + + public string IsIntPrj { get; set; } + + public string LocCity { get; set; } + + public string LocPro { get; set; } + + public string LocRegion { get; set; } + + public string MnStaffCode { get; set; } + + public string PlanBeginDate { get; set; } + + public string PlanEndDate { get; set; } + + public string PppPrjCalcType { get; set; } + } +} diff --git a/SGGL/Model/APIItem/CheckRectifyItem.cs b/SGGL/Model/APIItem/CheckRectifyItem.cs new file mode 100644 index 00000000..611cfeb0 --- /dev/null +++ b/SGGL/Model/APIItem/CheckRectifyItem.cs @@ -0,0 +1,266 @@ +namespace Model +{ + using System; + using System.Collections.Generic; + + public class CheckRectifyItem + { + /// + /// 整改id + /// + + public string CheckRectifyId + { + get; + set; + } + + /// + /// 编号 + /// + + public string CheckRectifyCode + { + get; + set; + } + /// + /// 检查项目 + /// + + public string ProjectId + { + get; + set; + } + /// + /// 单位 + /// + + public string UnitId + { + get; + set; + } + /// + /// 检查日期 + /// + + public DateTime? CheckDate + { + get; + set; + } + /// + /// 签发人 + /// + + public string IssueMan + { + get; + set; + } + /// + /// 签发日期 + /// + + public DateTime? IssueDate + { + get; + set; + } + /// + /// 处理状态 + /// + + public string HandleState + { + get; + set; + } + + /// + /// 明细id + /// + + public string CheckRectifyItemId + { + get; + set; + } + /// + /// 检查隐患表 + /// + + public string Table5ItemId + { + get; + set; + } + /// + /// 立项人 + /// + + public string ConfirmMan + { + get; + set; + } + /// + /// 立项日期 + /// + + public DateTime? ConfirmDate + { + get; + set; + } + /// + /// 要求消项日期 + /// + + public DateTime? OrderEndDate + { + get; + set; + } + /// + /// 要求消项责任人 + /// + + public string OrderEndPerson + { + get; + set; + } + /// + /// 企业管理部门验证人 + /// + + public string Verification + { + get; + set; + } + /// + /// 实际消项日期 + /// + + public DateTime? RealEndDate + { + get; + set; + } + /// + /// 序号 + /// + + public int? SortIndex + { + get; + set; + } + /// + /// 类别 + /// + + public string WorkType + { + get; + set; + } + /// + /// 隐患源点 + /// + + public string DangerPoint + { + get; + set; + } + /// + /// 存在危险 + /// + + public string RiskExists + { + get; + set; + } + /// + /// 是否立项 + /// + + public bool? IsProject + { + get; + set; + } + /// + /// 检查人 + /// + + public string CheckMan + { + get; + set; + } + /// + /// 单位负责人确认 + /// + + public string SubjectUnitMan + { + get; + set; + } + /// + ///附件字节 + /// + + public List FileContext + { + get; + set; + } + /// + ///附件表主键 + /// + + public string AttachFileId + { + get; + set; + } + + /// + ///对应主键 + /// + + public string ToKeyId + { + get; + set; + } + + /// + ///附件转换 + /// + + public string AttachSource + { + get; + set; + } + + /// + /// 附件路径 + /// + + public string AttachUrl + { + get; + set; + } + } +} diff --git a/SGGL/Model/APIItem/EnvironmentalCheckInput.cs b/SGGL/Model/APIItem/EnvironmentalCheckInput.cs new file mode 100644 index 00000000..f13bf6ce --- /dev/null +++ b/SGGL/Model/APIItem/EnvironmentalCheckInput.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model +{ + /// + /// 环境监测 + /// + public class EnvironmentalCheckInput + { + /// + /// 项目id + /// + [Required(ErrorMessage = "ProjectId is required.")] + public string ProjectId { get; set; } + /// + /// /TSP + /// + [Required(ErrorMessage = "Tsp is required.")] + public double Tsp { get; set; } + /// + /// 温度 + /// + [Required(ErrorMessage = "Temp is required.")] + public double Temp { get; set; } + /// + /// 噪声 + /// + [Required(ErrorMessage = "Noise is required.")] + public double Noise { get; set; } + /// + /// 湿度 + /// + [Required(ErrorMessage = "Humid is required.")] + public double Humid { get; set; } + /// + /// PM2.5 + /// + [Required(ErrorMessage = "PmTwoPointFive is required.")] + public double PmTwoPointFive { get; set; } + /// + /// 风速 + /// + [Required(ErrorMessage = "WindSpeed is required.")] + public double WindSpeed { get; set; } + /// + /// PM10 + /// + [Required(ErrorMessage = "PmTen is required.")] + public double PmTen { get; set; } + /// + /// 监测时间 + /// + [Required(ErrorMessage = "Time is required.")] + public DateTime Time { get; set; } + /// + /// 创建时间 + /// + public DateTime? CreateTime { get; set; } + } +} diff --git a/SGGL/Model/APIItem/Law_RulesRegulations.cs b/SGGL/Model/APIItem/Law_RulesRegulations.cs new file mode 100644 index 00000000..be7360b9 --- /dev/null +++ b/SGGL/Model/APIItem/Law_RulesRegulations.cs @@ -0,0 +1,196 @@ +using System.Collections.Generic; +using System; + +namespace Model +{ + public class Law_RulesRegulationsItems + { + /// + /// 生产规章制度表 + /// + + public string RulesRegulationsId + { + get; + set; + } + /// + /// 编号 + /// + + public string RulesRegulationsCode + { + get; + set; + } + /// + /// 名称 + /// + + public string RulesRegulationsName + { + get; + set; + } + /// + /// 类型 + /// + + public string RulesRegulationsTypeId + { + get; + set; + } + /// + /// 类型编号 + /// + + public string RulesRegulationsTypeCode + { + get; + set; + } + /// + /// 类型名称 + /// + + public string RulesRegulationsTypeName + { + get; + set; + } + + /// + /// 订制时间 + /// + + public DateTime? CustomDate + { + get; + set; + } + /// + /// 适用范围 + /// + + public string ApplicableScope + { + get; + set; + } + /// + /// 摘要 + /// + + public string Remark + { + get; + set; + } + /// + /// + /// + + public string CompileMan + { + get; + set; + } + /// + /// + /// + + public DateTime? CompileDate + { + get; + set; + } + /// + /// + /// + + public string AuditMan + { + get; + set; + } + /// + /// + /// + + public DateTime? AuditDate + { + get; + set; + } + /// + /// + /// + + public bool? IsPass + { + get; + set; + } + + /// + /// 单位id + /// + + public string UnitId + { + get; + set; + } + + /// + ///附件字节 + /// + + public List FileContext + { + get; + set; + } + + /// + ///附件表主键 + /// + + public string AttachFileId + { + get; + set; + } + + /// + ///对应主键 + /// + + public string ToKeyId + { + get; + set; + } + + /// + ///附件转换 + /// + + public string AttachSource + { + get; + set; + } + + /// + /// 附件路径 + /// + + public string AttachUrl + { + get; + set; + } + } +} \ No newline at end of file diff --git a/SGGL/Model/APIItem/NoticeOutput.cs b/SGGL/Model/APIItem/NoticeOutput.cs new file mode 100644 index 00000000..ea9fc6ce --- /dev/null +++ b/SGGL/Model/APIItem/NoticeOutput.cs @@ -0,0 +1,16 @@ +using System; + +namespace Model +{ + [Serializable] + public class NoticeOutput + { + public string NoticeId { get; set; } + public string NoticeCode { get; set; } + public string NoticeTitle { get; set; } + public string MainContent { get; set; } + public string CompileManName { get; set; } + public DateTime? CompileDate { get; set; } + public string AttachUrl { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/APIItem/SubUnitReportItemItem.cs b/SGGL/Model/APIItem/SubUnitReportItemItem.cs new file mode 100644 index 00000000..0143d4ae --- /dev/null +++ b/SGGL/Model/APIItem/SubUnitReportItemItem.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; + +namespace Model +{ + public class SubUnitReportItemItem + { + /// + /// 子公司上传明细id + /// + + public string SubUnitReportItemId + { + get; + set; + } + /// + /// 子公司上传id + /// + + public string SubUnitReportId + { + get; + set; + } + /// + /// 子单位 + /// + + public string UnitId + { + get; + set; + } + + /// + /// 要求上报时间 + /// + + public DateTime? PlanReortDate + { + get; + set; + } + /// + /// 标题 + /// + + public string ReportTitle + { + get; + set; + } + /// + /// 内容 + /// + + public string ReportContent + { + get; + set; + } + /// + /// 上报时间 + /// + + public DateTime? ReportDate + { + get; + set; + } + /// + /// 状态 + /// + + public string State + { + get; + set; + } + + /// + /// 附件字节 + /// + + public List FileContext + { + get; + set; + } + + /// + ///附件表主键 + /// + + public string AttachFileId + { + get; + set; + } + + /// + ///对应主键 + /// + + public string ToKeyId + { + get; + set; + } + + /// + ///附件转换 + /// + + public string AttachSource + { + get; + set; + } + + /// + /// 附件路径 + /// + + public string AttachUrl + { + get; + set; + } + } +} diff --git a/SGGL/Model/APIItem/UpCheckReportItem.cs b/SGGL/Model/APIItem/UpCheckReportItem.cs new file mode 100644 index 00000000..58b00573 --- /dev/null +++ b/SGGL/Model/APIItem/UpCheckReportItem.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; + +namespace Model +{ + public class UpCheckReportItem + { + /// + /// id + /// + + public string UpCheckReportId + { + get; + set; + } + /// + /// 单位id + /// + + public string UnitId + { + get; + set; + } + /// + /// 检查开始时间 + /// + + public DateTime? CheckStartTime + { + get; + set; + } + + /// + /// 检查结束时间 + /// + + public DateTime? CheckEndTime + { + get; + set; + } + + /// + /// 评价目的 + /// + + public string Values1 + { + get; + set; + } + /// + /// 依据 + /// + + public string Values2 + { + get; + set; + } + /// + /// 被评价单位(项目)概况 + /// + + public string Values3 + { + get; + set; + } + /// + /// 符合项 + /// + + public string Values4 + { + get; + set; + } + /// + /// 不符合项 + /// + + public string Values5 + { + get; + set; + } + /// + /// 观察项 + /// + + public string Values6 + { + get; + set; + } + /// + /// 改进建议 + /// + + public string Values7 + { + get; + set; + } + + /// + /// 编制日期 + /// + + public DateTime? CompileDate + { + get; + set; + } + + /// + /// 审核时间 + /// + + public DateTime? AuditDate + { + get; + set; + } + + public List item1 + { + get; + set; + } + + public List item2 + { + get; + set; + } + } +} diff --git a/SGGL/Model/APIItem/UpCheckReportItemItem.cs b/SGGL/Model/APIItem/UpCheckReportItemItem.cs new file mode 100644 index 00000000..82d1a65a --- /dev/null +++ b/SGGL/Model/APIItem/UpCheckReportItemItem.cs @@ -0,0 +1,98 @@ +using System; + +namespace Model +{ + public class UpCheckReportItemItem + { + /// + /// 评价组成员表id + /// + + public string UpCheckReportItemId + { + get; + set; + } + /// + /// 评价id + /// + + public string UpCheckReportId + { + get; + set; + } + /// + /// 序号 + /// + + public string SortIndex + { + get; + set; + } + /// + /// 名字 + /// + + public string Name + { + get; + set; + } + /// + /// 性别 + /// + + public string Sex + { + get; + set; + } + /// + /// 所在单位名称 + /// + + public string UnitName + { + get; + set; + } + /// + /// 职务 + /// + + public string PostName + { + get; + set; + } + /// + /// 职称 + /// + + public string WorkTitle + { + get; + set; + } + /// + /// 评价小组职务 + /// + + public string CheckPostName + { + get; + set; + } + /// + /// 评价时间 + /// + + public DateTime? CheckDate + { + get; + set; + } + } +} diff --git a/SGGL/Model/APIItem/UpCheckReportItemItem2.cs b/SGGL/Model/APIItem/UpCheckReportItemItem2.cs new file mode 100644 index 00000000..167fd2aa --- /dev/null +++ b/SGGL/Model/APIItem/UpCheckReportItemItem2.cs @@ -0,0 +1,134 @@ +using System; + +namespace Model +{ + public class UpCheckReportItemItem2 + { + /// + /// 检查明细id + /// + + public string UpCheckReportItem2Id + { + get; + set; + } + /// + /// 评价id + /// + + public string UpCheckReportId + { + get; + set; + } + /// + /// 序号 + /// + + public string SortIndex + { + get; + set; + } + /// + /// 受检对象 + /// + + public string SubjectObject + { + get; + set; + } + /// + /// 受检对象信息 + /// + + public string SubjectObjectInfo + { + get; + set; + } + /// + /// 负责人 + /// + + public string UnitMan + { + get; + set; + } + /// + /// 负责人电话 + /// + + public string UnitManTel + { + get; + set; + } + /// + /// 安全专职管理人 + /// + + public string UnitHSSEMan + { + get; + set; + } + /// + /// 安全专职管理人电话 + /// + + public string UnitHSSEManTel + { + get; + set; + } + /// + /// 检查时间 + /// + + public DateTime? CheckDate + { + get; + set; + } + /// + /// 隐患数 + /// + + public int? RectifyCount + { + get; + set; + } + /// + /// 整改数 + /// + + public int? CompRectifyCount + { + get; + set; + } + /// + /// 总得分 + /// + + public decimal? TotalGetScore + { + get; + set; + } + /// + /// 结果等级 + /// + + public string ResultLevel + { + get; + set; + } + } +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 620285d9..d7cfcad7 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -557,6 +557,9 @@ namespace Model partial void InsertEnvironmental_UnexpectedEnvironmental(Environmental_UnexpectedEnvironmental instance); partial void UpdateEnvironmental_UnexpectedEnvironmental(Environmental_UnexpectedEnvironmental instance); partial void DeleteEnvironmental_UnexpectedEnvironmental(Environmental_UnexpectedEnvironmental instance); + partial void InsertEnvironmentalCheck(EnvironmentalCheck instance); + partial void UpdateEnvironmentalCheck(EnvironmentalCheck instance); + partial void DeleteEnvironmentalCheck(EnvironmentalCheck instance); partial void InsertHazard_EnvironmentalRiskItem(Hazard_EnvironmentalRiskItem instance); partial void UpdateHazard_EnvironmentalRiskItem(Hazard_EnvironmentalRiskItem instance); partial void DeleteHazard_EnvironmentalRiskItem(Hazard_EnvironmentalRiskItem instance); @@ -3275,6 +3278,14 @@ namespace Model } } + public System.Data.Linq.Table EnvironmentalCheck + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Hazard_EnvironmentalRiskItem { get @@ -12037,7 +12048,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(200)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(2000)")] public string ApproveIdea { get @@ -24086,6 +24097,8 @@ namespace Model private System.Nullable _IsCNCECShow; + private string _MasterSysId; + private EntitySet _Accident_AccidentHandle; private EntitySet _Accident_AccidentPersonRecord; @@ -24506,6 +24519,8 @@ namespace Model partial void OnProjectRealCodeChanged(); partial void OnIsCNCECShowChanging(System.Nullable value); partial void OnIsCNCECShowChanged(); + partial void OnMasterSysIdChanging(string value); + partial void OnMasterSysIdChanged(); #endregion public Base_Project() @@ -25299,6 +25314,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MasterSysId", DbType="NVarChar(200)")] + public string MasterSysId + { + get + { + return this._MasterSysId; + } + set + { + if ((this._MasterSysId != value)) + { + this.OnMasterSysIdChanging(value); + this.SendPropertyChanging(); + this._MasterSysId = value; + this.SendPropertyChanged("MasterSysId"); + this.OnMasterSysIdChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentHandle_Base_Project", Storage="_Accident_AccidentHandle", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")] public EntitySet Accident_AccidentHandle { @@ -62194,6 +62229,8 @@ namespace Model private System.Nullable _ApproveDate; + private System.Nullable _Extract; + private EntityRef _Base_Project; private EntityRef _Base_Unit; @@ -62230,6 +62267,8 @@ namespace Model partial void OnApproveManChanged(); partial void OnApproveDateChanging(System.Nullable value); partial void OnApproveDateChanged(); + partial void OnExtractChanging(System.Nullable value); + partial void OnExtractChanged(); #endregion public CostGoods_CostSmallDetail() @@ -62508,6 +62547,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Extract", DbType="Decimal(18,0)")] + public System.Nullable Extract + { + get + { + return this._Extract; + } + set + { + if ((this._Extract != value)) + { + this.OnExtractChanging(value); + this.SendPropertyChanging(); + this._Extract = value; + this.SendPropertyChanged("Extract"); + this.OnExtractChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_CostGoods_CostSmallDetail_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] public Base_Project Base_Project { @@ -79956,6 +80015,332 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.EnvironmentalCheck")] + public partial class EnvironmentalCheck : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _Id; + + private string _ProjectId; + + private System.Nullable _Tsp; + + private System.Nullable _Temp; + + private System.Nullable _Noise; + + private System.Nullable _Humid; + + private System.Nullable _PmTwoPointFive; + + private System.Nullable _WindSpeed; + + private System.Nullable _PmTen; + + private System.Nullable _Time; + + private System.Nullable _CreateTime; + + private System.Nullable _IsPushed; + + #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 OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); + partial void OnTspChanging(System.Nullable value); + partial void OnTspChanged(); + partial void OnTempChanging(System.Nullable value); + partial void OnTempChanged(); + partial void OnNoiseChanging(System.Nullable value); + partial void OnNoiseChanged(); + partial void OnHumidChanging(System.Nullable value); + partial void OnHumidChanged(); + partial void OnPmTwoPointFiveChanging(System.Nullable value); + partial void OnPmTwoPointFiveChanged(); + partial void OnWindSpeedChanging(System.Nullable value); + partial void OnWindSpeedChanged(); + partial void OnPmTenChanging(System.Nullable value); + partial void OnPmTenChanged(); + partial void OnTimeChanging(System.Nullable value); + partial void OnTimeChanged(); + partial void OnCreateTimeChanging(System.Nullable value); + partial void OnCreateTimeChanged(); + partial void OnIsPushedChanging(System.Nullable value); + partial void OnIsPushedChanged(); + #endregion + + public EnvironmentalCheck() + { + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(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="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Tsp", DbType="Float")] + public System.Nullable Tsp + { + get + { + return this._Tsp; + } + set + { + if ((this._Tsp != value)) + { + this.OnTspChanging(value); + this.SendPropertyChanging(); + this._Tsp = value; + this.SendPropertyChanged("Tsp"); + this.OnTspChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Temp", DbType="Float")] + public System.Nullable Temp + { + get + { + return this._Temp; + } + set + { + if ((this._Temp != value)) + { + this.OnTempChanging(value); + this.SendPropertyChanging(); + this._Temp = value; + this.SendPropertyChanged("Temp"); + this.OnTempChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Noise", DbType="Float")] + public System.Nullable Noise + { + get + { + return this._Noise; + } + set + { + if ((this._Noise != value)) + { + this.OnNoiseChanging(value); + this.SendPropertyChanging(); + this._Noise = value; + this.SendPropertyChanged("Noise"); + this.OnNoiseChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Humid", DbType="Float")] + public System.Nullable Humid + { + get + { + return this._Humid; + } + set + { + if ((this._Humid != value)) + { + this.OnHumidChanging(value); + this.SendPropertyChanging(); + this._Humid = value; + this.SendPropertyChanged("Humid"); + this.OnHumidChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmTwoPointFive", DbType="Float")] + public System.Nullable PmTwoPointFive + { + get + { + return this._PmTwoPointFive; + } + set + { + if ((this._PmTwoPointFive != value)) + { + this.OnPmTwoPointFiveChanging(value); + this.SendPropertyChanging(); + this._PmTwoPointFive = value; + this.SendPropertyChanged("PmTwoPointFive"); + this.OnPmTwoPointFiveChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WindSpeed", DbType="Float")] + public System.Nullable WindSpeed + { + get + { + return this._WindSpeed; + } + set + { + if ((this._WindSpeed != value)) + { + this.OnWindSpeedChanging(value); + this.SendPropertyChanging(); + this._WindSpeed = value; + this.SendPropertyChanged("WindSpeed"); + this.OnWindSpeedChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PmTen", DbType="Float")] + public System.Nullable PmTen + { + get + { + return this._PmTen; + } + set + { + if ((this._PmTen != value)) + { + this.OnPmTenChanging(value); + this.SendPropertyChanging(); + this._PmTen = value; + this.SendPropertyChanged("PmTen"); + this.OnPmTenChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Time", DbType="DateTime")] + public System.Nullable Time + { + get + { + return this._Time; + } + set + { + if ((this._Time != value)) + { + this.OnTimeChanging(value); + this.SendPropertyChanging(); + this._Time = value; + this.SendPropertyChanged("Time"); + this.OnTimeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateTime", DbType="DateTime")] + public System.Nullable CreateTime + { + get + { + return this._CreateTime; + } + set + { + if ((this._CreateTime != value)) + { + this.OnCreateTimeChanging(value); + this.SendPropertyChanging(); + this._CreateTime = value; + this.SendPropertyChanged("CreateTime"); + this.OnCreateTimeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsPushed", DbType="Bit")] + public System.Nullable IsPushed + { + get + { + return this._IsPushed; + } + set + { + if ((this._IsPushed != value)) + { + this.OnIsPushedChanging(value); + this.SendPropertyChanging(); + this._IsPushed = value; + this.SendPropertyChanged("IsPushed"); + this.OnIsPushedChanged(); + } + } + } + + 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.Hazard_EnvironmentalRiskItem")] public partial class Hazard_EnvironmentalRiskItem : INotifyPropertyChanging, INotifyPropertyChanged { @@ -102477,7 +102862,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(500)")] public string Rectification { get @@ -102603,7 +102988,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(500)")] public string Measures { get @@ -104752,6 +105137,8 @@ namespace Model private System.Nullable _CreateDate; + private System.Nullable _EnvironmentalTrainNum; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -104912,6 +105299,8 @@ namespace Model partial void OnCreateManChanged(); partial void OnCreateDateChanging(System.Nullable value); partial void OnCreateDateChanged(); + partial void OnEnvironmentalTrainNumChanging(System.Nullable value); + partial void OnEnvironmentalTrainNumChanged(); #endregion public HSSEData_HSSE() @@ -106479,6 +106868,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnvironmentalTrainNum", DbType="Int")] + public System.Nullable EnvironmentalTrainNum + { + get + { + return this._EnvironmentalTrainNum; + } + set + { + if ((this._EnvironmentalTrainNum != value)) + { + this.OnEnvironmentalTrainNumChanging(value); + this.SendPropertyChanging(); + this._EnvironmentalTrainNum = value; + this.SendPropertyChanged("EnvironmentalTrainNum"); + this.OnEnvironmentalTrainNumChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -144264,6 +144673,8 @@ namespace Model private string _WorkStates; + private System.Nullable _IsHighRisk; + private EntityRef _Base_LicenseType; private EntityRef _Base_Project; @@ -144306,6 +144717,8 @@ namespace Model partial void OnApplicantManChanged(); partial void OnWorkStatesChanging(string value); partial void OnWorkStatesChanged(); + partial void OnIsHighRiskChanging(System.Nullable value); + partial void OnIsHighRiskChanged(); #endregion public License_LicenseManager() @@ -144633,6 +145046,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 { @@ -153587,6 +154020,10 @@ namespace Model private string _MeetingHostManOther; + private string _ProjectId; + + private string _UnitId; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -153621,6 +154058,10 @@ namespace Model partial void OnAttentPersonIdsChanged(); partial void OnMeetingHostManOtherChanging(string value); partial void OnMeetingHostManOtherChanged(); + partial void OnProjectIdChanging(string value); + partial void OnProjectIdChanged(); + partial void OnUnitIdChanging(string value); + partial void OnUnitIdChanged(); #endregion public Meeting_CompanySafetyMeeting() @@ -153928,6 +154369,46 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this.OnProjectIdChanging(value); + this.SendPropertyChanging(); + this._ProjectId = value; + this.SendPropertyChanged("ProjectId"); + this.OnProjectIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")] + public string UnitId + { + get + { + return this._UnitId; + } + set + { + if ((this._UnitId != value)) + { + this.OnUnitIdChanging(value); + this.SendPropertyChanging(); + this._UnitId = value; + this.SendPropertyChanged("UnitId"); + this.OnUnitIdChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -153985,6 +154466,8 @@ namespace Model private string _MeetingHostManOther; + private string _UnitId; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -154019,6 +154502,8 @@ namespace Model partial void OnAttentPersonIdsChanged(); partial void OnMeetingHostManOtherChanging(string value); partial void OnMeetingHostManOtherChanged(); + partial void OnUnitIdChanging(string value); + partial void OnUnitIdChanged(); #endregion public Meeting_CompanySpecialMeeting() @@ -154326,6 +154811,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(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(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -154598,7 +155103,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(3000)")] public string AttentPerson { get @@ -185557,7 +186062,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(255)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)] public string ProjectDescription { get @@ -185677,7 +186182,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(255)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)] public string CalculationRule { get @@ -185737,7 +186242,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(100)")] public string ConstructionSubcontractor { get @@ -186121,7 +186626,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,2)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,3)")] public System.Nullable WorkPackageEstimate { get @@ -186426,6 +186931,16 @@ namespace Model private string _ProjectId; + private string _ContractId; + + private string _OrderCode; + + private System.Nullable _OrderInDate; + + private System.Nullable _OrderOutDate; + + private string _MaterialRequisitionUnit; + private System.Nullable _State; private string _InvoiceCode; @@ -186454,16 +186969,6 @@ namespace Model private string _CreateUser; - private string _ContractId; - - private System.Nullable _OrderInDate; - - private string _OrderCode; - - private System.Nullable _OrderOutDate; - - private string _MaterialRequisitionUnit; - #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -186472,6 +186977,16 @@ namespace Model partial void OnInvoiceIdChanged(); partial void OnProjectIdChanging(string value); partial void OnProjectIdChanged(); + partial void OnContractIdChanging(string value); + partial void OnContractIdChanged(); + partial void OnOrderCodeChanging(string value); + partial void OnOrderCodeChanged(); + partial void OnOrderInDateChanging(System.Nullable value); + partial void OnOrderInDateChanged(); + partial void OnOrderOutDateChanging(System.Nullable value); + partial void OnOrderOutDateChanged(); + partial void OnMaterialRequisitionUnitChanging(string value); + partial void OnMaterialRequisitionUnitChanged(); partial void OnStateChanging(System.Nullable value); partial void OnStateChanged(); partial void OnInvoiceCodeChanging(string value); @@ -186500,16 +187015,6 @@ namespace Model partial void OnCreateDateChanged(); partial void OnCreateUserChanging(string value); partial void OnCreateUserChanged(); - partial void OnContractIdChanging(string value); - partial void OnContractIdChanged(); - partial void OnOrderInDateChanging(System.Nullable value); - partial void OnOrderInDateChanged(); - partial void OnOrderCodeChanging(string value); - partial void OnOrderCodeChanged(); - partial void OnOrderOutDateChanging(System.Nullable value); - partial void OnOrderOutDateChanged(); - partial void OnMaterialRequisitionUnitChanging(string value); - partial void OnMaterialRequisitionUnitChanged(); #endregion public PHTGL_Invoice() @@ -186557,6 +187062,106 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")] + public string ContractId + { + get + { + return this._ContractId; + } + set + { + if ((this._ContractId != value)) + { + this.OnContractIdChanging(value); + this.SendPropertyChanging(); + this._ContractId = value; + this.SendPropertyChanged("ContractId"); + this.OnContractIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")] + public string OrderCode + { + get + { + return this._OrderCode; + } + set + { + if ((this._OrderCode != value)) + { + this.OnOrderCodeChanging(value); + this.SendPropertyChanging(); + this._OrderCode = value; + this.SendPropertyChanged("OrderCode"); + this.OnOrderCodeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")] + public System.Nullable OrderInDate + { + get + { + return this._OrderInDate; + } + set + { + if ((this._OrderInDate != value)) + { + this.OnOrderInDateChanging(value); + this.SendPropertyChanging(); + this._OrderInDate = value; + this.SendPropertyChanged("OrderInDate"); + this.OnOrderInDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")] + public System.Nullable OrderOutDate + { + get + { + return this._OrderOutDate; + } + set + { + if ((this._OrderOutDate != value)) + { + this.OnOrderOutDateChanging(value); + this.SendPropertyChanging(); + this._OrderOutDate = value; + this.SendPropertyChanged("OrderOutDate"); + this.OnOrderOutDateChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")] + public string MaterialRequisitionUnit + { + get + { + return this._MaterialRequisitionUnit; + } + set + { + if ((this._MaterialRequisitionUnit != value)) + { + this.OnMaterialRequisitionUnitChanging(value); + this.SendPropertyChanging(); + this._MaterialRequisitionUnit = value; + this.SendPropertyChanged("MaterialRequisitionUnit"); + this.OnMaterialRequisitionUnitChanged(); + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="Int")] public System.Nullable State { @@ -186837,106 +187442,6 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")] - public string ContractId - { - get - { - return this._ContractId; - } - set - { - if ((this._ContractId != value)) - { - this.OnContractIdChanging(value); - this.SendPropertyChanging(); - this._ContractId = value; - this.SendPropertyChanged("ContractId"); - this.OnContractIdChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")] - public System.Nullable OrderInDate - { - get - { - return this._OrderInDate; - } - set - { - if ((this._OrderInDate != value)) - { - this.OnOrderInDateChanging(value); - this.SendPropertyChanging(); - this._OrderInDate = value; - this.SendPropertyChanged("OrderInDate"); - this.OnOrderInDateChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")] - public string OrderCode - { - get - { - return this._OrderCode; - } - set - { - if ((this._OrderCode != value)) - { - this.OnOrderCodeChanging(value); - this.SendPropertyChanging(); - this._OrderCode = value; - this.SendPropertyChanged("OrderCode"); - this.OnOrderCodeChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")] - public System.Nullable OrderOutDate - { - get - { - return this._OrderOutDate; - } - set - { - if ((this._OrderOutDate != value)) - { - this.OnOrderOutDateChanging(value); - this.SendPropertyChanging(); - this._OrderOutDate = value; - this.SendPropertyChanged("OrderOutDate"); - this.OnOrderOutDateChanged(); - } - } - } - - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")] - public string MaterialRequisitionUnit - { - get - { - return this._MaterialRequisitionUnit; - } - set - { - if ((this._MaterialRequisitionUnit != value)) - { - this.OnMaterialRequisitionUnitChanging(value); - this.SendPropertyChanging(); - this._MaterialRequisitionUnit = value; - this.SendPropertyChanged("MaterialRequisitionUnit"); - this.OnMaterialRequisitionUnitChanged(); - } - } - } - public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -198505,6 +199010,8 @@ namespace Model private System.Nullable _SuperFinishedNum; + private System.Nullable _EnvironmentalTrainNum; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -198661,6 +199168,8 @@ namespace Model partial void OnSuperConstructionNumChanged(); partial void OnSuperFinishedNumChanging(System.Nullable value); partial void OnSuperFinishedNumChanged(); + partial void OnEnvironmentalTrainNumChanging(System.Nullable value); + partial void OnEnvironmentalTrainNumChanged(); #endregion public Project_HSSEData_HSSE() @@ -200188,6 +200697,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnvironmentalTrainNum", DbType="Int")] + public System.Nullable EnvironmentalTrainNum + { + get + { + return this._EnvironmentalTrainNum; + } + set + { + if ((this._EnvironmentalTrainNum != value)) + { + this.OnEnvironmentalTrainNumChanging(value); + this.SendPropertyChanging(); + this._EnvironmentalTrainNum = value; + this.SendPropertyChanged("EnvironmentalTrainNum"); + this.OnEnvironmentalTrainNumChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -292771,6 +293300,8 @@ namespace Model private string _States; + private System.Nullable _IsHighRisk; + private string _ProjectCode; private string _ProjectName; @@ -292957,6 +293488,22 @@ 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._IsHighRisk = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectCode", DbType="NVarChar(50)")] public string ProjectCode { @@ -302257,7 +302804,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(200)")] public string Name { get @@ -302834,7 +303381,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -303025,7 +303572,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -308336,7 +308883,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -309808,7 +310355,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")] public string PackageContent { get @@ -319359,7 +319906,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(1500)")] public string ContractNo { get @@ -319379,7 +319926,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(500)")] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(1500)")] public string UnitWorks { get diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index af3f0af2..ac3b9b05 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -52,6 +52,10 @@ ..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + + ..\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll + + @@ -69,11 +73,14 @@ + + + @@ -125,6 +132,8 @@ + + @@ -171,6 +180,7 @@ + @@ -178,6 +188,9 @@ + + + @@ -237,9 +250,24 @@ + + + + + + + + + + + + + + + diff --git a/SGGL/Model/ZHGL/DataSync/AccidentOutput.cs b/SGGL/Model/ZHGL/DataSync/AccidentOutput.cs new file mode 100644 index 00000000..4d25fb7c --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/AccidentOutput.cs @@ -0,0 +1,28 @@ +using System; + +namespace Model +{ + /// + /// 事故事件数据 + /// + public class AccidentOutput:BaseEntities + { + public string Id { get; set; } + /// + /// 事故类型 + /// + public string AccidentTypeName { get; set; } + /// + /// 发生时间 + /// + public DateTime ? AccidentDate { get; set; } + /// + /// 人数 + /// + public int ? PeopleNum { get; set; } + /// + /// 事故情况 + /// + public string Info { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/BaseEntities.cs b/SGGL/Model/ZHGL/DataSync/BaseEntities.cs new file mode 100644 index 00000000..33529c81 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/BaseEntities.cs @@ -0,0 +1,35 @@ +namespace Model +{ + public class BaseEntities + { + /// + /// 主键id + /// + public string Id { get; set; } + /// + /// 项目id + /// + public string ProjectId { get; set; } + /// + /// 项目编码 + /// + public string ProjectCode { get; set; } + /// + /// 项目名称 + /// + public string ProjectName { get; set; } + /// + /// 单位id + /// + public string UnitId { get; set; } + /// + /// 单位名称 + /// + public string UnitName { get; set; } + /// + /// 单位编码 + /// + public string UnitCode { get; set; } + } +} + diff --git a/SGGL/Model/ZHGL/DataSync/CheckOutput.cs b/SGGL/Model/ZHGL/DataSync/CheckOutput.cs new file mode 100644 index 00000000..08e8b76d --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/CheckOutput.cs @@ -0,0 +1,17 @@ +using System; +using System.Security.Permissions; + +namespace Model +{ + public class CheckOutput : BaseEntities + { + /// + /// 检查组/人 + /// + public string CheckTeam { get; set; } + /// + /// 检查日期 + /// + public DateTime? CheckDate { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/ConstructionEquipmentOutput.cs b/SGGL/Model/ZHGL/DataSync/ConstructionEquipmentOutput.cs new file mode 100644 index 00000000..d2eddb39 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/ConstructionEquipmentOutput.cs @@ -0,0 +1,35 @@ +using System; + +namespace Model +{ + public class ConstructionEquipmentOutput:BaseEntities + { + + /// + /// 设备 + /// + public string SpecialEquipmentName { get; set; } + /// + /// 类型 + /// + public string EQType { get; set; } + /// + /// 规格型号 + /// + public string SizeModel { get; set; } + /// + /// 进场自检情况 + /// + public string OwnerCheck { get; set; } + /// + /// 设备合格证号 + /// + public string CertificateNum { get; set; } + public DateTime? CompileDate { get; set; } + /// + /// 是否使用 + /// + public bool ? IsUsed { get; set; } + + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/CostSmallDetailOutput.cs b/SGGL/Model/ZHGL/DataSync/CostSmallDetailOutput.cs new file mode 100644 index 00000000..0289c235 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/CostSmallDetailOutput.cs @@ -0,0 +1,11 @@ +using System; + +namespace Model +{ + public class CostSmallDetailOutput : BaseEntities + { + public DateTime? Months { get; set; } + public decimal? SUMCost { get; set; } + } +} + diff --git a/SGGL/Model/ZHGL/DataSync/EduTrainOutput.cs b/SGGL/Model/ZHGL/DataSync/EduTrainOutput.cs new file mode 100644 index 00000000..0bdb2fe5 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/EduTrainOutput.cs @@ -0,0 +1,12 @@ +using System; + +namespace Model +{ + public class EduTrainOutput:BaseEntities + { + public string TrainTitle { get; set; } + public DateTime? TrainStartDate { get; set; } + public DateTime? TrainEndDate { get; set; } + public int TrainPersonNum { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/EmergencyOutput.cs b/SGGL/Model/ZHGL/DataSync/EmergencyOutput.cs new file mode 100644 index 00000000..3887ee7c --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/EmergencyOutput.cs @@ -0,0 +1,27 @@ +using System; + +namespace Model +{ + public class EmergencyOutput:BaseEntities + { + + /// + /// 预案类型 + /// + public string EmergencyTypeName { get; set; } + /// + /// 名称 + /// + public string EmergencyName { get; set; } + /// + /// 版次 + /// + public string VersionCode { get; set; } + public int? JointPersonNum { get; set; } + public decimal? DrillCost { get; set; } + /// + /// 整理日期 + /// + public DateTime? Date { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs b/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs index 1afbf4d0..dfd1a9df 100644 --- a/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs +++ b/SGGL/Model/ZHGL/DataSync/HSSEDataItem.cs @@ -84,6 +84,7 @@ namespace Model public int? ShutdownNum { get; set; } public int? SpecialEquipmentNum { get; set; } public int? SpecialOperationTrainNum { get; set; } + public int? EnvironmentalTrainNum { get; set; } public int? SpecialSeriousAccidentNum { get; set; } public int? SpecialTrainNum { get; set; } public int? SuperCompletedNum { get; set; } diff --git a/SGGL/Model/ZHGL/DataSync/HiddenRectificationOutput.cs b/SGGL/Model/ZHGL/DataSync/HiddenRectificationOutput.cs new file mode 100644 index 00000000..20f9dd3c --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/HiddenRectificationOutput.cs @@ -0,0 +1,26 @@ +namespace Model +{ + public class HiddenRectificationOutput :BaseEntities + {/// + /// 项目简称 + /// + public string ProjectShortName { get; set; } + + /// + /// 问题数量 + /// + public int ProNum { get; set; } + /// + /// 整改数量 + /// + public int RecNum { get; set; } + /// + /// 未整改数量 + /// + public int NoRecNum { get; set; } + /// + /// 整改率 + /// + public string RecRate { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs b/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs new file mode 100644 index 00000000..d12d0cd2 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/LargeEngineeringOutput.cs @@ -0,0 +1,38 @@ +namespace Model +{ + public class LargeEngineeringOutput:BaseEntities + { + /// + /// 危大工程审批完成数 + /// + public int CompletedNum { get; set; } + /// + /// 危大工程培训人次数 + /// + public int TrainPersonNum { get; set; } + /// + /// 危大工程施工个数 + /// + public int ConstructionNum { get; set; } + /// + /// 危大工程完工个数 + /// + public int FinishedNum { get; set; } + /// + /// 超危大工程审批完成数 + /// + public int SuperCompletedNum { get; set; } + /// + /// 超危大工程培训人次数 + /// + public int SuperTrainPersonNum { get; set; } + /// + /// 超危大工程施工个数 + /// + public int SuperConstructionNum { get; set; } + /// + /// 超危大工程完工个数 + /// + public int SuperFinishedNum { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/LicenseOutput.cs b/SGGL/Model/ZHGL/DataSync/LicenseOutput.cs new file mode 100644 index 00000000..c88a0148 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/LicenseOutput.cs @@ -0,0 +1,20 @@ +using System; + +namespace Model +{ + /// + /// 作业许可证 + /// + public class LicenseOutput:BaseEntities + { + public string LicenseTypeName { get; set; } + public string UnitTypeName { get; set; } + public string WorkAreaName { get; set; } + public bool? IsHighRisk { get; set; } + public DateTime? CompileDate { get; set; } + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + public string WorkStatesStr { get; set; } + + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/MeetingOutput.cs b/SGGL/Model/ZHGL/DataSync/MeetingOutput.cs new file mode 100644 index 00000000..9ba2ef09 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/MeetingOutput.cs @@ -0,0 +1,32 @@ +using System; + +namespace Model +{ + public class MeetingOutput:BaseEntities + { + /// + /// 标题 + /// + public string MeetingName { get; set; } + /// + /// 日期 + /// + public DateTime? MeetingDate { get; set; } + /// + /// + /// + public decimal? MeetingHours { get; set; } + /// + /// 主持人 + /// + public string HostMan { get; set; } + /// + /// 参会人数 + /// + public int? AttentPersonNum { get; set; } + /// + /// 参会人员 + /// + public string AttentPerson { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/OfSafetySupervisorsOutput.cs b/SGGL/Model/ZHGL/DataSync/OfSafetySupervisorsOutput.cs new file mode 100644 index 00000000..318102c8 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/OfSafetySupervisorsOutput.cs @@ -0,0 +1,29 @@ +namespace Model +{ + /// + /// 安监人员数据 + /// + public class OfSafetySupervisorsOutput : BaseEntities + { + /// + /// 姓名 + /// + public string Name { get; set; } + /// + /// 性别 + /// + public string Sex { get; set; } + /// + /// 身份证号 + /// + public string IdentityCard { get; set; } + /// + /// 岗位名称 + /// + public string WorkPostName { get; set; } + /// + /// 电话 + /// + public string Phone { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/ProjectInformationOutput.cs b/SGGL/Model/ZHGL/DataSync/ProjectInformationOutput.cs new file mode 100644 index 00000000..9f8f3ba3 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/ProjectInformationOutput.cs @@ -0,0 +1,7 @@ +namespace Model +{ + public class ProjectInformationOutput + { + + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/ProjectOutput.cs b/SGGL/Model/ZHGL/DataSync/ProjectOutput.cs new file mode 100644 index 00000000..8b2be767 --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/ProjectOutput.cs @@ -0,0 +1,20 @@ +using System; + +namespace Model +{ + public class ProjectOutput :BaseEntities + { + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + public string ProjectAddress { get; set; } + public string ShortName { get; set; } + public decimal? ConstructionMoney { get; set; } + public string ProjectStateName { get; set; } + public string ProjectState { get; set; } + public string ProjectAttributeName { get; set; } + public decimal? ProjectMoney { get; set; } + public int? DayCount { get; set; } + public string ProjectTypeName { get; set; } + public string ProjectStateName2 { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/Model/ZHGL/DataSync/SecurityRiskOutput.cs b/SGGL/Model/ZHGL/DataSync/SecurityRiskOutput.cs new file mode 100644 index 00000000..aba4aa7e --- /dev/null +++ b/SGGL/Model/ZHGL/DataSync/SecurityRiskOutput.cs @@ -0,0 +1,22 @@ +namespace Model +{ + public class SecurityRiskOutput:BaseEntities + { + /// + /// 一般风险数 + /// + public int GeneralRiskNum { get; set; } + /// + /// 低风险数 + /// + public int LowRiskNum { get; set; } + /// + /// 中风险数 + /// + public int MediumRiskNum { get; set; } + /// + /// 高风险数 + /// + public int HighRiskNum { get; set; } + } +} \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs b/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs index 5d467e30..4be7dfcb 100644 --- a/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs +++ b/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs @@ -26,7 +26,7 @@ namespace WebAPI.Controllers ServerService.GetToken(); returnData.token = BLL.SysConstSetService.CNCECToken; returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; - if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime)&& DateTime.Parse(returnData.expiryTime)>DateTime.Now) + if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime) && DateTime.Parse(returnData.expiryTime) > DateTime.Now) { returnData.data = CQMSDataService.GetTodayCQMSData_CQMS(); } @@ -51,11 +51,11 @@ namespace WebAPI.Controllers returnData.time = DateTime.Now.ToString(); foreach (var item in data.CQMSDataItems) { - var cQMSData_CQMS= CQMSDataService.GetCQMSData_CQMSById(item.Id); + var cQMSData_CQMS = CQMSDataService.GetCQMSData_CQMSById(item.Id); cQMSData_CQMS.State = Const.CNCEC_State_S; CQMSDataService.UpdateCQMSData_CQMS(cQMSData_CQMS); - } - + } + } catch (Exception ex) { @@ -77,7 +77,7 @@ namespace WebAPI.Controllers ServerService.GetToken(); returnData.token = BLL.SysConstSetService.CNCECToken; returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; - if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime)&&DateTime.Parse(returnData.expiryTime) > DateTime.Now) + if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime) && DateTime.Parse(returnData.expiryTime) > DateTime.Now) { returnData.data = HJGLData_HJGLService.GetTodayHJGLData_HJGL(); } @@ -102,7 +102,7 @@ namespace WebAPI.Controllers returnData.time = DateTime.Now.ToString(); foreach (var item in data.HJGLDataItems) { - var hJGLData_HJGL = HJGLData_HJGLService.GetHJGLData_HJGLById(item.Id); + var hJGLData_HJGL = HJGLData_HJGLService.GetHJGLData_HJGLById(item.Id); hJGLData_HJGL.State = Const.CNCEC_State_S; HJGLData_HJGLService.UpdateHJGLData_HJGL(hJGLData_HJGL); } @@ -129,7 +129,17 @@ namespace WebAPI.Controllers returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime) && DateTime.Parse(returnData.expiryTime) > DateTime.Now) { - returnData.data = HSSEData_HSSEService.GetTodayHSSEData_HSSE(); + try + { + returnData.data = HSSEData_HSSEService.GetTodayHSSEData_HSSE().Result; + + } + catch (Exception ex) + { + + returnData.code = 0; + returnData.message = ex.ToString(); + } } else { @@ -204,7 +214,7 @@ namespace WebAPI.Controllers returnData.time = DateTime.Now.ToString(); foreach (var item in data.SYHSEDataItems) { - var sYHSEData_SYHSE = SYHSEData_SYHSEService.GetSYHSEData_SYHSEById(item.Id); + var sYHSEData_SYHSE = SYHSEData_SYHSEService.GetSYHSEData_SYHSEById(item.Id); sYHSEData_SYHSE.State = Const.CNCEC_State_S; SYHSEData_SYHSEService.UpdateSYHSEData_SYHSE(sYHSEData_SYHSE); } @@ -220,5 +230,85 @@ namespace WebAPI.Controllers } return returnData; } + + + + #region 推送项目安全隐患风险数据 + + /// + /// 推送项目安全隐患风险数据 + /// + /// + //[HttpPost] + public Model.ResponeData PushProjectHSSEData() + { + var responeData = new Model.ResponeData(); + try + { + var returndata = Project_HSSEData_HSSEService.PushProjectHSSEData(); + responeData.code = returndata.code; + responeData.message = returndata.message; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + #endregion + + #region 推送项目质量数据 + + /// + /// 推送项目质量数据 + /// + /// + //[HttpPost] + public Model.ResponeData PushProjectCQMSData() + { + var responeData = new Model.ResponeData(); + try + { + var returndata = Project_CQMSDataService.PushProjectCQMSData(); + responeData.code = returndata.code; + responeData.message = returndata.message; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + #endregion + + #region 推送项目焊接数据数据 + + /// + /// 推送项目焊接数据数据 + /// + /// + //[HttpPost] + public Model.ResponeData PushProjectHJGLData() + { + var responeData = new Model.ResponeData(); + try + { + var returndata = Project_HJGLData_HJGLService.PushProjectHJGLData(); + responeData.code = returndata.code; + responeData.message = returndata.message; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + #endregion } } \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/DataSync/EnvironmentalController.cs b/SGGL/WebAPI/Controllers/DataSync/EnvironmentalController.cs new file mode 100644 index 00000000..df005078 --- /dev/null +++ b/SGGL/WebAPI/Controllers/DataSync/EnvironmentalController.cs @@ -0,0 +1,73 @@ +using BLL; +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; + +namespace WebAPI.Controllers +{ + /// + /// 上报环保数据接口 + /// + public class EnvironmentalController : ApiController + { + #region 推送环境监测数据 + + /// + /// 推送环境监测数据 + /// + /// + [HttpPost] + public Model.ResponeData PushEnvironmentalCheckData() + { + var responeData = new Model.ResponeData(); + try + { + var returndata = EnvironmentalCheckService.PushEnvironmentalCheckData(); + responeData.code = returndata.code; + responeData.message = returndata.message; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + #endregion + + /// + /// 保存环境监测数据 + /// + /// + /// + [HttpPost] + public Model.ResponeData SaveEnvironmentData(Model.EnvironmentalCheckInput input) + { + var responeData = new Model.ResponeData(); + try + { + if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId) != null) + { + responeData.data = LotAPIService.saveEnvironmentCheck(input); + } + else + { + responeData.code = 0; + responeData.message = "此项目不存在!"; + } + + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + } +} \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/ProjectController.cs b/SGGL/WebAPI/Controllers/ProjectController.cs index 3204101f..587cc400 100644 --- a/SGGL/WebAPI/Controllers/ProjectController.cs +++ b/SGGL/WebAPI/Controllers/ProjectController.cs @@ -1,4 +1,5 @@ -using System; +using BLL; +using System; using System.Web.Http; namespace WebAPI.Controllers @@ -76,5 +77,32 @@ namespace WebAPI.Controllers return responeData; } #endregion + + #region 将项目推送到集团 + /// + /// 将项目推送到集团 + /// + /// + public Model.ResponeData pushProject() + { + var responeData = new Model.ResponeData(); + try + { + var code = CNCECHSSEWebService.PushProject(); + if (code == "1") + { + responeData.message = "同步成功"; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion + } } diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index 24cbf101..a27b0a4e 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -182,6 +182,7 @@ +