diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index 42aaa782..005f0c3b 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -535,7 +535,7 @@ namespace BLL TotalWorkingHour = GetTotalWorkingHour(), LostWorkingHour = GetLostWorkingHour(), SafeWorkingHour = GetSafeWorkingHour(), - SafeTrainNum = GetSafeTrain().Sum(x => x.TrainPersonNum), + SafeTrainNum = GetSafeTrain().Sum(x => x.TrainPersonNum) + GetBoShengSafeTrain().Sum(x => x.TrainPersonNum), SpecialTrainNum = GetSpecialTrain().Sum(x => x.TrainPersonNum), SpecialOperationTrainNum = GetSpecialOperationTrain().Sum(x => x.TrainPersonNum), EnvironmentalTrainNum = 0, @@ -646,6 +646,7 @@ namespace BLL 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 hseTechnicalNumTask = HSSEData_HSSEService.GetHseTechnicalNumAsync(); @@ -704,7 +705,7 @@ namespace BLL totalWorkingHourTask, lostWorkingHourTask, safeWorkingHourTask, - safeTrainTask, + safeTrainTask, safeTrainBoShengTask, specialTrainTask, specialOperationTrainTask, hseTechnicalNumTask, headOfficeInspectorGeneralTask, @@ -765,6 +766,7 @@ namespace BLL 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 hseTechnicalNum = await hseTechnicalNumTask; @@ -826,7 +828,7 @@ namespace BLL TotalWorkingHour = totalWorkingHour, LostWorkingHour = lostWorkingHour, SafeWorkingHour = safeWorkingHour, - SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum), + SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum) + safeTrainBoShengList.Sum(x => x.TrainPersonNum), SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum), SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum), HseTechnicalNum = hseTechnicalNum, @@ -2869,6 +2871,39 @@ namespace BLL return await Task.Run(GetSafeTrain); } + /// + /// 获取三级安全教育培训数——博晟培训 + /// + /// + public static List 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 == "入场(厂)培训" || x.TrainType == "入厂(场)级培训") + && (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; + } + /// + /// 获取三级安全教育培训数——博晟培训(异步) + /// + /// + public static async Task> GetBoShengSafeTrainAsync() + { + return await Task.Run(GetBoShengSafeTrain); + } + /// /// 获取专项培训数 /// diff --git a/SGGL/BLL/ZHGL/DataSync/MainSevice.cs b/SGGL/BLL/ZHGL/DataSync/MainSevice.cs index f5522c59..9a6f244d 100644 --- a/SGGL/BLL/ZHGL/DataSync/MainSevice.cs +++ b/SGGL/BLL/ZHGL/DataSync/MainSevice.cs @@ -4,320 +4,324 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace BLL { - -public class MainSevice +namespace BLL { - /// - /// 在建项目集合 - /// - private List _beUnderConstructionList; - private HSSEData_HSSE _hsseData; - private string _unitId; - private int _unitType; - - public MainSevice(string userid) + public class MainSevice { - var userModel = UserService.GetUserByUserId(userid); - int unitType = CommonService.GetUnitTypeByUserId(userid); - var projectList = ProjectService.GetProjectWorkList().Select(x => new { x.ProjectId, x.UnitId }).ToList(); - _unitId = userModel.UnitId; - _unitType = unitType; - if (unitType == 0) - { - _beUnderConstructionList = projectList.Select(x => x.ProjectId).ToList(); - _unitId = CommonService.GetThisUnitId(); - } - else if (unitType == 1) - { - _beUnderConstructionList = projectList.Where(x => x.UnitId == userModel.UnitId).Select(x => x.ProjectId).ToList(); - } - else if (unitType == 2) - { - _beUnderConstructionList = new List() { "0" }; - } - } - public async Task GetHsseDataAsync() - { + /// + /// 在建项目集合 + /// + private List _beUnderConstructionList; + private HSSEData_HSSE _hsseData; + private string _unitId; + private int _unitType; + + public MainSevice(string userid) + { + var userModel = UserService.GetUserByUserId(userid); + int unitType = CommonService.GetUnitTypeByUserId(userid); + var projectList = ProjectService.GetProjectWorkList().Select(x => new { x.ProjectId, x.UnitId }).ToList(); + _unitId = userModel.UnitId; + _unitType = unitType; + if (unitType == 0) + { + _beUnderConstructionList = projectList.Select(x => x.ProjectId).ToList(); + _unitId = CommonService.GetThisUnitId(); + } + else if (unitType == 1) + { + _beUnderConstructionList = projectList.Where(x => x.UnitId == userModel.UnitId).Select(x => x.ProjectId).ToList(); + } + else if (unitType == 2) + { + _beUnderConstructionList = new List() { "0" }; + } + + } + public async Task GetHsseDataAsync() + { try { - - // 并行执行异步方法 - var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); - var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); - var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); - var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync() - .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId))); - var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync() - .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId))); - var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync(); - var certificateATask = HSSEData_HSSEService.GetCertificateAAsync(); - var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync(); - var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync(); - var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync(); - var shutdownTask = HSSEData_HSSEService.GetShutdownAsync(); - var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync(); - var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync(); - var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync(); - var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync(); - var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync(); - var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync(); - var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync(); - var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync(); - var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync(); - var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync(); - var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync(); - var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync(); - var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync(); - var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync(); - var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync(); - var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync(); - var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync(); - var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync(); - var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync(); - var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync(); - var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync(); - var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync(); - var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync(); - var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync(); - var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync(); - var nearMissTask = HSSEData_HSSEService.GetNearMissAsync(); - var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync(); - var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync(); - var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync(); - var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync(); - var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync(); - var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync(); - var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync(); - var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync(); - var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync(); - var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync(); - var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync(); - var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync(); - var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync(); - var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync(); - var costUseTask = HSSEData_HSSEService.GetCostUseAsync(); - var useEquipmentTask = HSSEData_HSSEService.GetUseEquipmentAsync(); - var specialEquipmentTask = HSSEData_HSSEService.GetSpecialEquipmentAsync(); - var licensesTask = HSSEData_HSSEService.GetLicensesAsync(); - var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync(); - var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync(); - var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync(); - // 等待所有异步方法执行完成 - await Task.WhenAll( - securityRiskOutputListTask, - largeEngineeringOutputsTask, - safetyInjectionEngineerTask, - certificateATask, - certificateBTask, - certificateCTask, - beUnderConstructionTask, - shutdownTask, - joinConstructionPersonTask, - majorProjectsUnderConstructionTask, - totalWorkingHourTask, - lostWorkingHourTask, - safeWorkingHourTask, - safeTrainTask, - specialTrainTask, - specialOperationTrainTask, - headOfficeInspectorGeneralTask, - headOfficeFullTimeTask, - branchInspectorGeneralTask, - branchFullTimeTask, - projectInspectorGeneralTask, - projectFullTimeTask, - projectSafetyMonitorTask, - safetyCommitteeMeetingTask, - enterpriseTopicsMeetingTask, - projectSafetyLeadingGroupMeetingTask, - projectSafetyMeetingTask, - companyLeadShiftCheckTask, - companyComprehensiveCheckTask, - companySpecialCheckTask, - projectLeadShiftCheckTask, - projectSpecialCheckTask, - projectMajorCheckTask, - nearMissTask, - recordableEventTask, - generalAccidentTask, - majorAccidentTask, - seriousAccidentTask, - specialSeriousAccidentTask, - companyComprehensivePlanTask, - companySpecialPlanTask, - companyOnSiteDisposalPlanTask, - companyDrillTask, - projectComprehensivePlanTask, - projectSpecialPlanTask, - projectOnSiteDisposalPlanTask, - projectDrillTask, - costExtractTask, - costUseTask, - useEquipmentTask, - specialEquipmentTask, - licensesTask, - licensesCloseTask, - generalHiddenRectificationOutputsTask, - majorHiddenRectificationOutputsTask - ); + // 并行执行异步方法 + var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); + var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); + var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption(); + var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync() + .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId))); + var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync() + .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId))); + var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync(); + var certificateATask = HSSEData_HSSEService.GetCertificateAAsync(); + var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync(); + var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync(); + var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync(); + var shutdownTask = HSSEData_HSSEService.GetShutdownAsync(); + var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync(); + var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync(); + var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync(); + var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync(); + var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync(); + var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync(); + var safeTrainBoShengTask = HSSEData_HSSEService.GetBoShengSafeTrainAsync(); + var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync(); + var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync(); + var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync(); + var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync(); + var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync(); + var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync(); + var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync(); + var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync(); + var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync(); + var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync(); + var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync(); + var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync(); + var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync(); + var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync(); + var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync(); + var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync(); + var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync(); + var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync(); + var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync(); + var nearMissTask = HSSEData_HSSEService.GetNearMissAsync(); + var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync(); + var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync(); + var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync(); + var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync(); + var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync(); + var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync(); + var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync(); + var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync(); + var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync(); + var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync(); + var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync(); + var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync(); + var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync(); + var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync(); + var costUseTask = HSSEData_HSSEService.GetCostUseAsync(); + var useEquipmentTask = HSSEData_HSSEService.GetUseEquipmentAsync(); + var specialEquipmentTask = HSSEData_HSSEService.GetSpecialEquipmentAsync(); + var licensesTask = HSSEData_HSSEService.GetLicensesAsync(); + var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync(); + var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync(); + var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync(); + + // 等待所有异步方法执行完成 + await Task.WhenAll( + securityRiskOutputListTask, + largeEngineeringOutputsTask, + safetyInjectionEngineerTask, + certificateATask, + certificateBTask, + certificateCTask, + beUnderConstructionTask, + shutdownTask, + joinConstructionPersonTask, + majorProjectsUnderConstructionTask, + totalWorkingHourTask, + lostWorkingHourTask, + safeWorkingHourTask, + safeTrainTask, + safeTrainBoShengTask, + specialTrainTask, + specialOperationTrainTask, + headOfficeInspectorGeneralTask, + headOfficeFullTimeTask, + branchInspectorGeneralTask, + branchFullTimeTask, + projectInspectorGeneralTask, + projectFullTimeTask, + projectSafetyMonitorTask, + safetyCommitteeMeetingTask, + enterpriseTopicsMeetingTask, + projectSafetyLeadingGroupMeetingTask, + projectSafetyMeetingTask, + companyLeadShiftCheckTask, + companyComprehensiveCheckTask, + companySpecialCheckTask, + projectLeadShiftCheckTask, + projectSpecialCheckTask, + projectMajorCheckTask, + nearMissTask, + recordableEventTask, + generalAccidentTask, + majorAccidentTask, + seriousAccidentTask, + specialSeriousAccidentTask, + companyComprehensivePlanTask, + companySpecialPlanTask, + companyOnSiteDisposalPlanTask, + companyDrillTask, + projectComprehensivePlanTask, + projectSpecialPlanTask, + projectOnSiteDisposalPlanTask, + projectDrillTask, + costExtractTask, + costUseTask, + useEquipmentTask, + specialEquipmentTask, + licensesTask, + licensesCloseTask, + generalHiddenRectificationOutputsTask, + majorHiddenRectificationOutputsTask + ); - // 统一获取异步方法的返回值 - var totalEnergyConsumption = totalEnergyConsumptionTask; - var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask; - var newWaterConsumption = newWaterConsumptionTask; - var safetyInjectionEngineerList = await safetyInjectionEngineerTask; - var certificateAList = await certificateATask; - var certificateBList = await certificateBTask; - var certificateCList = await certificateCTask; - var beUnderConstructionList = await beUnderConstructionTask; - var shutdownList = await shutdownTask; - var joinConstructionPersonList = await joinConstructionPersonTask; - var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask; - var totalWorkingHour = await totalWorkingHourTask; - var lostWorkingHour = await lostWorkingHourTask; - var safeWorkingHour = await safeWorkingHourTask; - var safeTrainList = await safeTrainTask; - var specialTrainList = await specialTrainTask; - var specialOperationTrainList = await specialOperationTrainTask; - var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask; - var headOfficeFullTimeList = await headOfficeFullTimeTask; - var branchInspectorGeneralList = await branchInspectorGeneralTask; - var branchFullTimeList = await branchFullTimeTask; - var projectInspectorGeneralList = await projectInspectorGeneralTask; - var projectFullTimeList = await projectFullTimeTask; - var projectSafetyMonitorList = await projectSafetyMonitorTask; - var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask; - var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask; - var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask; - var projectSafetyMeetingList = await projectSafetyMeetingTask; - var companyLeadShiftCheckList = await companyLeadShiftCheckTask; - var companyComprehensiveCheckList = await companyComprehensiveCheckTask; - var companySpecialCheckList = await companySpecialCheckTask; - var projectLeadShiftCheckList = await projectLeadShiftCheckTask; - var projectSpecialCheckList = await projectSpecialCheckTask; - var projectMajorCheckList = await projectMajorCheckTask; - var nearMissList = await nearMissTask; - var recordableEventList = await recordableEventTask; - var generalAccidentList = await generalAccidentTask; - var majorAccidentList = await majorAccidentTask; - var seriousAccidentList = await seriousAccidentTask; - var specialSeriousAccidentList = await specialSeriousAccidentTask; - var companyComprehensivePlanList = await companyComprehensivePlanTask; - var companySpecialPlanList = await companySpecialPlanTask; - var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask; - var companyDrillList = await companyDrillTask; - var projectComprehensivePlanList = await projectComprehensivePlanTask; - var projectSpecialPlanList = await projectSpecialPlanTask; - var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask; - var projectDrillList = await projectDrillTask; - var costExtractList = await costExtractTask; - var costUseList = await costUseTask; - var useEquipmentList = await useEquipmentTask; - var specialEquipmentList = await specialEquipmentTask; - var licensesList = await licensesTask; - var licensesCloseList = await licensesCloseTask; - var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; - var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; + // 统一获取异步方法的返回值 + var totalEnergyConsumption = totalEnergyConsumptionTask; + var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask; + var newWaterConsumption = newWaterConsumptionTask; + var safetyInjectionEngineerList = await safetyInjectionEngineerTask; + var certificateAList = await certificateATask; + var certificateBList = await certificateBTask; + var certificateCList = await certificateCTask; + var beUnderConstructionList = await beUnderConstructionTask; + var shutdownList = await shutdownTask; + var joinConstructionPersonList = await joinConstructionPersonTask; + var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask; + var totalWorkingHour = await totalWorkingHourTask; + var lostWorkingHour = await lostWorkingHourTask; + var safeWorkingHour = await safeWorkingHourTask; + var safeTrainList = await safeTrainTask; + var safeTrainBoShengList = await safeTrainBoShengTask; + var specialTrainList = await specialTrainTask; + var specialOperationTrainList = await specialOperationTrainTask; + var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask; + var headOfficeFullTimeList = await headOfficeFullTimeTask; + var branchInspectorGeneralList = await branchInspectorGeneralTask; + var branchFullTimeList = await branchFullTimeTask; + var projectInspectorGeneralList = await projectInspectorGeneralTask; + var projectFullTimeList = await projectFullTimeTask; + var projectSafetyMonitorList = await projectSafetyMonitorTask; + var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask; + var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask; + var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask; + var projectSafetyMeetingList = await projectSafetyMeetingTask; + var companyLeadShiftCheckList = await companyLeadShiftCheckTask; + var companyComprehensiveCheckList = await companyComprehensiveCheckTask; + var companySpecialCheckList = await companySpecialCheckTask; + var projectLeadShiftCheckList = await projectLeadShiftCheckTask; + var projectSpecialCheckList = await projectSpecialCheckTask; + var projectMajorCheckList = await projectMajorCheckTask; + var nearMissList = await nearMissTask; + var recordableEventList = await recordableEventTask; + var generalAccidentList = await generalAccidentTask; + var majorAccidentList = await majorAccidentTask; + var seriousAccidentList = await seriousAccidentTask; + var specialSeriousAccidentList = await specialSeriousAccidentTask; + var companyComprehensivePlanList = await companyComprehensivePlanTask; + var companySpecialPlanList = await companySpecialPlanTask; + var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask; + var companyDrillList = await companyDrillTask; + var projectComprehensivePlanList = await projectComprehensivePlanTask; + var projectSpecialPlanList = await projectSpecialPlanTask; + var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask; + var projectDrillList = await projectDrillTask; + var costExtractList = await costExtractTask; + var costUseList = await costUseTask; + var useEquipmentList = await useEquipmentTask; + var specialEquipmentList = await specialEquipmentTask; + var licensesList = await licensesTask; + var licensesCloseList = await licensesCloseTask; + var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; + var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; - // 构造结果对象 - var table = new HSSEData_HSSE - { - JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - TotalWorkingHour = totalWorkingHour, - LostWorkingHour = lostWorkingHour, - SafeWorkingHour = safeWorkingHour, - SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), - SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), - SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), - EnvironmentalTrainNum = 0, - TotalEnergyConsumption = totalEnergyConsumption, - IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, - NewWaterConsumption = newWaterConsumption, - HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(), - HeadOfficeFullTimeNum = headOfficeFullTimeList.Count, - BranchInspectorGeneralNum = branchInspectorGeneralList.Count, - BranchFullTimeNum = branchFullTimeList.Count, - ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId), - CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId), - CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId), - CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)), - ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - ProjectDrillNum = projectDrillList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - CostExtract = Convert.ToInt32(costExtractList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)), - CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)), - UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - LicensesCloseNum = licensesCloseList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), - GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), - GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), - MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), - MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), - LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum), - GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum), - MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum), - HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum), - CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum), - TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum), - ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum), - FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum), - SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum), - SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum), - SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum) - }; + // 构造结果对象 + var table = new HSSEData_HSSE + { + JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + TotalWorkingHour = totalWorkingHour, + LostWorkingHour = lostWorkingHour, + SafeWorkingHour = safeWorkingHour, + SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum) + safeTrainBoShengList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), + SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), + SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), + EnvironmentalTrainNum = 0, + TotalEnergyConsumption = totalEnergyConsumption, + IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, + NewWaterConsumption = newWaterConsumption, + HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(), + HeadOfficeFullTimeNum = headOfficeFullTimeList.Count, + BranchInspectorGeneralNum = branchInspectorGeneralList.Count, + BranchFullTimeNum = branchFullTimeList.Count, + ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId), + CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId), + CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId), + CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)), + ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + ProjectDrillNum = projectDrillList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + CostExtract = Convert.ToInt32(costExtractList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)), + CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)), + UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + LicensesCloseNum = licensesCloseList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), + GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), + GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), + MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), + MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), + LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum), + GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum), + MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum), + HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum), + CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum), + TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum), + ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum), + FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum), + SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum), + SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum) + }; - if (_unitType == 0) - { - table.BeUnderConstructionNum = beUnderConstructionList.Count(); - table.ShutdownNum = shutdownList.Count(); - table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(); - table.EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(); - table.CertificateANum = certificateAList.Count(); - table.CertificateBNum = certificateBList.Count(); - table.CertificateCNum = certificateCList.Count(); - table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(); + if (_unitType == 0) + { + table.BeUnderConstructionNum = beUnderConstructionList.Count(); + table.ShutdownNum = shutdownList.Count(); + table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(); + table.EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(); + table.CertificateANum = certificateAList.Count(); + table.CertificateBNum = certificateBList.Count(); + table.CertificateCNum = certificateCList.Count(); + table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(); - } - else if (_unitType == 1) - { - table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId); - table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId); - table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(x => x.UnitId == _unitId); - table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); - table.EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); - table.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); - table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); - table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); - } + } + else if (_unitType == 1) + { + table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId); + table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId); + table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(x => x.UnitId == _unitId); + table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId); + } - _hsseData = table; - return _hsseData; + _hsseData = table; + return _hsseData; } catch (Exception ex) { @@ -326,35 +330,36 @@ public class MainSevice } } - public List GetDataHiddenDangerDetailItems() - { - var db = Funs.DB; - var list = from x in db.HSSE_Hazard_HazardRegister - where _beUnderConstructionList.Contains(x.ProjectId) - select x; - var data = (from x in list - join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId - group x by new - { x.ProjectId, x.RegisterTypesId, y.RegisterTypesName } - into g - select new - { - UnitId = _unitId, - ProjectId = g.Key.ProjectId, - TypeName = g.Key.RegisterTypesName, - TotalNum = g.Count(), - NeedRectifyNum = g.Count(x => x.States == "1"), - }).ToList(); + public List GetDataHiddenDangerDetailItems() + { + var db = Funs.DB; + var list = from x in db.HSSE_Hazard_HazardRegister + where _beUnderConstructionList.Contains(x.ProjectId) + select x; + var data = (from x in list + join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId + group x by new + { x.ProjectId, x.RegisterTypesId, y.RegisterTypesName } + into g + select new + { + UnitId = _unitId, + ProjectId = g.Key.ProjectId, + TypeName = g.Key.RegisterTypesName, + TotalNum = g.Count(), + NeedRectifyNum = g.Count(x => x.States == "1"), + }).ToList(); - var result = (from x in data - group x by x.TypeName into g - select new Model.HSSEDataHiddenDangerDetailItem - { - Id = SQLHelper.GetNewID(), - TypeName = g.Key, - NeedRectifyNum = g.Sum(p => p.NeedRectifyNum), - TotalNum = g.Sum(p => p.TotalNum) - }).ToList(); - return result; + var result = (from x in data + group x by x.TypeName into g + select new Model.HSSEDataHiddenDangerDetailItem + { + Id = SQLHelper.GetNewID(), + TypeName = g.Key, + NeedRectifyNum = g.Sum(p => p.NeedRectifyNum), + TotalNum = g.Sum(p => p.TotalNum) + }).ToList(); + return result; + } } -} } \ No newline at end of file +} \ No newline at end of file