diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index 33a28f18..6c050f2d 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -547,117 +547,6 @@ namespace BLL }; 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 StatisticalDataAsync() { var thisUnitId = string.Empty; @@ -870,6 +759,7 @@ namespace BLL var licensesCloseList = await licensesCloseTask; var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask; var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask; + var largeEngineerinOutputOutputsList = await largeEngineeringOutputsTask; // 构造结果对象 var table = new HSSEData_HSSE @@ -954,18 +844,18 @@ namespace BLL GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum), MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum), HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum), - CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum), - TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum), - OperativesNum = largeEngineeringOutputsTask.Result.Sum(x => x.OperativesNum), - ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum), - FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum), - ArgumentNum = largeEngineeringOutputsTask.Result.Sum(x => x.ArgumentNum), - SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum), - SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum), - SuperOperativesNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperOperativesNum), - SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum), - SuperFinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperFinishedNum), - SuperArgumentNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperArgumentNum) + CompletedNum = largeEngineerinOutputOutputsList.Sum(x => x.CompletedNum), + TrainPersonNum = largeEngineerinOutputOutputsList.Sum(x => x.TrainPersonNum), + OperativesNum = largeEngineerinOutputOutputsList.Sum(x => x.OperativesNum), + ConstructionNum = largeEngineerinOutputOutputsList.Sum(x => x.ConstructionNum), + FinishedNum = largeEngineerinOutputOutputsList.Sum(x => x.FinishedNum), + ArgumentNum = largeEngineerinOutputOutputsList.Sum(x => x.ArgumentNum), + SuperCompletedNum = largeEngineerinOutputOutputsList.Sum(x => x.SuperCompletedNum), + SuperTrainPersonNum = largeEngineerinOutputOutputsList.Sum(x => x.SuperTrainPersonNum), + SuperOperativesNum = largeEngineerinOutputOutputsList.Sum(x => x.SuperOperativesNum), + SuperConstructionNum = largeEngineerinOutputOutputsList.Sum(x => x.SuperConstructionNum), + SuperFinishedNum = largeEngineerinOutputOutputsList.Sum(x => x.SuperFinishedNum), + SuperArgumentNum = largeEngineerinOutputOutputsList.Sum(x => x.SuperArgumentNum) }; #region 添加项目统计数据 @@ -2981,36 +2871,8 @@ namespace BLL /// public static List 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 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin - from sysConst in sysConstJoin.DefaultIfEmpty() - where 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 = "工程", - ProjectMoney = project.ProjectMoney, - DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, - ProjectTypeName = projectType.ProjectTypeName, - ProjectStateName2 = sysConst.ConstText - }; - var result = projectInfos.ToList(); - return result; + return BaseDataService.GetBeUnderConstruction(); + } /// /// 获取在建项目数(异步) @@ -3028,36 +2890,8 @@ namespace BLL /// public static List 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 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin - from sysConst in sysConstJoin.DefaultIfEmpty() - where 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 = "工程", - ProjectMoney = project.ProjectMoney, - DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, - ProjectTypeName = projectType.ProjectTypeName, - ProjectStateName2 = sysConst.ConstText - }; - var result = projectInfos.ToList(); - return result; + return BaseDataService.GetShutdown(); + } /// /// 获取停工项目数(异步) @@ -3073,36 +2907,8 @@ namespace BLL /// public static List 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 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin - from sysConst in sysConstJoin.DefaultIfEmpty() - where 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 = "工程", - ProjectMoney = project.ProjectMoney, - DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, - ProjectTypeName = projectType.ProjectTypeName, - ProjectStateName2 = sysConst.ConstText - }; - var result = projectInfos.ToList(); - return result; + return BaseDataService.GetCompletedProject(); + } /// /// 获取所有项目数 @@ -3110,35 +2916,7 @@ namespace BLL /// public static List 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 = "", GroupId = BLL.ConstValue.GroupId_ProjectState } equals new { ProjectState2 = sysConst.ConstValue, GroupId = sysConst.GroupId } into sysConstJoin - from sysConst in sysConstJoin.DefaultIfEmpty() - 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 = "工程", - ProjectMoney = project.ProjectMoney, - DayCount = DateTime.Now.Subtract(project.StartDate.Value).Days, - ProjectTypeName = projectType.ProjectTypeName, - ProjectStateName2 = sysConst.ConstText - }; - var result = projectInfos.ToList(); - return result; + return BaseDataService.GetALLProject(); } ///