365 lines
		
	
	
		
			25 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			365 lines
		
	
	
		
			25 KiB
		
	
	
	
		
			C#
		
	
	
	
using Model;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
using System.Threading.Tasks;
 | 
						|
 | 
						|
namespace BLL
 | 
						|
{
 | 
						|
 | 
						|
    public class MainSevice
 | 
						|
    {
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 在建项目集合
 | 
						|
        /// </summary>
 | 
						|
        private List<string> _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<string>() { "0" };
 | 
						|
            }
 | 
						|
 | 
						|
        }
 | 
						|
        public async Task<HSSEData_HSSE> 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 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 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) + 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();
 | 
						|
 | 
						|
                }
 | 
						|
                else if (_unitType == 1)
 | 
						|
                {
 | 
						|
                    table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId);
 | 
						|
                    table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId);
 | 
						|
                    table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(x => x.UnitId == _unitId);
 | 
						|
                    table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
 | 
						|
                    table.EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
 | 
						|
                    table.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
 | 
						|
                    table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
 | 
						|
                    table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
 | 
						|
                }
 | 
						|
 | 
						|
                _hsseData = table;
 | 
						|
                return _hsseData;
 | 
						|
            }
 | 
						|
            catch (Exception ex)
 | 
						|
            {
 | 
						|
 | 
						|
                throw;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        public List<HSSEDataHiddenDangerDetailItem> 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;
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |