推送集团三级安全教育培训数据补充博晟培训入场培训

This commit is contained in:
夏菊 2025-06-10 10:34:14 +08:00
parent a25dada293
commit 63b616b571
2 changed files with 373 additions and 333 deletions

View File

@ -535,7 +535,7 @@ namespace BLL
TotalWorkingHour = GetTotalWorkingHour(), TotalWorkingHour = GetTotalWorkingHour(),
LostWorkingHour = GetLostWorkingHour(), LostWorkingHour = GetLostWorkingHour(),
SafeWorkingHour = GetSafeWorkingHour(), 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), SpecialTrainNum = GetSpecialTrain().Sum(x => x.TrainPersonNum),
SpecialOperationTrainNum = GetSpecialOperationTrain().Sum(x => x.TrainPersonNum), SpecialOperationTrainNum = GetSpecialOperationTrain().Sum(x => x.TrainPersonNum),
EnvironmentalTrainNum = 0, EnvironmentalTrainNum = 0,
@ -646,6 +646,7 @@ namespace BLL
var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync(); var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync();
var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync(); var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync();
var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync(); var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync();
var safeTrainBoShengTask = HSSEData_HSSEService.GetBoShengSafeTrainAsync();
var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync(); var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync();
var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync(); var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync();
var hseTechnicalNumTask = HSSEData_HSSEService.GetHseTechnicalNumAsync(); var hseTechnicalNumTask = HSSEData_HSSEService.GetHseTechnicalNumAsync();
@ -704,7 +705,7 @@ namespace BLL
totalWorkingHourTask, totalWorkingHourTask,
lostWorkingHourTask, lostWorkingHourTask,
safeWorkingHourTask, safeWorkingHourTask,
safeTrainTask, safeTrainTask, safeTrainBoShengTask,
specialTrainTask, specialTrainTask,
specialOperationTrainTask, hseTechnicalNumTask, specialOperationTrainTask, hseTechnicalNumTask,
headOfficeInspectorGeneralTask, headOfficeInspectorGeneralTask,
@ -765,6 +766,7 @@ namespace BLL
var lostWorkingHour = await lostWorkingHourTask; var lostWorkingHour = await lostWorkingHourTask;
var safeWorkingHour = await safeWorkingHourTask; var safeWorkingHour = await safeWorkingHourTask;
var safeTrainList = await safeTrainTask; var safeTrainList = await safeTrainTask;
var safeTrainBoShengList = await safeTrainBoShengTask;
var specialTrainList = await specialTrainTask; var specialTrainList = await specialTrainTask;
var specialOperationTrainList = await specialOperationTrainTask; var specialOperationTrainList = await specialOperationTrainTask;
var hseTechnicalNum = await hseTechnicalNumTask; var hseTechnicalNum = await hseTechnicalNumTask;
@ -826,7 +828,7 @@ namespace BLL
TotalWorkingHour = totalWorkingHour, TotalWorkingHour = totalWorkingHour,
LostWorkingHour = lostWorkingHour, LostWorkingHour = lostWorkingHour,
SafeWorkingHour = safeWorkingHour, 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), SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum),
SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum), SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum),
HseTechnicalNum = hseTechnicalNum, HseTechnicalNum = hseTechnicalNum,
@ -2869,6 +2871,39 @@ namespace BLL
return await Task.Run(GetSafeTrain); 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 == "入场(厂)培训" || 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;
}
/// <summary>
/// 获取三级安全教育培训数——博晟培训(异步)
/// </summary>
/// <returns></returns>
public static async Task<List<EduTrainOutput>> GetBoShengSafeTrainAsync()
{
return await Task.Run(GetBoShengSafeTrain);
}
/// <summary> /// <summary>
/// 获取专项培训数 /// 获取专项培训数
/// </summary> /// </summary>

View File

@ -4,320 +4,324 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace BLL { namespace BLL
public class MainSevice
{ {
/// <summary> public class MainSevice
/// 在建项目集合
/// </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" };
}
} /// <summary>
public async Task<HSSEData_HSSE> GetHsseDataAsync() /// 在建项目集合
{ /// </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 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( var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption();
securityRiskOutputListTask, var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
largeEngineeringOutputsTask, var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption();
safetyInjectionEngineerTask, var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync()
certificateATask, .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId)));
certificateBTask, var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync()
certificateCTask, .ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId)));
beUnderConstructionTask, var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync();
shutdownTask, var certificateATask = HSSEData_HSSEService.GetCertificateAAsync();
joinConstructionPersonTask, var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync();
majorProjectsUnderConstructionTask, var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync();
totalWorkingHourTask, var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync();
lostWorkingHourTask, var shutdownTask = HSSEData_HSSEService.GetShutdownAsync();
safeWorkingHourTask, var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync();
safeTrainTask, var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync();
specialTrainTask, var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync();
specialOperationTrainTask, var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync();
headOfficeInspectorGeneralTask, var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync();
headOfficeFullTimeTask, var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync();
branchInspectorGeneralTask, var safeTrainBoShengTask = HSSEData_HSSEService.GetBoShengSafeTrainAsync();
branchFullTimeTask, var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync();
projectInspectorGeneralTask, var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync();
projectFullTimeTask, var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync();
projectSafetyMonitorTask, var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync();
safetyCommitteeMeetingTask, var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync();
enterpriseTopicsMeetingTask, var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync();
projectSafetyLeadingGroupMeetingTask, var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync();
projectSafetyMeetingTask, var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync();
companyLeadShiftCheckTask, var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync();
companyComprehensiveCheckTask, var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync();
companySpecialCheckTask, var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync();
projectLeadShiftCheckTask, var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync();
projectSpecialCheckTask, var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync();
projectMajorCheckTask, var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync();
nearMissTask, var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync();
recordableEventTask, var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync();
generalAccidentTask, var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync();
majorAccidentTask, var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync();
seriousAccidentTask, var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync();
specialSeriousAccidentTask, var nearMissTask = HSSEData_HSSEService.GetNearMissAsync();
companyComprehensivePlanTask, var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync();
companySpecialPlanTask, var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync();
companyOnSiteDisposalPlanTask, var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync();
companyDrillTask, var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync();
projectComprehensivePlanTask, var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync();
projectSpecialPlanTask, var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync();
projectOnSiteDisposalPlanTask, var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync();
projectDrillTask, var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync();
costExtractTask, var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync();
costUseTask, var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync();
useEquipmentTask, var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync();
specialEquipmentTask, var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync();
licensesTask, var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync();
licensesCloseTask, var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync();
generalHiddenRectificationOutputsTask, var costUseTask = HSSEData_HSSEService.GetCostUseAsync();
majorHiddenRectificationOutputsTask 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 totalEnergyConsumption = totalEnergyConsumptionTask;
var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask; var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask;
var newWaterConsumption = newWaterConsumptionTask; var newWaterConsumption = newWaterConsumptionTask;
var safetyInjectionEngineerList = await safetyInjectionEngineerTask; var safetyInjectionEngineerList = await safetyInjectionEngineerTask;
var certificateAList = await certificateATask; var certificateAList = await certificateATask;
var certificateBList = await certificateBTask; var certificateBList = await certificateBTask;
var certificateCList = await certificateCTask; var certificateCList = await certificateCTask;
var beUnderConstructionList = await beUnderConstructionTask; var beUnderConstructionList = await beUnderConstructionTask;
var shutdownList = await shutdownTask; var shutdownList = await shutdownTask;
var joinConstructionPersonList = await joinConstructionPersonTask; var joinConstructionPersonList = await joinConstructionPersonTask;
var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask; var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask;
var totalWorkingHour = await totalWorkingHourTask; var totalWorkingHour = await totalWorkingHourTask;
var lostWorkingHour = await lostWorkingHourTask; var lostWorkingHour = await lostWorkingHourTask;
var safeWorkingHour = await safeWorkingHourTask; var safeWorkingHour = await safeWorkingHourTask;
var safeTrainList = await safeTrainTask; var safeTrainList = await safeTrainTask;
var specialTrainList = await specialTrainTask; var safeTrainBoShengList = await safeTrainBoShengTask;
var specialOperationTrainList = await specialOperationTrainTask; var specialTrainList = await specialTrainTask;
var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask; var specialOperationTrainList = await specialOperationTrainTask;
var headOfficeFullTimeList = await headOfficeFullTimeTask; var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask;
var branchInspectorGeneralList = await branchInspectorGeneralTask; var headOfficeFullTimeList = await headOfficeFullTimeTask;
var branchFullTimeList = await branchFullTimeTask; var branchInspectorGeneralList = await branchInspectorGeneralTask;
var projectInspectorGeneralList = await projectInspectorGeneralTask; var branchFullTimeList = await branchFullTimeTask;
var projectFullTimeList = await projectFullTimeTask; var projectInspectorGeneralList = await projectInspectorGeneralTask;
var projectSafetyMonitorList = await projectSafetyMonitorTask; var projectFullTimeList = await projectFullTimeTask;
var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask; var projectSafetyMonitorList = await projectSafetyMonitorTask;
var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask; var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask;
var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask; var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask;
var projectSafetyMeetingList = await projectSafetyMeetingTask; var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask;
var companyLeadShiftCheckList = await companyLeadShiftCheckTask; var projectSafetyMeetingList = await projectSafetyMeetingTask;
var companyComprehensiveCheckList = await companyComprehensiveCheckTask; var companyLeadShiftCheckList = await companyLeadShiftCheckTask;
var companySpecialCheckList = await companySpecialCheckTask; var companyComprehensiveCheckList = await companyComprehensiveCheckTask;
var projectLeadShiftCheckList = await projectLeadShiftCheckTask; var companySpecialCheckList = await companySpecialCheckTask;
var projectSpecialCheckList = await projectSpecialCheckTask; var projectLeadShiftCheckList = await projectLeadShiftCheckTask;
var projectMajorCheckList = await projectMajorCheckTask; var projectSpecialCheckList = await projectSpecialCheckTask;
var nearMissList = await nearMissTask; var projectMajorCheckList = await projectMajorCheckTask;
var recordableEventList = await recordableEventTask; var nearMissList = await nearMissTask;
var generalAccidentList = await generalAccidentTask; var recordableEventList = await recordableEventTask;
var majorAccidentList = await majorAccidentTask; var generalAccidentList = await generalAccidentTask;
var seriousAccidentList = await seriousAccidentTask; var majorAccidentList = await majorAccidentTask;
var specialSeriousAccidentList = await specialSeriousAccidentTask; var seriousAccidentList = await seriousAccidentTask;
var companyComprehensivePlanList = await companyComprehensivePlanTask; var specialSeriousAccidentList = await specialSeriousAccidentTask;
var companySpecialPlanList = await companySpecialPlanTask; var companyComprehensivePlanList = await companyComprehensivePlanTask;
var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask; var companySpecialPlanList = await companySpecialPlanTask;
var companyDrillList = await companyDrillTask; var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask;
var projectComprehensivePlanList = await projectComprehensivePlanTask; var companyDrillList = await companyDrillTask;
var projectSpecialPlanList = await projectSpecialPlanTask; var projectComprehensivePlanList = await projectComprehensivePlanTask;
var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask; var projectSpecialPlanList = await projectSpecialPlanTask;
var projectDrillList = await projectDrillTask; var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask;
var costExtractList = await costExtractTask; var projectDrillList = await projectDrillTask;
var costUseList = await costUseTask; var costExtractList = await costExtractTask;
var useEquipmentList = await useEquipmentTask; var costUseList = await costUseTask;
var specialEquipmentList = await specialEquipmentTask; var useEquipmentList = await useEquipmentTask;
var licensesList = await licensesTask; var specialEquipmentList = await specialEquipmentTask;
var licensesCloseList = await licensesCloseTask; var licensesList = await licensesTask;
var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; var licensesCloseList = await licensesCloseTask;
var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask;
var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask;
// 构造结果对象 // 构造结果对象
var table = new HSSEData_HSSE var table = new HSSEData_HSSE
{ {
JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
TotalWorkingHour = totalWorkingHour, TotalWorkingHour = totalWorkingHour,
LostWorkingHour = lostWorkingHour, LostWorkingHour = lostWorkingHour,
SafeWorkingHour = safeWorkingHour, SafeWorkingHour = safeWorkingHour,
SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), 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), SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum), SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
EnvironmentalTrainNum = 0, EnvironmentalTrainNum = 0,
TotalEnergyConsumption = totalEnergyConsumption, TotalEnergyConsumption = totalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption, IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption,
NewWaterConsumption = newWaterConsumption, NewWaterConsumption = newWaterConsumption,
HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(), HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(),
HeadOfficeFullTimeNum = headOfficeFullTimeList.Count, HeadOfficeFullTimeNum = headOfficeFullTimeList.Count,
BranchInspectorGeneralNum = branchInspectorGeneralList.Count, BranchInspectorGeneralNum = branchInspectorGeneralList.Count,
BranchFullTimeNum = branchFullTimeList.Count, BranchFullTimeNum = branchFullTimeList.Count,
ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId), CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId),
CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId), CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId),
CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId), CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId),
CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)), CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)),
ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectDrillNum = projectDrillList.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)), 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)), CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)),
UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)), LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
LicensesCloseNum = licensesCloseList.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), GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum),
GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum),
MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum), MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum),
MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum), MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum),
LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum), LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum),
GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum), GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum),
MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum), MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum),
HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum), HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum),
CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum), CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum),
TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum), TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum),
ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum), ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum),
FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum), FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum),
SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum), SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum),
SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum), SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum),
SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum) SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum)
}; };
if (_unitType == 0) if (_unitType == 0)
{ {
table.BeUnderConstructionNum = beUnderConstructionList.Count(); table.BeUnderConstructionNum = beUnderConstructionList.Count();
table.ShutdownNum = shutdownList.Count(); table.ShutdownNum = shutdownList.Count();
table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(); table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count();
table.EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(); table.EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count();
table.CertificateANum = certificateAList.Count(); table.CertificateANum = certificateAList.Count();
table.CertificateBNum = certificateBList.Count(); table.CertificateBNum = certificateBList.Count();
table.CertificateCNum = certificateCList.Count(); table.CertificateCNum = certificateCList.Count();
table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(); table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count();
} }
else if (_unitType == 1) else if (_unitType == 1)
{ {
table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId); table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId);
table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId); table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId);
table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.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.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.EnterpriseTopicsMeetingNum = 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.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.CertificateBNum = certificateBList.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); table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
} }
_hsseData = table; _hsseData = table;
return _hsseData; return _hsseData;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -326,35 +330,36 @@ public class MainSevice
} }
} }
public List<HSSEDataHiddenDangerDetailItem> GetDataHiddenDangerDetailItems() public List<HSSEDataHiddenDangerDetailItem> GetDataHiddenDangerDetailItems()
{ {
var db = Funs.DB; var db = Funs.DB;
var list = from x in db.HSSE_Hazard_HazardRegister var list = from x in db.HSSE_Hazard_HazardRegister
where _beUnderConstructionList.Contains(x.ProjectId) where _beUnderConstructionList.Contains(x.ProjectId)
select x; select x;
var data = (from x in list var data = (from x in list
join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId
group x by new group x by new
{ x.ProjectId, x.RegisterTypesId, y.RegisterTypesName } { x.ProjectId, x.RegisterTypesId, y.RegisterTypesName }
into g into g
select new select new
{ {
UnitId = _unitId, UnitId = _unitId,
ProjectId = g.Key.ProjectId, ProjectId = g.Key.ProjectId,
TypeName = g.Key.RegisterTypesName, TypeName = g.Key.RegisterTypesName,
TotalNum = g.Count(), TotalNum = g.Count(),
NeedRectifyNum = g.Count(x => x.States == "1"), NeedRectifyNum = g.Count(x => x.States == "1"),
}).ToList(); }).ToList();
var result = (from x in data var result = (from x in data
group x by x.TypeName into g group x by x.TypeName into g
select new Model.HSSEDataHiddenDangerDetailItem select new Model.HSSEDataHiddenDangerDetailItem
{ {
Id = SQLHelper.GetNewID(), Id = SQLHelper.GetNewID(),
TypeName = g.Key, TypeName = g.Key,
NeedRectifyNum = g.Sum(p => p.NeedRectifyNum), NeedRectifyNum = g.Sum(p => p.NeedRectifyNum),
TotalNum = g.Sum(p => p.TotalNum) TotalNum = g.Sum(p => p.TotalNum)
}).ToList(); }).ToList();
return result; return result;
}
} }
} } }