4519 lines
		
	
	
		
			237 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			4519 lines
		
	
	
		
			237 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| 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;
 | ||
| 
 | ||
| namespace BLL
 | ||
| {
 | ||
|     public static class HSSEData_HSSEService
 | ||
|     {
 | ||
|         //public static SGGLDB Db = Funs.DB;
 | ||
| 
 | ||
|         //public static List<string> BeUnderConstructionList = ProjectService.GetProjectWorkList().Where(x => (x.ProjectAttribute == "GONGCHENG" || x.ProjectAttribute == null)).Select(x => x.ProjectId).ToList();
 | ||
|         public static List<string> BeUnderConstructionList = BaseDataService.BeUnderConstructionList;
 | ||
|         public static void AddHSSEData_HSSE(HSSEData_HSSE newtable)
 | ||
|         {
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 var table = new HSSEData_HSSE
 | ||
|                 {
 | ||
|                     Id = newtable.Id,
 | ||
|                     UnitId = newtable.UnitId,
 | ||
|                     CollCropCode = newtable.CollCropCode,
 | ||
|                     UnitName = newtable.UnitName,
 | ||
|                     ReportDate = newtable.ReportDate,
 | ||
|                     BeUnderConstructionNum = newtable.BeUnderConstructionNum,
 | ||
|                     ShutdownNum = newtable.ShutdownNum,
 | ||
|                     JoinConstructionPersonNum = newtable.JoinConstructionPersonNum,
 | ||
|                     MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum,
 | ||
|                     TotalWorkingHour = newtable.TotalWorkingHour,
 | ||
|                     LostWorkingHour = newtable.LostWorkingHour,
 | ||
|                     SafeWorkingHour = newtable.SafeWorkingHour,
 | ||
|                     SafeTrainNum = newtable.SafeTrainNum,
 | ||
|                     SpecialTrainNum = newtable.SpecialTrainNum,
 | ||
|                     SpecialOperationTrainNum = newtable.SpecialOperationTrainNum,
 | ||
|                     HseTechnicalNum = newtable.HseTechnicalNum,
 | ||
|                     EnvironmentalTrainNum = newtable.EnvironmentalTrainNum,
 | ||
|                     TotalEnergyConsumption = newtable.TotalEnergyConsumption,
 | ||
|                     IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
 | ||
|                     NewWaterConsumption = newtable.NewWaterConsumption,
 | ||
|                     HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum,
 | ||
|                     HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum,
 | ||
|                     BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum,
 | ||
|                     BranchFullTimeNum = newtable.BranchFullTimeNum,
 | ||
|                     ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum,
 | ||
|                     ProjectFullTimeNum = newtable.ProjectFullTimeNum,
 | ||
|                     ProjectSubFullTimeNum = newtable.ProjectSubFullTimeNum,
 | ||
|                     ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum,
 | ||
|                     SafetyInjectionEngineer = newtable.SafetyInjectionEngineer,
 | ||
|                     CertificateANum = newtable.CertificateANum,
 | ||
|                     CertificateBNum = newtable.CertificateBNum,
 | ||
|                     CertificateCNum = newtable.CertificateCNum,
 | ||
|                     QualityPersonNum = newtable.QualityPersonNum,
 | ||
|                     SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum,
 | ||
|                     EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum,
 | ||
|                     ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum,
 | ||
|                     ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum,
 | ||
|                     CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum,
 | ||
|                     CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum,
 | ||
|                     CompanySpecialCheckNum = newtable.CompanySpecialCheckNum,
 | ||
|                     BranchLeadShiftCheckNum = newtable.BranchLeadShiftCheckNum,
 | ||
|                     BranchComprehensiveCheckNum = newtable.BranchComprehensiveCheckNum,
 | ||
|                     BranchSpecialCheckNum = newtable.BranchSpecialCheckNum,
 | ||
|                     ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum,
 | ||
|                     ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum,
 | ||
|                     ProjectMajorCheckNum = newtable.ProjectMajorCheckNum,
 | ||
|                     NearMissNum = newtable.NearMissNum,
 | ||
|                     RecordableEventNum = newtable.RecordableEventNum,
 | ||
|                     GeneralAccidentNum = newtable.GeneralAccidentNum,
 | ||
|                     MajorAccidentNum = newtable.MajorAccidentNum,
 | ||
|                     SeriousAccidentNum = newtable.SeriousAccidentNum,
 | ||
|                     SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum,
 | ||
|                     CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum,
 | ||
|                     CompanySpecialPlanNum = newtable.CompanySpecialPlanNum,
 | ||
|                     CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan,
 | ||
|                     BranchComprehensivePlanNum = newtable.BranchComprehensivePlanNum,
 | ||
|                     BranchSpecialPlanNum = newtable.BranchSpecialPlanNum,
 | ||
|                     BranchOnSiteDisposalPlan = newtable.BranchOnSiteDisposalPlan,
 | ||
|                     CompanyDrillNum = newtable.CompanyDrillNum,
 | ||
|                     CompanyDrillPersonNum = newtable.CompanyDrillPersonNum,
 | ||
|                     BranchDrillNum = newtable.BranchDrillNum,
 | ||
|                     BranchDrillPersonNum = newtable.BranchDrillPersonNum,
 | ||
|                     ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum,
 | ||
|                     ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum,
 | ||
|                     ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan,
 | ||
|                     ProjectDrillNum = newtable.ProjectDrillNum,
 | ||
|                     ProjectDrillPersonNum = newtable.ProjectDrillPersonNum,
 | ||
|                     CostExtract = newtable.CostExtract,
 | ||
|                     CostUse = newtable.CostUse,
 | ||
|                     UseEquipmentNum = newtable.UseEquipmentNum,
 | ||
|                     SpecialEquipmentNum = newtable.SpecialEquipmentNum,
 | ||
|                     LicensesNum = newtable.LicensesNum,
 | ||
|                     LicensesCloseNum = newtable.LicensesCloseNum,
 | ||
|                     GeneralClosedNum = newtable.GeneralClosedNum,
 | ||
|                     GeneralNotClosedNum = newtable.GeneralNotClosedNum,
 | ||
|                     MajorClosedNum = newtable.MajorClosedNum,
 | ||
|                     MajorNotClosedNum = newtable.MajorNotClosedNum,
 | ||
|                     GeneralRiskNum = newtable.GeneralRiskNum,
 | ||
|                     LowRiskNum = newtable.LowRiskNum,
 | ||
|                     MediumRiskNum = newtable.MediumRiskNum,
 | ||
|                     HighRiskNum = newtable.HighRiskNum,
 | ||
|                     CompletedNum = newtable.CompletedNum,
 | ||
|                     TrainPersonNum = newtable.TrainPersonNum,
 | ||
|                     OperativesNum = newtable.OperativesNum,
 | ||
|                     ConstructionNum = newtable.ConstructionNum,
 | ||
|                     FinishedNum = newtable.FinishedNum,
 | ||
|                     ArgumentNum = newtable.ArgumentNum,
 | ||
|                     SuperCompletedNum = newtable.SuperCompletedNum,
 | ||
|                     SuperTrainPersonNum = newtable.SuperTrainPersonNum,
 | ||
|                     SuperConstructionNum = newtable.SuperConstructionNum,
 | ||
|                     SuperFinishedNum = newtable.SuperFinishedNum,
 | ||
|                     SuperArgumentNum = newtable.SuperArgumentNum,
 | ||
|                     State = newtable.State,
 | ||
|                     CreateDate = newtable.CreateDate,
 | ||
|                     CreateMan = newtable.CreateMan
 | ||
|                 };
 | ||
|                 db.HSSEData_HSSE.InsertOnSubmit(table);
 | ||
|                 db.SubmitChanges();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         public static void DeleteHSSEData_HSSEById(string id)
 | ||
|         {
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 var table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == id);
 | ||
|                 if (table != null)
 | ||
|                 {
 | ||
|                     db.HSSEData_HSSE.DeleteOnSubmit(table);
 | ||
|                     db.SubmitChanges();
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public static HSSEData_HSSE GetHSSEData_HSSEById(string id)
 | ||
|         {
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 return db.HSSEData_HSSE.FirstOrDefault(x => x.Id == id);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public static HSSEData GetItemById(string id)
 | ||
|         {
 | ||
|             var item = new HsseDataItem();
 | ||
|             var data = new HSSEData();
 | ||
|             var dataHsse = GetHSSEData_HSSEById(id);
 | ||
|             if (dataHsse != null)
 | ||
|             {
 | ||
|                 item.BranchLeadShiftCheckNum = dataHsse.BranchLeadShiftCheckNum;
 | ||
|                 item.BranchComprehensiveCheckNum = dataHsse.BranchComprehensiveCheckNum;
 | ||
|                 item.BranchSpecialCheckNum = dataHsse.BranchSpecialCheckNum;
 | ||
|                 item.BeUnderConstructionNum = dataHsse.BeUnderConstructionNum;
 | ||
|                 item.BranchFullTimeNum = dataHsse.BranchFullTimeNum;
 | ||
|                 item.BranchInspectorGeneralNum = dataHsse.BranchInspectorGeneralNum;
 | ||
|                 item.BranchComprehensivePlanNum = dataHsse.BranchComprehensivePlanNum;
 | ||
|                 item.BranchSpecialPlanNum = dataHsse.BranchSpecialPlanNum;
 | ||
|                 item.BranchOnSiteDisposalPlan = dataHsse.BranchOnSiteDisposalPlan;
 | ||
|                 item.CertificateANum = dataHsse.CertificateANum;
 | ||
|                 item.CertificateBNum = dataHsse.CertificateBNum;
 | ||
|                 item.CertificateCNum = dataHsse.CertificateCNum;
 | ||
|                 item.QualityPersonNum = dataHsse.QualityPersonNum;
 | ||
|                 item.CollCropCode = dataHsse.CollCropCode;
 | ||
|                 item.CompanyComprehensiveCheckNum = dataHsse.CompanyComprehensiveCheckNum;
 | ||
|                 item.CompanyComprehensivePlanNum = dataHsse.CompanyComprehensivePlanNum;
 | ||
|                 item.CompanyDrillNum = dataHsse.CompanyDrillNum;
 | ||
|                 item.CompanyDrillPersonNum = dataHsse.CompanyDrillPersonNum;
 | ||
|                 item.BranchDrillNum = dataHsse.BranchDrillNum;
 | ||
|                 item.BranchDrillPersonNum = dataHsse.BranchDrillPersonNum;
 | ||
|                 item.CompanyLeadShiftCheckNum = dataHsse.CompanyLeadShiftCheckNum;
 | ||
|                 item.CompanyOnSiteDisposalPlan = dataHsse.CompanyOnSiteDisposalPlan;
 | ||
|                 item.CompanySpecialCheckNum = dataHsse.CompanySpecialCheckNum;
 | ||
|                 item.CompanySpecialPlanNum = dataHsse.CompanySpecialPlanNum;
 | ||
|                 item.CompletedNum = dataHsse.CompletedNum;
 | ||
|                 item.ConstructionNum = dataHsse.ConstructionNum;
 | ||
|                 item.CostExtract = dataHsse.CostExtract;
 | ||
|                 item.CostUse = dataHsse.CostUse;
 | ||
|                 item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum;
 | ||
|                 item.FinishedNum = dataHsse.FinishedNum;
 | ||
|                 item.ArgumentNum = dataHsse.ArgumentNum;
 | ||
|                 item.GeneralAccidentNum = dataHsse.GeneralAccidentNum;
 | ||
|                 item.GeneralClosedNum = dataHsse.GeneralClosedNum;
 | ||
|                 item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
 | ||
|                 item.GeneralRate = "";
 | ||
|                 item.GeneralRiskNum = dataHsse.GeneralRiskNum;
 | ||
|                 item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum;
 | ||
|                 item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum;
 | ||
|                 item.HighRiskNum = dataHsse.HighRiskNum;
 | ||
|                 item.Id = dataHsse.Id;
 | ||
|                 item.IncomeComprehensiveEnergyConsumption = dataHsse.IncomeComprehensiveEnergyConsumption;
 | ||
|                 item.JoinConstructionPersonNum = dataHsse.JoinConstructionPersonNum;
 | ||
|                 item.LicensesCloseNum = dataHsse.LicensesCloseNum;
 | ||
|                 item.LicensesNum = dataHsse.LicensesNum;
 | ||
|                 item.LostWorkingHour = dataHsse.LostWorkingHour;
 | ||
|                 item.LowRiskNum = dataHsse.LowRiskNum;
 | ||
|                 item.MajorAccidentNum = dataHsse.MajorAccidentNum;
 | ||
|                 item.MajorClosedNum = dataHsse.MajorClosedNum;
 | ||
|                 item.MajorNotClosedNum = dataHsse.MajorNotClosedNum;
 | ||
|                 item.MajorProjectsUnderConstructionNum = dataHsse.MajorProjectsUnderConstructionNum;
 | ||
|                 item.MajorRate = "";
 | ||
|                 item.MediumRiskNum = dataHsse.MediumRiskNum;
 | ||
|                 item.NearMissNum = dataHsse.NearMissNum;
 | ||
|                 item.NewWaterConsumption = dataHsse.NewWaterConsumption;
 | ||
|                 item.ProjectComprehensivePlanNum = dataHsse.ProjectComprehensivePlanNum;
 | ||
|                 item.ProjectDrillNum = dataHsse.ProjectDrillNum;
 | ||
|                 item.ProjectDrillPersonNum = dataHsse.ProjectDrillPersonNum;
 | ||
|                 item.ProjectFullTimeNum = dataHsse.ProjectFullTimeNum;
 | ||
|                 item.ProjectInspectorGeneralNum = dataHsse.ProjectInspectorGeneralNum;
 | ||
|                 item.ProjectLeadShiftCheckNum = dataHsse.ProjectLeadShiftCheckNum;
 | ||
|                 item.ProjectMajorCheckNum = dataHsse.ProjectMajorCheckNum;
 | ||
|                 item.ProjectOnSiteDisposalPlan = dataHsse.ProjectOnSiteDisposalPlan;
 | ||
|                 item.ProjectSafetyLeadingGroupMeetingNum = dataHsse.ProjectSafetyLeadingGroupMeetingNum;
 | ||
|                 item.ProjectSafetyMeetingNum = dataHsse.ProjectSafetyMeetingNum;
 | ||
|                 item.ProjectSafetyMonitorNum = dataHsse.ProjectSafetyMonitorNum;
 | ||
|                 item.ProjectSpecialCheckNum = dataHsse.ProjectSpecialCheckNum;
 | ||
|                 item.ProjectSpecialPlanNum = dataHsse.ProjectSpecialPlanNum;
 | ||
|                 item.RecordableEventNum = dataHsse.RecordableEventNum;
 | ||
|                 item.ReportDate = dataHsse.ReportDate.Value.ToShortDateString();
 | ||
|                 item.SafeTrainNum = dataHsse.SafeTrainNum;
 | ||
|                 item.SafetyCommitteeMeetingNum = dataHsse.SafetyCommitteeMeetingNum;
 | ||
|                 item.SafetyInjectionEngineer = dataHsse.SafetyInjectionEngineer;
 | ||
|                 item.SafeWorkingHour = dataHsse.SafeWorkingHour;
 | ||
|                 item.SeriousAccidentNum = dataHsse.SeriousAccidentNum;
 | ||
|                 item.ShutdownNum = dataHsse.ShutdownNum;
 | ||
|                 item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum;
 | ||
|                 item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum;
 | ||
|                 item.HseTechnicalNum = dataHsse.HseTechnicalNum;
 | ||
|                 item.EnvironmentalTrainNum = dataHsse.EnvironmentalTrainNum;
 | ||
|                 item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum;
 | ||
|                 item.SpecialTrainNum = dataHsse.SpecialTrainNum;
 | ||
|                 item.SuperCompletedNum = dataHsse.SuperCompletedNum;
 | ||
|                 item.SuperConstructionNum = dataHsse.SuperConstructionNum;
 | ||
|                 item.SuperFinishedNum = dataHsse.SuperFinishedNum;
 | ||
|                 item.SuperTrainPersonNum = dataHsse.SuperTrainPersonNum;
 | ||
|                 item.SuperOperativesNum = dataHsse.SuperOperativesNum;
 | ||
|                 item.SuperArgumentNum = dataHsse.SuperArgumentNum;
 | ||
|                 item.TotalEnergyConsumption = dataHsse.TotalEnergyConsumption;
 | ||
|                 item.TotalWorkingHour = dataHsse.TotalWorkingHour;
 | ||
|                 item.TrainPersonNum = dataHsse.TrainPersonNum;
 | ||
|                 item.OperativesNum = dataHsse.OperativesNum;
 | ||
|                 item.UnitId = dataHsse.UnitId;
 | ||
|                 item.UseEquipmentNum = dataHsse.UseEquipmentNum;
 | ||
|                 var hSseDataHiddens =
 | ||
|                     HSSEData_HiddenDangerDetailService.GetHSSEData_HiddenDangerDetailByDate(dataHsse.ReportDate);
 | ||
|                 if (hSseDataHiddens != null)
 | ||
|                 {
 | ||
|                     var list = hSseDataHiddens.Select(detail => new HSSEDataHiddenDangerDetailItem
 | ||
|                     {
 | ||
|                         Id = detail.Id,
 | ||
|                         NeedRectifyNum = detail.NeedRectifyNum,
 | ||
|                         TotalNum = detail.TotalNum,
 | ||
|                         TypeName = detail.TypeName
 | ||
|                     }).ToList();
 | ||
| 
 | ||
|                     item.HiddenDangerDetailItems = list;
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             var hsseDataItems = new List<HsseDataItem> { item };
 | ||
|             data.HSSEDataItems = hsseDataItems;
 | ||
|             return data;
 | ||
|         }
 | ||
| 
 | ||
|         public static HSSEData GetItemByHSSEData_HSSE(HSSEData_HSSE dataHsse,
 | ||
|             List<HSSEDataHiddenDangerDetailItem> hSseDataHiddens)
 | ||
|         {
 | ||
|             var item = new HsseDataItem();
 | ||
|             var data = new HSSEData();
 | ||
|             if (dataHsse != null)
 | ||
|             {
 | ||
|                 item.BranchLeadShiftCheckNum = dataHsse.BranchLeadShiftCheckNum;
 | ||
|                 item.BranchComprehensiveCheckNum = dataHsse.BranchComprehensiveCheckNum;
 | ||
|                 item.BranchSpecialCheckNum = dataHsse.BranchSpecialCheckNum;
 | ||
|                 item.BeUnderConstructionNum = dataHsse.BeUnderConstructionNum;
 | ||
|                 item.BranchFullTimeNum = dataHsse.BranchFullTimeNum;
 | ||
|                 item.BranchInspectorGeneralNum = dataHsse.BranchInspectorGeneralNum;
 | ||
|                 item.BranchComprehensivePlanNum = dataHsse.BranchComprehensivePlanNum;
 | ||
|                 item.BranchSpecialPlanNum = dataHsse.BranchSpecialPlanNum;
 | ||
|                 item.BranchOnSiteDisposalPlan = dataHsse.BranchOnSiteDisposalPlan;
 | ||
|                 item.CertificateANum = dataHsse.CertificateANum;
 | ||
|                 item.CertificateBNum = dataHsse.CertificateBNum;
 | ||
|                 item.CertificateCNum = dataHsse.CertificateCNum;
 | ||
|                 item.QualityPersonNum = dataHsse.QualityPersonNum;
 | ||
|                 item.CollCropCode = dataHsse.CollCropCode;
 | ||
|                 item.CompanyComprehensiveCheckNum = dataHsse.CompanyComprehensiveCheckNum;
 | ||
|                 item.CompanyComprehensivePlanNum = dataHsse.CompanyComprehensivePlanNum;
 | ||
|                 item.CompanyDrillNum = dataHsse.CompanyDrillNum;
 | ||
|                 item.CompanyDrillPersonNum = dataHsse.CompanyDrillPersonNum;
 | ||
|                 item.BranchDrillNum = dataHsse.BranchDrillNum;
 | ||
|                 item.BranchDrillPersonNum = dataHsse.BranchDrillPersonNum;
 | ||
|                 item.CompanyLeadShiftCheckNum = dataHsse.CompanyLeadShiftCheckNum;
 | ||
|                 item.CompanyOnSiteDisposalPlan = dataHsse.CompanyOnSiteDisposalPlan;
 | ||
|                 item.CompanySpecialCheckNum = dataHsse.CompanySpecialCheckNum;
 | ||
|                 item.CompanySpecialPlanNum = dataHsse.CompanySpecialPlanNum;
 | ||
|                 item.CompletedNum = dataHsse.CompletedNum;
 | ||
|                 item.ConstructionNum = dataHsse.ConstructionNum;
 | ||
|                 item.CostExtract = dataHsse.CostExtract;
 | ||
|                 item.CostUse = dataHsse.CostUse;
 | ||
|                 item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum;
 | ||
|                 item.FinishedNum = dataHsse.FinishedNum;
 | ||
|                 item.ArgumentNum = dataHsse.ArgumentNum;
 | ||
|                 item.GeneralAccidentNum = dataHsse.GeneralAccidentNum;
 | ||
|                 item.GeneralClosedNum = dataHsse.GeneralClosedNum;
 | ||
|                 item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
 | ||
|                 item.GeneralRate = "";
 | ||
|                 item.GeneralRiskNum = dataHsse.GeneralRiskNum;
 | ||
|                 item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum;
 | ||
|                 item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum;
 | ||
|                 item.HighRiskNum = dataHsse.HighRiskNum;
 | ||
|                 item.Id = dataHsse.Id;
 | ||
|                 item.IncomeComprehensiveEnergyConsumption = dataHsse.IncomeComprehensiveEnergyConsumption;
 | ||
|                 item.JoinConstructionPersonNum = dataHsse.JoinConstructionPersonNum;
 | ||
|                 item.LicensesCloseNum = dataHsse.LicensesCloseNum;
 | ||
|                 item.LicensesNum = dataHsse.LicensesNum;
 | ||
|                 item.LostWorkingHour = dataHsse.LostWorkingHour;
 | ||
|                 item.LowRiskNum = dataHsse.LowRiskNum;
 | ||
|                 item.MajorAccidentNum = dataHsse.MajorAccidentNum;
 | ||
|                 item.MajorClosedNum = dataHsse.MajorClosedNum;
 | ||
|                 item.MajorNotClosedNum = dataHsse.MajorNotClosedNum;
 | ||
|                 item.MajorProjectsUnderConstructionNum = dataHsse.MajorProjectsUnderConstructionNum;
 | ||
|                 item.MajorRate = "";
 | ||
|                 item.MediumRiskNum = dataHsse.MediumRiskNum;
 | ||
|                 item.NearMissNum = dataHsse.NearMissNum;
 | ||
|                 item.NewWaterConsumption = dataHsse.NewWaterConsumption;
 | ||
|                 item.ProjectComprehensivePlanNum = dataHsse.ProjectComprehensivePlanNum;
 | ||
|                 item.ProjectDrillNum = dataHsse.ProjectDrillNum;
 | ||
|                 item.ProjectDrillPersonNum = dataHsse.ProjectDrillPersonNum;
 | ||
|                 item.ProjectFullTimeNum = dataHsse.ProjectFullTimeNum;
 | ||
|                 item.ProjectSubFullTimeNum = dataHsse.ProjectSubFullTimeNum;
 | ||
|                 item.ProjectInspectorGeneralNum = dataHsse.ProjectInspectorGeneralNum;
 | ||
|                 item.ProjectLeadShiftCheckNum = dataHsse.ProjectLeadShiftCheckNum;
 | ||
|                 item.ProjectMajorCheckNum = dataHsse.ProjectMajorCheckNum;
 | ||
|                 item.ProjectOnSiteDisposalPlan = dataHsse.ProjectOnSiteDisposalPlan;
 | ||
|                 item.ProjectSafetyLeadingGroupMeetingNum = dataHsse.ProjectSafetyLeadingGroupMeetingNum;
 | ||
|                 item.ProjectSafetyMeetingNum = dataHsse.ProjectSafetyMeetingNum;
 | ||
|                 item.ProjectSafetyMonitorNum = dataHsse.ProjectSafetyMonitorNum;
 | ||
|                 item.ProjectSpecialCheckNum = dataHsse.ProjectSpecialCheckNum;
 | ||
|                 item.ProjectSpecialPlanNum = dataHsse.ProjectSpecialPlanNum;
 | ||
|                 item.RecordableEventNum = dataHsse.RecordableEventNum;
 | ||
|                 item.ReportDate = dataHsse.ReportDate.Value.ToShortDateString();
 | ||
|                 item.SafeTrainNum = dataHsse.SafeTrainNum;
 | ||
|                 item.SafetyCommitteeMeetingNum = dataHsse.SafetyCommitteeMeetingNum;
 | ||
|                 item.SafetyInjectionEngineer = dataHsse.SafetyInjectionEngineer;
 | ||
|                 item.SafeWorkingHour = dataHsse.SafeWorkingHour;
 | ||
|                 item.SeriousAccidentNum = dataHsse.SeriousAccidentNum;
 | ||
|                 item.ShutdownNum = dataHsse.ShutdownNum;
 | ||
|                 item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum;
 | ||
|                 item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum;
 | ||
|                 item.HseTechnicalNum = dataHsse.HseTechnicalNum;
 | ||
|                 item.EnvironmentalTrainNum = dataHsse.EnvironmentalTrainNum;
 | ||
|                 item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum;
 | ||
|                 item.SpecialTrainNum = dataHsse.SpecialTrainNum;
 | ||
|                 item.SuperCompletedNum = dataHsse.SuperCompletedNum;
 | ||
|                 item.SuperConstructionNum = dataHsse.SuperConstructionNum;
 | ||
|                 item.SuperFinishedNum = dataHsse.SuperFinishedNum;
 | ||
|                 item.SuperArgumentNum = dataHsse.SuperArgumentNum;
 | ||
|                 item.SuperTrainPersonNum = dataHsse.SuperTrainPersonNum;
 | ||
|                 item.SuperOperativesNum = dataHsse.SuperOperativesNum;
 | ||
|                 item.TotalEnergyConsumption = dataHsse.TotalEnergyConsumption;
 | ||
|                 item.TotalWorkingHour = dataHsse.TotalWorkingHour;
 | ||
|                 item.TrainPersonNum = dataHsse.TrainPersonNum;
 | ||
|                 item.OperativesNum = dataHsse.OperativesNum;
 | ||
|                 item.UnitId = dataHsse.UnitId;
 | ||
|                 item.UseEquipmentNum = dataHsse.UseEquipmentNum;
 | ||
|                 if (hSseDataHiddens != null)
 | ||
|                 {
 | ||
|                     var list = hSseDataHiddens.Select(detail =>
 | ||
|                         new HSSEDataHiddenDangerDetailItem
 | ||
|                         {
 | ||
|                             Id = detail.Id,
 | ||
|                             NeedRectifyNum = detail.NeedRectifyNum,
 | ||
|                             TotalNum = detail.TotalNum,
 | ||
|                             TypeName = detail.TypeName
 | ||
|                         }).ToList();
 | ||
| 
 | ||
|                     item.HiddenDangerDetailItems = list;
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             var hsseDataItems = new List<HsseDataItem> { item };
 | ||
|             data.HSSEDataItems = hsseDataItems;
 | ||
|             return data;
 | ||
|         }
 | ||
| 
 | ||
|         public static async Task<HSSEData> GetTodayHSSEData_HSSE()
 | ||
|         {
 | ||
|             var modelTask = StatisticalDataAsync();
 | ||
|             var model = await modelTask;
 | ||
|             HSSEData data = model;
 | ||
|             return data;
 | ||
|         }
 | ||
| 
 | ||
|         public static HSSEData_HSSE GetTodayData()
 | ||
|         {
 | ||
|             var q = (from x in Funs.DB.HSSEData_HSSE
 | ||
|                      where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
 | ||
|                      select x).FirstOrDefault();
 | ||
|             return q;
 | ||
|         }
 | ||
| 
 | ||
|         public static void UpdateTodyData_State()
 | ||
|         {
 | ||
|             var q = GetTodayData();
 | ||
|             if (q != null)
 | ||
|             {
 | ||
|                 q.State = Const.CNCEC_State_1;
 | ||
|                 UpdateHSSEData_HSSE(q);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public static bool IsReportByDate(DateTime dateTime)
 | ||
|         {
 | ||
|             var result = false;
 | ||
|             var q = (from x in Funs.DB.HSSEData_HSSE
 | ||
|                      where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date
 | ||
|                      select x).ToList();
 | ||
|             if (q.Count > 0) result = true;
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     判断当天是否已上报
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static bool IsReportByToday()
 | ||
|         {
 | ||
|             var result = false;
 | ||
|             var q = (from x in Funs.DB.HSSEData_HSSE
 | ||
|                      where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
 | ||
|                      select x).ToList();
 | ||
|             if (q.Count > 0) result = true;
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         public static ReturnData PushCncec(string id)
 | ||
|         {
 | ||
|             var baseurl = "/api/HSSEData/SaveHSSEData";
 | ||
|             var item = GetItemById(id);
 | ||
|             var str = JsonConvert.SerializeObject(item);
 | ||
|             var responeData = ServerService.PushCNCEC(str, baseurl);
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         public static Model.HSSEData_HSSE GetSubUnitHsseDataByDate(string Unitid, DateTime? reportdate)
 | ||
|         {
 | ||
|             var result = new Model.HSSEData_HSSE();
 | ||
|             if (reportdate == null)
 | ||
|             {
 | ||
|                 return result;
 | ||
|             }
 | ||
| 
 | ||
|             var projectlist = BLL.ProjectService.GetProjectWorkList(Unitid);
 | ||
|             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,
 | ||
|                 BeUnderConstructionNum = projectData.Sum(x => x.BeUnderConstructionNum),
 | ||
|                 ShutdownNum = projectData.Sum(x => x.ShutdownNum),
 | ||
|                 JoinConstructionPersonNum = projectData.Sum(x => x.JoinConstructionPersonNum),
 | ||
|                 MajorProjectsUnderConstructionNum = projectData.Sum(x => x.MajorProjectsUnderConstructionNum),
 | ||
|                 TotalWorkingHour = projectData.Sum(x => x.TotalWorkingHour),
 | ||
|                 LostWorkingHour = projectData.Sum(x => x.LostWorkingHour),
 | ||
|                 SafeWorkingHour = projectData.Sum(x => x.SafeWorkingHour),
 | ||
|                 SafeTrainNum = projectData.Sum(x => x.SafeTrainNum),
 | ||
|                 SpecialTrainNum = projectData.Sum(x => x.SpecialTrainNum),
 | ||
|                 SpecialOperationTrainNum = projectData.Sum(x => x.SpecialOperationTrainNum),
 | ||
|                 TotalEnergyConsumption = 0,
 | ||
|                 IncomeComprehensiveEnergyConsumption = 0,
 | ||
|                 NewWaterConsumption = 0,
 | ||
|                 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),
 | ||
|                 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 = GetSafetyCommitteeMeeting().Count,
 | ||
|                 EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(),
 | ||
|                 ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum),
 | ||
|                 ProjectSafetyMeetingNum = projectData.Sum(x => x.ProjectSafetyMeetingNum),
 | ||
|                 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),
 | ||
|                 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
 | ||
|             };
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 统计数据(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<HSSEData> 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 qualityPersonNumTask = HSSEData_HSSEService.GetQualityPersonNumAsync();
 | ||
| 
 | ||
|             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 safeTrainBoShengTask = HSSEData_HSSEService.GetBoShengSafeTrainAsync();
 | ||
|             var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync();
 | ||
|             var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync();
 | ||
|             var hseTechnicalTask = HSSEData_HSSEService.GetHseTechnicalAsync();
 | ||
|             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 branchLeadShiftCheckTask = HSSEData_HSSEService.GetBranchLeadShiftCheckAsync();
 | ||
|             var branchComprehensiveCheckTask = HSSEData_HSSEService.GetBranchComprehensiveCheckAsync();
 | ||
|             var branchSpecialCheckTask = HSSEData_HSSEService.GetBranchSpecialCheckAsync();
 | ||
|             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 branchComprehensivePlanTask = HSSEData_HSSEService.GetBranchComprehensivePlanAsync();
 | ||
|             var branchSpecialPlanTask = HSSEData_HSSEService.GetBranchSpecialPlanAsync();
 | ||
|             var branchOnSiteDisposalPlanTask = HSSEData_HSSEService.GetBranchOnSiteDisposalPlanAsync();
 | ||
|             var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync();
 | ||
|             var branchDrillTask = HSSEData_HSSEService.GetBranchDrillAsync();
 | ||
|             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,
 | ||
|                 qualityPersonNumTask,
 | ||
|                 beUnderConstructionTask,
 | ||
|                 shutdownTask,
 | ||
|                 joinConstructionPersonTask,
 | ||
|                 majorProjectsUnderConstructionTask,
 | ||
|                 totalWorkingHourTask,
 | ||
|                 lostWorkingHourTask,
 | ||
|                 safeWorkingHourTask,
 | ||
|                 safeTrainTask,
 | ||
|                 safeTrainBoShengTask,
 | ||
|                 specialTrainTask,
 | ||
|                 specialOperationTrainTask, hseTechnicalTask,
 | ||
|                 headOfficeInspectorGeneralTask,
 | ||
|                 headOfficeFullTimeTask,
 | ||
|                 branchInspectorGeneralTask,
 | ||
|                 branchFullTimeTask,
 | ||
|                 projectInspectorGeneralTask,
 | ||
|                 projectFullTimeTask,
 | ||
|                 projectSafetyMonitorTask,
 | ||
|                 safetyCommitteeMeetingTask,
 | ||
|                 enterpriseTopicsMeetingTask,
 | ||
|                 projectSafetyLeadingGroupMeetingTask,
 | ||
|                 projectSafetyMeetingTask,
 | ||
|                 companyLeadShiftCheckTask,
 | ||
|                 companyComprehensiveCheckTask,
 | ||
|                 companySpecialCheckTask,
 | ||
|                 branchLeadShiftCheckTask,
 | ||
|                 branchComprehensiveCheckTask,
 | ||
|                 branchSpecialCheckTask,
 | ||
|                 projectLeadShiftCheckTask,
 | ||
|                 projectSpecialCheckTask,
 | ||
|                 projectMajorCheckTask,
 | ||
|                 nearMissTask,
 | ||
|                 recordableEventTask,
 | ||
|                 generalAccidentTask,
 | ||
|                 majorAccidentTask,
 | ||
|                 seriousAccidentTask,
 | ||
|                 specialSeriousAccidentTask,
 | ||
|                 companyComprehensivePlanTask,
 | ||
|                 companySpecialPlanTask,
 | ||
|                 companyOnSiteDisposalPlanTask,
 | ||
|                 branchComprehensivePlanTask,
 | ||
|                 branchSpecialPlanTask,
 | ||
|                 branchOnSiteDisposalPlanTask,
 | ||
|                 companyDrillTask, branchDrillTask,
 | ||
|                 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 qualityPersonList = await qualityPersonNumTask;
 | ||
|             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 safeTrainBoShengList = await safeTrainBoShengTask;
 | ||
|             var specialTrainList = await specialTrainTask;
 | ||
|             var specialOperationTrainList = await specialOperationTrainTask;
 | ||
|             var hseTechnicalList = await hseTechnicalTask;
 | ||
|             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 branchLeadShiftCheckList = await branchLeadShiftCheckTask;
 | ||
|             var branchComprehensiveCheckList = await branchComprehensiveCheckTask;
 | ||
|             var branchSpecialCheckList = await branchSpecialCheckTask;
 | ||
|             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 branchComprehensivePlanList = await branchComprehensivePlanTask;
 | ||
|             var branchSpecialPlanList = await branchSpecialPlanTask;
 | ||
|             var branchOnSiteDisposalPlanList = await branchOnSiteDisposalPlanTask;
 | ||
|             var companyDrillList = await companyDrillTask;
 | ||
|             var branchDrillList = await branchDrillTask;
 | ||
|             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(),
 | ||
|                 QualityPersonNum = qualityPersonList.Count(),
 | ||
|                 JoinConstructionPersonNum = joinConstructionPersonList.Count(),
 | ||
|                 MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(),
 | ||
|                 TotalWorkingHour = totalWorkingHour,
 | ||
|                 LostWorkingHour = lostWorkingHour,
 | ||
|                 SafeWorkingHour = safeWorkingHour,
 | ||
|                 SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum) + safeTrainBoShengList.Sum(x => x.TrainPersonNum),
 | ||
|                 SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum),
 | ||
|                 SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum),
 | ||
|                 HseTechnicalNum = hseTechnicalList.Count(),
 | ||
|                 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(x => x.IsOffice == true),
 | ||
|                 ProjectSubFullTimeNum = projectFullTimeList.Count(x => x.IsOffice == false),
 | ||
|                 ProjectSafetyMonitorNum = projectSafetyMonitorList.Count,
 | ||
|                 SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(),
 | ||
|                 EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(),
 | ||
|                 ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(),
 | ||
|                 ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(),
 | ||
|                 CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(),
 | ||
|                 CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(),
 | ||
|                 CompanySpecialCheckNum = companySpecialCheckList.Count(),
 | ||
|                 BranchLeadShiftCheckNum = branchLeadShiftCheckList.Count(),
 | ||
|                 BranchComprehensiveCheckNum = branchComprehensiveCheckList.Count(),
 | ||
|                 BranchSpecialCheckNum = branchSpecialCheckList.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(),
 | ||
|                 BranchComprehensivePlanNum = branchComprehensivePlanList.Count(),
 | ||
|                 BranchSpecialPlanNum = branchSpecialPlanList.Count(),
 | ||
|                 BranchOnSiteDisposalPlan = branchOnSiteDisposalPlanList.Count(),
 | ||
|                 CompanyDrillNum = companyDrillList.Count(),
 | ||
|                 CompanyDrillPersonNum = companyDrillList.Sum(x => x.JointPersonNum),
 | ||
|                 BranchDrillNum = branchDrillList.Count(),
 | ||
|                 BranchDrillPersonNum = branchDrillList.Sum(x => x.JointPersonNum),
 | ||
|                 ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(),
 | ||
|                 ProjectSpecialPlanNum = projectSpecialPlanList.Count(),
 | ||
|                 ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(),
 | ||
|                 ProjectDrillNum = projectDrillList.Count(),
 | ||
|                 ProjectDrillPersonNum = projectDrillList.Sum(x => x.JointPersonNum),
 | ||
|                 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),
 | ||
|                 OperativesNum = largeEngineeringOutputsTask.Result.Sum(x => x.OperativesNum),
 | ||
|                 ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum),
 | ||
|                 FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum),
 | ||
|                 ArgumentNum = largeEngineeringOutputsTask.Result.Sum(x => x.ArgumentNum),
 | ||
|                 SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum),
 | ||
|                 SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum),
 | ||
|                 SuperOperativesNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperOperativesNum),
 | ||
|                 SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum),
 | ||
|                 SuperFinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperFinishedNum),
 | ||
|                 SuperArgumentNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperArgumentNum)
 | ||
|             };
 | ||
| 
 | ||
|             #region 添加项目统计数据
 | ||
| 
 | ||
|             Project_HSSEData_HSSEService.DeleteProject_HSSEData_HSSEByDate(DateTime.Now.Date);
 | ||
| 
 | ||
|             var generalHiddenRectificationOutputsDict = generalHiddenRectificationOutputsList
 | ||
|             .GroupBy(x => x.ProjectId)
 | ||
|             .ToDictionary(
 | ||
|                 g => g.Key,
 | ||
|                 g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) }
 | ||
|             );
 | ||
|             var majorHiddenRectificationOutputsDict = majorHiddenRectificationOutputsList
 | ||
|                 .GroupBy(x => x.ProjectId)
 | ||
|                 .ToDictionary(
 | ||
|                     g => g.Key,
 | ||
|                     g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) }
 | ||
|                 );
 | ||
|             var securityRiskOutputList = securityRiskOutputListTask.Result;
 | ||
|             var securityRiskOutputDict = securityRiskOutputList
 | ||
|                 .GroupBy(x => x.ProjectId)
 | ||
|                 .ToDictionary(
 | ||
|                     g => g.Key,
 | ||
|                     g => new
 | ||
|                     {
 | ||
|                         LowRiskNum = g.Sum(x => x.LowRiskNum),
 | ||
|                         GeneralRiskNum = g.Sum(x => x.GeneralRiskNum),
 | ||
|                         MediumRiskNum = g.Sum(x => x.MediumRiskNum),
 | ||
|                         HighRiskNum = g.Sum(x => x.HighRiskNum)
 | ||
|                     }
 | ||
|                 );
 | ||
|             var largeEngineeringOutputList = largeEngineeringOutputsTask.Result;
 | ||
|             var largeEngineeringOutputsDict = largeEngineeringOutputList
 | ||
|                 .GroupBy(x => x.ProjectId)
 | ||
|                 .ToDictionary(
 | ||
|                     g => g.Key,
 | ||
|                     g => new
 | ||
|                     {
 | ||
|                         CompletedNum = g.Sum(x => x.CompletedNum),
 | ||
|                         TrainPersonNum = g.Sum(x => x.TrainPersonNum),
 | ||
|                         OperativesNum = g.Sum(x => x.OperativesNum),
 | ||
|                         ConstructionNum = g.Sum(x => x.ConstructionNum),
 | ||
|                         FinishedNum = g.Sum(x => x.FinishedNum),
 | ||
|                         ArgumentNum = g.Sum(x => x.ArgumentNum),
 | ||
|                         SuperCompletedNum = g.Sum(x => x.SuperCompletedNum),
 | ||
|                         SuperTrainPersonNum = g.Sum(x => x.SuperTrainPersonNum),
 | ||
|                         SuperOperativesNum = g.Sum(x => x.SuperOperativesNum),
 | ||
|                         SuperConstructionNum = g.Sum(x => x.SuperConstructionNum),
 | ||
|                         SuperFinishedNum = g.Sum(x => x.SuperFinishedNum),
 | ||
|                         SuperArgumentNum = g.Sum(x => x.SuperArgumentNum)
 | ||
|                     }
 | ||
|                 );
 | ||
|             foreach (var projectid in BeUnderConstructionList)
 | ||
|             {
 | ||
|                 generalHiddenRectificationOutputsDict.TryGetValue(projectid, out var generalHiddenRectificationOutputs);
 | ||
|                 majorHiddenRectificationOutputsDict.TryGetValue(projectid, out var majorHiddenRectificationOutputs);
 | ||
|                 securityRiskOutputDict.TryGetValue(projectid, out var securityRiskOutputs);
 | ||
|                 largeEngineeringOutputsDict.TryGetValue(projectid, out var largeEngineeringOutputs);
 | ||
|                 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) + safeTrainBoShengList.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),
 | ||
|                     HseTechnicalNum = hseTechnicalList.Count(x => x.ProjectId == projectid),
 | ||
|                     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),
 | ||
|                     QualityPersonNum = qualityPersonList.Count(x => x.ProjectId == projectid),
 | ||
|                     ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => x.ProjectId == projectid),
 | ||
|                     ProjectFullTimeNum = projectFullTimeList.Count(x => x.ProjectId == projectid && x.IsOffice == true),
 | ||
|                     ProjectSubFullTimeNum = projectFullTimeList.Count(x => x.ProjectId == projectid && x.IsOffice == false),
 | ||
|                     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),
 | ||
|                     BranchLeadShiftCheckNum = branchLeadShiftCheckList.Count(x => x.ProjectId == projectid),
 | ||
|                     BranchComprehensiveCheckNum = branchComprehensiveCheckList.Count(x => x.ProjectId == projectid),
 | ||
|                     BranchSpecialCheckNum = branchSpecialCheckList.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,
 | ||
|                     BranchComprehensivePlanNum = 0,
 | ||
|                     BranchSpecialPlanNum = 0,
 | ||
|                     BranchOnSiteDisposalPlan = 0,
 | ||
|                     CompanyDrillNum = 0,
 | ||
|                     CompanyDrillPersonNum = 0,
 | ||
|                     BranchDrillNum = 0,
 | ||
|                     BranchDrillPersonNum = 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),
 | ||
|                     ProjectDrillPersonNum = projectDrillList.Where(x => x.ProjectId == projectid).Sum(x => x.JointPersonNum),
 | ||
|                     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 = generalHiddenRectificationOutputs?.ClosedNum ?? 0,
 | ||
|                     GeneralNotClosedNum = generalHiddenRectificationOutputs?.NotClosedNum ?? 0,
 | ||
|                     MajorClosedNum = majorHiddenRectificationOutputs?.ClosedNum ?? 0,
 | ||
|                     MajorNotClosedNum = majorHiddenRectificationOutputs?.NotClosedNum ?? 0,
 | ||
|                     LowRiskNum = securityRiskOutputs?.LowRiskNum ?? 0,
 | ||
|                     GeneralRiskNum = securityRiskOutputs?.GeneralRiskNum ?? 0,
 | ||
|                     MediumRiskNum = securityRiskOutputs?.MediumRiskNum ?? 0,
 | ||
|                     HighRiskNum = securityRiskOutputs?.HighRiskNum ?? 0,
 | ||
|                     CompletedNum = largeEngineeringOutputs?.CompletedNum ?? 0,
 | ||
|                     TrainPersonNum = largeEngineeringOutputs?.TrainPersonNum ?? 0,
 | ||
|                     OperativesNum = largeEngineeringOutputs?.OperativesNum ?? 0,
 | ||
|                     ConstructionNum = largeEngineeringOutputs?.ConstructionNum ?? 0,
 | ||
|                     FinishedNum = largeEngineeringOutputs?.FinishedNum ?? 0,
 | ||
|                     ArgumentNum = largeEngineeringOutputs?.ArgumentNum ?? 0,
 | ||
|                     SuperCompletedNum = largeEngineeringOutputs?.SuperCompletedNum ?? 0,
 | ||
|                     SuperTrainPersonNum = largeEngineeringOutputs?.SuperTrainPersonNum ?? 0,
 | ||
|                     SuperOperativesNum = largeEngineeringOutputs?.SuperOperativesNum ?? 0,
 | ||
|                     SuperConstructionNum = largeEngineeringOutputs?.SuperConstructionNum ?? 0,
 | ||
|                     SuperFinishedNum = largeEngineeringOutputs?.SuperFinishedNum ?? 0,
 | ||
|                     SuperArgumentNum = largeEngineeringOutputs?.SuperArgumentNum ?? 0
 | ||
|                 };
 | ||
|                 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 void UpdateHSSEData_HSSE(HSSEData_HSSE newtable)
 | ||
|         {
 | ||
|             using (var db = new SGGLDB(Funs.ConnString))
 | ||
|             {
 | ||
|                 var table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id);
 | ||
|                 if (table != null)
 | ||
|                 {
 | ||
|                     table.Id = newtable.Id;
 | ||
|                     table.UnitId = newtable.UnitId;
 | ||
|                     table.CollCropCode = newtable.CollCropCode;
 | ||
|                     table.UnitName = newtable.UnitName;
 | ||
|                     table.ReportDate = newtable.ReportDate;
 | ||
|                     table.BeUnderConstructionNum = newtable.BeUnderConstructionNum;
 | ||
|                     table.ShutdownNum = newtable.ShutdownNum;
 | ||
|                     table.JoinConstructionPersonNum = newtable.JoinConstructionPersonNum;
 | ||
|                     table.MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum;
 | ||
|                     table.TotalWorkingHour = newtable.TotalWorkingHour;
 | ||
|                     table.LostWorkingHour = newtable.LostWorkingHour;
 | ||
|                     table.SafeWorkingHour = newtable.SafeWorkingHour;
 | ||
|                     table.SafeTrainNum = newtable.SafeTrainNum;
 | ||
|                     table.SpecialTrainNum = newtable.SpecialTrainNum;
 | ||
|                     table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum;
 | ||
|                     table.HseTechnicalNum = newtable.HseTechnicalNum;
 | ||
|                     table.EnvironmentalTrainNum = newtable.EnvironmentalTrainNum;
 | ||
|                     table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
 | ||
|                     table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
 | ||
|                     table.NewWaterConsumption = newtable.NewWaterConsumption;
 | ||
|                     table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum;
 | ||
|                     table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum;
 | ||
|                     table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum;
 | ||
|                     table.BranchFullTimeNum = newtable.BranchFullTimeNum;
 | ||
|                     table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum;
 | ||
|                     table.ProjectFullTimeNum = newtable.ProjectFullTimeNum;
 | ||
|                     table.ProjectSubFullTimeNum = newtable.ProjectSubFullTimeNum;
 | ||
|                     table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum;
 | ||
|                     table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer;
 | ||
|                     table.CertificateANum = newtable.CertificateANum;
 | ||
|                     table.CertificateBNum = newtable.CertificateBNum;
 | ||
|                     table.CertificateCNum = newtable.CertificateCNum;
 | ||
|                     table.QualityPersonNum = newtable.QualityPersonNum;
 | ||
|                     table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum;
 | ||
|                     table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum;
 | ||
|                     table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum;
 | ||
|                     table.ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum;
 | ||
|                     table.CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum;
 | ||
|                     table.CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum;
 | ||
|                     table.CompanySpecialCheckNum = newtable.CompanySpecialCheckNum;
 | ||
|                     table.BranchLeadShiftCheckNum = newtable.BranchLeadShiftCheckNum;
 | ||
|                     table.BranchComprehensiveCheckNum = newtable.BranchComprehensiveCheckNum;
 | ||
|                     table.BranchSpecialCheckNum = newtable.BranchSpecialCheckNum;
 | ||
|                     table.ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum;
 | ||
|                     table.ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum;
 | ||
|                     table.ProjectMajorCheckNum = newtable.ProjectMajorCheckNum;
 | ||
|                     table.NearMissNum = newtable.NearMissNum;
 | ||
|                     table.RecordableEventNum = newtable.RecordableEventNum;
 | ||
|                     table.GeneralAccidentNum = newtable.GeneralAccidentNum;
 | ||
|                     table.MajorAccidentNum = newtable.MajorAccidentNum;
 | ||
|                     table.SeriousAccidentNum = newtable.SeriousAccidentNum;
 | ||
|                     table.SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum;
 | ||
|                     table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum;
 | ||
|                     table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum;
 | ||
|                     table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan;
 | ||
|                     table.BranchComprehensivePlanNum = newtable.BranchComprehensivePlanNum;
 | ||
|                     table.BranchSpecialPlanNum = newtable.BranchSpecialPlanNum;
 | ||
|                     table.BranchOnSiteDisposalPlan = newtable.BranchOnSiteDisposalPlan;
 | ||
|                     table.CompanyDrillNum = newtable.CompanyDrillNum;
 | ||
|                     table.CompanyDrillPersonNum = newtable.CompanyDrillPersonNum;
 | ||
|                     table.BranchDrillNum = newtable.BranchDrillNum;
 | ||
|                     table.BranchDrillPersonNum = newtable.BranchDrillPersonNum;
 | ||
|                     table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum;
 | ||
|                     table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum;
 | ||
|                     table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan;
 | ||
|                     table.ProjectDrillNum = newtable.ProjectDrillNum;
 | ||
|                     table.ProjectDrillPersonNum = newtable.ProjectDrillPersonNum;
 | ||
|                     table.CostExtract = newtable.CostExtract;
 | ||
|                     table.CostUse = newtable.CostUse;
 | ||
|                     table.UseEquipmentNum = newtable.UseEquipmentNum;
 | ||
|                     table.SpecialEquipmentNum = newtable.SpecialEquipmentNum;
 | ||
|                     table.LicensesNum = newtable.LicensesNum;
 | ||
|                     table.LicensesCloseNum = newtable.LicensesCloseNum;
 | ||
|                     table.GeneralClosedNum = newtable.GeneralClosedNum;
 | ||
|                     table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
 | ||
|                     table.MajorClosedNum = newtable.MajorClosedNum;
 | ||
|                     table.MajorNotClosedNum = newtable.MajorNotClosedNum;
 | ||
|                     table.GeneralRiskNum = newtable.GeneralRiskNum;
 | ||
|                     table.LowRiskNum = newtable.LowRiskNum;
 | ||
|                     table.MediumRiskNum = newtable.MediumRiskNum;
 | ||
|                     table.HighRiskNum = newtable.HighRiskNum;
 | ||
|                     table.CompletedNum = newtable.CompletedNum;
 | ||
|                     table.TrainPersonNum = newtable.TrainPersonNum;
 | ||
|                     table.OperativesNum = newtable.OperativesNum;
 | ||
|                     table.ConstructionNum = newtable.ConstructionNum;
 | ||
|                     table.FinishedNum = newtable.FinishedNum;
 | ||
|                     table.ArgumentNum = newtable.ArgumentNum;
 | ||
|                     table.SuperCompletedNum = newtable.SuperCompletedNum;
 | ||
|                     table.SuperTrainPersonNum = newtable.SuperTrainPersonNum;
 | ||
|                     table.SuperOperativesNum = newtable.SuperOperativesNum;
 | ||
|                     table.SuperConstructionNum = newtable.SuperConstructionNum;
 | ||
|                     table.SuperFinishedNum = newtable.SuperFinishedNum;
 | ||
|                     table.SuperArgumentNum = newtable.SuperArgumentNum;
 | ||
|                     table.State = newtable.State;
 | ||
|                     table.CreateMan = newtable.CreateMan;
 | ||
|                     table.CreateDate = newtable.CreateDate;
 | ||
|                     db.SubmitChanges();
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         #region 安监人员数据
 | ||
|         /// <summary>
 | ||
|         ///     获取企业总部总监人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetHeadOfficeInspectorGeneral()
 | ||
|         {
 | ||
|             var unitId = string.Empty;
 | ||
|             var thisUnit = CommonService.GetIsThisUnit();
 | ||
|             if (thisUnit != null) unitId = thisUnit.UnitId;
 | ||
|             var result = (from x in Funs.DB.Person_CompanyBranchPerson
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = "",
 | ||
|                               ProjectName = "",
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.Telephone
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取企业总部总监人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetHeadOfficeInspectorGeneralAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetHeadOfficeInspectorGeneral);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业总部专职人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetHeadOfficeFullTime()
 | ||
|         {
 | ||
|             var unitId = string.Empty;
 | ||
|             var thisUnit = CommonService.GetIsThisUnit();
 | ||
|             if (thisUnit != null) unitId = thisUnit.UnitId;
 | ||
|             var result = (from x in Funs.DB.Person_CompanyBranchPerson
 | ||
|                           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.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectName = "",
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.Telephone
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取企业总部专职人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetHeadOfficeFullTimeAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetHeadOfficeFullTime);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构专职人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetBranchFullTime()
 | ||
|         {
 | ||
|             var unitId = string.Empty;
 | ||
|             var thisUnit = CommonService.GetIsThisUnit();
 | ||
|             if (thisUnit != null) unitId = thisUnit.UnitId;
 | ||
|             var result = (from x in Funs.DB.Person_CompanyBranchPerson
 | ||
|                           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.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectName = "",
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.Telephone
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取分支机构专职人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetBranchFullTimeAsync()
 | ||
|         {
 | ||
| 
 | ||
|             return await Task.Run(GetBranchFullTime);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构总监人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetBranchInspectorGeneral()
 | ||
|         {
 | ||
|             var unitId = string.Empty;
 | ||
|             var thisUnit = CommonService.GetIsThisUnit();
 | ||
|             if (thisUnit != null) unitId = thisUnit.UnitId;
 | ||
|             var result = (from x in Funs.DB.Person_CompanyBranchPerson
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectName = "",
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.Telephone
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取分支机构总监人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetBranchInspectorGeneralAsync()
 | ||
|         {
 | ||
| 
 | ||
|             return await Task.Run(GetBranchInspectorGeneral);
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目总监人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> 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
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) &&
 | ||
|                                 x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.IsUsed == true && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.Telephone
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取项目总监人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetProjectInspectorGeneralAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectInspectorGeneral);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专职人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetProjectFullTime()
 | ||
|         {
 | ||
|             string ThisUnitId = CommonService.GetThisUnitId();
 | ||
|             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 into yGroup
 | ||
|                           from y in yGroup.DefaultIfEmpty()
 | ||
|                           join z in Funs.DB.Base_Post on x.WorkPostId equals z.PostId into zGroup
 | ||
|                           from z in zGroup.DefaultIfEmpty()
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) && y.IsHsse == true && x.IsUsed == true && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               ProjectFromUnitId = p.UnitId,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = y.WorkPostName == null ? "" : y.WorkPostName,
 | ||
|                               Phone = x.Telephone,
 | ||
|                               // IsOffice=(u.UnitId== ThisUnitId?true:false)
 | ||
|                               IsOffice = u.UnitId == null ? false : (u.UnitId == ThisUnitId || u.IsBranch == true ? true : false)
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取项目专职人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetProjectFullTimeAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectFullTime);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目安全监护人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetProjectSafetyMonitor()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.SitePerson_Person
 | ||
|                           where x.IsSafetyMonitoring == true && x.IsUsed == true && 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()
 | ||
|                           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 = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = post.WorkPostName,
 | ||
|                               Phone = x.Telephone
 | ||
|                           }).ToList();
 | ||
|             result = result
 | ||
|                 .GroupBy(x => x.IdentityCard)
 | ||
|                 .Select(g => g.FirstOrDefault())
 | ||
|                 .ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取项目安全监护人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetProjectSafetyMonitorAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectSafetyMonitor);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取在岗执业注安师
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> 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
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) && z.IsRegisterHSSE == true && x.IsUsed == true && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取在岗执业注安师(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetSafetyInjectionEngineerAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSafetyInjectionEngineer);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取A证人员
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetCertificateA()
 | ||
|         {
 | ||
|             var result = new List<Model.OfSafetySupervisorsOutput>();
 | ||
|             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
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "A" && x.IsUsed == true && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取A证人员(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetCertificateAAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCertificateA);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取B证人员
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetCertificateB()
 | ||
|         {
 | ||
|             var result = new List<Model.OfSafetySupervisorsOutput>();
 | ||
|             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
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "B" && x.IsUsed == true && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取B证人员(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetCertificateBAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCertificateB);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取C证人员
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetCertificateC()
 | ||
|         {
 | ||
|             var result = new List<Model.OfSafetySupervisorsOutput>();
 | ||
|             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
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "C" && x.IsUsed == true && x.IdentityCard != null
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = x.PersonName,
 | ||
|                               Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = x.IdentityCard,
 | ||
|                               WorkPostName = PostService.GetPostNameById(x.WorkPostId),
 | ||
|                               Phone = x.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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取C证人员(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetCertificateCAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCertificateC);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取在岗特种作业人员数量
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.OfSafetySupervisorsOutput> GetQualityPersonNum()
 | ||
|         {
 | ||
|             var result = (from p in Funs.DB.SitePerson_Person
 | ||
|                           join bp in Funs.DB.Base_Project on p.ProjectId equals bp.ProjectId into bpGroup
 | ||
|                           from bp in bpGroup.DefaultIfEmpty()
 | ||
|                           join u in Funs.DB.Base_Unit on p.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           join q in Funs.DB.QualityAudit_PersonQuality on p.PersonId equals q.PersonId into qGroup
 | ||
|                           from q in qGroup.DefaultIfEmpty()
 | ||
|                           join m in Funs.DB.Base_WorkPost on p.WorkPostId equals m.WorkPostId into mGroup
 | ||
|                           from m in mGroup.DefaultIfEmpty()
 | ||
|                           join su in Funs.DB.Sys_User on q.CompileMan equals su.UserId into suGroup
 | ||
|                           from su in suGroup.DefaultIfEmpty()
 | ||
|                           join bc in Funs.DB.Base_Certificate on q.CertificateId equals bc.CertificateId into bcGroup
 | ||
|                           from bc in bcGroup.DefaultIfEmpty()
 | ||
|                           join su1 in Funs.DB.Sys_User on q.AuditorId equals su1.UserId into su1Group
 | ||
|                           from su1 in su1Group.DefaultIfEmpty()
 | ||
|                           where BeUnderConstructionList.Contains(p.ProjectId) && m.PostType == Const.PostType_2 && p.IsUsed == true
 | ||
|                           select new Model.OfSafetySupervisorsOutput
 | ||
|                           {
 | ||
|                               ProjectId = p.ProjectId,
 | ||
|                               ProjectName = bp.ProjectName,
 | ||
|                               UnitId = u.UnitId,
 | ||
|                               UnitName = u.UnitName,
 | ||
|                               Name = p.PersonName,
 | ||
|                               Sex = p.Sex == null ? "" : (p.Sex == "1" ? "男" : "女"),
 | ||
|                               IdentityCard = p.IdentityCard,
 | ||
|                               WorkPostName = m.WorkPostName == null ? "" : m.WorkPostName,
 | ||
|                               Phone = p.Telephone
 | ||
|                           }).ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 获取在岗特种作业人员数量(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.OfSafetySupervisorsOutput>> GetQualityPersonNumAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetQualityPersonNum);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 安全会议数据
 | ||
|         /// <summary>
 | ||
|         /// 获取企业安委会会数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<MeetingOutput> 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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业安委会会数据(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<MeetingOutput>> GetSafetyCommitteeMeetingAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSafetyCommitteeMeeting);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业专题会议数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetEnterpriseTopicsMeetingNum()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Meeting_CompanySpecialMeeting
 | ||
|                           where x.CompileDate > Const.DtmarkTime
 | ||
|                           select x).Count();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业专题会议
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<MeetingOutput> 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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业专题会议(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<MeetingOutput>> GetEnterpriseTopicsMeetingAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetEnterpriseTopicsMeeting);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目班前会
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<MeetingOutput> 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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目班前会议(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<MeetingOutput>> GetProjectClassMeetingAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectClassMeeting);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专题会议
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<MeetingOutput> 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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专题会议(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<MeetingOutput>> GetProjectSpecialMeetingAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectSpecialMeeting);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目安全领导小组会议
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<MeetingOutput> 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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目安全领导小组会议(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<MeetingOutput>> GetProjectSafetyLeadingGroupMeetingAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectSafetyLeadingGroupMeeting);
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目安全例会数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<MeetingOutput> 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();
 | ||
| 
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目安全例会数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<MeetingOutput>> GetProjectSafetyMeetingAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectSafetyMeeting);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 安全监督检查数据
 | ||
| 
 | ||
|         #region 企业级-本单位
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业负责人带班检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> 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()
 | ||
|                           join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
 | ||
|                           from cu in cuGroup.DefaultIfEmpty()
 | ||
|                           where cu.UnitId == CommonService.GetThisUnitId() && x.CheckMainType == "0" && x.CheckType == "1" && x.CheckDate > Const.DtmarkTime
 | ||
|                           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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业负责人带班检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetCompanyLeadShiftCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanyLeadShiftCheck);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业综合检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> 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()
 | ||
|                           join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
 | ||
|                           from cu in cuGroup.DefaultIfEmpty()
 | ||
|                           where cu.UnitId == CommonService.GetThisUnitId() && x.CheckMainType == "0" && x.CheckType == "2" && x.CheckDate > Const.DtmarkTime
 | ||
|                           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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业综合检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetCompanyComprehensiveCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanyComprehensiveCheck);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业专项检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> 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()
 | ||
|                           join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
 | ||
|                           from cu in cuGroup.DefaultIfEmpty()
 | ||
|                           where cu.UnitId == CommonService.GetThisUnitId() && x.CheckMainType == "0" && x.CheckType == "3" && x.CheckDate > Const.DtmarkTime
 | ||
|                           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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业专项检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetCompanySpecialCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanySpecialCheck);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 分支机构
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构企业负责人带班检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> GetBranchLeadShiftCheck()
 | ||
|         {
 | ||
|             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()
 | ||
|                           join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
 | ||
|                           from cu in cuGroup.DefaultIfEmpty()
 | ||
|                           where cu.IsBranch == true && x.CheckMainType == "0" && x.CheckType == "1" && x.CheckDate > Const.DtmarkTime
 | ||
|                           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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构企业负责人带班检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetBranchLeadShiftCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchLeadShiftCheck);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构企业综合检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> GetBranchComprehensiveCheck()
 | ||
|         {
 | ||
|             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()
 | ||
|                           join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
 | ||
|                           from cu in cuGroup.DefaultIfEmpty()
 | ||
|                           where cu.IsBranch == true && x.CheckMainType == "0" && x.CheckType == "2" && x.CheckDate > Const.DtmarkTime
 | ||
|                           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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构企业综合检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetBranchComprehensiveCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchComprehensiveCheck);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构企业专项检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> GetBranchSpecialCheck()
 | ||
|         {
 | ||
|             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()
 | ||
|                           join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
 | ||
|                           from cu in cuGroup.DefaultIfEmpty()
 | ||
|                           where cu.IsBranch == true && x.CheckMainType == "0" && x.CheckType == "3" && x.CheckDate > Const.DtmarkTime
 | ||
|                           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();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构企业专项检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetBranchSpecialCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchSpecialCheck);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 项目级
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目负责人带班检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> GetProjectLeadShiftCheck()
 | ||
|         {
 | ||
|             // 先批量获取所有需要的UnitIds和LeaderIds
 | ||
|             var unitIds = Funs.DB.Check_ProjectLeaderCheck
 | ||
|                 .Where(x => BeUnderConstructionList.Contains(x.ProjectId) && x.CheckDate > Const.DtmarkTime)
 | ||
|                 .Select(x => x.UnitIds).Distinct().ToList();
 | ||
|             Dictionary<string, string> unitNames = new Dictionary<string, string>();
 | ||
|             foreach (var item in unitIds)
 | ||
|             {
 | ||
|                 unitNames.Add(item ?? "null", UnitService.getUnitNamesUnitIds(item));
 | ||
| 
 | ||
|             }
 | ||
| 
 | ||
|             var leaderIds = Funs.DB.Check_ProjectLeaderCheck
 | ||
|                 .Where(x => BeUnderConstructionList.Contains(x.ProjectId) && x.CheckDate > Const.DtmarkTime)
 | ||
|                 .Select(x => x.LeaderIds).Distinct().ToList();
 | ||
|             Dictionary<string, string> leaderNames = new Dictionary<string, string>();
 | ||
|             foreach (var item in leaderIds)
 | ||
|             {
 | ||
|                 leaderNames.Add(item ?? "null", UserService.getUserNamesUserIds(item));
 | ||
| 
 | ||
|             }
 | ||
| 
 | ||
|             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 = unitNames[x.UnitIds ?? "null"], // 从预加载的字典中获取
 | ||
|                               Id = x.ProjectLeaderCheckId,
 | ||
|                               CheckTeam = leaderNames[x.LeaderIds ?? "null"], // 从预加载的字典中获取
 | ||
|                               CheckDate = x.CheckDate,
 | ||
|                           });
 | ||
|             return result.ToList();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目负责人带班检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetProjectLeadShiftCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectLeadShiftCheck);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专项检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> GetProjectSpecialCheck()
 | ||
|         {
 | ||
|             var unitIds = Funs.DB.Check_CheckSpecial
 | ||
|                 .Where(x => BeUnderConstructionList.Contains(x.ProjectId) && x.CheckTime > Const.DtmarkTime)
 | ||
|                 .Select(x => x.PartInUnits).Distinct().ToList();
 | ||
|             Dictionary<string, string> unitNames = new Dictionary<string, string>();
 | ||
|             foreach (var item in unitIds)
 | ||
|             {
 | ||
|                 unitNames.Add(item ?? "null", UnitService.getUnitNamesUnitIds(item));
 | ||
| 
 | ||
|             }
 | ||
|             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 = unitNames[x.PartInUnits ?? "null"],
 | ||
|                               Id = x.CheckSpecialId,
 | ||
|                               CheckTeam = x.PartInPersonNames,
 | ||
|                               CheckDate = x.CheckTime,
 | ||
|                           });
 | ||
|             return result.ToList();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专项检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetProjectSpecialCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectSpecialCheck);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专业检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<CheckOutput> 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.Sys_User on x.CheckManId equals user.UserId 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.UserName,
 | ||
|                               CheckDate = x.CheckTime,
 | ||
|                           });
 | ||
|             return result.ToList();
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目专业检查次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<CheckOutput>> GetProjectMajorCheckAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectMajorCheck);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 应急管理数据  
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级综合预案数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetCompanyComprehensivePlan()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | ||
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.UnitId == CommonService.GetThisUnitId() && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级综合预案数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetCompanyComprehensivePlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanyComprehensivePlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级专项预案数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetCompanySpecialPlan()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | ||
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.UnitId == CommonService.GetThisUnitId() && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级专项预案数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetCompanySpecialPlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanySpecialPlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级现场处置预案
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetCompanyOnSiteDisposalPlan()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | ||
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.UnitId == CommonService.GetThisUnitId() && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级现场处置预案(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetCompanyOnSiteDisposalPlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanyOnSiteDisposalPlan);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构综合预案数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetBranchComprehensivePlan()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | ||
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.IsBranch == true && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构综合预案数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetBranchComprehensivePlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchComprehensivePlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构专项预案数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetBranchSpecialPlan()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | ||
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.IsBranch == true && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构专项预案数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetBranchSpecialPlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchSpecialPlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构现场处置预案
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetBranchOnSiteDisposalPlan()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
 | ||
|                           join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.IsBranch == true && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构现场处置预案(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetBranchOnSiteDisposalPlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchOnSiteDisposalPlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级演练次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetCompanyDrill()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
 | ||
|                           join y in Funs.DB.Sys_Const on x.DrillRecordType equals y.ConstValue
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitIds equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.UnitId == CommonService.GetThisUnitId() && y.GroupId == "DrillRecordType" && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取企业级演练次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetCompanyDrillAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCompanyDrill);
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构演练次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> GetBranchDrill()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
 | ||
|                           join y in Funs.DB.Sys_Const on x.DrillRecordType equals y.ConstValue
 | ||
|                           join u in Funs.DB.Base_Unit on x.UnitIds equals u.UnitId into uGroup
 | ||
|                           from u in uGroup.DefaultIfEmpty()
 | ||
|                           where u.IsBranch == true && y.GroupId == "DrillRecordType" && 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取分支机构演练次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetBranchDrillAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBranchDrill);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级综合预案
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级综合预案(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetProjectComprehensivePlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectComprehensivePlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级专项预案数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级专项预案数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetProjectSpecialPlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectSpecialPlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级现场处置预案
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级现场处置预案(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetProjectOnSiteDisposalPlanAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectOnSiteDisposalPlan);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级演练次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EmergencyOutput> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取项目级演练次数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EmergencyOutput>> GetProjectDrillAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetProjectDrill);
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 基础信息
 | ||
|         /// <summary>
 | ||
|         ///     获取在建项目数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.ProjectOutput> 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 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
 | ||
|                                from sysConst in sysConstJoin.DefaultIfEmpty()
 | ||
|                                where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false) && 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 = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
 | ||
|                                    ProjectMoney = project.ProjectMoney,
 | ||
|                                    DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
 | ||
|                                    ProjectTypeName = projectType.ProjectTypeName,
 | ||
|                                    ProjectStateName2 = sysConst.ConstText
 | ||
|                                };
 | ||
|             var result = projectInfos.ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取在建项目数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.ProjectOutput>> GetBeUnderConstructionAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBeUnderConstruction);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取停工项目数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.ProjectOutput> 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 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
 | ||
|                                from sysConst in sysConstJoin.DefaultIfEmpty()
 | ||
|                                where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false) && 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 = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
 | ||
|                                    ProjectMoney = project.ProjectMoney,
 | ||
|                                    DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
 | ||
|                                    ProjectTypeName = projectType.ProjectTypeName,
 | ||
|                                    ProjectStateName2 = sysConst.ConstText
 | ||
|                                };
 | ||
|             var result = projectInfos.ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取停工项目数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.ProjectOutput>> GetShutdownAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetShutdown);
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取完工项目数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.ProjectOutput> 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 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
 | ||
|                                from sysConst in sysConstJoin.DefaultIfEmpty()
 | ||
|                                where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false) && 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 = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
 | ||
|                                    ProjectMoney = project.ProjectMoney,
 | ||
|                                    DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
 | ||
|                                    ProjectTypeName = projectType.ProjectTypeName,
 | ||
|                                    ProjectStateName2 = sysConst.ConstText
 | ||
|                                };
 | ||
|             var result = projectInfos.ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取所有项目数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.ProjectOutput> 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 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
 | ||
|                                from sysConst in sysConstJoin.DefaultIfEmpty()
 | ||
|                                where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false)
 | ||
|                                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 = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
 | ||
|                                    ProjectMoney = project.ProjectMoney,
 | ||
|                                    DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
 | ||
|                                    ProjectTypeName = projectType.ProjectTypeName,
 | ||
|                                    ProjectStateName2 = sysConst.ConstText
 | ||
|                                };
 | ||
|             var result = projectInfos.ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取参建人数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.BaseEntities> GetJoinConstructionPerson()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.SitePerson_Person
 | ||
|                           where BeUnderConstructionList.Contains(x.ProjectId) && x.IsUsed == true
 | ||
|                           select new Model.BaseEntities
 | ||
|                           {
 | ||
|                               Id = x.PersonId,
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               UnitId = x.UnitId
 | ||
|                           }).ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取参建人数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.BaseEntities>> GetJoinConstructionPersonAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetJoinConstructionPerson);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取在施危大工程数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.BaseEntities> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取在施危大工程数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<Model.BaseEntities>> GetMajorProjectsUnderConstructionAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetMajorProjectsUnderConstruction);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 工时数据
 | ||
|         /// <summary>
 | ||
|         ///     获取总工时数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetTotalWorkingHour()
 | ||
|         {
 | ||
| 
 | ||
|             var thisUnitid = CommonService.GetThisUnitId();
 | ||
|             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]);
 | ||
|             */
 | ||
| 
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取总工时数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<int> GetTotalWorkingHourAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetTotalWorkingHour);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取损失工时数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取损失工时数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<int> GetLostWorkingHourAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetLostWorkingHour);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取安全工时数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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 = CommonService.GetThisUnitId();
 | ||
|             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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取安全工时数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<int> GetSafeWorkingHourAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSafeWorkingHour);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 安全教育培训
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取三级安全教育培训数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EduTrainOutput> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取三级安全教育培训数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EduTrainOutput>> GetSafeTrainAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSafeTrain);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取三级安全教育培训数——博晟培训
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EduTrainOutput> GetBoShengSafeTrain()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.Bo_Sheng_Train
 | ||
|                           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.TrainType.Contains("入场") || x.TrainType.Contains("入厂"))
 | ||
|                                 && (x.DeleteTag == "False" || x.DeleteTag == null) && x.TrainStartDate > Const.DtmarkTime
 | ||
|                           select new Model.EduTrainOutput()
 | ||
|                           {
 | ||
|                               Id = x.ID,
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitName = x.TrainDepart,
 | ||
|                               TrainTitle = x.RecordName,
 | ||
|                               TrainStartDate = x.TrainStartDate,
 | ||
|                               TrainEndDate = x.TrainEndDate,
 | ||
|                               TrainPersonNum = x.PersonCount ?? 0,
 | ||
|                           }).ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取三级安全教育培训数——博晟培训(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EduTrainOutput>> GetBoShengSafeTrainAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetBoShengSafeTrain);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取专项培训数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EduTrainOutput> 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;
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取专项培训数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<EduTrainOutput>> GetSpecialTrainAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSpecialTrain);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取特种作业培训数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<EduTrainOutput> 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<List<EduTrainOutput>> GetSpecialOperationTrainAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSpecialOperationTrain);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 获取安全技术交底数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetHseTechnicalNum()
 | ||
|         {
 | ||
|             var list = (from x in Funs.DB.License_HSETechnical
 | ||
|                         where BeUnderConstructionList.Contains(x.ProjectId)
 | ||
|                         select x).Distinct().ToList();
 | ||
|             var result = list.ToList().Count();
 | ||
|             return result;
 | ||
| 
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取安全技术交底数(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<int> GetHseTechnicalNumAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetHseTechnicalNum);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 获取安全技术交底
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<LicenseHSETechnicalOutput> GetHseTechnical()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.License_HSETechnical
 | ||
|                           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)
 | ||
|                           select new Model.LicenseHSETechnicalOutput()
 | ||
|                           {
 | ||
|                               ProjectId = x.ProjectId,
 | ||
|                               ProjectName = p.ProjectName,
 | ||
|                               UnitName = UnitService.getUnitNamesUnitIds(x.UnitId),
 | ||
|                               Id = x.HSETechnicalId,
 | ||
|                               HSETechnicalCode = x.HSETechnicalCode,
 | ||
|                               WorkContents = x.WorkContents
 | ||
|                           }).ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取安全技术交底(异步)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static async Task<List<LicenseHSETechnicalOutput>> GetHseTechnicalAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetHseTechnical);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取能耗总量
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetTotalEnergyConsumption()
 | ||
|         {
 | ||
|             var result = 0;
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取万元营业收入综合能耗
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetIncomeComprehensiveEnergyConsumption()
 | ||
|         {
 | ||
|             var result = 0;
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取二氧化碳
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetNewWaterConsumption()
 | ||
|         {
 | ||
|             var result = 0;
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         #region 事故事件数据
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取未遂事件数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.AccidentOutput> 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<List<Model.AccidentOutput>> GetNearMissAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetNearMiss);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取可记录事件数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.AccidentOutput> 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<List<Model.AccidentOutput>> GetRecordableEventAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetRecordableEvent);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取一般事故数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.AccidentOutput> 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<List<Model.AccidentOutput>> GetGeneralAccidentAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetGeneralAccident);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取较大事故数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.AccidentOutput> 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<List<Model.AccidentOutput>> GetMajorAccidentAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetMajorAccident);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取重大事故数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.AccidentOutput> 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<List<Model.AccidentOutput>> GetSeriousAccidentAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSeriousAccident);
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         ///     获取特别重大事故数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.AccidentOutput> 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<List<Model.AccidentOutput>> GetSpecialSeriousAccidentAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSpecialSeriousAccident);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 安全费用
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取费用提取(万元)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns> 
 | ||
|         public static List<Model.CostSmallDetailOutput> 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<List<Model.CostSmallDetailOutput>> GetCostExtractAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCostExtract);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取费用使用(万元)
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.CostSmallDetailOutput> 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<List<Model.CostSmallDetailOutput>> GetCostUseAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetCostUse);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 施工机具
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取施工机具在用数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.ConstructionEquipmentOutput> GetUseEquipment()
 | ||
|         {
 | ||
|             var query = (from item in Funs.DB.QualityAudit_EquipmentQuality
 | ||
|                              //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 item.ProjectId equals p.ProjectId into pGroup
 | ||
|                          from p in pGroup.DefaultIfEmpty()
 | ||
|                          join unit in Funs.DB.Base_Unit on item.UnitId equals unit.UnitId into unitGroup
 | ||
|                          from unit in unitGroup.DefaultIfEmpty()
 | ||
|                          where BeUnderConstructionList.Contains(item.ProjectId)
 | ||
|                          select new ConstructionEquipmentOutput
 | ||
|                          {
 | ||
|                              Id = item.EquipmentQualityId,
 | ||
|                              ProjectId = item.ProjectId,
 | ||
|                              //ProjectCode = p.ProjectCode,
 | ||
|                              ProjectName = p.ProjectName,
 | ||
|                              //UnitId = item.UnitId,
 | ||
|                              UnitName = unit.UnitName,
 | ||
|                              SpecialEquipmentName = item.EquipmentQualityName,
 | ||
|                              //SizeModel = item.SizeModel,
 | ||
|                              CertificateNum = item.CertificateCode,
 | ||
|                              CompileDate = item.CompileDate,
 | ||
|                              EQType = "特种设备"
 | ||
|                          })
 | ||
|             .Union(
 | ||
|                   from item in Funs.DB.QualityAudit_GeneralEquipmentQuality
 | ||
|                   join eq in Funs.DB.Base_SpecialEquipment on item.GeneralEquipmentQualityId equals eq.SpecialEquipmentId 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 item.ProjectId equals p.ProjectId into pGroup
 | ||
|                   from p in pGroup.DefaultIfEmpty()
 | ||
|                   join unit in Funs.DB.Base_Unit on item.UnitId equals unit.UnitId into unitGroup
 | ||
|                   from unit in unitGroup.DefaultIfEmpty()
 | ||
|                   where BeUnderConstructionList.Contains(item.ProjectId)
 | ||
|                   select new ConstructionEquipmentOutput
 | ||
|                   {
 | ||
|                       Id = item.GeneralEquipmentQualityId,
 | ||
|                       ProjectId = item.ProjectId,
 | ||
|                       // ProjectCode = p.ProjectCode,
 | ||
|                       ProjectName = p.ProjectName,
 | ||
|                       // UnitId = item.UnitId,
 | ||
|                       UnitName = unit.UnitName,
 | ||
|                       // SpecialEquipmentId = item.SpecialEquipmentId,
 | ||
|                       SpecialEquipmentName = eq.SpecialEquipmentName,
 | ||
|                       //SizeModel = eq.SizeModel,
 | ||
|                       //OwnerCheck = item.OwnerCheck,
 | ||
|                       CertificateNum = item.GeneralEquipmentQualityCode,
 | ||
|                       //IsUsed = item.IsUsed,
 | ||
|                       CompileDate = item.CompileDate,
 | ||
|                       EQType = "一般设备"
 | ||
|                   }
 | ||
|               );
 | ||
| 
 | ||
|             /* 通用版业务逻辑【弃用】
 | ||
|             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 = item.IsUsed,
 | ||
|                              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 = item.IsUsed,
 | ||
|                       CompileDate = eq.CompileDate,
 | ||
|                       EQType = "一般设备"
 | ||
|                   }
 | ||
|               );
 | ||
|             */
 | ||
| 
 | ||
|             return query.ToList();
 | ||
|         }
 | ||
|         public static async Task<List<Model.ConstructionEquipmentOutput>> GetUseEquipmentAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetUseEquipment);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取施工机具特种设备数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.ConstructionEquipmentOutput> GetSpecialEquipment()
 | ||
|         {
 | ||
|             var query = (from item in Funs.DB.QualityAudit_EquipmentQuality
 | ||
|                              //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 item.ProjectId equals p.ProjectId into pGroup
 | ||
|                          from p in pGroup.DefaultIfEmpty()
 | ||
|                          join unit in Funs.DB.Base_Unit on item.UnitId equals unit.UnitId into unitGroup
 | ||
|                          from unit in unitGroup.DefaultIfEmpty()
 | ||
|                          where BeUnderConstructionList.Contains(item.ProjectId)
 | ||
|                          select new ConstructionEquipmentOutput
 | ||
|                          {
 | ||
|                              Id = item.EquipmentQualityId,
 | ||
|                              ProjectId = item.ProjectId,
 | ||
|                              //ProjectCode = p.ProjectCode,
 | ||
|                              ProjectName = p.ProjectName,
 | ||
|                              //UnitId = item.UnitId,
 | ||
|                              UnitName = unit.UnitName,
 | ||
|                              SpecialEquipmentName = item.EquipmentQualityName,
 | ||
|                              SizeModel = item.SizeModel,
 | ||
|                              CertificateNum = item.CertificateCode,
 | ||
|                              CompileDate = item.CompileDate,
 | ||
|                              EQType = "特种设备"
 | ||
|                          });
 | ||
|             /* 通用版业务逻辑【弃用】
 | ||
|             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 = item.IsUsed,
 | ||
|                              CompileDate = eq.CompileDate,
 | ||
|                              EQType = "特种设备"
 | ||
|                          });
 | ||
|             */
 | ||
|             return query.ToList();
 | ||
|         }
 | ||
|         public static async Task<List<Model.ConstructionEquipmentOutput>> GetSpecialEquipmentAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSpecialEquipment);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 高风险作业许可
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取作业许可项数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<LicenseOutput> 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 = x.UnitTypeName,
 | ||
|                               IsHighRisk = x.IsHighRisk,
 | ||
|                               WorkAreaName = x.WorkStates,
 | ||
|                               CompileDate = x.CompileDate,
 | ||
|                               StartDate = x.StartDate,
 | ||
|                               EndDate = x.EndDate,
 | ||
|                               WorkStatesStr = x.WorkStatesStr
 | ||
|                           }).ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         public static async Task<List<LicenseOutput>> GetLicensesAsync()
 | ||
|         {
 | ||
| 
 | ||
|             return await Task.Run(GetLicenses);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取作业许可关闭项数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<LicenseOutput> GetLicensesClose()
 | ||
|         {
 | ||
|             var result = (from x in Funs.DB.View_License_LicenseManager
 | ||
|                           where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true && x.WorkStates == "3" &&
 | ||
|                       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 = x.UnitTypeName,
 | ||
|                               IsHighRisk = x.IsHighRisk,
 | ||
|                               WorkAreaName = x.WorkStates,
 | ||
|                               CompileDate = x.CompileDate,
 | ||
|                               StartDate = x.StartDate,
 | ||
|                               EndDate = x.EndDate,
 | ||
|                               WorkStatesStr = x.WorkStatesStr
 | ||
|                           }).ToList();
 | ||
|             return result;
 | ||
|         }
 | ||
|         public static async Task<List<LicenseOutput>> GetLicensesCloseAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetLicensesClose);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 隐患整改
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///  获取一般隐患数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.HiddenRectificationOutput> 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.Risk_Level == "一般事故隐患" && 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<List<Model.HiddenRectificationOutput>> GetGeneralHiddenRectificationOutputsAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetGeneralHiddenRectificationOutputs);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///  获取重大隐患数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.HiddenRectificationOutput> 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.Risk_Level == "重大事故隐患" && 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<List<Model.HiddenRectificationOutput>> GetMajorHiddenRectificationOutputsAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetMajorHiddenRectificationOutputs);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 风险数据
 | ||
|         /// <summary>
 | ||
|         /// 获取风险数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.SecurityRiskOutput> 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 || y.State == "1")
 | ||
|                          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<List<Model.SecurityRiskOutput>> GetSecurityRiskOutputsAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetSecurityRiskOutputs);
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 危大工程数据
 | ||
|         /// <summary>
 | ||
|         /// 获取危大工程数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<Model.LargeEngineeringOutput> 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,
 | ||
|                              OperativesNum = gg.Where(x => x.IsSuperLargerHazard == false).Sum(x => x.OperativesNum) ?? 0,
 | ||
|                              TrainPersonNum = gg.Where(x => x.IsSuperLargerHazard == false).Sum(x => x.TrainPersonNum) ?? 0,
 | ||
|                              CompletedNum = gg.Count(x => x.States == "1" && x.IsSuperLargerHazard == false),
 | ||
|                              ConstructionNum = gg.Count(x => x.States == "2" && x.IsSuperLargerHazard == false),
 | ||
|                              FinishedNum = gg.Count(x => x.States == "3" && x.IsSuperLargerHazard == false),
 | ||
|                              ArgumentNum = gg.Count(x => x.IsArgument == true && x.IsSuperLargerHazard == false),
 | ||
|                              SuperOperativesNum = gg.Where(x => x.IsSuperLargerHazard == true).Sum(x => x.OperativesNum) ?? 0,
 | ||
|                              SuperTrainPersonNum = gg.Where(x => x.IsSuperLargerHazard == true).Sum(x => x.TrainPersonNum) ?? 0,
 | ||
|                              SuperCompletedNum = gg.Count(x => x.States == "1" && x.IsSuperLargerHazard == true),
 | ||
|                              SuperConstructionNum = gg.Count(x => x.States == "2" && x.IsSuperLargerHazard == true),
 | ||
|                              SuperFinishedNum = gg.Count(x => x.States == "3" && x.IsSuperLargerHazard == true),
 | ||
|                              SuperArgumentNum = gg.Count(x => x.IsArgument == true && x.IsSuperLargerHazard == true),
 | ||
|                          }).ToList();
 | ||
|             return query;
 | ||
|         }
 | ||
|         public static async Task<List<Model.LargeEngineeringOutput>> GetLargeEngineeringOutputsAsync()
 | ||
|         {
 | ||
|             return await Task.Run(GetLargeEngineeringOutputs);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取危大工程审批完成数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取危大工程培训人次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取危大工程施工个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取危大工程完工个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取超危大工程审批完成数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取超危大工程培训人次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取超危大工程施工个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取超危大工程完工个数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         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 获取列表
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     记录数
 | ||
|         /// </summary>
 | ||
|         public static int Count { get; set; }
 | ||
| 
 | ||
|         public static List<HSSEData_HSSE> GetHSSEData_HSSEByModle(HSSEData_HSSE table)
 | ||
|         {
 | ||
|             var db = Funs.DB;
 | ||
|             var q = from x in db.HSSEData_HSSE
 | ||
|                     where
 | ||
|                         (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
 | ||
|                         (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
 | ||
|                         (string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
 | ||
|                         (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName))
 | ||
|                     orderby x.ReportDate descending
 | ||
|                     select x
 | ||
|                 ;
 | ||
| 
 | ||
|             return q.ToList();
 | ||
|         }
 | ||
| 
 | ||
|         // ReSharper disable once InvalidXmlDocComment
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static IEnumerable GetListData(HSSEData_HSSE table, Grid Grid1)
 | ||
|         {
 | ||
|             var q = GetHSSEData_HSSEByModle(table);
 | ||
|             Count = q.Count();
 | ||
|             if (Count == 0) return null;
 | ||
|             // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
 | ||
|             return from x in q
 | ||
|                    select new
 | ||
|                    {
 | ||
|                        x.Id,
 | ||
|                        x.UnitId,
 | ||
|                        x.CollCropCode,
 | ||
|                        x.UnitName,
 | ||
|                        x.ReportDate,
 | ||
|                        x.BeUnderConstructionNum,
 | ||
|                        x.ShutdownNum,
 | ||
|                        x.JoinConstructionPersonNum,
 | ||
|                        x.MajorProjectsUnderConstructionNum,
 | ||
|                        x.TotalWorkingHour,
 | ||
|                        x.LostWorkingHour,
 | ||
|                        x.SafeWorkingHour,
 | ||
|                        x.SafeTrainNum,
 | ||
|                        x.SpecialTrainNum,
 | ||
|                        x.SpecialOperationTrainNum,
 | ||
|                        x.HseTechnicalNum,
 | ||
|                        x.EnvironmentalTrainNum,
 | ||
|                        x.TotalEnergyConsumption,
 | ||
|                        x.IncomeComprehensiveEnergyConsumption,
 | ||
|                        x.NewWaterConsumption,
 | ||
|                        x.HeadOfficeInspectorGeneralNum,
 | ||
|                        x.HeadOfficeFullTimeNum,
 | ||
|                        x.BranchInspectorGeneralNum,
 | ||
|                        x.BranchFullTimeNum,
 | ||
|                        x.ProjectInspectorGeneralNum,
 | ||
|                        x.ProjectFullTimeNum,
 | ||
|                        x.ProjectSafetyMonitorNum,
 | ||
|                        x.SafetyInjectionEngineer,
 | ||
|                        x.CertificateANum,
 | ||
|                        x.CertificateBNum,
 | ||
|                        x.CertificateCNum,
 | ||
|                        x.SafetyCommitteeMeetingNum,
 | ||
|                        x.EnterpriseTopicsMeetingNum,
 | ||
|                        x.ProjectSafetyLeadingGroupMeetingNum,
 | ||
|                        x.ProjectSafetyMeetingNum,
 | ||
|                        x.CompanyLeadShiftCheckNum,
 | ||
|                        x.CompanyComprehensiveCheckNum,
 | ||
|                        x.CompanySpecialCheckNum,
 | ||
|                        x.ProjectLeadShiftCheckNum,
 | ||
|                        x.ProjectSpecialCheckNum,
 | ||
|                        x.ProjectMajorCheckNum,
 | ||
|                        x.NearMissNum,
 | ||
|                        x.RecordableEventNum,
 | ||
|                        x.GeneralAccidentNum,
 | ||
|                        x.MajorAccidentNum,
 | ||
|                        x.SeriousAccidentNum,
 | ||
|                        x.SpecialSeriousAccidentNum,
 | ||
|                        x.CompanyComprehensivePlanNum,
 | ||
|                        x.CompanySpecialPlanNum,
 | ||
|                        x.CompanyOnSiteDisposalPlan,
 | ||
|                        x.CompanyDrillNum,
 | ||
|                        x.CompanyDrillPersonNum,
 | ||
|                        x.ProjectComprehensivePlanNum,
 | ||
|                        x.ProjectSpecialPlanNum,
 | ||
|                        x.ProjectOnSiteDisposalPlan,
 | ||
|                        x.ProjectDrillNum,
 | ||
|                        x.ProjectDrillPersonNum,
 | ||
|                        x.CostExtract,
 | ||
|                        x.CostUse,
 | ||
|                        x.UseEquipmentNum,
 | ||
|                        x.SpecialEquipmentNum,
 | ||
|                        x.LicensesNum,
 | ||
|                        x.LicensesCloseNum,
 | ||
|                        x.GeneralClosedNum,
 | ||
|                        x.GeneralNotClosedNum,
 | ||
|                        x.MajorClosedNum,
 | ||
|                        x.MajorNotClosedNum,
 | ||
|                        x.GeneralRiskNum,
 | ||
|                        x.LowRiskNum,
 | ||
|                        x.MediumRiskNum,
 | ||
|                        x.HighRiskNum,
 | ||
|                        x.CompletedNum,
 | ||
|                        x.TrainPersonNum,
 | ||
|                        x.ConstructionNum,
 | ||
|                        x.FinishedNum,
 | ||
|                        x.ArgumentNum,
 | ||
|                        x.SuperCompletedNum,
 | ||
|                        x.SuperTrainPersonNum,
 | ||
|                        x.SuperConstructionNum,
 | ||
|                        x.SuperFinishedNum,
 | ||
|                        x.SuperArgumentNum,
 | ||
|                        x.State,
 | ||
|                        x.CreateDate,
 | ||
|                        x.CreateMan
 | ||
|                    };
 | ||
|         }
 | ||
| 
 | ||
|         #endregion 获取列表
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业安委会会议数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetSafetyCommitteeMeetingNum()
 | ||
|         {
 | ||
|             var result =
 | ||
|                 (from x in Funs.DB.Meeting_CompanySafetyMeeting where x.CompileDate > Const.DtmarkTime select x)
 | ||
|                 .Count();
 | ||
|             return result;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业负责人带班检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetCompanyLeadShiftCheckNum(string[] pids = null)
 | ||
|         {
 | ||
|             if (pids == null)
 | ||
|             {
 | ||
|                 var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
 | ||
|                               where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime
 | ||
|                               select x).Count();
 | ||
|                 return result;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
 | ||
|                               where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime
 | ||
|                               && pids.Contains(x.ProjectId)
 | ||
|                               select x).Count();
 | ||
|                 return result;
 | ||
|             }
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业综合检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetCompanyComprehensiveCheckNum(string[] pids = null)
 | ||
|         {
 | ||
|             if (pids == null)
 | ||
|             {
 | ||
|                 var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
 | ||
|                               where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime
 | ||
|                               select x).Count();
 | ||
|                 return result;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
 | ||
|                               where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime
 | ||
|                                && pids.Contains(x.ProjectId)
 | ||
|                               select x).Count();
 | ||
|                 return result;
 | ||
|             }
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         ///     获取企业专项检查次数
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static int GetCompanySpecialCheckNum(string[] pids = null)
 | ||
|         {
 | ||
|             if (pids == null)
 | ||
|             {
 | ||
|                 var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
 | ||
|                               where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime
 | ||
|                               select x).Count();
 | ||
|                 return result;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
 | ||
|                               where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime
 | ||
|                                && pids.Contains(x.ProjectId)
 | ||
|                               select x).Count();
 | ||
|                 return result;
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         #region 推送企业级检查明细数据检查
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 推送企业级检查明细数据检查
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static ReturnData PushSuperviseCheckReportData(int pushNum)
 | ||
|         {
 | ||
|             var thisUnit = CommonService.GetIsThisUnit();
 | ||
|             Model.SGGLDB db = Funs.DB;
 | ||
| 
 | ||
|             var items = (from x in db.Supervise_SuperviseCheckReport
 | ||
|                          join P in db.Base_Project on x.ProjectId equals P.ProjectId into PJ
 | ||
|                          from P in PJ.DefaultIfEmpty()
 | ||
|                          join U in db.Base_Unit on x.UnitId equals U.UnitId into UJ
 | ||
|                          from U in UJ.DefaultIfEmpty()
 | ||
|                          join CU in db.Base_Unit on x.CheckUnitId equals CU.UnitId into CUJ
 | ||
|                          from CU in CUJ.DefaultIfEmpty()
 | ||
|                          where (x.IsUpdate == null || x.IsUpdate == false) && x.CheckDate > BLL.Const.DtmarkTime
 | ||
|                          select new Model.SuperviseCheckReportItem
 | ||
|                          {
 | ||
|                              Id = x.SuperviseCheckReportId,
 | ||
|                              SourceUnitId = thisUnit.UnitId,
 | ||
|                              ProjectId = x.ProjectId,
 | ||
|                              CollCropCode = thisUnit.CollCropCode,
 | ||
|                              DataDate = x.CheckDate,
 | ||
|                              AttachFile = AttachFileService.getFileUrl(x.SuperviseCheckReportId.ToString()),
 | ||
|                              SuperviseCheckReportCode = x.SuperviseCheckReportCode,
 | ||
|                              CheckDate = x.CheckDate,
 | ||
|                              UnitId = x.UnitId,
 | ||
|                              UnitName = U.UnitName,
 | ||
|                              CheckTeam = x.CheckTeam,
 | ||
|                              CheckType = x.CheckType,
 | ||
|                              CheckTypeName = x.CheckType == "1" ? "企业负责人带班检查" :
 | ||
|                                  x.CheckType == "2" ? "企业综合检查" :
 | ||
|                                  x.CheckType == "3" ? "企业专项检查" : "",
 | ||
|                              CheckMainType = x.CheckMainType,
 | ||
|                              CheckMainTypeName = x.CheckMainType == "0" ? "安全" :
 | ||
|                                  x.CheckMainType == "1" ? "质量" : "",
 | ||
|                              CheckUnitId = x.CheckUnitId,
 | ||
|                              CheckUnitName = CU.UnitName,
 | ||
|                          }).Take(pushNum).ToList();
 | ||
|             Model.ReturnData responeData = new Model.ReturnData();
 | ||
|             if (items.Count() > 0)
 | ||
|             {
 | ||
|                 foreach (var superviseCheckReportItem in items)
 | ||
|                 {
 | ||
|                     List<SuperviseCheckReportDetailItem> detailItems = getDetail(superviseCheckReportItem.Id, thisUnit);
 | ||
|                     superviseCheckReportItem.SuperviseCheckReportDetail = detailItems;
 | ||
|                 }
 | ||
| 
 | ||
|                 var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
 | ||
|                 var str = JsonConvert.SerializeObject(newItem);
 | ||
|                 var baseurl = "/api/HSSEData/SaveSuperviseCheckReportData";
 | ||
|                 responeData = ServerService.PushCNCEC(str, baseurl);
 | ||
|                 if (responeData.code == 1)
 | ||
|                 {
 | ||
|                     foreach (var item in items)
 | ||
|                     {
 | ||
|                         var data = db.Supervise_SuperviseCheckReport.FirstOrDefault(x =>
 | ||
|                             x.SuperviseCheckReportId == item.Id && (x.IsUpdate == null || x.IsUpdate == false));
 | ||
|                         data.IsUpdate = true;
 | ||
|                         db.SubmitChanges();
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = "当前没有企业级检查明细数据检查数据";
 | ||
|             }
 | ||
| 
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         #region 转换字符串
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 获取明细
 | ||
|         /// </summary>
 | ||
|         /// <param name="workStage"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public static List<SuperviseCheckReportDetailItem> getDetail(string SuperviseCheckReportId,
 | ||
|             Model.Base_Unit thisUnit)
 | ||
|         {
 | ||
|             List<SuperviseCheckReportDetailItem> detailItems = null;
 | ||
|             if (!string.IsNullOrEmpty(SuperviseCheckReportId))
 | ||
|             {
 | ||
|                 detailItems = (from x in Funs.DB.View_Supervise_SuperviseCheckReportItem
 | ||
|                                where x.SuperviseCheckReportId == SuperviseCheckReportId
 | ||
|                                select new Model.SuperviseCheckReportDetailItem
 | ||
|                                {
 | ||
|                                    Id = x.SuperviseCheckReportItemId,
 | ||
|                                    SourceUnitId = thisUnit.UnitId,
 | ||
|                                    // ProjectId = x.ProjectId,
 | ||
|                                    CollCropCode = thisUnit.CollCropCode,
 | ||
|                                    // DataDate = x.CheckDate,
 | ||
|                                    AttachFile = AttachFileService.getFileUrl(x.SuperviseCheckReportItemId.ToString()),
 | ||
|                                    SuperviseCheckReportId = x.SuperviseCheckReportId,
 | ||
|                                    RectifyItemId = x.RectifyItemId,
 | ||
|                                    IsSelected = x.IsSelected,
 | ||
|                                    HazardSourcePoint = x.HazardSourcePoint,
 | ||
|                                    RiskAnalysis = x.RiskAnalysis,
 | ||
|                                    RiskPrevention = x.RiskPrevention,
 | ||
|                                    SimilarRisk = x.SimilarRisk,
 | ||
|                                    RectifyName = x.RectifyName,
 | ||
|                                    RectifyCode = x.RectifyCode,
 | ||
|                                }).ToList();
 | ||
|             }
 | ||
| 
 | ||
|             return detailItems;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 删除企业级检查明细数据检查
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 删除企业级检查明细数据检查
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public static ReturnData DeleteSuperviseCheckReportData(string Id)
 | ||
|         {
 | ||
|             Model.ReturnData responeData = new Model.ReturnData();
 | ||
|             try
 | ||
|             {
 | ||
|                 var thisUnit = CommonService.GetIsThisUnit();
 | ||
|                 Model.SGGLDB db = Funs.DB;
 | ||
|                 var items = (from x in db.Supervise_SuperviseCheckReport
 | ||
|                              join P in db.Base_Project on x.ProjectId equals P.ProjectId into PJ
 | ||
|                              from P in PJ.DefaultIfEmpty()
 | ||
|                              join U in db.Base_Unit on x.UnitId equals U.UnitId into UJ
 | ||
|                              from U in UJ.DefaultIfEmpty()
 | ||
|                              join CU in db.Base_Unit on x.CheckUnitId equals CU.UnitId into CUJ
 | ||
|                              from CU in CUJ.DefaultIfEmpty()
 | ||
|                              where x.SuperviseCheckReportId == Id
 | ||
|                              select new Model.SuperviseCheckReportItem
 | ||
|                              {
 | ||
|                                  Id = x.SuperviseCheckReportId,
 | ||
|                                  SourceUnitId = thisUnit.UnitId,
 | ||
|                                  ProjectId = x.ProjectId,
 | ||
|                                  CollCropCode = thisUnit.CollCropCode,
 | ||
|                                  DataDate = x.CheckDate,
 | ||
|                                  AttachFile = AttachFileService.getFileUrl(x.SuperviseCheckReportId.ToString()),
 | ||
|                                  SuperviseCheckReportCode = x.SuperviseCheckReportCode,
 | ||
|                                  CheckDate = x.CheckDate,
 | ||
|                                  UnitId = x.UnitId,
 | ||
|                                  UnitName = U.UnitName,
 | ||
|                                  CheckTeam = x.CheckTeam,
 | ||
|                                  CheckType = x.CheckType,
 | ||
|                                  CheckTypeName = x.CheckType == "1" ? "企业负责人带班检查" :
 | ||
|                                      x.CheckType == "2" ? "企业综合检查" :
 | ||
|                                      x.CheckType == "3" ? "企业专项检查" : "",
 | ||
|                                  CheckMainType = x.CheckMainType,
 | ||
|                                  CheckMainTypeName = x.CheckMainType == "0" ? "安全" :
 | ||
|                                      x.CheckMainType == "1" ? "质量" : "",
 | ||
|                                  CheckUnitId = x.CheckUnitId,
 | ||
|                                  CheckUnitName = CU.UnitName,
 | ||
|                              }).ToList();
 | ||
| 
 | ||
|                 if (items.Count() > 0)
 | ||
|                 {
 | ||
|                     var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
 | ||
|                     var str = JsonConvert.SerializeObject(newItem);
 | ||
|                     var baseurl = "/api/HSSEData/DeleteSuperviseCheckReportData";
 | ||
|                     responeData = ServerService.PushCNCEC(str, baseurl);
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     responeData.code = 0;
 | ||
|                     responeData.message = "集团数据删除失败";
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = "集团数据删除失败";
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|     }
 | ||
| } |