3757 lines
199 KiB
C#
3757 lines
199 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Runtime.InteropServices.ComTypes;
|
|||
|
using System.Runtime.Remoting.Contexts;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using Aspose.Words.Lists;
|
|||
|
using FastReport;
|
|||
|
using FineUIPro;
|
|||
|
using Model;
|
|||
|
using Newtonsoft.Json;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
public static class HSSEData_HSSEService
|
|||
|
{
|
|||
|
public static SGGLDB Db = Funs.DB;
|
|||
|
|
|||
|
public static List<string> BeUnderConstructionList = ProjectService.GetProjectWorkList().Where(x=> (x.ProjectAttribute == "GONGCHENG" || x.ProjectAttribute == null)).Select(x => x.ProjectId).ToList();
|
|||
|
|
|||
|
public static void AddHSSEData_HSSE(HSSEData_HSSE newtable)
|
|||
|
{
|
|||
|
using (var db = new SGGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var table = new HSSEData_HSSE
|
|||
|
{
|
|||
|
Id = newtable.Id,
|
|||
|
UnitId = newtable.UnitId,
|
|||
|
CollCropCode = newtable.CollCropCode,
|
|||
|
UnitName = newtable.UnitName,
|
|||
|
ReportDate = newtable.ReportDate,
|
|||
|
BeUnderConstructionNum = newtable.BeUnderConstructionNum,
|
|||
|
ShutdownNum = newtable.ShutdownNum,
|
|||
|
JoinConstructionPersonNum = newtable.JoinConstructionPersonNum,
|
|||
|
MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum,
|
|||
|
TotalWorkingHour = newtable.TotalWorkingHour,
|
|||
|
LostWorkingHour = newtable.LostWorkingHour,
|
|||
|
SafeWorkingHour = newtable.SafeWorkingHour,
|
|||
|
SafeTrainNum = newtable.SafeTrainNum,
|
|||
|
SpecialTrainNum = newtable.SpecialTrainNum,
|
|||
|
SpecialOperationTrainNum = newtable.SpecialOperationTrainNum,
|
|||
|
EnvironmentalTrainNum = newtable.EnvironmentalTrainNum,
|
|||
|
TotalEnergyConsumption = newtable.TotalEnergyConsumption,
|
|||
|
IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
|
|||
|
NewWaterConsumption = newtable.NewWaterConsumption,
|
|||
|
HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum,
|
|||
|
HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum,
|
|||
|
BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum,
|
|||
|
BranchFullTimeNum = newtable.BranchFullTimeNum,
|
|||
|
ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum,
|
|||
|
ProjectFullTimeNum = newtable.ProjectFullTimeNum,
|
|||
|
ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum,
|
|||
|
SafetyInjectionEngineer = newtable.SafetyInjectionEngineer,
|
|||
|
CertificateANum = newtable.CertificateANum,
|
|||
|
CertificateBNum = newtable.CertificateBNum,
|
|||
|
CertificateCNum = newtable.CertificateCNum,
|
|||
|
SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum,
|
|||
|
EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum,
|
|||
|
ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum,
|
|||
|
ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum,
|
|||
|
CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum,
|
|||
|
CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum,
|
|||
|
CompanySpecialCheckNum = newtable.CompanySpecialCheckNum,
|
|||
|
ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum,
|
|||
|
ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum,
|
|||
|
ProjectMajorCheckNum = newtable.ProjectMajorCheckNum,
|
|||
|
NearMissNum = newtable.NearMissNum,
|
|||
|
RecordableEventNum = newtable.RecordableEventNum,
|
|||
|
GeneralAccidentNum = newtable.GeneralAccidentNum,
|
|||
|
MajorAccidentNum = newtable.MajorAccidentNum,
|
|||
|
SeriousAccidentNum = newtable.SeriousAccidentNum,
|
|||
|
SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum,
|
|||
|
CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum,
|
|||
|
CompanySpecialPlanNum = newtable.CompanySpecialPlanNum,
|
|||
|
CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan,
|
|||
|
CompanyDrillNum = newtable.CompanyDrillNum,
|
|||
|
ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum,
|
|||
|
ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum,
|
|||
|
ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan,
|
|||
|
ProjectDrillNum = newtable.ProjectDrillNum,
|
|||
|
CostExtract = newtable.CostExtract,
|
|||
|
CostUse = newtable.CostUse,
|
|||
|
UseEquipmentNum = newtable.UseEquipmentNum,
|
|||
|
SpecialEquipmentNum = newtable.SpecialEquipmentNum,
|
|||
|
LicensesNum = newtable.LicensesNum,
|
|||
|
LicensesCloseNum = newtable.LicensesCloseNum,
|
|||
|
GeneralClosedNum = newtable.GeneralClosedNum,
|
|||
|
GeneralNotClosedNum = newtable.GeneralNotClosedNum,
|
|||
|
MajorClosedNum = newtable.MajorClosedNum,
|
|||
|
MajorNotClosedNum = newtable.MajorNotClosedNum,
|
|||
|
GeneralRiskNum = newtable.GeneralRiskNum,
|
|||
|
LowRiskNum = newtable.LowRiskNum,
|
|||
|
MediumRiskNum = newtable.MediumRiskNum,
|
|||
|
HighRiskNum = newtable.HighRiskNum,
|
|||
|
CompletedNum = newtable.CompletedNum,
|
|||
|
TrainPersonNum = newtable.TrainPersonNum,
|
|||
|
ConstructionNum = newtable.ConstructionNum,
|
|||
|
FinishedNum = newtable.FinishedNum,
|
|||
|
SuperCompletedNum = newtable.SuperCompletedNum,
|
|||
|
SuperTrainPersonNum = newtable.SuperTrainPersonNum,
|
|||
|
SuperConstructionNum = newtable.SuperConstructionNum,
|
|||
|
SuperFinishedNum = newtable.SuperFinishedNum,
|
|||
|
State = newtable.State,
|
|||
|
CreateDate = newtable.CreateDate,
|
|||
|
CreateMan = newtable.CreateMan
|
|||
|
};
|
|||
|
db.HSSEData_HSSE.InsertOnSubmit(table);
|
|||
|
db.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static void DeleteHSSEData_HSSEById(string id)
|
|||
|
{
|
|||
|
using (var db = new SGGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == id);
|
|||
|
if (table != null)
|
|||
|
{
|
|||
|
db.HSSEData_HSSE.DeleteOnSubmit(table);
|
|||
|
db.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static HSSEData_HSSE GetHSSEData_HSSEById(string id)
|
|||
|
{
|
|||
|
using (var db = new SGGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
return db.HSSEData_HSSE.FirstOrDefault(x => x.Id == id);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static HSSEData GetItemById(string id)
|
|||
|
{
|
|||
|
var item = new HsseDataItem();
|
|||
|
var data = new HSSEData();
|
|||
|
var dataHsse = GetHSSEData_HSSEById(id);
|
|||
|
if (dataHsse != null)
|
|||
|
{
|
|||
|
item.BeUnderConstructionNum = dataHsse.BeUnderConstructionNum;
|
|||
|
item.BranchFullTimeNum = dataHsse.BranchFullTimeNum;
|
|||
|
item.BranchInspectorGeneralNum = dataHsse.BranchInspectorGeneralNum;
|
|||
|
item.CertificateANum = dataHsse.CertificateANum;
|
|||
|
item.CertificateBNum = dataHsse.CertificateBNum;
|
|||
|
item.CertificateCNum = dataHsse.CertificateCNum;
|
|||
|
item.CollCropCode = dataHsse.CollCropCode;
|
|||
|
item.CompanyComprehensiveCheckNum = dataHsse.CompanyComprehensiveCheckNum;
|
|||
|
item.CompanyComprehensivePlanNum = dataHsse.CompanyComprehensivePlanNum;
|
|||
|
item.CompanyDrillNum = dataHsse.CompanyDrillNum;
|
|||
|
item.CompanyLeadShiftCheckNum = dataHsse.CompanyLeadShiftCheckNum;
|
|||
|
item.CompanyOnSiteDisposalPlan = dataHsse.CompanyOnSiteDisposalPlan;
|
|||
|
item.CompanySpecialCheckNum = dataHsse.CompanySpecialCheckNum;
|
|||
|
item.CompanySpecialPlanNum = dataHsse.CompanySpecialPlanNum;
|
|||
|
item.CompletedNum = dataHsse.CompletedNum;
|
|||
|
item.ConstructionNum = dataHsse.ConstructionNum;
|
|||
|
item.CostExtract = dataHsse.CostExtract;
|
|||
|
item.CostUse = dataHsse.CostUse;
|
|||
|
item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum;
|
|||
|
item.FinishedNum = dataHsse.FinishedNum;
|
|||
|
item.GeneralAccidentNum = dataHsse.GeneralAccidentNum;
|
|||
|
item.GeneralClosedNum = dataHsse.GeneralClosedNum;
|
|||
|
item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
|
|||
|
item.GeneralRate = "";
|
|||
|
item.GeneralRiskNum = dataHsse.GeneralRiskNum;
|
|||
|
item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum;
|
|||
|
item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum;
|
|||
|
item.HighRiskNum = dataHsse.HighRiskNum;
|
|||
|
item.Id = dataHsse.Id;
|
|||
|
item.IncomeComprehensiveEnergyConsumption = dataHsse.IncomeComprehensiveEnergyConsumption;
|
|||
|
item.JoinConstructionPersonNum = dataHsse.JoinConstructionPersonNum;
|
|||
|
item.LicensesCloseNum = dataHsse.LicensesCloseNum;
|
|||
|
item.LicensesNum = dataHsse.LicensesNum;
|
|||
|
item.LostWorkingHour = dataHsse.LostWorkingHour;
|
|||
|
item.LowRiskNum = dataHsse.LowRiskNum;
|
|||
|
item.MajorAccidentNum = dataHsse.MajorAccidentNum;
|
|||
|
item.MajorClosedNum = dataHsse.MajorClosedNum;
|
|||
|
item.MajorNotClosedNum = dataHsse.MajorNotClosedNum;
|
|||
|
item.MajorProjectsUnderConstructionNum = dataHsse.MajorProjectsUnderConstructionNum;
|
|||
|
item.MajorRate = "";
|
|||
|
item.MediumRiskNum = dataHsse.MediumRiskNum;
|
|||
|
item.NearMissNum = dataHsse.NearMissNum;
|
|||
|
item.NewWaterConsumption = dataHsse.NewWaterConsumption;
|
|||
|
item.ProjectComprehensivePlanNum = dataHsse.ProjectComprehensivePlanNum;
|
|||
|
item.ProjectDrillNum = dataHsse.ProjectDrillNum;
|
|||
|
item.ProjectFullTimeNum = dataHsse.ProjectFullTimeNum;
|
|||
|
item.ProjectInspectorGeneralNum = dataHsse.ProjectInspectorGeneralNum;
|
|||
|
item.ProjectLeadShiftCheckNum = dataHsse.ProjectLeadShiftCheckNum;
|
|||
|
item.ProjectMajorCheckNum = dataHsse.ProjectMajorCheckNum;
|
|||
|
item.ProjectOnSiteDisposalPlan = dataHsse.ProjectOnSiteDisposalPlan;
|
|||
|
item.ProjectSafetyLeadingGroupMeetingNum = dataHsse.ProjectSafetyLeadingGroupMeetingNum;
|
|||
|
item.ProjectSafetyMeetingNum = dataHsse.ProjectSafetyMeetingNum;
|
|||
|
item.ProjectSafetyMonitorNum = dataHsse.ProjectSafetyMonitorNum;
|
|||
|
item.ProjectSpecialCheckNum = dataHsse.ProjectSpecialCheckNum;
|
|||
|
item.ProjectSpecialPlanNum = dataHsse.ProjectSpecialPlanNum;
|
|||
|
item.RecordableEventNum = dataHsse.RecordableEventNum;
|
|||
|
item.ReportDate = dataHsse.ReportDate.Value.ToShortDateString();
|
|||
|
item.SafeTrainNum = dataHsse.SafeTrainNum;
|
|||
|
item.SafetyCommitteeMeetingNum = dataHsse.SafetyCommitteeMeetingNum;
|
|||
|
item.SafetyInjectionEngineer = dataHsse.SafetyInjectionEngineer;
|
|||
|
item.SafeWorkingHour = dataHsse.SafeWorkingHour;
|
|||
|
item.SeriousAccidentNum = dataHsse.SeriousAccidentNum;
|
|||
|
item.ShutdownNum = dataHsse.ShutdownNum;
|
|||
|
item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum;
|
|||
|
item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum;
|
|||
|
item.EnvironmentalTrainNum = dataHsse.EnvironmentalTrainNum;
|
|||
|
item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum;
|
|||
|
item.SpecialTrainNum = dataHsse.SpecialTrainNum;
|
|||
|
item.SuperCompletedNum = dataHsse.SuperCompletedNum;
|
|||
|
item.SuperConstructionNum = dataHsse.SuperConstructionNum;
|
|||
|
item.SuperFinishedNum = dataHsse.SuperFinishedNum;
|
|||
|
item.SuperTrainPersonNum = dataHsse.SuperTrainPersonNum;
|
|||
|
item.TotalEnergyConsumption = dataHsse.TotalEnergyConsumption;
|
|||
|
item.TotalWorkingHour = dataHsse.TotalWorkingHour;
|
|||
|
item.TrainPersonNum = dataHsse.TrainPersonNum;
|
|||
|
item.UnitId = dataHsse.UnitId;
|
|||
|
item.UseEquipmentNum = dataHsse.UseEquipmentNum;
|
|||
|
var hSseDataHiddens =
|
|||
|
HSSEData_HiddenDangerDetailService.GetHSSEData_HiddenDangerDetailByDate(dataHsse.ReportDate);
|
|||
|
if (hSseDataHiddens != null)
|
|||
|
{
|
|||
|
var list = hSseDataHiddens.Select(detail => new HSSEDataHiddenDangerDetailItem
|
|||
|
{
|
|||
|
Id = detail.Id,
|
|||
|
NeedRectifyNum = detail.NeedRectifyNum,
|
|||
|
TotalNum = detail.TotalNum,
|
|||
|
TypeName = detail.TypeName
|
|||
|
}).ToList();
|
|||
|
|
|||
|
item.HiddenDangerDetailItems = list;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
var hsseDataItems = new List<HsseDataItem> { item };
|
|||
|
data.HSSEDataItems = hsseDataItems;
|
|||
|
return data;
|
|||
|
}
|
|||
|
|
|||
|
public static HSSEData GetItemByHSSEData_HSSE(HSSEData_HSSE dataHsse,
|
|||
|
List<HSSEDataHiddenDangerDetailItem> hSseDataHiddens)
|
|||
|
{
|
|||
|
var item = new HsseDataItem();
|
|||
|
var data = new HSSEData();
|
|||
|
if (dataHsse != null)
|
|||
|
{
|
|||
|
item.BeUnderConstructionNum = dataHsse.BeUnderConstructionNum;
|
|||
|
item.BranchFullTimeNum = dataHsse.BranchFullTimeNum;
|
|||
|
item.BranchInspectorGeneralNum = dataHsse.BranchInspectorGeneralNum;
|
|||
|
item.CertificateANum = dataHsse.CertificateANum;
|
|||
|
item.CertificateBNum = dataHsse.CertificateBNum;
|
|||
|
item.CertificateCNum = dataHsse.CertificateCNum;
|
|||
|
item.CollCropCode = dataHsse.CollCropCode;
|
|||
|
item.CompanyComprehensiveCheckNum = dataHsse.CompanyComprehensiveCheckNum;
|
|||
|
item.CompanyComprehensivePlanNum = dataHsse.CompanyComprehensivePlanNum;
|
|||
|
item.CompanyDrillNum = dataHsse.CompanyDrillNum;
|
|||
|
item.CompanyLeadShiftCheckNum = dataHsse.CompanyLeadShiftCheckNum;
|
|||
|
item.CompanyOnSiteDisposalPlan = dataHsse.CompanyOnSiteDisposalPlan;
|
|||
|
item.CompanySpecialCheckNum = dataHsse.CompanySpecialCheckNum;
|
|||
|
item.CompanySpecialPlanNum = dataHsse.CompanySpecialPlanNum;
|
|||
|
item.CompletedNum = dataHsse.CompletedNum;
|
|||
|
item.ConstructionNum = dataHsse.ConstructionNum;
|
|||
|
item.CostExtract = dataHsse.CostExtract;
|
|||
|
item.CostUse = dataHsse.CostUse;
|
|||
|
item.EnterpriseTopicsMeetingNum = dataHsse.EnterpriseTopicsMeetingNum;
|
|||
|
item.FinishedNum = dataHsse.FinishedNum;
|
|||
|
item.GeneralAccidentNum = dataHsse.GeneralAccidentNum;
|
|||
|
item.GeneralClosedNum = dataHsse.GeneralClosedNum;
|
|||
|
item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
|
|||
|
item.GeneralRate = "";
|
|||
|
item.GeneralRiskNum = dataHsse.GeneralRiskNum;
|
|||
|
item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum;
|
|||
|
item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum;
|
|||
|
item.HighRiskNum = dataHsse.HighRiskNum;
|
|||
|
item.Id = dataHsse.Id;
|
|||
|
item.IncomeComprehensiveEnergyConsumption = dataHsse.IncomeComprehensiveEnergyConsumption;
|
|||
|
item.JoinConstructionPersonNum = dataHsse.JoinConstructionPersonNum;
|
|||
|
item.LicensesCloseNum = dataHsse.LicensesCloseNum;
|
|||
|
item.LicensesNum = dataHsse.LicensesNum;
|
|||
|
item.LostWorkingHour = dataHsse.LostWorkingHour;
|
|||
|
item.LowRiskNum = dataHsse.LowRiskNum;
|
|||
|
item.MajorAccidentNum = dataHsse.MajorAccidentNum;
|
|||
|
item.MajorClosedNum = dataHsse.MajorClosedNum;
|
|||
|
item.MajorNotClosedNum = dataHsse.MajorNotClosedNum;
|
|||
|
item.MajorProjectsUnderConstructionNum = dataHsse.MajorProjectsUnderConstructionNum;
|
|||
|
item.MajorRate = "";
|
|||
|
item.MediumRiskNum = dataHsse.MediumRiskNum;
|
|||
|
item.NearMissNum = dataHsse.NearMissNum;
|
|||
|
item.NewWaterConsumption = dataHsse.NewWaterConsumption;
|
|||
|
item.ProjectComprehensivePlanNum = dataHsse.ProjectComprehensivePlanNum;
|
|||
|
item.ProjectDrillNum = dataHsse.ProjectDrillNum;
|
|||
|
item.ProjectFullTimeNum = dataHsse.ProjectFullTimeNum;
|
|||
|
item.ProjectInspectorGeneralNum = dataHsse.ProjectInspectorGeneralNum;
|
|||
|
item.ProjectLeadShiftCheckNum = dataHsse.ProjectLeadShiftCheckNum;
|
|||
|
item.ProjectMajorCheckNum = dataHsse.ProjectMajorCheckNum;
|
|||
|
item.ProjectOnSiteDisposalPlan = dataHsse.ProjectOnSiteDisposalPlan;
|
|||
|
item.ProjectSafetyLeadingGroupMeetingNum = dataHsse.ProjectSafetyLeadingGroupMeetingNum;
|
|||
|
item.ProjectSafetyMeetingNum = dataHsse.ProjectSafetyMeetingNum;
|
|||
|
item.ProjectSafetyMonitorNum = dataHsse.ProjectSafetyMonitorNum;
|
|||
|
item.ProjectSpecialCheckNum = dataHsse.ProjectSpecialCheckNum;
|
|||
|
item.ProjectSpecialPlanNum = dataHsse.ProjectSpecialPlanNum;
|
|||
|
item.RecordableEventNum = dataHsse.RecordableEventNum;
|
|||
|
item.ReportDate = dataHsse.ReportDate.Value.ToShortDateString();
|
|||
|
item.SafeTrainNum = dataHsse.SafeTrainNum;
|
|||
|
item.SafetyCommitteeMeetingNum = dataHsse.SafetyCommitteeMeetingNum;
|
|||
|
item.SafetyInjectionEngineer = dataHsse.SafetyInjectionEngineer;
|
|||
|
item.SafeWorkingHour = dataHsse.SafeWorkingHour;
|
|||
|
item.SeriousAccidentNum = dataHsse.SeriousAccidentNum;
|
|||
|
item.ShutdownNum = dataHsse.ShutdownNum;
|
|||
|
item.SpecialEquipmentNum = dataHsse.SpecialEquipmentNum;
|
|||
|
item.SpecialOperationTrainNum = dataHsse.SpecialOperationTrainNum;
|
|||
|
item.EnvironmentalTrainNum = dataHsse.EnvironmentalTrainNum;
|
|||
|
item.SpecialSeriousAccidentNum = dataHsse.SpecialSeriousAccidentNum;
|
|||
|
item.SpecialTrainNum = dataHsse.SpecialTrainNum;
|
|||
|
item.SuperCompletedNum = dataHsse.SuperCompletedNum;
|
|||
|
item.SuperConstructionNum = dataHsse.SuperConstructionNum;
|
|||
|
item.SuperFinishedNum = dataHsse.SuperFinishedNum;
|
|||
|
item.SuperTrainPersonNum = dataHsse.SuperTrainPersonNum;
|
|||
|
item.TotalEnergyConsumption = dataHsse.TotalEnergyConsumption;
|
|||
|
item.TotalWorkingHour = dataHsse.TotalWorkingHour;
|
|||
|
item.TrainPersonNum = dataHsse.TrainPersonNum;
|
|||
|
item.UnitId = dataHsse.UnitId;
|
|||
|
item.UseEquipmentNum = dataHsse.UseEquipmentNum;
|
|||
|
if (hSseDataHiddens != null)
|
|||
|
{
|
|||
|
var list = hSseDataHiddens.Select(detail =>
|
|||
|
new HSSEDataHiddenDangerDetailItem
|
|||
|
{
|
|||
|
Id = detail.Id,
|
|||
|
NeedRectifyNum = detail.NeedRectifyNum,
|
|||
|
TotalNum = detail.TotalNum,
|
|||
|
TypeName = detail.TypeName
|
|||
|
}).ToList();
|
|||
|
|
|||
|
item.HiddenDangerDetailItems = list;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
var hsseDataItems = new List<HsseDataItem> { item };
|
|||
|
data.HSSEDataItems = hsseDataItems;
|
|||
|
return data;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<HSSEData> GetTodayHSSEData_HSSE()
|
|||
|
{
|
|||
|
var modelTask= StatisticalDataAsync();
|
|||
|
var model=await modelTask;
|
|||
|
HSSEData data = model;
|
|||
|
return data;
|
|||
|
}
|
|||
|
|
|||
|
public static HSSEData_HSSE GetTodayData()
|
|||
|
{
|
|||
|
var q = (from x in Funs.DB.HSSEData_HSSE
|
|||
|
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
|||
|
select x).FirstOrDefault();
|
|||
|
return q;
|
|||
|
}
|
|||
|
|
|||
|
public static void UpdateTodyData_State()
|
|||
|
{
|
|||
|
var q = GetTodayData();
|
|||
|
if (q != null)
|
|||
|
{
|
|||
|
q.State = Const.CNCEC_State_1;
|
|||
|
UpdateHSSEData_HSSE(q);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static bool IsReportByDate(DateTime dateTime)
|
|||
|
{
|
|||
|
var result = false;
|
|||
|
var q = (from x in Funs.DB.HSSEData_HSSE
|
|||
|
where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date
|
|||
|
select x).ToList();
|
|||
|
if (q.Count > 0) result = true;
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 判断当天是否已上报
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static bool IsReportByToday()
|
|||
|
{
|
|||
|
var result = false;
|
|||
|
var q = (from x in Funs.DB.HSSEData_HSSE
|
|||
|
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
|||
|
select x).ToList();
|
|||
|
if (q.Count > 0) result = true;
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static ReturnData PushCncec(string id)
|
|||
|
{
|
|||
|
var baseurl = "/api/HSSEData/SaveHSSEData";
|
|||
|
var item = GetItemById(id);
|
|||
|
var str = JsonConvert.SerializeObject(item);
|
|||
|
var responeData = ServerService.PushCNCEC(str, baseurl);
|
|||
|
return responeData;
|
|||
|
}
|
|||
|
|
|||
|
public static Model.HSSEData_HSSE GetSubUnitHsseDataByDate(string Unitid, DateTime? reportdate)
|
|||
|
{
|
|||
|
var result = new Model.HSSEData_HSSE();
|
|||
|
if (reportdate == null)
|
|||
|
{
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
var projectlist = BLL.ProjectService.GetProjectWorkList(Unitid);
|
|||
|
var baseUnit = UnitService.GetUnitByUnitId(Unitid);
|
|||
|
var projectData = (from x in Funs.DB.Project_HSSEData_HSSE
|
|||
|
where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId)
|
|||
|
select x).ToList();
|
|||
|
result = new HSSEData_HSSE
|
|||
|
{
|
|||
|
UnitId = Unitid,
|
|||
|
CollCropCode = baseUnit.CollCropCode,
|
|||
|
UnitName = baseUnit.UnitName,
|
|||
|
ReportDate = DateTime.Now.Date,
|
|||
|
BeUnderConstructionNum = projectData.Sum(x => x.BeUnderConstructionNum),
|
|||
|
ShutdownNum = projectData.Sum(x => x.ShutdownNum),
|
|||
|
JoinConstructionPersonNum = projectData.Sum(x => x.JoinConstructionPersonNum),
|
|||
|
MajorProjectsUnderConstructionNum = projectData.Sum(x => x.MajorProjectsUnderConstructionNum),
|
|||
|
TotalWorkingHour = projectData.Sum(x => x.TotalWorkingHour),
|
|||
|
LostWorkingHour = projectData.Sum(x => x.LostWorkingHour),
|
|||
|
SafeWorkingHour = projectData.Sum(x => x.SafeWorkingHour),
|
|||
|
SafeTrainNum = projectData.Sum(x => x.SafeTrainNum),
|
|||
|
SpecialTrainNum = projectData.Sum(x => x.SpecialTrainNum),
|
|||
|
SpecialOperationTrainNum = projectData.Sum(x => x.SpecialOperationTrainNum),
|
|||
|
TotalEnergyConsumption = 0,
|
|||
|
IncomeComprehensiveEnergyConsumption = 0,
|
|||
|
NewWaterConsumption = 0,
|
|||
|
HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneral().Count,
|
|||
|
HeadOfficeFullTimeNum = GetHeadOfficeFullTime().Count,
|
|||
|
BranchInspectorGeneralNum = GetBranchInspectorGeneral().Count,
|
|||
|
BranchFullTimeNum = GetBranchFullTime().Count,
|
|||
|
ProjectInspectorGeneralNum = projectData.Sum(x => x.ProjectInspectorGeneralNum),
|
|||
|
ProjectFullTimeNum = projectData.Sum(x => x.ProjectFullTimeNum),
|
|||
|
ProjectSafetyMonitorNum = projectData.Sum(x => x.ProjectSafetyMonitorNum),
|
|||
|
SafetyInjectionEngineer = projectData.Sum(x => x.SafetyInjectionEngineer),
|
|||
|
CertificateANum = projectData.Sum(x => x.CertificateANum),
|
|||
|
CertificateBNum = projectData.Sum(x => x.CertificateBNum),
|
|||
|
CertificateCNum = projectData.Sum(x => x.CertificateCNum),
|
|||
|
SafetyCommitteeMeetingNum = GetSafetyCommitteeMeeting().Count,
|
|||
|
EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(),
|
|||
|
ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum),
|
|||
|
ProjectSafetyMeetingNum = projectData.Sum(x => x.ProjectSafetyMeetingNum),
|
|||
|
CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheck().Count,
|
|||
|
CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheck().Count,
|
|||
|
CompanySpecialCheckNum = GetCompanySpecialCheck().Count,
|
|||
|
ProjectLeadShiftCheckNum = projectData.Sum(x => x.ProjectLeadShiftCheckNum),
|
|||
|
ProjectSpecialCheckNum = projectData.Sum(x => x.ProjectSpecialCheckNum),
|
|||
|
ProjectMajorCheckNum = projectData.Sum(x => x.ProjectMajorCheckNum),
|
|||
|
NearMissNum = projectData.Sum(x => x.NearMissNum),
|
|||
|
RecordableEventNum = projectData.Sum(x => x.RecordableEventNum),
|
|||
|
GeneralAccidentNum = projectData.Sum(x => x.GeneralAccidentNum),
|
|||
|
MajorAccidentNum = projectData.Sum(x => x.MajorAccidentNum),
|
|||
|
SeriousAccidentNum = projectData.Sum(x => x.SeriousAccidentNum),
|
|||
|
SpecialSeriousAccidentNum = projectData.Sum(x => x.SpecialSeriousAccidentNum),
|
|||
|
// CompanyComprehensivePlanNum = GetCompanyComprehensivePlan(),
|
|||
|
// CompanySpecialPlanNum = GetCompanySpecialPlan(),
|
|||
|
// CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(),
|
|||
|
// CompanyDrillNum = GetCompanyDrill(),
|
|||
|
ProjectComprehensivePlanNum = projectData.Sum(x => x.ProjectComprehensivePlanNum),
|
|||
|
ProjectSpecialPlanNum = projectData.Sum(x => x.ProjectSpecialPlanNum),
|
|||
|
ProjectOnSiteDisposalPlan = projectData.Sum(x => x.ProjectOnSiteDisposalPlan),
|
|||
|
ProjectDrillNum = projectData.Sum(x => x.ProjectDrillNum),
|
|||
|
CostExtract = projectData.Sum(x => x.CostExtract),
|
|||
|
CostUse = projectData.Sum(x => x.CostUse),
|
|||
|
UseEquipmentNum = projectData.Sum(x => x.UseEquipmentNum),
|
|||
|
SpecialEquipmentNum = projectData.Sum(x => x.SpecialEquipmentNum),
|
|||
|
LicensesNum = projectData.Sum(x => x.LicensesNum),
|
|||
|
LicensesCloseNum = projectData.Sum(x => x.LicensesCloseNum),
|
|||
|
GeneralClosedNum = projectData.Sum(x => x.GeneralClosedNum),
|
|||
|
GeneralNotClosedNum = projectData.Sum(x => x.GeneralNotClosedNum),
|
|||
|
MajorClosedNum = projectData.Sum(x => x.MajorClosedNum),
|
|||
|
MajorNotClosedNum = projectData.Sum(x => x.MajorNotClosedNum),
|
|||
|
GeneralRiskNum = projectData.Sum(x => x.GeneralRiskNum),
|
|||
|
LowRiskNum = projectData.Sum(x => x.LowRiskNum),
|
|||
|
MediumRiskNum = projectData.Sum(x => x.MediumRiskNum),
|
|||
|
HighRiskNum = projectData.Sum(x => x.HighRiskNum),
|
|||
|
CompletedNum = projectData.Sum(x => x.CompletedNum),
|
|||
|
TrainPersonNum = projectData.Sum(x => x.TrainPersonNum),
|
|||
|
ConstructionNum = projectData.Sum(x => x.ConstructionNum),
|
|||
|
FinishedNum = projectData.Sum(x => x.FinishedNum),
|
|||
|
SuperCompletedNum = projectData.Sum(x => x.SuperCompletedNum),
|
|||
|
SuperTrainPersonNum = projectData.Sum(x => x.SuperTrainPersonNum),
|
|||
|
SuperConstructionNum = projectData.Sum(x => x.SuperConstructionNum),
|
|||
|
SuperFinishedNum = projectData.Sum(x => x.SuperFinishedNum),
|
|||
|
CreateMan = Const.sysglyId,
|
|||
|
CreateDate = DateTime.Now
|
|||
|
};
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static HSSEData StatisticalData()
|
|||
|
{
|
|||
|
var thisUnitId = string.Empty;
|
|||
|
var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
|
|||
|
var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
|
|||
|
Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData();
|
|||
|
|
|||
|
var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption();
|
|||
|
var incomeComprehensiveEnergyConsumption =
|
|||
|
ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
|
|||
|
var newWaterConsumption = ChemicalReportItemService.GetLatstTimeNewWaterConsumption();
|
|||
|
|
|||
|
var table = new HSSEData_HSSE
|
|||
|
{
|
|||
|
UnitId = thisUnitId,
|
|||
|
CollCropCode = baseUnit.CollCropCode,
|
|||
|
UnitName = baseUnit.UnitName,
|
|||
|
ReportDate = DateTime.Now.Date,
|
|||
|
BeUnderConstructionNum = GetBeUnderConstruction().Count,
|
|||
|
ShutdownNum = GetShutdown().Count,
|
|||
|
JoinConstructionPersonNum = GetJoinConstructionPerson().Count,
|
|||
|
MajorProjectsUnderConstructionNum = GetMajorProjectsUnderConstruction().Count,
|
|||
|
TotalWorkingHour = GetTotalWorkingHour(),
|
|||
|
LostWorkingHour = GetLostWorkingHour(),
|
|||
|
SafeWorkingHour = GetSafeWorkingHour(),
|
|||
|
SafeTrainNum = GetSafeTrain().Sum(x => x.TrainPersonNum),
|
|||
|
SpecialTrainNum = GetSpecialTrain().Sum(x => x.TrainPersonNum),
|
|||
|
SpecialOperationTrainNum = GetSpecialOperationTrain().Sum(x => x.TrainPersonNum),
|
|||
|
EnvironmentalTrainNum = 0,
|
|||
|
TotalEnergyConsumption = totalEnergyConsumption,
|
|||
|
IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption,
|
|||
|
NewWaterConsumption = newWaterConsumption,
|
|||
|
HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneral().Count,
|
|||
|
HeadOfficeFullTimeNum = GetHeadOfficeFullTime().Count,
|
|||
|
BranchInspectorGeneralNum = GetBranchInspectorGeneral().Count,
|
|||
|
BranchFullTimeNum = GetBranchFullTime().Count,
|
|||
|
ProjectInspectorGeneralNum = GetProjectInspectorGeneral().Count,
|
|||
|
ProjectFullTimeNum = GetProjectFullTime().Count,
|
|||
|
ProjectSafetyMonitorNum = GetProjectSafetyMonitor().Count,
|
|||
|
SafetyInjectionEngineer = GetSafetyInjectionEngineer().Count,
|
|||
|
CertificateANum = GetCertificateA().Count,
|
|||
|
CertificateBNum = GetCertificateB().Count,
|
|||
|
CertificateCNum = GetCertificateC().Count,
|
|||
|
SafetyCommitteeMeetingNum = GetSafetyCommitteeMeeting().Count,
|
|||
|
EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeeting().Count,
|
|||
|
ProjectSafetyLeadingGroupMeetingNum = GetProjectSafetyLeadingGroupMeeting().Count,
|
|||
|
ProjectSafetyMeetingNum = GetProjectSafetyMeeting().Count,
|
|||
|
CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheck().Count,
|
|||
|
CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheck().Count,
|
|||
|
CompanySpecialCheckNum = GetCompanySpecialCheck().Count,
|
|||
|
ProjectLeadShiftCheckNum = GetProjectLeadShiftCheck().Count,
|
|||
|
ProjectSpecialCheckNum = GetProjectSpecialCheck().Count,
|
|||
|
ProjectMajorCheckNum = GetProjectMajorCheck().Count,
|
|||
|
NearMissNum = GetNearMiss().Count,
|
|||
|
RecordableEventNum = GetRecordableEvent().Count,
|
|||
|
GeneralAccidentNum = GetGeneralAccident().Count,
|
|||
|
MajorAccidentNum = GetMajorAccident().Count,
|
|||
|
SeriousAccidentNum = GetSeriousAccident().Count,
|
|||
|
SpecialSeriousAccidentNum = GetSpecialSeriousAccident().Count,
|
|||
|
CompanyComprehensivePlanNum = GetCompanyComprehensivePlan().Count,
|
|||
|
CompanySpecialPlanNum = GetCompanySpecialPlan().Count,
|
|||
|
CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan().Count,
|
|||
|
CompanyDrillNum = GetCompanyDrill().Count,
|
|||
|
ProjectComprehensivePlanNum = GetProjectComprehensivePlan().Count,
|
|||
|
ProjectSpecialPlanNum = GetProjectSpecialPlan().Count,
|
|||
|
ProjectOnSiteDisposalPlan = GetProjectOnSiteDisposalPlan().Count,
|
|||
|
ProjectDrillNum = GetProjectDrill().Count,
|
|||
|
CostExtract = Convert.ToInt32(GetCostExtract().Sum(x => x.SUMCost)),
|
|||
|
CostUse = Convert.ToInt32(GetCostUse().Sum(x => x.SUMCost)),
|
|||
|
UseEquipmentNum = GetUseEquipment().Count,
|
|||
|
SpecialEquipmentNum = GetSpecialEquipment().Count,
|
|||
|
LicensesNum = GetLicenses().Count,
|
|||
|
LicensesCloseNum = GetLicensesClose().Count,
|
|||
|
GeneralClosedNum = GetGeneralHiddenRectificationOutputs().Sum(x => x.RecNum),
|
|||
|
GeneralNotClosedNum = GetGeneralHiddenRectificationOutputs().Sum(x => x.NoRecNum),
|
|||
|
MajorClosedNum = GetMajorHiddenRectificationOutputs().Sum(x => x.RecNum),
|
|||
|
MajorNotClosedNum = GetMajorHiddenRectificationOutputs().Sum(x => x.NoRecNum),
|
|||
|
GeneralRiskNum = GetSecurityRiskOutputs().Sum(x => x.GeneralRiskNum),
|
|||
|
LowRiskNum = GetSecurityRiskOutputs().Sum(x => x.LowRiskNum),
|
|||
|
MediumRiskNum = GetSecurityRiskOutputs().Sum(x => x.MediumRiskNum),
|
|||
|
HighRiskNum = GetSecurityRiskOutputs().Sum(x => x.HighRiskNum),
|
|||
|
CompletedNum = GetLargeEngineeringOutputs().Sum(x => x.CompletedNum),
|
|||
|
TrainPersonNum = GetLargeEngineeringOutputs().Sum(x => x.TrainPersonNum),
|
|||
|
ConstructionNum = GetLargeEngineeringOutputs().Sum(x => x.ConstructionNum),
|
|||
|
FinishedNum = GetLargeEngineeringOutputs().Sum(x => x.FinishedNum),
|
|||
|
SuperCompletedNum = GetLargeEngineeringOutputs().Sum(x => x.SuperCompletedNum),
|
|||
|
SuperTrainPersonNum = GetLargeEngineeringOutputs().Sum(x => x.SuperTrainPersonNum),
|
|||
|
SuperConstructionNum = GetLargeEngineeringOutputs().Sum(x => x.SuperConstructionNum),
|
|||
|
SuperFinishedNum = GetLargeEngineeringOutputs().Sum(x => x.SuperFinishedNum),
|
|||
|
CreateMan = Const.sysglyId,
|
|||
|
CreateDate = DateTime.Now
|
|||
|
};
|
|||
|
if (IsReportByToday())
|
|||
|
{
|
|||
|
table.Id = GetTodayData().Id;
|
|||
|
table.State = Const.CNCEC_State_1;
|
|||
|
UpdateHSSEData_HSSE(table);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
table.Id = SQLHelper.GetNewID();
|
|||
|
table.State = Const.CNCEC_State_0;
|
|||
|
AddHSSEData_HSSE(table);
|
|||
|
}
|
|||
|
|
|||
|
var data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel());
|
|||
|
return data;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<HSSEData> StatisticalDataAsync()
|
|||
|
{
|
|||
|
var thisUnitId = string.Empty;
|
|||
|
var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
|
|||
|
var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
|
|||
|
Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData();
|
|||
|
|
|||
|
// 并行执行异步方法
|
|||
|
var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption();
|
|||
|
var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
|
|||
|
var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption();
|
|||
|
var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync();
|
|||
|
var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync();
|
|||
|
|
|||
|
var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync();
|
|||
|
var certificateATask = HSSEData_HSSEService.GetCertificateAAsync();
|
|||
|
var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync();
|
|||
|
var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync();
|
|||
|
var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync();
|
|||
|
var shutdownTask = HSSEData_HSSEService.GetShutdownAsync();
|
|||
|
var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync();
|
|||
|
var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync();
|
|||
|
var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync();
|
|||
|
var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync();
|
|||
|
var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync();
|
|||
|
var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync();
|
|||
|
var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync();
|
|||
|
var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync();
|
|||
|
var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync();
|
|||
|
var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync();
|
|||
|
var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync();
|
|||
|
var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync();
|
|||
|
var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync();
|
|||
|
var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync();
|
|||
|
var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync();
|
|||
|
var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync();
|
|||
|
var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync();
|
|||
|
var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync();
|
|||
|
var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync();
|
|||
|
var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync();
|
|||
|
var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync();
|
|||
|
var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync();
|
|||
|
var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync();
|
|||
|
var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync();
|
|||
|
var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync();
|
|||
|
var nearMissTask = HSSEData_HSSEService.GetNearMissAsync();
|
|||
|
var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync();
|
|||
|
var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync();
|
|||
|
var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync();
|
|||
|
var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync();
|
|||
|
var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync();
|
|||
|
var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync();
|
|||
|
var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync();
|
|||
|
var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync();
|
|||
|
var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync();
|
|||
|
var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync();
|
|||
|
var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync();
|
|||
|
var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync();
|
|||
|
var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync();
|
|||
|
var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync();
|
|||
|
var costUseTask = HSSEData_HSSEService.GetCostUseAsync();
|
|||
|
var useEquipmentTask = HSSEData_HSSEService.GetUseEquipmentAsync();
|
|||
|
var specialEquipmentTask = HSSEData_HSSEService.GetSpecialEquipmentAsync();
|
|||
|
var licensesTask = HSSEData_HSSEService.GetLicensesAsync();
|
|||
|
var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync();
|
|||
|
var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync();
|
|||
|
var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync();
|
|||
|
|
|||
|
// 等待所有异步方法执行完成
|
|||
|
await Task.WhenAll(
|
|||
|
securityRiskOutputListTask,
|
|||
|
largeEngineeringOutputsTask,
|
|||
|
safetyInjectionEngineerTask,
|
|||
|
certificateATask,
|
|||
|
certificateBTask,
|
|||
|
certificateCTask,
|
|||
|
beUnderConstructionTask,
|
|||
|
shutdownTask,
|
|||
|
joinConstructionPersonTask,
|
|||
|
majorProjectsUnderConstructionTask,
|
|||
|
totalWorkingHourTask,
|
|||
|
lostWorkingHourTask,
|
|||
|
safeWorkingHourTask,
|
|||
|
safeTrainTask,
|
|||
|
specialTrainTask,
|
|||
|
specialOperationTrainTask,
|
|||
|
headOfficeInspectorGeneralTask,
|
|||
|
headOfficeFullTimeTask,
|
|||
|
branchInspectorGeneralTask,
|
|||
|
branchFullTimeTask,
|
|||
|
projectInspectorGeneralTask,
|
|||
|
projectFullTimeTask,
|
|||
|
projectSafetyMonitorTask,
|
|||
|
safetyCommitteeMeetingTask,
|
|||
|
enterpriseTopicsMeetingTask,
|
|||
|
projectSafetyLeadingGroupMeetingTask,
|
|||
|
projectSafetyMeetingTask,
|
|||
|
companyLeadShiftCheckTask,
|
|||
|
companyComprehensiveCheckTask,
|
|||
|
companySpecialCheckTask,
|
|||
|
projectLeadShiftCheckTask,
|
|||
|
projectSpecialCheckTask,
|
|||
|
projectMajorCheckTask,
|
|||
|
nearMissTask,
|
|||
|
recordableEventTask,
|
|||
|
generalAccidentTask,
|
|||
|
majorAccidentTask,
|
|||
|
seriousAccidentTask,
|
|||
|
specialSeriousAccidentTask,
|
|||
|
companyComprehensivePlanTask,
|
|||
|
companySpecialPlanTask,
|
|||
|
companyOnSiteDisposalPlanTask,
|
|||
|
companyDrillTask,
|
|||
|
projectComprehensivePlanTask,
|
|||
|
projectSpecialPlanTask,
|
|||
|
projectOnSiteDisposalPlanTask,
|
|||
|
projectDrillTask,
|
|||
|
costExtractTask,
|
|||
|
costUseTask,
|
|||
|
useEquipmentTask,
|
|||
|
specialEquipmentTask,
|
|||
|
licensesTask,
|
|||
|
licensesCloseTask,
|
|||
|
generalHiddenRectificationOutputsTask,
|
|||
|
majorHiddenRectificationOutputsTask
|
|||
|
);
|
|||
|
|
|||
|
|
|||
|
// 统一获取异步方法的返回值
|
|||
|
var totalEnergyConsumption = totalEnergyConsumptionTask;
|
|||
|
var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask;
|
|||
|
var newWaterConsumption = newWaterConsumptionTask;
|
|||
|
var safetyInjectionEngineerList = await safetyInjectionEngineerTask;
|
|||
|
var certificateAList = await certificateATask;
|
|||
|
var certificateBList = await certificateBTask;
|
|||
|
var certificateCList = await certificateCTask;
|
|||
|
var beUnderConstructionList = await beUnderConstructionTask;
|
|||
|
var shutdownList = await shutdownTask;
|
|||
|
var joinConstructionPersonList = await joinConstructionPersonTask;
|
|||
|
var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask;
|
|||
|
var totalWorkingHour = await totalWorkingHourTask;
|
|||
|
var lostWorkingHour = await lostWorkingHourTask;
|
|||
|
var safeWorkingHour = await safeWorkingHourTask;
|
|||
|
var safeTrainList = await safeTrainTask;
|
|||
|
var specialTrainList = await specialTrainTask;
|
|||
|
var specialOperationTrainList = await specialOperationTrainTask;
|
|||
|
var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask;
|
|||
|
var headOfficeFullTimeList = await headOfficeFullTimeTask;
|
|||
|
var branchInspectorGeneralList = await branchInspectorGeneralTask;
|
|||
|
var branchFullTimeList = await branchFullTimeTask;
|
|||
|
var projectInspectorGeneralList = await projectInspectorGeneralTask;
|
|||
|
var projectFullTimeList = await projectFullTimeTask;
|
|||
|
var projectSafetyMonitorList = await projectSafetyMonitorTask;
|
|||
|
var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask;
|
|||
|
var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask;
|
|||
|
var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask;
|
|||
|
var projectSafetyMeetingList = await projectSafetyMeetingTask;
|
|||
|
var companyLeadShiftCheckList = await companyLeadShiftCheckTask;
|
|||
|
var companyComprehensiveCheckList = await companyComprehensiveCheckTask;
|
|||
|
var companySpecialCheckList = await companySpecialCheckTask;
|
|||
|
var projectLeadShiftCheckList = await projectLeadShiftCheckTask;
|
|||
|
var projectSpecialCheckList = await projectSpecialCheckTask;
|
|||
|
var projectMajorCheckList = await projectMajorCheckTask;
|
|||
|
var nearMissList = await nearMissTask;
|
|||
|
var recordableEventList = await recordableEventTask;
|
|||
|
var generalAccidentList = await generalAccidentTask;
|
|||
|
var majorAccidentList = await majorAccidentTask;
|
|||
|
var seriousAccidentList = await seriousAccidentTask;
|
|||
|
var specialSeriousAccidentList = await specialSeriousAccidentTask;
|
|||
|
var companyComprehensivePlanList = await companyComprehensivePlanTask;
|
|||
|
var companySpecialPlanList = await companySpecialPlanTask;
|
|||
|
var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask;
|
|||
|
var companyDrillList = await companyDrillTask;
|
|||
|
var projectComprehensivePlanList = await projectComprehensivePlanTask;
|
|||
|
var projectSpecialPlanList = await projectSpecialPlanTask;
|
|||
|
var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask;
|
|||
|
var projectDrillList = await projectDrillTask;
|
|||
|
var costExtract = await costExtractTask;
|
|||
|
var costUseList = await costUseTask;
|
|||
|
var useEquipmentList = await useEquipmentTask;
|
|||
|
var specialEquipmentList = await specialEquipmentTask;
|
|||
|
var licensesList = await licensesTask;
|
|||
|
var licensesCloseList = await licensesCloseTask;
|
|||
|
var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask;
|
|||
|
var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask;
|
|||
|
|
|||
|
// 构造结果对象
|
|||
|
var table = new HSSEData_HSSE
|
|||
|
{
|
|||
|
UnitId = thisUnitId,
|
|||
|
CollCropCode = baseUnit.CollCropCode,
|
|||
|
UnitName = baseUnit.UnitName,
|
|||
|
ReportDate = DateTime.Now.Date,
|
|||
|
BeUnderConstructionNum = beUnderConstructionList.Count(),
|
|||
|
ShutdownNum = shutdownList.Count(),
|
|||
|
SafetyInjectionEngineer = safetyInjectionEngineerList.Count(),
|
|||
|
CertificateANum = certificateAList.Count(),
|
|||
|
CertificateBNum = certificateBList.Count(),
|
|||
|
CertificateCNum = certificateCList.Count(),
|
|||
|
JoinConstructionPersonNum = joinConstructionPersonList.Count(),
|
|||
|
MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(),
|
|||
|
TotalWorkingHour = totalWorkingHour,
|
|||
|
LostWorkingHour = lostWorkingHour,
|
|||
|
SafeWorkingHour = safeWorkingHour,
|
|||
|
SafeTrainNum = safeTrainList.Sum(x => x.TrainPersonNum),
|
|||
|
SpecialTrainNum = specialTrainList.Sum(x => x.TrainPersonNum),
|
|||
|
SpecialOperationTrainNum = specialOperationTrainList.Sum(x => x.TrainPersonNum),
|
|||
|
EnvironmentalTrainNum = 0,
|
|||
|
TotalEnergyConsumption = totalEnergyConsumption,
|
|||
|
IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption,
|
|||
|
NewWaterConsumption = newWaterConsumption,
|
|||
|
HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count,
|
|||
|
HeadOfficeFullTimeNum = headOfficeFullTimeList.Count,
|
|||
|
BranchInspectorGeneralNum = branchInspectorGeneralList.Count,
|
|||
|
BranchFullTimeNum = branchFullTimeList.Count,
|
|||
|
ProjectInspectorGeneralNum = projectInspectorGeneralList.Count,
|
|||
|
ProjectFullTimeNum = projectFullTimeList.Count,
|
|||
|
ProjectSafetyMonitorNum = projectSafetyMonitorList.Count,
|
|||
|
SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(),
|
|||
|
EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count(),
|
|||
|
ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(),
|
|||
|
ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(),
|
|||
|
CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(),
|
|||
|
CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(),
|
|||
|
CompanySpecialCheckNum = companySpecialCheckList.Count(),
|
|||
|
ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(),
|
|||
|
ProjectSpecialCheckNum = projectSpecialCheckList.Count(),
|
|||
|
ProjectMajorCheckNum = projectMajorCheckList.Count(),
|
|||
|
NearMissNum = nearMissList.Count(),
|
|||
|
RecordableEventNum = recordableEventList.Count(),
|
|||
|
GeneralAccidentNum = generalAccidentList.Count(),
|
|||
|
MajorAccidentNum = majorAccidentList.Count(),
|
|||
|
SeriousAccidentNum = seriousAccidentList.Count(),
|
|||
|
SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(),
|
|||
|
CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(),
|
|||
|
CompanySpecialPlanNum = companySpecialPlanList.Count(),
|
|||
|
CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(),
|
|||
|
CompanyDrillNum = companyDrillList.Count(),
|
|||
|
ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(),
|
|||
|
ProjectSpecialPlanNum = projectSpecialPlanList.Count(),
|
|||
|
ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(),
|
|||
|
ProjectDrillNum = projectDrillList.Count(),
|
|||
|
CostExtract = Convert.ToInt32(costExtract.Sum(x => x.SUMCost)),
|
|||
|
CostUse = Convert.ToInt32(costUseList.Sum(x => x.SUMCost)),
|
|||
|
UseEquipmentNum = useEquipmentList.Count(),
|
|||
|
SpecialEquipmentNum = specialEquipmentList.Count(),
|
|||
|
LicensesNum = licensesList.Count(),
|
|||
|
LicensesCloseNum = licensesCloseList.Count(),
|
|||
|
GeneralClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.RecNum),
|
|||
|
GeneralNotClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.NoRecNum),
|
|||
|
MajorClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.RecNum),
|
|||
|
MajorNotClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.NoRecNum),
|
|||
|
LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum),
|
|||
|
GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum),
|
|||
|
MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum),
|
|||
|
HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum),
|
|||
|
CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum),
|
|||
|
TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum),
|
|||
|
ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum),
|
|||
|
FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum),
|
|||
|
SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum),
|
|||
|
SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum),
|
|||
|
SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum)
|
|||
|
};
|
|||
|
|
|||
|
#region 添加项目统计数据
|
|||
|
|
|||
|
Project_HSSEData_HSSEService.DeleteProject_HSSEData_HSSEByDate(DateTime.Now.Date);
|
|||
|
foreach (var projectid in BeUnderConstructionList)
|
|||
|
{
|
|||
|
var projectHsseData = new Project_HSSEData_HSSE
|
|||
|
{
|
|||
|
Id = SQLHelper.GetNewID(),
|
|||
|
ProjectId = projectid,
|
|||
|
UnitId = thisUnitId,
|
|||
|
CollCropCode = baseUnit.CollCropCode,
|
|||
|
UnitName = baseUnit.UnitName,
|
|||
|
ReportDate = DateTime.Now.Date,
|
|||
|
JoinConstructionPersonNum = joinConstructionPersonList.Count(x => x.ProjectId == projectid),
|
|||
|
MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => x.ProjectId == projectid),
|
|||
|
TotalWorkingHour = 0,//工时数据取自集团报表,项目无法提取
|
|||
|
LostWorkingHour = 0,
|
|||
|
SafeWorkingHour = 0,
|
|||
|
SafeTrainNum = safeTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
|
|||
|
SpecialTrainNum = specialTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
|
|||
|
SpecialOperationTrainNum = specialOperationTrainList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
|
|||
|
EnvironmentalTrainNum = 0,
|
|||
|
TotalEnergyConsumption = 0,
|
|||
|
IncomeComprehensiveEnergyConsumption = 0,
|
|||
|
NewWaterConsumption = 0,
|
|||
|
HeadOfficeInspectorGeneralNum = 0,
|
|||
|
HeadOfficeFullTimeNum =0,
|
|||
|
BranchInspectorGeneralNum = 0,
|
|||
|
BranchFullTimeNum = 0,
|
|||
|
SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => x.ProjectId == projectid),
|
|||
|
EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => x.ProjectId == projectid),
|
|||
|
CertificateANum = certificateAList.Count(x => x.ProjectId == projectid),
|
|||
|
CertificateBNum = certificateBList.Count(x => x.ProjectId == projectid),
|
|||
|
CertificateCNum = certificateCList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectFullTimeNum = projectFullTimeList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => x.ProjectId == projectid),
|
|||
|
CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => x.ProjectId == projectid),
|
|||
|
CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => x.ProjectId == projectid),
|
|||
|
CompanySpecialCheckNum = companySpecialCheckList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectMajorCheckNum = projectMajorCheckList.Count(x => x.ProjectId == projectid),
|
|||
|
NearMissNum = nearMissList.Count(x => x.ProjectId == projectid),
|
|||
|
RecordableEventNum = recordableEventList.Count(x => x.ProjectId == projectid),
|
|||
|
GeneralAccidentNum = generalAccidentList.Count(x => x.ProjectId == projectid),
|
|||
|
MajorAccidentNum = majorAccidentList.Count(x => x.ProjectId == projectid),
|
|||
|
SeriousAccidentNum = seriousAccidentList.Count(x => x.ProjectId == projectid),
|
|||
|
SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => x.ProjectId == projectid),
|
|||
|
CompanyComprehensivePlanNum = 0,
|
|||
|
CompanySpecialPlanNum = 0,
|
|||
|
CompanyOnSiteDisposalPlan =0,
|
|||
|
CompanyDrillNum = 0,
|
|||
|
ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => x.ProjectId == projectid),
|
|||
|
ProjectDrillNum = projectDrillList.Count(x => x.ProjectId == projectid),
|
|||
|
CostExtract = Convert.ToInt32(costExtract.Where(x => x.ProjectId == projectid).Sum(x => x.SUMCost)),
|
|||
|
CostUse = Convert.ToInt32(costUseList.Where(x => x.ProjectId == projectid).Sum(x => x.SUMCost)),
|
|||
|
UseEquipmentNum = useEquipmentList.Count(x => x.ProjectId == projectid),
|
|||
|
SpecialEquipmentNum = specialEquipmentList.Count(x => x.ProjectId == projectid),
|
|||
|
LicensesNum = licensesList.Count(x => x.ProjectId == projectid),
|
|||
|
LicensesCloseNum = licensesCloseList.Count(x => x.ProjectId == projectid),
|
|||
|
GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.RecNum),
|
|||
|
GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.NoRecNum),
|
|||
|
MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.RecNum),
|
|||
|
MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => x.ProjectId == projectid).Sum(x => x.NoRecNum),
|
|||
|
LowRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.LowRiskNum),
|
|||
|
GeneralRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.GeneralRiskNum),
|
|||
|
MediumRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.MediumRiskNum),
|
|||
|
HighRiskNum = securityRiskOutputListTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.HighRiskNum),
|
|||
|
CompletedNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.CompletedNum),
|
|||
|
TrainPersonNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
|
|||
|
ConstructionNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.ConstructionNum),
|
|||
|
FinishedNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.FinishedNum),
|
|||
|
SuperCompletedNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.SuperCompletedNum),
|
|||
|
SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.SuperTrainPersonNum),
|
|||
|
SuperConstructionNum = largeEngineeringOutputsTask.Result.Where(x => x.ProjectId == projectid).Sum(x => x.SuperConstructionNum)
|
|||
|
};
|
|||
|
Project_HSSEData_HSSEService.AddProject_HSSEData_HSSE(projectHsseData);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
if (IsReportByToday())
|
|||
|
{
|
|||
|
table.Id = GetTodayData().Id;
|
|||
|
table.State = Const.CNCEC_State_1;
|
|||
|
UpdateHSSEData_HSSE(table);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
table.Id = SQLHelper.GetNewID();
|
|||
|
table.State = Const.CNCEC_State_0;
|
|||
|
AddHSSEData_HSSE(table);
|
|||
|
}
|
|||
|
|
|||
|
var data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel());
|
|||
|
return data;
|
|||
|
}
|
|||
|
|
|||
|
//public static HSSEData StatisticalDataOld()
|
|||
|
//{
|
|||
|
// var thisUnitId = string.Empty;
|
|||
|
// var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
// if (thisUnit != null) thisUnitId = thisUnit.UnitId;
|
|||
|
// var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
|
|||
|
// Project_HSSEData_HSSEService.StatisticalAllProjectData();
|
|||
|
// Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData();
|
|||
|
|
|||
|
// var projectData = (from x in Funs.DB.Project_HSSEData_HSSE
|
|||
|
// where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
|||
|
// select x).ToList();
|
|||
|
// var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption();
|
|||
|
// var incomeComprehensiveEnergyConsumption =
|
|||
|
// ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
|
|||
|
// var newWaterConsumption = ChemicalReportItemService.GetLatstTimeNewWaterConsumption();
|
|||
|
|
|||
|
// var table = new HSSEData_HSSE
|
|||
|
// {
|
|||
|
// UnitId = thisUnitId,
|
|||
|
// CollCropCode = baseUnit.CollCropCode,
|
|||
|
// UnitName = baseUnit.UnitName,
|
|||
|
// ReportDate = DateTime.Now.Date,
|
|||
|
// BeUnderConstructionNum = projectData.Sum(x => x.BeUnderConstructionNum),
|
|||
|
// ShutdownNum = projectData.Sum(x => x.ShutdownNum),
|
|||
|
// JoinConstructionPersonNum = projectData.Sum(x => x.JoinConstructionPersonNum),
|
|||
|
// MajorProjectsUnderConstructionNum = projectData.Sum(x => x.MajorProjectsUnderConstructionNum),
|
|||
|
// TotalWorkingHour = projectData.Sum(x => x.TotalWorkingHour),
|
|||
|
// LostWorkingHour = projectData.Sum(x => x.LostWorkingHour),
|
|||
|
// SafeWorkingHour = projectData.Sum(x => x.SafeWorkingHour),
|
|||
|
// SafeTrainNum = projectData.Sum(x => x.SafeTrainNum),
|
|||
|
// SpecialTrainNum = projectData.Sum(x => x.SpecialTrainNum),
|
|||
|
// SpecialOperationTrainNum = projectData.Sum(x => x.SpecialOperationTrainNum),
|
|||
|
// EnvironmentalTrainNum = projectData.Sum(x => x.EnvironmentalTrainNum),
|
|||
|
// TotalEnergyConsumption = totalEnergyConsumption,
|
|||
|
// IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption,
|
|||
|
// NewWaterConsumption = newWaterConsumption,
|
|||
|
// HeadOfficeInspectorGeneralNum = GetHeadOfficeInspectorGeneralNum(),
|
|||
|
// HeadOfficeFullTimeNum = GetHeadOfficeFullTimeNum(),
|
|||
|
// BranchInspectorGeneralNum = GetBranchInspectorGeneralNum(),
|
|||
|
// BranchFullTimeNum = GetBranchFullTimeNum(),
|
|||
|
// ProjectInspectorGeneralNum = projectData.Sum(x => x.ProjectInspectorGeneralNum),
|
|||
|
// ProjectFullTimeNum = projectData.Sum(x => x.ProjectFullTimeNum),
|
|||
|
// ProjectSafetyMonitorNum = projectData.Sum(x => x.ProjectSafetyMonitorNum),
|
|||
|
// SafetyInjectionEngineer = projectData.Sum(x => x.SafetyInjectionEngineer),
|
|||
|
// CertificateANum = projectData.Sum(x => x.CertificateANum),
|
|||
|
// CertificateBNum = projectData.Sum(x => x.CertificateBNum),
|
|||
|
// CertificateCNum = projectData.Sum(x => x.CertificateCNum),
|
|||
|
// SafetyCommitteeMeetingNum = GetSafetyCommitteeMeetingNum(),
|
|||
|
// EnterpriseTopicsMeetingNum = GetEnterpriseTopicsMeetingNum(),
|
|||
|
// ProjectSafetyLeadingGroupMeetingNum = projectData.Sum(x => x.ProjectSafetyLeadingGroupMeetingNum),
|
|||
|
// ProjectSafetyMeetingNum = projectData.Sum(x => x.ProjectSafetyMeetingNum),
|
|||
|
// // CompanyLeadShiftCheckNum = GetCompanyLeadShiftCheckNum(),
|
|||
|
// // CompanyComprehensiveCheckNum = GetCompanyComprehensiveCheckNum(),
|
|||
|
// // CompanySpecialCheckNum = GetCompanySpecialCheckNum(),
|
|||
|
// ProjectLeadShiftCheckNum = projectData.Sum(x => x.ProjectLeadShiftCheckNum),
|
|||
|
// ProjectSpecialCheckNum = projectData.Sum(x => x.ProjectSpecialCheckNum),
|
|||
|
// ProjectMajorCheckNum = projectData.Sum(x => x.ProjectMajorCheckNum),
|
|||
|
// NearMissNum = projectData.Sum(x => x.NearMissNum),
|
|||
|
// RecordableEventNum = projectData.Sum(x => x.RecordableEventNum),
|
|||
|
// GeneralAccidentNum = projectData.Sum(x => x.GeneralAccidentNum),
|
|||
|
// MajorAccidentNum = projectData.Sum(x => x.MajorAccidentNum),
|
|||
|
// SeriousAccidentNum = projectData.Sum(x => x.SeriousAccidentNum),
|
|||
|
// SpecialSeriousAccidentNum = projectData.Sum(x => x.SpecialSeriousAccidentNum),
|
|||
|
// //CompanyComprehensivePlanNum = GetCompanyComprehensivePlan(),
|
|||
|
// // CompanySpecialPlanNum = GetCompanySpecialPlan(),
|
|||
|
// // CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(),
|
|||
|
// // CompanyDrillNum = GetCompanyDrill(),
|
|||
|
// ProjectComprehensivePlanNum = projectData.Sum(x => x.ProjectComprehensivePlanNum),
|
|||
|
// ProjectSpecialPlanNum = projectData.Sum(x => x.ProjectSpecialPlanNum),
|
|||
|
// ProjectOnSiteDisposalPlan = projectData.Sum(x => x.ProjectOnSiteDisposalPlan),
|
|||
|
// ProjectDrillNum = projectData.Sum(x => x.ProjectDrillNum),
|
|||
|
// CostExtract = projectData.Sum(x => x.CostExtract),
|
|||
|
// CostUse = projectData.Sum(x => x.CostUse),
|
|||
|
// UseEquipmentNum = projectData.Sum(x => x.UseEquipmentNum),
|
|||
|
// SpecialEquipmentNum = projectData.Sum(x => x.SpecialEquipmentNum),
|
|||
|
// LicensesNum = projectData.Sum(x => x.LicensesNum),
|
|||
|
// LicensesCloseNum = projectData.Sum(x => x.LicensesCloseNum),
|
|||
|
// GeneralClosedNum = projectData.Sum(x => x.GeneralClosedNum),
|
|||
|
// GeneralNotClosedNum = projectData.Sum(x => x.GeneralNotClosedNum),
|
|||
|
// MajorClosedNum = projectData.Sum(x => x.MajorClosedNum),
|
|||
|
// MajorNotClosedNum = projectData.Sum(x => x.MajorNotClosedNum),
|
|||
|
// GeneralRiskNum = projectData.Sum(x => x.GeneralRiskNum),
|
|||
|
// LowRiskNum = projectData.Sum(x => x.LowRiskNum),
|
|||
|
// MediumRiskNum = projectData.Sum(x => x.MediumRiskNum),
|
|||
|
// HighRiskNum = projectData.Sum(x => x.HighRiskNum),
|
|||
|
// CompletedNum = projectData.Sum(x => x.CompletedNum),
|
|||
|
// TrainPersonNum = projectData.Sum(x => x.TrainPersonNum),
|
|||
|
// ConstructionNum = projectData.Sum(x => x.ConstructionNum),
|
|||
|
// FinishedNum = projectData.Sum(x => x.FinishedNum),
|
|||
|
// SuperCompletedNum = projectData.Sum(x => x.SuperCompletedNum),
|
|||
|
// SuperTrainPersonNum = projectData.Sum(x => x.SuperTrainPersonNum),
|
|||
|
// SuperConstructionNum = projectData.Sum(x => x.SuperConstructionNum),
|
|||
|
// SuperFinishedNum = projectData.Sum(x => x.SuperFinishedNum),
|
|||
|
// CreateMan = Const.sysglyId,
|
|||
|
// CreateDate = DateTime.Now
|
|||
|
// };
|
|||
|
// if (IsReportByToday())
|
|||
|
// {
|
|||
|
// table.Id = GetTodayData().Id;
|
|||
|
// table.State = Const.CNCEC_State_1;
|
|||
|
// UpdateHSSEData_HSSE(table);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// table.Id = SQLHelper.GetNewID();
|
|||
|
// table.State = Const.CNCEC_State_0;
|
|||
|
// AddHSSEData_HSSE(table);
|
|||
|
// }
|
|||
|
|
|||
|
// var data = GetItemByHSSEData_HSSE(table, Project_HSSEData_HiddenDangerDetailService.GetTodayModel());
|
|||
|
// return data;
|
|||
|
//}
|
|||
|
|
|||
|
public static void UpdateHSSEData_HSSE(HSSEData_HSSE newtable)
|
|||
|
{
|
|||
|
using (var db = new SGGLDB(Funs.ConnString))
|
|||
|
{
|
|||
|
var table = db.HSSEData_HSSE.FirstOrDefault(x => x.Id == newtable.Id);
|
|||
|
if (table != null)
|
|||
|
{
|
|||
|
table.Id = newtable.Id;
|
|||
|
table.UnitId = newtable.UnitId;
|
|||
|
table.CollCropCode = newtable.CollCropCode;
|
|||
|
table.UnitName = newtable.UnitName;
|
|||
|
table.ReportDate = newtable.ReportDate;
|
|||
|
table.BeUnderConstructionNum = newtable.BeUnderConstructionNum;
|
|||
|
table.ShutdownNum = newtable.ShutdownNum;
|
|||
|
table.JoinConstructionPersonNum = newtable.JoinConstructionPersonNum;
|
|||
|
table.MajorProjectsUnderConstructionNum = newtable.MajorProjectsUnderConstructionNum;
|
|||
|
table.TotalWorkingHour = newtable.TotalWorkingHour;
|
|||
|
table.LostWorkingHour = newtable.LostWorkingHour;
|
|||
|
table.SafeWorkingHour = newtable.SafeWorkingHour;
|
|||
|
table.SafeTrainNum = newtable.SafeTrainNum;
|
|||
|
table.SpecialTrainNum = newtable.SpecialTrainNum;
|
|||
|
table.SpecialOperationTrainNum = newtable.SpecialOperationTrainNum;
|
|||
|
table.EnvironmentalTrainNum = newtable.EnvironmentalTrainNum;
|
|||
|
table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
|
|||
|
table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
|
|||
|
table.NewWaterConsumption = newtable.NewWaterConsumption;
|
|||
|
table.HeadOfficeInspectorGeneralNum = newtable.HeadOfficeInspectorGeneralNum;
|
|||
|
table.HeadOfficeFullTimeNum = newtable.HeadOfficeFullTimeNum;
|
|||
|
table.BranchInspectorGeneralNum = newtable.BranchInspectorGeneralNum;
|
|||
|
table.BranchFullTimeNum = newtable.BranchFullTimeNum;
|
|||
|
table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum;
|
|||
|
table.ProjectFullTimeNum = newtable.ProjectFullTimeNum;
|
|||
|
table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum;
|
|||
|
table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer;
|
|||
|
table.CertificateANum = newtable.CertificateANum;
|
|||
|
table.CertificateBNum = newtable.CertificateBNum;
|
|||
|
table.CertificateCNum = newtable.CertificateCNum;
|
|||
|
table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum;
|
|||
|
table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum;
|
|||
|
table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum;
|
|||
|
table.ProjectSafetyMeetingNum = newtable.ProjectSafetyMeetingNum;
|
|||
|
table.CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum;
|
|||
|
table.CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum;
|
|||
|
table.CompanySpecialCheckNum = newtable.CompanySpecialCheckNum;
|
|||
|
table.ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum;
|
|||
|
table.ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum;
|
|||
|
table.ProjectMajorCheckNum = newtable.ProjectMajorCheckNum;
|
|||
|
table.NearMissNum = newtable.NearMissNum;
|
|||
|
table.RecordableEventNum = newtable.RecordableEventNum;
|
|||
|
table.GeneralAccidentNum = newtable.GeneralAccidentNum;
|
|||
|
table.MajorAccidentNum = newtable.MajorAccidentNum;
|
|||
|
table.SeriousAccidentNum = newtable.SeriousAccidentNum;
|
|||
|
table.SpecialSeriousAccidentNum = newtable.SpecialSeriousAccidentNum;
|
|||
|
table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum;
|
|||
|
table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum;
|
|||
|
table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan;
|
|||
|
table.CompanyDrillNum = newtable.CompanyDrillNum;
|
|||
|
table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum;
|
|||
|
table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum;
|
|||
|
table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan;
|
|||
|
table.ProjectDrillNum = newtable.ProjectDrillNum;
|
|||
|
table.CostExtract = newtable.CostExtract;
|
|||
|
table.CostUse = newtable.CostUse;
|
|||
|
table.UseEquipmentNum = newtable.UseEquipmentNum;
|
|||
|
table.SpecialEquipmentNum = newtable.SpecialEquipmentNum;
|
|||
|
table.LicensesNum = newtable.LicensesNum;
|
|||
|
table.LicensesCloseNum = newtable.LicensesCloseNum;
|
|||
|
table.GeneralClosedNum = newtable.GeneralClosedNum;
|
|||
|
table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
|
|||
|
table.MajorClosedNum = newtable.MajorClosedNum;
|
|||
|
table.MajorNotClosedNum = newtable.MajorNotClosedNum;
|
|||
|
table.GeneralRiskNum = newtable.GeneralRiskNum;
|
|||
|
table.LowRiskNum = newtable.LowRiskNum;
|
|||
|
table.MediumRiskNum = newtable.MediumRiskNum;
|
|||
|
table.HighRiskNum = newtable.HighRiskNum;
|
|||
|
table.CompletedNum = newtable.CompletedNum;
|
|||
|
table.TrainPersonNum = newtable.TrainPersonNum;
|
|||
|
table.ConstructionNum = newtable.ConstructionNum;
|
|||
|
table.FinishedNum = newtable.FinishedNum;
|
|||
|
table.SuperCompletedNum = newtable.SuperCompletedNum;
|
|||
|
table.SuperTrainPersonNum = newtable.SuperTrainPersonNum;
|
|||
|
table.SuperConstructionNum = newtable.SuperConstructionNum;
|
|||
|
table.SuperFinishedNum = newtable.SuperFinishedNum;
|
|||
|
table.State = newtable.State;
|
|||
|
table.CreateMan = newtable.CreateMan;
|
|||
|
table.CreateDate = newtable.CreateDate;
|
|||
|
db.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 安监人员数据
|
|||
|
/// <summary>
|
|||
|
/// 获取企业总部总监人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetHeadOfficeInspectorGeneral()
|
|||
|
{
|
|||
|
var unitId = string.Empty;
|
|||
|
var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
if (thisUnit != null) unitId = thisUnit.UnitId;
|
|||
|
var result = (from x in Funs.DB.Person_CompanyBranchPerson
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = "",
|
|||
|
ProjectName = "",
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业总部总监人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetHeadOfficeInspectorGeneralAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetHeadOfficeInspectorGeneral);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业总部专职人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetHeadOfficeFullTime()
|
|||
|
{
|
|||
|
var unitId = string.Empty;
|
|||
|
var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
if (thisUnit != null) unitId = thisUnit.UnitId;
|
|||
|
var result = (from x in Funs.DB.Person_CompanyBranchPerson
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|||
|
where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectName = "",
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业总部专职人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetHeadOfficeFullTimeAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetHeadOfficeFullTime);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取分支机构专职人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetBranchFullTime()
|
|||
|
{
|
|||
|
var unitId = string.Empty;
|
|||
|
var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
if (thisUnit != null) unitId = thisUnit.UnitId;
|
|||
|
var result = (from x in Funs.DB.Person_CompanyBranchPerson
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|||
|
where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectName = "",
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取分支机构专职人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetBranchFullTimeAsync()
|
|||
|
{
|
|||
|
|
|||
|
return await Task.Run(GetBranchFullTime);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取分支机构总监人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetBranchInspectorGeneral()
|
|||
|
{
|
|||
|
var unitId = string.Empty;
|
|||
|
var thisUnit = CommonService.GetIsThisUnit();
|
|||
|
if (thisUnit != null) unitId = thisUnit.UnitId;
|
|||
|
var result = (from x in Funs.DB.Person_CompanyBranchPerson
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectName = "",
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取分支机构总监人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetBranchInspectorGeneralAsync()
|
|||
|
{
|
|||
|
|
|||
|
return await Task.Run(GetBranchInspectorGeneral);
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目总监人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetProjectInspectorGeneral()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.SitePerson_Person
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) &&
|
|||
|
x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.IsUsed == true && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目总监人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetProjectInspectorGeneralAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectInspectorGeneral);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专职人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetProjectFullTime()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.SitePerson_Person
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && y.IsHsse == true && x.IsUsed == true && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专职人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetProjectFullTimeAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectFullTime);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目安全监护人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetProjectSafetyMonitor()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.SitePerson_Person
|
|||
|
where x.IsSafetyMonitoring == true && x.IsUsed == true && x.IdentityCard != null
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join post in Funs.DB.Base_WorkPost on x.WorkPostId equals post.WorkPostId into postGroup
|
|||
|
from post in postGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId)
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = post.WorkPostName,
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目安全监护人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetProjectSafetyMonitorAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectSafetyMonitor);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取在岗执业注安师
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetSafetyInjectionEngineer()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.SitePerson_Person
|
|||
|
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && z.IsRegisterHSSE == true && x.IsUsed == true && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
|
|||
|
var query2 = (from x in Funs.DB.Sys_User
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where z.IsRegisterHSSE == true && x.IdentityCard != null && x.IsPost == true
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.UserName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
|
|||
|
result.AddRange(query2);
|
|||
|
result = result
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取在岗执业注安师(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetSafetyInjectionEngineerAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSafetyInjectionEngineer);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取A证人员
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetCertificateA()
|
|||
|
{
|
|||
|
var result = new List<Model.OfSafetySupervisorsOutput>();
|
|||
|
var query1 = (from x in Funs.DB.SitePerson_Person
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "A" && x.IsUsed == true && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
var query2 = (from x in Funs.DB.Sys_User
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where z.CertificateType == "A" && x.IdentityCard != null && x.IsPost == true
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.UserName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
query1.AddRange(query2);
|
|||
|
result = query1
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取A证人员(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetCertificateAAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCertificateA);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取B证人员
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetCertificateB()
|
|||
|
{
|
|||
|
var result = new List<Model.OfSafetySupervisorsOutput>();
|
|||
|
var query1 = (from x in Funs.DB.SitePerson_Person
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "B" && x.IsUsed == true && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
var query2 = (from x in Funs.DB.Sys_User
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where z.CertificateType == "B" && x.IdentityCard != null && x.IsPost == true
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.UserName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
query1.AddRange(query2);
|
|||
|
result = query1
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取B证人员(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetCertificateBAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCertificateB);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取C证人员
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.OfSafetySupervisorsOutput> GetCertificateC()
|
|||
|
{
|
|||
|
var result = new List<Model.OfSafetySupervisorsOutput>();
|
|||
|
var query1 = (from x in Funs.DB.SitePerson_Person
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && z.CertificateType == "C" && x.IsUsed == true && x.IdentityCard != null
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = u.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.PersonName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
var query2 = (from x in Funs.DB.Sys_User
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.QualityAudit_PersonQuality on x.UserId equals y.UserId
|
|||
|
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
|||
|
where z.CertificateType == "C" && x.IdentityCard != null && x.IsPost == true
|
|||
|
select new Model.OfSafetySupervisorsOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Name = x.UserName,
|
|||
|
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
|
|||
|
IdentityCard = x.IdentityCard,
|
|||
|
WorkPostName = PostService.GetPostNameById(x.WorkPostId),
|
|||
|
Phone = x.Telephone
|
|||
|
}).ToList();
|
|||
|
query1.AddRange(query2);
|
|||
|
result = query1
|
|||
|
.GroupBy(x => x.IdentityCard)
|
|||
|
.Select(g => g.FirstOrDefault())
|
|||
|
.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取C证人员(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.OfSafetySupervisorsOutput>> GetCertificateCAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCertificateC);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 安全会议数据
|
|||
|
/// <summary>
|
|||
|
/// 获取企业安委会会数据
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<MeetingOutput> GetSafetyCommitteeMeeting()
|
|||
|
{
|
|||
|
var result =
|
|||
|
(from x in Funs.DB.Meeting_CompanySafetyMeeting
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.CompileDate > Const.DtmarkTime
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Id = x.CompanySafetyMeetingId,
|
|||
|
MeetingName = x.CompanySafetyMeetingName,
|
|||
|
MeetingDate = x.CompanySafetyMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业安委会会数据(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<MeetingOutput>> GetSafetyCommitteeMeetingAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSafetyCommitteeMeeting);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业专题会议数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetEnterpriseTopicsMeetingNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Meeting_CompanySpecialMeeting
|
|||
|
where x.CompileDate > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业专题会议
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<MeetingOutput> GetEnterpriseTopicsMeeting()
|
|||
|
{
|
|||
|
var result =
|
|||
|
(from x in Funs.DB.Meeting_CompanySpecialMeeting
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.CompileDate > Const.DtmarkTime
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Id = x.CompanySpecialMeetingId,
|
|||
|
MeetingName = x.CompanySpecialMeetingName,
|
|||
|
MeetingDate = x.CompanySpecialMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业专题会议(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<MeetingOutput>> GetEnterpriseTopicsMeetingAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetEnterpriseTopicsMeeting);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目班前会
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<MeetingOutput> GetProjectClassMeeting()
|
|||
|
{
|
|||
|
var result =
|
|||
|
(
|
|||
|
from x in Funs.DB.Meeting_ClassMeeting
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where x.CompileDate > Const.DtmarkTime && BeUnderConstructionList.Contains(p.ProjectId)
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
Id = x.ClassMeetingId,
|
|||
|
MeetingName = x.ClassMeetingName,
|
|||
|
MeetingDate = x.ClassMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目班前会议(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<MeetingOutput>> GetProjectClassMeetingAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectClassMeeting);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专题会议
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<MeetingOutput> GetProjectSpecialMeeting()
|
|||
|
{
|
|||
|
var result =
|
|||
|
(
|
|||
|
from x in Funs.DB.Meeting_SpecialMeeting
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where x.CompileDate > Const.DtmarkTime && BeUnderConstructionList.Contains(p.ProjectId)
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
Id = x.SpecialMeetingId,
|
|||
|
MeetingName = x.SpecialMeetingName,
|
|||
|
MeetingDate = x.SpecialMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专题会议(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<MeetingOutput>> GetProjectSpecialMeetingAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectSpecialMeeting);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目安全领导小组会议
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<MeetingOutput> GetProjectSafetyLeadingGroupMeeting()
|
|||
|
{
|
|||
|
var result =
|
|||
|
(
|
|||
|
from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where x.CompileDate > Const.DtmarkTime && BeUnderConstructionList.Contains(p.ProjectId)
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
Id = x.SafetyLeaderGroupMeetingId,
|
|||
|
MeetingName = x.SafetyLeaderGroupMeetingName,
|
|||
|
MeetingDate = x.SafetyLeaderGroupMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目安全领导小组会议(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<MeetingOutput>> GetProjectSafetyLeadingGroupMeetingAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectSafetyLeadingGroupMeeting);
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目安全例会数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<MeetingOutput> GetProjectSafetyMeeting()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Meeting_WeekMeeting
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
Id = x.WeekMeetingId,
|
|||
|
MeetingName = x.WeekMeetingName,
|
|||
|
MeetingDate = x.WeekMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
}).Union
|
|||
|
(from x in Funs.DB.Meeting_MonthMeeting
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
select new MeetingOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
Id = x.MonthMeetingId,
|
|||
|
MeetingName = x.MonthMeetingName,
|
|||
|
MeetingDate = x.MonthMeetingDate,
|
|||
|
MeetingHours = x.MeetingHours,
|
|||
|
HostMan = x.MeetingHostMan,
|
|||
|
AttentPerson = x.AttentPerson,
|
|||
|
AttentPersonNum = x.AttentPersonNum,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目安全例会数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<MeetingOutput>> GetProjectSafetyMeetingAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectSafetyMeeting);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 安全监督检查数据
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业负责人带班检查次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<CheckOutput> GetCompanyLeadShiftCheck()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime
|
|||
|
select new Model.CheckOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Id = x.SuperviseCheckReportId,
|
|||
|
CheckTeam = x.CheckTeam,
|
|||
|
CheckDate = x.CheckDate,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业负责人带班检查次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<CheckOutput>> GetCompanyLeadShiftCheckAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanyLeadShiftCheck);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业综合检查次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<CheckOutput> GetCompanyComprehensiveCheck()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime
|
|||
|
select new Model.CheckOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Id = x.SuperviseCheckReportId,
|
|||
|
CheckTeam = x.CheckTeam,
|
|||
|
CheckDate = x.CheckDate,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业综合检查次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<CheckOutput>> GetCompanyComprehensiveCheckAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanyComprehensiveCheck);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业专项检查次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<CheckOutput> GetCompanySpecialCheck()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Supervise_SuperviseCheckReport
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime
|
|||
|
select new Model.CheckOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Id = x.SuperviseCheckReportId,
|
|||
|
CheckTeam = x.CheckTeam,
|
|||
|
CheckDate = x.CheckDate,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业专项检查次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<CheckOutput>> GetCompanySpecialCheckAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanySpecialCheck);
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目负责人带班检查次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<CheckOutput> GetProjectLeadShiftCheck()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Check_ProjectLeaderCheck
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && x.CheckDate > Const.DtmarkTime
|
|||
|
select new Model.CheckOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
|||
|
Id = x.ProjectLeaderCheckId,
|
|||
|
CheckTeam = UserService.getUserNamesUserIds(x.LeaderIds),
|
|||
|
CheckDate = x.CheckDate,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目负责人带班检查次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<CheckOutput>> GetProjectLeadShiftCheckAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectLeadShiftCheck);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专项检查次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<CheckOutput> GetProjectSpecialCheck()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Check_CheckSpecial
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && x.CheckTime > Const.DtmarkTime
|
|||
|
select new Model.CheckOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.PartInUnits),
|
|||
|
Id = x.CheckSpecialId,
|
|||
|
CheckTeam = x.PartInPersonNames,
|
|||
|
CheckDate = x.CheckTime,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专项检查次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<CheckOutput>> GetProjectSpecialCheckAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectSpecialCheck);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专业检查次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<CheckOutput> GetProjectMajorCheck()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join u in Funs.DB.Base_Unit on x.ResponsibleUnit equals u.UnitId into uGroup
|
|||
|
from u in uGroup.DefaultIfEmpty()
|
|||
|
join user in Funs.DB.Sys_User on x.CheckManId equals user.UserId into userGroup
|
|||
|
from user in userGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && x.CheckTime > Const.DtmarkTime
|
|||
|
select new Model.CheckOutput()
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = x.ResponsibleUnit,
|
|||
|
UnitName = u.UnitName,
|
|||
|
Id = x.HazardRegisterId,
|
|||
|
CheckTeam = user.UserName,
|
|||
|
CheckDate = x.CheckTime,
|
|||
|
});
|
|||
|
return result.ToList();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目专业检查次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<CheckOutput>> GetProjectMajorCheckAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectMajorCheck);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 应急管理数据
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级综合预案数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetCompanyComprehensivePlan()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
|||
|
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
|||
|
where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
Id = x.EmergencyListId,
|
|||
|
EmergencyName = x.EmergencyName,
|
|||
|
EmergencyTypeName = y.EmergencyTypeName,
|
|||
|
VersionCode = x.VersionCode,
|
|||
|
Date = x.CompileDate,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级综合预案数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetCompanyComprehensivePlanAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanyComprehensivePlan);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级专项预案数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetCompanySpecialPlan()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
|||
|
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
|||
|
where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
Id = x.EmergencyListId,
|
|||
|
EmergencyName = x.EmergencyName,
|
|||
|
EmergencyTypeName = y.EmergencyTypeName,
|
|||
|
VersionCode = x.VersionCode,
|
|||
|
Date = x.CompileDate,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级专项预案数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetCompanySpecialPlanAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanySpecialPlan);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级现场处置预案
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetCompanyOnSiteDisposalPlan()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
|||
|
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
|||
|
where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
Id = x.EmergencyListId,
|
|||
|
EmergencyName = x.EmergencyName,
|
|||
|
EmergencyTypeName = y.EmergencyTypeName,
|
|||
|
VersionCode = x.VersionCode,
|
|||
|
Date = x.CompileDate,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级现场处置预案(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetCompanyOnSiteDisposalPlanAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanyOnSiteDisposalPlan);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级演练次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetCompanyDrill()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
|
|||
|
join y in Funs.DB.Sys_Const on x.DrillRecordType equals y.ConstValue
|
|||
|
where y.GroupId == "DrillRecordType"
|
|||
|
where x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitIds,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
|||
|
Id = x.DrillRecordListId,
|
|||
|
EmergencyName = x.DrillRecordName,
|
|||
|
EmergencyTypeName = y.ConstText,
|
|||
|
Date = x.DrillRecordDate,
|
|||
|
DrillCost = x.DrillCost,
|
|||
|
JointPersonNum = x.JointPersonNum,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取企业级演练次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetCompanyDrillAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCompanyDrill);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级综合预案
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetProjectComprehensivePlan()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_EmergencyList
|
|||
|
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && y.EmergencyTypeName.Contains("综合") &&
|
|||
|
x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
Id = x.EmergencyListId,
|
|||
|
EmergencyName = x.EmergencyName,
|
|||
|
EmergencyTypeName = y.EmergencyTypeName,
|
|||
|
VersionCode = x.VersionCode,
|
|||
|
Date = x.CompileDate,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级综合预案(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetProjectComprehensivePlanAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectComprehensivePlan);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级专项预案数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetProjectSpecialPlan()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_EmergencyList
|
|||
|
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && y.EmergencyTypeName.Contains("专项") &&
|
|||
|
x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
Id = x.EmergencyListId,
|
|||
|
EmergencyName = x.EmergencyName,
|
|||
|
EmergencyTypeName = y.EmergencyTypeName,
|
|||
|
VersionCode = x.VersionCode,
|
|||
|
Date = x.CompileDate,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级专项预案数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetProjectSpecialPlanAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectSpecialPlan);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级现场处置预案
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetProjectOnSiteDisposalPlan()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_EmergencyList
|
|||
|
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && y.EmergencyTypeName.Contains("现场处置") &&
|
|||
|
x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
Id = x.EmergencyListId,
|
|||
|
EmergencyName = x.EmergencyName,
|
|||
|
EmergencyTypeName = y.EmergencyTypeName,
|
|||
|
VersionCode = x.VersionCode,
|
|||
|
Date = x.CompileDate,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级现场处置预案(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetProjectOnSiteDisposalPlanAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectOnSiteDisposalPlan);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级演练次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EmergencyOutput> GetProjectDrill()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Emergency_DrillRecordList
|
|||
|
join y in Funs.DB.Sys_Const on x.DrillRecordType equals y.ConstValue
|
|||
|
where y.GroupId == "DrillRecordType"
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.EmergencyOutput
|
|||
|
{
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitIds,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
|||
|
Id = x.DrillRecordListId,
|
|||
|
EmergencyName = x.DrillRecordName,
|
|||
|
EmergencyTypeName = y.ConstText,
|
|||
|
Date = x.DrillRecordDate,
|
|||
|
DrillCost = x.DrillCost,
|
|||
|
JointPersonNum = x.JointPersonNum,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取项目级演练次数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EmergencyOutput>> GetProjectDrillAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetProjectDrill);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 基础信息
|
|||
|
/// <summary>
|
|||
|
/// 获取在建项目数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.ProjectOutput> GetBeUnderConstruction()
|
|||
|
{
|
|||
|
var projectInfos = from project in Funs.DB.Base_Project
|
|||
|
join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin
|
|||
|
from unit in unitJoin.DefaultIfEmpty()
|
|||
|
join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin
|
|||
|
from projectType in projectTypeJoin.DefaultIfEmpty()
|
|||
|
join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
|
|||
|
from sysConst in sysConstJoin.DefaultIfEmpty()
|
|||
|
where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false) && project.ProjectState == "1"
|
|||
|
select new ProjectOutput
|
|||
|
{
|
|||
|
ProjectId = project.ProjectId,
|
|||
|
ProjectCode = project.ProjectCode,
|
|||
|
ProjectName = project.ProjectName,
|
|||
|
UnitId = project.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
StartDate = project.StartDate,
|
|||
|
EndDate = project.EndDate,
|
|||
|
ProjectAddress = project.ProjectAddress,
|
|||
|
ShortName = project.ShortName,
|
|||
|
ConstructionMoney = project.ConstructionMoney,
|
|||
|
ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"),
|
|||
|
ProjectState = project.ProjectState,
|
|||
|
ProjectAttributeName = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
|
|||
|
ProjectMoney = project.ProjectMoney,
|
|||
|
DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
|
|||
|
ProjectTypeName = projectType.ProjectTypeName,
|
|||
|
ProjectStateName2 = sysConst.ConstText
|
|||
|
};
|
|||
|
var result = projectInfos.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取在建项目数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.ProjectOutput>> GetBeUnderConstructionAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetBeUnderConstruction);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取停工项目数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.ProjectOutput> GetShutdown()
|
|||
|
{
|
|||
|
var projectInfos = from project in Funs.DB.Base_Project
|
|||
|
join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin
|
|||
|
from unit in unitJoin.DefaultIfEmpty()
|
|||
|
join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin
|
|||
|
from projectType in projectTypeJoin.DefaultIfEmpty()
|
|||
|
join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
|
|||
|
from sysConst in sysConstJoin.DefaultIfEmpty()
|
|||
|
where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false) && project.ProjectState == "2"
|
|||
|
select new ProjectOutput
|
|||
|
{
|
|||
|
ProjectId = project.ProjectId,
|
|||
|
ProjectCode = project.ProjectCode,
|
|||
|
ProjectName = project.ProjectName,
|
|||
|
UnitId = project.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
StartDate = project.StartDate,
|
|||
|
EndDate = project.EndDate,
|
|||
|
ProjectAddress = project.ProjectAddress,
|
|||
|
ShortName = project.ShortName,
|
|||
|
ConstructionMoney = project.ConstructionMoney,
|
|||
|
ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"),
|
|||
|
ProjectState = project.ProjectState,
|
|||
|
ProjectAttributeName = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
|
|||
|
ProjectMoney = project.ProjectMoney,
|
|||
|
DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
|
|||
|
ProjectTypeName = projectType.ProjectTypeName,
|
|||
|
ProjectStateName2 = sysConst.ConstText
|
|||
|
};
|
|||
|
var result = projectInfos.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取停工项目数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.ProjectOutput>> GetShutdownAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetShutdown);
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取完工项目数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.ProjectOutput> GetCompletedProject()
|
|||
|
{
|
|||
|
var projectInfos = from project in Funs.DB.Base_Project
|
|||
|
join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin
|
|||
|
from unit in unitJoin.DefaultIfEmpty()
|
|||
|
join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin
|
|||
|
from projectType in projectTypeJoin.DefaultIfEmpty()
|
|||
|
join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
|
|||
|
from sysConst in sysConstJoin.DefaultIfEmpty()
|
|||
|
where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false) && project.ProjectState == "3"
|
|||
|
select new ProjectOutput
|
|||
|
{
|
|||
|
ProjectId = project.ProjectId,
|
|||
|
ProjectCode = project.ProjectCode,
|
|||
|
ProjectName = project.ProjectName,
|
|||
|
UnitId = project.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
StartDate = project.StartDate,
|
|||
|
EndDate = project.EndDate,
|
|||
|
ProjectAddress = project.ProjectAddress,
|
|||
|
ShortName = project.ShortName,
|
|||
|
ConstructionMoney = project.ConstructionMoney,
|
|||
|
ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"),
|
|||
|
ProjectState = project.ProjectState,
|
|||
|
ProjectAttributeName = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
|
|||
|
ProjectMoney = project.ProjectMoney,
|
|||
|
DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
|
|||
|
ProjectTypeName = projectType.ProjectTypeName,
|
|||
|
ProjectStateName2 = sysConst.ConstText
|
|||
|
};
|
|||
|
var result = projectInfos.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取所有项目数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.ProjectOutput> GetALLProject()
|
|||
|
{
|
|||
|
var projectInfos = from project in Funs.DB.Base_Project
|
|||
|
join unit in Funs.DB.Base_Unit on project.UnitId equals unit.UnitId into unitJoin
|
|||
|
from unit in unitJoin.DefaultIfEmpty()
|
|||
|
join projectType in Funs.DB.Base_ProjectType on project.ProjectType equals projectType.ProjectTypeId into projectTypeJoin
|
|||
|
from projectType in projectTypeJoin.DefaultIfEmpty()
|
|||
|
join sysConst in Funs.DB.Sys_Const on new { ProjectState2 = project.ProjectState2, GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin
|
|||
|
from sysConst in sysConstJoin.DefaultIfEmpty()
|
|||
|
where (project.ProjectAttribute == "GONGCHENG" || project.ProjectAttribute == null) && (project.IsDelete == null || project.IsDelete == false)
|
|||
|
select new ProjectOutput
|
|||
|
{
|
|||
|
ProjectId = project.ProjectId,
|
|||
|
ProjectCode = project.ProjectCode,
|
|||
|
ProjectName = project.ProjectName,
|
|||
|
UnitId = project.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
StartDate = project.StartDate,
|
|||
|
EndDate = project.EndDate,
|
|||
|
ProjectAddress = project.ProjectAddress,
|
|||
|
ShortName = project.ShortName,
|
|||
|
ConstructionMoney = project.ConstructionMoney,
|
|||
|
ProjectStateName = project.ProjectState == BLL.Const.ProjectState_2 ? "暂停中" : (project.ProjectState == BLL.Const.ProjectState_3 ? "已完工" : "施工中"),
|
|||
|
ProjectState = project.ProjectState,
|
|||
|
ProjectAttributeName = project.ProjectAttribute == "GONGCHENG" ? "工程" : (project.ProjectAttribute == "SHIYE" ? "实业" : ""),
|
|||
|
ProjectMoney = project.ProjectMoney,
|
|||
|
DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days,
|
|||
|
ProjectTypeName = projectType.ProjectTypeName,
|
|||
|
ProjectStateName2 = sysConst.ConstText
|
|||
|
};
|
|||
|
var result = projectInfos.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取参建人数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseEntities> GetJoinConstructionPerson()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.SitePerson_Person
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsUsed == true
|
|||
|
select new Model.BaseEntities
|
|||
|
{
|
|||
|
Id = x.PersonId,
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
UnitId = x.UnitId
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取参建人数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.BaseEntities>> GetJoinConstructionPersonAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetJoinConstructionPerson);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取在施危大工程数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.BaseEntities> GetMajorProjectsUnderConstruction()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "2" &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select new Model.BaseEntities
|
|||
|
{
|
|||
|
Id = x.HazardId,
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取在施危大工程数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<Model.BaseEntities>> GetMajorProjectsUnderConstructionAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetMajorProjectsUnderConstruction);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 工时数据
|
|||
|
/// <summary>
|
|||
|
/// 获取总工时数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetTotalWorkingHour()
|
|||
|
{
|
|||
|
|
|||
|
var thisUnitid = CommonService.GetThisUnitId();
|
|||
|
var yearSumItems = (from x in Funs.DB.Information_MillionsMonthlyReportItem
|
|||
|
join y in Funs.DB.Information_MillionsMonthlyReport
|
|||
|
on x.MillionsMonthlyReportId equals y.MillionsMonthlyReportId
|
|||
|
where y.UnitId == thisUnitid && y.Year == DateTime.Now.Year && y.Month <= DateTime.Now.Month
|
|||
|
&& x.Affiliation == "本月合计"
|
|||
|
select x).Distinct().ToList();
|
|||
|
var result = Convert.ToInt32(yearSumItems.Sum(x => x.TotalWorkNum ?? 0));
|
|||
|
return result;
|
|||
|
/*var result = (from x in Funs.DB.SitePerson_DayReportDetail
|
|||
|
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
|
|||
|
where BeUnderConstructionList.Contains(y.ProjectId) && y.CompileDate > Const.DtmarkTime
|
|||
|
select x.PersonWorkTime ?? 0).ToList().Sum();
|
|||
|
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
|
|||
|
*/
|
|||
|
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取总工时数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<int> GetTotalWorkingHourAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetTotalWorkingHour);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取损失工时数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetLostWorkingHour()
|
|||
|
{
|
|||
|
//var result =
|
|||
|
// (from x in Funs.DB.Accident_AccidentHandle
|
|||
|
// where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
// select x.WorkHoursLoss)
|
|||
|
// .ToList().Sum(x => x.Value)
|
|||
|
// + (from x in Funs.DB.Accident_AccidentReport
|
|||
|
// where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
// select x.WorkingHoursLoss)
|
|||
|
// .ToList().Sum(x => x.Value);
|
|||
|
//var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
|
|||
|
var q = 0;
|
|||
|
return q;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取损失工时数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<int> GetLostWorkingHourAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetLostWorkingHour);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取安全工时数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetSafeWorkingHour()
|
|||
|
{
|
|||
|
/*var result1 = (from x in Funs.DB.SitePerson_DayReportDetail
|
|||
|
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
|
|||
|
where BeUnderConstructionList.Contains(y.ProjectId) && y.CompileDate > Const.DtmarkTime
|
|||
|
select x.PersonWorkTime ?? 0).ToList().Sum();
|
|||
|
var result2 =
|
|||
|
(from x in Funs.DB.Accident_AccidentHandle
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
select x.WorkHoursLoss)
|
|||
|
.ToList().Sum(x => x.Value)
|
|||
|
+ (from x in Funs.DB.Accident_AccidentReport
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
|
|||
|
select x.WorkingHoursLoss)
|
|||
|
.ToList().Sum(x => x.Value);
|
|||
|
var result = result1 - result2;
|
|||
|
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
|
|||
|
|
|||
|
return q;*/
|
|||
|
var thisUnitid = CommonService.GetThisUnitId();
|
|||
|
var yearSumItems = (from x in Funs.DB.Information_MillionsMonthlyReportItem
|
|||
|
join y in Funs.DB.Information_MillionsMonthlyReport
|
|||
|
on x.MillionsMonthlyReportId equals y.MillionsMonthlyReportId
|
|||
|
where y.UnitId == thisUnitid && y.Year == DateTime.Now.Year && y.Month <= DateTime.Now.Month
|
|||
|
&& x.Affiliation == "本月合计"
|
|||
|
select x).Distinct().ToList();
|
|||
|
var result = Convert.ToInt32(yearSumItems.Sum(x => x.TotalWorkNum ?? 0));
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取安全工时数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<int> GetSafeWorkingHourAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSafeWorkingHour);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 安全教育培训
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取三级安全教育培训数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EduTrainOutput> GetSafeTrain()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.EduTrain_TrainRecord
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && y.TrainType == "1" &&
|
|||
|
x.TrainStartDate > Const.DtmarkTime
|
|||
|
select new Model.EduTrainOutput()
|
|||
|
{
|
|||
|
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
|||
|
Id = x.TrainingId,
|
|||
|
TrainTitle = x.TrainTitle,
|
|||
|
TrainStartDate = x.TrainStartDate,
|
|||
|
TrainEndDate = x.TrainEndDate,
|
|||
|
TrainPersonNum = x.TrainPersonNum ?? 0,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取三级安全教育培训数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EduTrainOutput>> GetSafeTrainAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSafeTrain);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取专项培训数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EduTrainOutput> GetSpecialTrain()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.EduTrain_TrainRecord
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && y.TrainType == "2" &&
|
|||
|
x.TrainStartDate > Const.DtmarkTime
|
|||
|
select new Model.EduTrainOutput()
|
|||
|
{
|
|||
|
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
|||
|
Id = x.TrainingId,
|
|||
|
TrainTitle = x.TrainTitle,
|
|||
|
TrainStartDate = x.TrainStartDate,
|
|||
|
TrainEndDate = x.TrainEndDate,
|
|||
|
TrainPersonNum = x.TrainPersonNum ?? 0,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取专项培训数(异步)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static async Task<List<EduTrainOutput>> GetSpecialTrainAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSpecialTrain);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取特种作业培训数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<EduTrainOutput> GetSpecialOperationTrain()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.EduTrain_TrainRecord
|
|||
|
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId) && y.TrainType == "3" &&
|
|||
|
x.TrainStartDate > Const.DtmarkTime
|
|||
|
select new Model.EduTrainOutput()
|
|||
|
{
|
|||
|
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
|||
|
Id = x.TrainingId,
|
|||
|
TrainTitle = x.TrainTitle,
|
|||
|
TrainStartDate = x.TrainStartDate,
|
|||
|
TrainEndDate = x.TrainEndDate,
|
|||
|
TrainPersonNum = x.TrainPersonNum ?? 0,
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<EduTrainOutput>> GetSpecialOperationTrainAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSpecialOperationTrain);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取能耗总量
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetTotalEnergyConsumption()
|
|||
|
{
|
|||
|
var result = 0;
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取万元营业收入综合能耗
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetIncomeComprehensiveEnergyConsumption()
|
|||
|
{
|
|||
|
var result = 0;
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取二氧化碳
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetNewWaterConsumption()
|
|||
|
{
|
|||
|
var result = 0;
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#region 事故事件数据
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取未遂事件数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.AccidentOutput> GetNearMiss()
|
|||
|
{
|
|||
|
var result = (from Record in Funs.DB.Accident_AccidentPersonRecord
|
|||
|
join AccidentType in Funs.DB.Base_AccidentType on Record.AccidentTypeId equals AccidentType.AccidentTypeId into AccidentTypeGroup
|
|||
|
from AccidentType in AccidentTypeGroup.DefaultIfEmpty()
|
|||
|
join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup
|
|||
|
from Project in ProjectGroup.DefaultIfEmpty()
|
|||
|
join Person in Funs.DB.SitePerson_Person on Record.PersonId equals Person.PersonId into PersonGroup
|
|||
|
from Person in PersonGroup.DefaultIfEmpty()
|
|||
|
join Unit in Funs.DB.Base_Unit on Person.UnitId equals Unit.UnitId into UnitGroup
|
|||
|
from Unit in UnitGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(Record.ProjectId) && Record.IsAttempt == "1" && Record.AccidentDate > Const.DtmarkTime
|
|||
|
select new AccidentOutput
|
|||
|
{
|
|||
|
Id = Record.AccidentPersonRecordId,
|
|||
|
ProjectId = Record.ProjectId,
|
|||
|
ProjectCode = Project.ProjectCode,
|
|||
|
ProjectName = Project.ProjectName,
|
|||
|
AccidentTypeName = AccidentType.AccidentTypeName,
|
|||
|
AccidentDate = Record.AccidentDate,
|
|||
|
UnitId = Unit.UnitId,
|
|||
|
UnitName = Unit.UnitName,
|
|||
|
PeopleNum = 1,
|
|||
|
Info = Record.Injury == "1" ? "死亡" : (Record.Injury == "2" ? "重伤" : "轻伤")
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<Model.AccidentOutput>> GetNearMissAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetNearMiss);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取可记录事件数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.AccidentOutput> GetRecordableEvent()
|
|||
|
{
|
|||
|
var result = (from Record in Funs.DB.Accident_AccidentPersonRecord
|
|||
|
join AccidentType in Funs.DB.Base_AccidentType on Record.AccidentTypeId equals AccidentType.AccidentTypeId into AccidentTypeGroup
|
|||
|
from AccidentType in AccidentTypeGroup.DefaultIfEmpty()
|
|||
|
join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup
|
|||
|
from Project in ProjectGroup.DefaultIfEmpty()
|
|||
|
join Person in Funs.DB.SitePerson_Person on Record.PersonId equals Person.PersonId into PersonGroup
|
|||
|
from Person in PersonGroup.DefaultIfEmpty()
|
|||
|
join Unit in Funs.DB.Base_Unit on Person.UnitId equals Unit.UnitId into UnitGroup
|
|||
|
from Unit in UnitGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDate > Const.DtmarkTime
|
|||
|
select new AccidentOutput
|
|||
|
{
|
|||
|
Id = Record.AccidentPersonRecordId,
|
|||
|
ProjectId = Record.ProjectId,
|
|||
|
ProjectCode = Project.ProjectCode,
|
|||
|
ProjectName = Project.ProjectName,
|
|||
|
AccidentTypeName = AccidentType.AccidentTypeName,
|
|||
|
AccidentDate = Record.AccidentDate,
|
|||
|
UnitId = Unit.UnitId,
|
|||
|
UnitName = Unit.UnitName,
|
|||
|
PeopleNum = 1,
|
|||
|
Info = Record.Injury == "1" ? "死亡" : (Record.Injury == "2" ? "重伤" : "轻伤")
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<Model.AccidentOutput>> GetRecordableEventAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetRecordableEvent);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取一般事故数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.AccidentOutput> GetGeneralAccident()
|
|||
|
{
|
|||
|
var query = from Record in Funs.DB.Accident_AccidentReport
|
|||
|
join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup
|
|||
|
from AccidentType in AccidentTypeGroup.DefaultIfEmpty()
|
|||
|
join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup
|
|||
|
from Project in ProjectGroup.DefaultIfEmpty()
|
|||
|
join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup
|
|||
|
from Unit in UnitGroup.DefaultIfEmpty()
|
|||
|
where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "1"
|
|||
|
select new AccidentOutput
|
|||
|
{
|
|||
|
Id = Record.AccidentReportId,
|
|||
|
ProjectId = Record.ProjectId,
|
|||
|
ProjectCode = Project.ProjectCode,
|
|||
|
ProjectName = Project.ProjectName,
|
|||
|
AccidentTypeName = AccidentType.ConstText,
|
|||
|
AccidentDate = Record.AccidentDate,
|
|||
|
UnitId = Unit.UnitId,
|
|||
|
UnitName = Unit.UnitName,
|
|||
|
PeopleNum = Record.PeopleNum,
|
|||
|
Info = Record.Abstract
|
|||
|
};
|
|||
|
|
|||
|
var result = query.ToList();
|
|||
|
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<Model.AccidentOutput>> GetGeneralAccidentAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetGeneralAccident);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取较大事故数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.AccidentOutput> GetMajorAccident()
|
|||
|
{
|
|||
|
var query = from Record in Funs.DB.Accident_AccidentReport
|
|||
|
join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup
|
|||
|
from AccidentType in AccidentTypeGroup.DefaultIfEmpty()
|
|||
|
join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup
|
|||
|
from Project in ProjectGroup.DefaultIfEmpty()
|
|||
|
join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup
|
|||
|
from Unit in UnitGroup.DefaultIfEmpty()
|
|||
|
where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "2"
|
|||
|
select new AccidentOutput
|
|||
|
{
|
|||
|
Id = Record.AccidentReportId,
|
|||
|
ProjectId = Record.ProjectId,
|
|||
|
ProjectCode = Project.ProjectCode,
|
|||
|
ProjectName = Project.ProjectName,
|
|||
|
AccidentTypeName = AccidentType.ConstText,
|
|||
|
AccidentDate = Record.AccidentDate,
|
|||
|
UnitId = Unit.UnitId,
|
|||
|
UnitName = Unit.UnitName,
|
|||
|
PeopleNum = Record.PeopleNum,
|
|||
|
Info = Record.Abstract
|
|||
|
};
|
|||
|
|
|||
|
var result = query.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<Model.AccidentOutput>> GetMajorAccidentAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetMajorAccident);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取重大事故数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.AccidentOutput> GetSeriousAccident()
|
|||
|
{
|
|||
|
var query = from Record in Funs.DB.Accident_AccidentReport
|
|||
|
join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup
|
|||
|
from AccidentType in AccidentTypeGroup.DefaultIfEmpty()
|
|||
|
join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup
|
|||
|
from Project in ProjectGroup.DefaultIfEmpty()
|
|||
|
join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup
|
|||
|
from Unit in UnitGroup.DefaultIfEmpty()
|
|||
|
where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "3"
|
|||
|
select new AccidentOutput
|
|||
|
{
|
|||
|
Id = Record.AccidentReportId,
|
|||
|
ProjectId = Record.ProjectId,
|
|||
|
ProjectCode = Project.ProjectCode,
|
|||
|
ProjectName = Project.ProjectName,
|
|||
|
AccidentTypeName = AccidentType.ConstText,
|
|||
|
AccidentDate = Record.AccidentDate,
|
|||
|
UnitId = Unit.UnitId,
|
|||
|
UnitName = Unit.UnitName,
|
|||
|
PeopleNum = Record.PeopleNum,
|
|||
|
Info = Record.Abstract
|
|||
|
};
|
|||
|
|
|||
|
var result = query.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<Model.AccidentOutput>> GetSeriousAccidentAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSeriousAccident);
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取特别重大事故数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.AccidentOutput> GetSpecialSeriousAccident()
|
|||
|
{
|
|||
|
var query = from Record in Funs.DB.Accident_AccidentReport
|
|||
|
join AccidentType in Funs.DB.Sys_Const on new { ConstValue = Record.AccidentTypeId, GroupId = "AccidentReportRegistration" } equals new { ConstValue = AccidentType.ConstValue, GroupId = AccidentType.GroupId } into AccidentTypeGroup
|
|||
|
from AccidentType in AccidentTypeGroup.DefaultIfEmpty()
|
|||
|
join Project in Funs.DB.Base_Project on Record.ProjectId equals Project.ProjectId into ProjectGroup
|
|||
|
from Project in ProjectGroup.DefaultIfEmpty()
|
|||
|
join Unit in Funs.DB.Base_Unit on Record.UnitId equals Unit.UnitId into UnitGroup
|
|||
|
from Unit in UnitGroup.DefaultIfEmpty()
|
|||
|
where Record.AccidentDate > Const.DtmarkTime && BeUnderConstructionList.Contains(Record.ProjectId) && Record.AccidentDegree == "4"
|
|||
|
select new AccidentOutput
|
|||
|
{
|
|||
|
Id = Record.AccidentReportId,
|
|||
|
ProjectId = Record.ProjectId,
|
|||
|
ProjectCode = Project.ProjectCode,
|
|||
|
ProjectName = Project.ProjectName,
|
|||
|
AccidentTypeName = AccidentType.ConstText,
|
|||
|
AccidentDate = Record.AccidentDate,
|
|||
|
UnitId = Unit.UnitId,
|
|||
|
UnitName = Unit.UnitName,
|
|||
|
PeopleNum = Record.PeopleNum,
|
|||
|
Info = Record.Abstract
|
|||
|
};
|
|||
|
|
|||
|
var result = query.ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public static async Task<List<Model.AccidentOutput>> GetSpecialSeriousAccidentAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSpecialSeriousAccident);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 安全费用
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取费用提取(万元)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.CostSmallDetailOutput> GetCostExtract()
|
|||
|
{
|
|||
|
var query = from cost in Funs.DB.CostGoods_CostSmallDetail
|
|||
|
join p in Funs.DB.Base_Project on cost.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join unit in Funs.DB.Base_Unit on cost.UnitId equals unit.UnitId into unitGroup
|
|||
|
from unit in unitGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId)
|
|||
|
select new CostSmallDetailOutput
|
|||
|
{
|
|||
|
Id = cost.CostSmallDetailId,
|
|||
|
ProjectId = p.ProjectId,
|
|||
|
ProjectCode = p.ProjectCode,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = cost.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
Months = cost.Months,
|
|||
|
SUMCost = cost.Extract//Math.Round(sumCost, 2)
|
|||
|
};
|
|||
|
return query.ToList();
|
|||
|
}
|
|||
|
public static async Task<List<Model.CostSmallDetailOutput>> GetCostExtractAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCostExtract);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取费用使用(万元)
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.CostSmallDetailOutput> GetCostUse()
|
|||
|
{
|
|||
|
var query = from cost in Funs.DB.CostGoods_CostSmallDetail
|
|||
|
join p in Funs.DB.Base_Project on cost.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join unit in Funs.DB.Base_Unit on cost.UnitId equals unit.UnitId into unitGroup
|
|||
|
from unit in unitGroup.DefaultIfEmpty()
|
|||
|
let sumCost = (from item in Funs.DB.CostGoods_CostSmallDetailItem
|
|||
|
where item.CostSmallDetailId == cost.CostSmallDetailId
|
|||
|
select item.CostMoney).Sum() * 1.0m // 10000
|
|||
|
where BeUnderConstructionList.Contains(p.ProjectId)
|
|||
|
select new CostSmallDetailOutput
|
|||
|
{
|
|||
|
Id = cost.CostSmallDetailId,
|
|||
|
ProjectId = p.ProjectId,
|
|||
|
ProjectCode = p.ProjectCode,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
UnitId = cost.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
Months = cost.Months,
|
|||
|
SUMCost = sumCost//Math.Round(sumCost, 2)
|
|||
|
};
|
|||
|
/*var result = 0;
|
|||
|
var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem
|
|||
|
join y in Funs.DB.CostGoods_CostSmallDetail
|
|||
|
on x.CostSmallDetailId equals y.CostSmallDetailId
|
|||
|
where BeUnderConstructionList.Contains(y.ProjectId) && y.CompileDate > Const.DtmarkTime
|
|||
|
select x.CostMoney ?? 0).ToList().Sum();
|
|||
|
result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]);*/
|
|||
|
return query.ToList();
|
|||
|
}
|
|||
|
public static async Task<List<Model.CostSmallDetailOutput>> GetCostUseAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetCostUse);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 施工机具
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取施工机具在用数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.ConstructionEquipmentOutput> GetUseEquipment()
|
|||
|
{
|
|||
|
var query = (from item in Funs.DB.InApproveManager_EquipmentInItem
|
|||
|
join eq in Funs.DB.InApproveManager_EquipmentIn on item.EquipmentInId equals eq.EquipmentInId into eqGroup
|
|||
|
from eq in eqGroup.DefaultIfEmpty()
|
|||
|
join spe in Funs.DB.Base_SpecialEquipment on item.SpecialEquipmentId equals spe.SpecialEquipmentId into speGroup
|
|||
|
from spe in speGroup.DefaultIfEmpty()
|
|||
|
join p in Funs.DB.Base_Project on eq.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join unit in Funs.DB.Base_Unit on eq.UnitId equals unit.UnitId into unitGroup
|
|||
|
from unit in unitGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(eq.ProjectId)
|
|||
|
select new ConstructionEquipmentOutput
|
|||
|
{
|
|||
|
Id = item.EquipmentInItemId,
|
|||
|
ProjectId = eq.ProjectId,
|
|||
|
//ProjectCode = p.ProjectCode,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
//UnitId = eq.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
//SpecialEquipmentId = item.SpecialEquipmentId,
|
|||
|
SpecialEquipmentName = spe.SpecialEquipmentName,
|
|||
|
SizeModel = item.SizeModel,
|
|||
|
OwnerCheck = item.OwnerCheck,
|
|||
|
CertificateNum = item.CertificateNum,
|
|||
|
IsUsed = item.IsUsed,
|
|||
|
CompileDate = eq.CompileDate,
|
|||
|
EQType = "特种设备"
|
|||
|
})
|
|||
|
.Union(
|
|||
|
from item in Funs.DB.InApproveManager_GeneralEquipmentInItem
|
|||
|
join eq in Funs.DB.InApproveManager_GeneralEquipmentIn on item.GeneralEquipmentInId equals eq.GeneralEquipmentInId into eqGroup
|
|||
|
from eq in eqGroup.DefaultIfEmpty()
|
|||
|
join spe in Funs.DB.Base_SpecialEquipment on item.SpecialEquipmentId equals spe.SpecialEquipmentId into speGroup
|
|||
|
from spe in speGroup.DefaultIfEmpty()
|
|||
|
join p in Funs.DB.Base_Project on eq.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join unit in Funs.DB.Base_Unit on eq.UnitId equals unit.UnitId into unitGroup
|
|||
|
from unit in unitGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(eq.ProjectId)
|
|||
|
select new ConstructionEquipmentOutput
|
|||
|
{
|
|||
|
Id = item.GeneralEquipmentInItemId,
|
|||
|
ProjectId = eq.ProjectId,
|
|||
|
// ProjectCode = p.ProjectCode,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
// UnitId = eq.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
// SpecialEquipmentId = item.SpecialEquipmentId,
|
|||
|
SpecialEquipmentName = spe.SpecialEquipmentName,
|
|||
|
SizeModel = item.SizeModel,
|
|||
|
OwnerCheck = item.OwnerCheck,
|
|||
|
CertificateNum = item.CertificateNum,
|
|||
|
IsUsed = item.IsUsed,
|
|||
|
CompileDate = eq.CompileDate,
|
|||
|
EQType = "一般设备"
|
|||
|
}
|
|||
|
);
|
|||
|
|
|||
|
return query.ToList();
|
|||
|
}
|
|||
|
public static async Task<List<Model.ConstructionEquipmentOutput>> GetUseEquipmentAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetUseEquipment);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取施工机具特种设备数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.ConstructionEquipmentOutput> GetSpecialEquipment()
|
|||
|
{
|
|||
|
var query = (from item in Funs.DB.InApproveManager_EquipmentInItem
|
|||
|
join eq in Funs.DB.InApproveManager_EquipmentIn on item.EquipmentInId equals eq.EquipmentInId into
|
|||
|
eqGroup
|
|||
|
from eq in eqGroup.DefaultIfEmpty()
|
|||
|
join spe in Funs.DB.Base_SpecialEquipment on item.SpecialEquipmentId equals spe.SpecialEquipmentId into
|
|||
|
speGroup
|
|||
|
from spe in speGroup.DefaultIfEmpty()
|
|||
|
join p in Funs.DB.Base_Project on eq.ProjectId equals p.ProjectId into pGroup
|
|||
|
from p in pGroup.DefaultIfEmpty()
|
|||
|
join unit in Funs.DB.Base_Unit on eq.UnitId equals unit.UnitId into unitGroup
|
|||
|
from unit in unitGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(eq.ProjectId)
|
|||
|
select new ConstructionEquipmentOutput
|
|||
|
{
|
|||
|
Id = item.EquipmentInItemId,
|
|||
|
ProjectId = eq.ProjectId,
|
|||
|
//ProjectCode = p.ProjectCode,
|
|||
|
ProjectName = p.ProjectName,
|
|||
|
//UnitId = eq.UnitId,
|
|||
|
UnitName = unit.UnitName,
|
|||
|
//SpecialEquipmentId = item.SpecialEquipmentId,
|
|||
|
SpecialEquipmentName = spe.SpecialEquipmentName,
|
|||
|
SizeModel = item.SizeModel,
|
|||
|
OwnerCheck = item.OwnerCheck,
|
|||
|
CertificateNum = item.CertificateNum,
|
|||
|
IsUsed = item.IsUsed,
|
|||
|
CompileDate = eq.CompileDate,
|
|||
|
EQType = "特种设备"
|
|||
|
});
|
|||
|
return query.ToList();
|
|||
|
}
|
|||
|
public static async Task<List<Model.ConstructionEquipmentOutput>> GetSpecialEquipmentAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSpecialEquipment);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 高风险作业许可
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取作业许可项数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<LicenseOutput> GetLicenses()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.View_License_LicenseManager
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true &&
|
|||
|
x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.LicenseOutput
|
|||
|
{
|
|||
|
Id = x.LicenseManagerId,
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
LicenseTypeName = x.LicenseTypeName,
|
|||
|
UnitTypeName = x.UnitTypeName,
|
|||
|
IsHighRisk = x.IsHighRisk,
|
|||
|
WorkAreaName = x.WorkStates,
|
|||
|
CompileDate = x.CompileDate,
|
|||
|
StartDate = x.StartDate,
|
|||
|
EndDate = x.EndDate,
|
|||
|
WorkStatesStr = x.WorkStatesStr
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
public static async Task<List<LicenseOutput>> GetLicensesAsync()
|
|||
|
{
|
|||
|
|
|||
|
return await Task.Run(GetLicenses);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取作业许可关闭项数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<LicenseOutput> GetLicensesClose()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.View_License_LicenseManager
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsHighRisk == true && x.WorkStates == "3" &&
|
|||
|
x.CompileDate > Const.DtmarkTime
|
|||
|
select new Model.LicenseOutput
|
|||
|
{
|
|||
|
Id = x.LicenseManagerId,
|
|||
|
ProjectId = x.ProjectId,
|
|||
|
ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId),
|
|||
|
UnitId = x.UnitId,
|
|||
|
UnitName = UnitService.GetUnitNameByUnitId(x.UnitId),
|
|||
|
LicenseTypeName = x.LicenseTypeName,
|
|||
|
UnitTypeName = x.UnitTypeName,
|
|||
|
IsHighRisk = x.IsHighRisk,
|
|||
|
WorkAreaName = x.WorkStates,
|
|||
|
CompileDate = x.CompileDate,
|
|||
|
StartDate = x.StartDate,
|
|||
|
EndDate = x.EndDate,
|
|||
|
WorkStatesStr = x.WorkStatesStr
|
|||
|
}).ToList();
|
|||
|
return result;
|
|||
|
}
|
|||
|
public static async Task<List<LicenseOutput>> GetLicensesCloseAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetLicensesClose);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 隐患整改
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取一般隐患数据
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.HiddenRectificationOutput> GetGeneralHiddenRectificationOutputs()
|
|||
|
{
|
|||
|
|
|||
|
var query = (from x in Funs.DB.Base_Project
|
|||
|
join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup
|
|||
|
from y in yGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.Risk_Level == "一般" && y.CheckTime > Const.DtmarkTime
|
|||
|
group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
|||
|
select new HiddenRectificationOutput
|
|||
|
{
|
|||
|
ProjectId = gg.Key.ProjectId,
|
|||
|
ProjectName = gg.Key.ProjectName,
|
|||
|
ProjectCode = gg.Key.ProjectCode,
|
|||
|
ProNum = gg.Count(y => y.States != "4" && y.States != "-1"),
|
|||
|
RecNum = gg.Count(y => y.States == "3"),
|
|||
|
NoRecNum = gg.Count(y => y.States != "3" && y.States != "-1"),
|
|||
|
RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" :
|
|||
|
Math.Round(Convert.ToDecimal( gg.Count(y => y.States == "3") /
|
|||
|
gg.Count(y => y.States != "4" && y.States != "-1") * 100), 2, MidpointRounding.AwayFromZero).ToString()
|
|||
|
}).ToList();
|
|||
|
|
|||
|
foreach (var item in query)
|
|||
|
{
|
|||
|
item.RecRate = Math .Round(Convert.ToDecimal(item.RecRate),2) .ToString(); // 转换为字符串并格式化为两位小数
|
|||
|
}
|
|||
|
return query;
|
|||
|
}
|
|||
|
public static async Task<List<Model.HiddenRectificationOutput>> GetGeneralHiddenRectificationOutputsAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetGeneralHiddenRectificationOutputs);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取重大隐患数据
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.HiddenRectificationOutput> GetMajorHiddenRectificationOutputs()
|
|||
|
{
|
|||
|
var query = (from x in Funs.DB.Base_Project
|
|||
|
join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup
|
|||
|
from y in yGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.Risk_Level == "重大" && y.CheckTime > Const.DtmarkTime
|
|||
|
group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
|||
|
select new HiddenRectificationOutput
|
|||
|
{
|
|||
|
ProjectId = gg.Key.ProjectId,
|
|||
|
ProjectName = gg.Key.ProjectName,
|
|||
|
ProjectCode = gg.Key.ProjectCode,
|
|||
|
ProNum = gg.Count(y => y.States != "4" && y.States != "-1" ),
|
|||
|
RecNum = gg.Count(y => y.States == "3" ),
|
|||
|
NoRecNum = gg.Count(y => y.States != "3" && y.States != "-1" ),
|
|||
|
RecRate = gg.Count(y => y.States != "4" && y.States != "-1" ) == 0 ? "0" :
|
|||
|
Math.Round((decimal)gg.Count(y => y.States == "3" ) /
|
|||
|
gg.Count(y => y.States != "4" && y.States != "-1" ) * 100, 2, MidpointRounding.AwayFromZero).ToString()
|
|||
|
}).ToList();
|
|||
|
foreach (var item in query)
|
|||
|
{
|
|||
|
item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数
|
|||
|
}
|
|||
|
return query;
|
|||
|
}
|
|||
|
public static async Task<List<Model.HiddenRectificationOutput>> GetMajorHiddenRectificationOutputsAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetMajorHiddenRectificationOutputs);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 风险数据
|
|||
|
/// <summary>
|
|||
|
/// 获取风险数据
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.SecurityRiskOutput> GetSecurityRiskOutputs()
|
|||
|
{
|
|||
|
var query = (from x in Funs.DB.Base_Project
|
|||
|
join y in Funs.DB.Hazard_HazardSelectedItem on x.ProjectId equals y.ProjectId into yGroup
|
|||
|
from y in yGroup.DefaultIfEmpty()
|
|||
|
join z in Funs.DB.Base_RiskLevel on y.HazardLevel equals z.RiskLevelId into zGroup
|
|||
|
from z in zGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && (y.IsStart == true || y.State == "1")
|
|||
|
group new { y, z } by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
|||
|
select new SecurityRiskOutput
|
|||
|
{
|
|||
|
ProjectId = gg.Key.ProjectId,
|
|||
|
ProjectName = gg.Key.ProjectName,
|
|||
|
ProjectCode = gg.Key.ProjectCode,
|
|||
|
LowRiskNum = gg.Sum(g => (g.z.RiskLevel == 1 || g.y.HazardLevel == "1") ? 1 : 0),
|
|||
|
GeneralRiskNum = gg.Sum(g => (g.z.RiskLevel == 2 || g.y.HazardLevel == "2") ? 1 : 0),
|
|||
|
MediumRiskNum = gg.Sum(g => (g.z.RiskLevel == 3 || g.y.HazardLevel == "3") ? 1 : 0),
|
|||
|
HighRiskNum = gg.Sum(g => g.z.RiskLevel == 4 ? 1 : 0),
|
|||
|
}).ToList();
|
|||
|
return query;
|
|||
|
}
|
|||
|
public static async Task<List<Model.SecurityRiskOutput>> GetSecurityRiskOutputsAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetSecurityRiskOutputs);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 危大工程数据
|
|||
|
/// <summary>
|
|||
|
/// 获取危大工程数据
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.LargeEngineeringOutput> GetLargeEngineeringOutputs()
|
|||
|
{
|
|||
|
var query = (from x in Funs.DB.Base_Project
|
|||
|
join y in Funs.DB.Solution_LargerHazard on x.ProjectId equals y.ProjectId into yGroup
|
|||
|
from y in yGroup.DefaultIfEmpty()
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && y.RecordTime > Const.DtmarkTime
|
|||
|
group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
|||
|
select new LargeEngineeringOutput
|
|||
|
{
|
|||
|
ProjectId = gg.Key.ProjectId,
|
|||
|
ProjectName = gg.Key.ProjectName,
|
|||
|
ProjectCode = gg.Key.ProjectCode,
|
|||
|
CompletedNum = gg.Count(x => x.States == "1" && x.IsSuperLargerHazard == false ),
|
|||
|
TrainPersonNum = gg.Where(x => x.IsSuperLargerHazard == false ).Sum(x => x.TrainPersonNum) ?? 0,
|
|||
|
ConstructionNum = gg.Count(x => x.States == "2" && x.IsSuperLargerHazard == false ),
|
|||
|
FinishedNum = gg.Count(x => x.States == "3" && x.IsSuperLargerHazard == false),
|
|||
|
SuperCompletedNum = gg.Count(x => x.States == "1" && x.IsSuperLargerHazard == true),
|
|||
|
SuperTrainPersonNum = gg.Where(x => x.IsSuperLargerHazard == true).Sum(x => x.TrainPersonNum) ?? 0,
|
|||
|
SuperConstructionNum = gg.Count(x => x.States == "2" && x.IsSuperLargerHazard == true),
|
|||
|
SuperFinishedNum = gg.Count(x => x.States == "3" && x.IsSuperLargerHazard == true),
|
|||
|
|
|||
|
}).ToList();
|
|||
|
return query;
|
|||
|
}
|
|||
|
public static async Task<List<Model.LargeEngineeringOutput>> GetLargeEngineeringOutputsAsync()
|
|||
|
{
|
|||
|
return await Task.Run(GetLargeEngineeringOutputs);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取危大工程审批完成数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetCompletedNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "1" &&
|
|||
|
x.IsSuperLargerHazard == false &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取危大工程培训人次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetTrainPersonNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsSuperLargerHazard == false &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x.TrainPersonNum).ToList().Sum(x => x.Value);
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取危大工程施工个数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetConstructionNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "2" &&
|
|||
|
x.IsSuperLargerHazard == false &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取危大工程完工个数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetFinishedNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "3" &&
|
|||
|
x.IsSuperLargerHazard == false &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取超危大工程审批完成数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetSuperCompletedNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "1" &&
|
|||
|
x.IsSuperLargerHazard == true &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取超危大工程培训人次数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetSuperTrainPersonNum()
|
|||
|
{
|
|||
|
var result =
|
|||
|
(from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.IsSuperLargerHazard == true &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x.TrainPersonNum).ToList().Sum(x => x.Value);
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取超危大工程施工个数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetSuperConstructionNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "2" &&
|
|||
|
x.IsSuperLargerHazard == true &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取超危大工程完工个数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetSuperFinishedNum()
|
|||
|
{
|
|||
|
var result = (from x in Funs.DB.Solution_LargerHazard
|
|||
|
where BeUnderConstructionList.Contains(x.ProjectId) && x.States == "3" &&
|
|||
|
x.IsSuperLargerHazard == true &&
|
|||
|
x.RecordTime > Const.DtmarkTime
|
|||
|
select x).Count();
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region 获取列表
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 记录数
|
|||
|
/// </summary>
|
|||
|
public static int Count { get; set; }
|
|||
|
|
|||
|
public static List<HSSEData_HSSE> GetHSSEData_HSSEByModle(HSSEData_HSSE table)
|
|||
|
{
|
|||
|
var db = Funs.DB;
|
|||
|
var q = from x in db.HSSEData_HSSE
|
|||
|
where
|
|||
|
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
|||
|
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
|
|||
|
(string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
|
|||
|
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName))
|
|||
|
orderby x.ReportDate descending
|
|||
|
select x
|
|||
|
;
|
|||
|
|
|||
|
return q.ToList();
|
|||
|
}
|
|||
|
|
|||
|
// ReSharper disable once InvalidXmlDocComment
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public static IEnumerable GetListData(HSSEData_HSSE table, Grid Grid1)
|
|||
|
{
|
|||
|
var q = GetHSSEData_HSSEByModle(table);
|
|||
|
Count = q.Count();
|
|||
|
if (Count == 0) return null;
|
|||
|
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|||
|
return from x in q
|
|||
|
select new
|
|||
|
{
|
|||
|
x.Id,
|
|||
|
x.UnitId,
|
|||
|
x.CollCropCode,
|
|||
|
x.UnitName,
|
|||
|
x.ReportDate,
|
|||
|
x.BeUnderConstructionNum,
|
|||
|
x.ShutdownNum,
|
|||
|
x.JoinConstructionPersonNum,
|
|||
|
x.MajorProjectsUnderConstructionNum,
|
|||
|
x.TotalWorkingHour,
|
|||
|
x.LostWorkingHour,
|
|||
|
x.SafeWorkingHour,
|
|||
|
x.SafeTrainNum,
|
|||
|
x.SpecialTrainNum,
|
|||
|
x.SpecialOperationTrainNum,
|
|||
|
x.EnvironmentalTrainNum,
|
|||
|
x.TotalEnergyConsumption,
|
|||
|
x.IncomeComprehensiveEnergyConsumption,
|
|||
|
x.NewWaterConsumption,
|
|||
|
x.HeadOfficeInspectorGeneralNum,
|
|||
|
x.HeadOfficeFullTimeNum,
|
|||
|
x.BranchInspectorGeneralNum,
|
|||
|
x.BranchFullTimeNum,
|
|||
|
x.ProjectInspectorGeneralNum,
|
|||
|
x.ProjectFullTimeNum,
|
|||
|
x.ProjectSafetyMonitorNum,
|
|||
|
x.SafetyInjectionEngineer,
|
|||
|
x.CertificateANum,
|
|||
|
x.CertificateBNum,
|
|||
|
x.CertificateCNum,
|
|||
|
x.SafetyCommitteeMeetingNum,
|
|||
|
x.EnterpriseTopicsMeetingNum,
|
|||
|
x.ProjectSafetyLeadingGroupMeetingNum,
|
|||
|
x.ProjectSafetyMeetingNum,
|
|||
|
x.CompanyLeadShiftCheckNum,
|
|||
|
x.CompanyComprehensiveCheckNum,
|
|||
|
x.CompanySpecialCheckNum,
|
|||
|
x.ProjectLeadShiftCheckNum,
|
|||
|
x.ProjectSpecialCheckNum,
|
|||
|
x.ProjectMajorCheckNum,
|
|||
|
x.NearMissNum,
|
|||
|
x.RecordableEventNum,
|
|||
|
x.GeneralAccidentNum,
|
|||
|
x.MajorAccidentNum,
|
|||
|
x.SeriousAccidentNum,
|
|||
|
x.SpecialSeriousAccidentNum,
|
|||
|
x.CompanyComprehensivePlanNum,
|
|||
|
x.CompanySpecialPlanNum,
|
|||
|
x.CompanyOnSiteDisposalPlan,
|
|||
|
x.CompanyDrillNum,
|
|||
|
x.ProjectComprehensivePlanNum,
|
|||
|
x.ProjectSpecialPlanNum,
|
|||
|
x.ProjectOnSiteDisposalPlan,
|
|||
|
x.ProjectDrillNum,
|
|||
|
x.CostExtract,
|
|||
|
x.CostUse,
|
|||
|
x.UseEquipmentNum,
|
|||
|
x.SpecialEquipmentNum,
|
|||
|
x.LicensesNum,
|
|||
|
x.LicensesCloseNum,
|
|||
|
x.GeneralClosedNum,
|
|||
|
x.GeneralNotClosedNum,
|
|||
|
x.MajorClosedNum,
|
|||
|
x.MajorNotClosedNum,
|
|||
|
x.GeneralRiskNum,
|
|||
|
x.LowRiskNum,
|
|||
|
x.MediumRiskNum,
|
|||
|
x.HighRiskNum,
|
|||
|
x.CompletedNum,
|
|||
|
x.TrainPersonNum,
|
|||
|
x.ConstructionNum,
|
|||
|
x.FinishedNum,
|
|||
|
x.SuperCompletedNum,
|
|||
|
x.SuperTrainPersonNum,
|
|||
|
x.SuperConstructionNum,
|
|||
|
x.SuperFinishedNum,
|
|||
|
x.State,
|
|||
|
x.CreateDate,
|
|||
|
x.CreateMan
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
#endregion 获取列表
|
|||
|
}
|
|||
|
}
|