fix:升级

This commit is contained in:
geh
2025-06-19 19:23:01 +08:00
parent 0cb37e2c02
commit 7aa8baadbb
111 changed files with 14465 additions and 1480 deletions
@@ -0,0 +1,180 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public static class BaseDataService
{
public static List<string> BeUnderConstructionList = GetBeUnderConstruction().Select(p => p.ProjectId).ToList();
/// <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;
}
}
}
+301 -106
View File
@@ -15,8 +15,7 @@ namespace BLL
{
public static class CQMSDataService
{
public static SUBQHSEDB 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 List<string> BeUnderConstructionList = BaseDataService.BeUnderConstructionList;
#region
@@ -63,6 +62,9 @@ namespace BLL
x.ReportDate,
x.TrainPersonNum,
x.TechnicalDisclosePersonNum,
x.ComprehensiveConTechnologyDisclosureNum,
x.ComprehensiveConTechnologyDisclosurePersonNum,
x.ComprehensiveReviewDrawingsNum,
x.UseNum,
x.OKNum,
x.CompanyPersonNum,
@@ -90,6 +92,8 @@ namespace BLL
x.SubProjectNum,
x.SubdivisionalWorksNum,
x.InspectionLotNum,
x.InspectionMachineNum,
x.InspectionMachineQualifiedNum,
x.State,
x.CreateDate,
x.CreateMan
@@ -113,11 +117,15 @@ namespace BLL
ReportDate = newtable.ReportDate,
TrainPersonNum = newtable.TrainPersonNum,
TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum,
ComprehensiveConTechnologyDisclosureNum = newtable.ComprehensiveConTechnologyDisclosureNum,
ComprehensiveConTechnologyDisclosurePersonNum = newtable.ComprehensiveConTechnologyDisclosurePersonNum,
ComprehensiveReviewDrawingsNum = newtable.ComprehensiveReviewDrawingsNum,
UseNum = newtable.UseNum,
OKNum = newtable.OKNum,
CompanyPersonNum = newtable.CompanyPersonNum,
BranchPersonNum = newtable.BranchPersonNum,
ProjectPersonNum = newtable.ProjectPersonNum,
ProjectSubPersonNum = newtable.ProjectSubPersonNum,
ProblemNum = newtable.ProblemNum,
ProblemCompletedNum = newtable.ProblemCompletedNum,
ProblemNotCompletedNum = newtable.ProblemNotCompletedNum,
@@ -159,6 +167,8 @@ namespace BLL
SubProjectAcceptOKNum = newtable.SubProjectAcceptOKNum,
SubdivisionalWorksAcceptNum = newtable.SubdivisionalWorksAcceptNum,
SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum,
InspectionMachineNum = newtable.InspectionMachineNum,
InspectionMachineQualifiedNum = newtable.InspectionMachineQualifiedNum,
State = newtable.State,
CreateDate = newtable.CreateDate,
CreateMan = newtable.CreateMan
@@ -182,14 +192,24 @@ namespace BLL
table.ReportDate = newtable.ReportDate;
table.TrainPersonNum = newtable.TrainPersonNum;
table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum;
table.ComprehensiveConTechnologyDisclosureNum = newtable.ComprehensiveConTechnologyDisclosureNum;
table.ComprehensiveConTechnologyDisclosurePersonNum = newtable.ComprehensiveConTechnologyDisclosurePersonNum;
table.ComprehensiveReviewDrawingsNum = newtable.ComprehensiveReviewDrawingsNum;
table.UseNum = newtable.UseNum;
table.OKNum = newtable.OKNum;
table.CompanyPersonNum = newtable.CompanyPersonNum;
table.BranchPersonNum = newtable.BranchPersonNum;
table.ProjectPersonNum = newtable.ProjectPersonNum;
table.ProjectSubPersonNum = newtable.ProjectSubPersonNum;
table.ProblemNum = newtable.ProblemNum;
table.ProblemCompletedNum = newtable.ProblemCompletedNum;
table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum;
table.UnitCheckNum = newtable.UnitCheckNum;
table.UnitCheckClosedNum = newtable.UnitCheckClosedNum;
table.UnitCheckNotClosedNum = newtable.UnitCheckNotClosedNum;
table.BranchCheckNum = newtable.BranchCheckNum;
table.BranchCheckClosedNum = newtable.BranchCheckClosedNum;
table.BranchCheckNotClosedNum = newtable.BranchCheckNotClosedNum;
table.SNum = newtable.SNum;
table.ANum = newtable.ANum;
table.BNum = newtable.BNum;
@@ -228,6 +248,8 @@ namespace BLL
table.SubProjectAcceptOKNum = newtable.SubProjectAcceptOKNum;
table.SubdivisionalWorksAcceptNum = newtable.SubdivisionalWorksAcceptNum;
table.SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum;
table.InspectionMachineNum = newtable.InspectionMachineNum;
table.InspectionMachineQualifiedNum = newtable.InspectionMachineQualifiedNum;
table.State = newtable.State;
table.CreateMan = newtable.CreateMan;
table.CreateDate = newtable.CreateDate;
@@ -270,6 +292,9 @@ namespace BLL
item.CollCropCode = model.CollCropCode;
item.TrainPersonNum = model.TrainPersonNum;
item.TechnicalDisclosePersonNum = model.TechnicalDisclosePersonNum;
item.ComprehensiveConTechnologyDisclosureNum = model.ComprehensiveConTechnologyDisclosureNum;
item.ComprehensiveConTechnologyDisclosurePersonNum = model.ComprehensiveConTechnologyDisclosurePersonNum;
item.ComprehensiveReviewDrawingsNum = model.ComprehensiveReviewDrawingsNum;
item.UseNum = model.UseNum;
item.OKNum = model.OKNum;
item.CompanyPersonNum = model.CompanyPersonNum;
@@ -279,6 +304,12 @@ namespace BLL
item.ProblemCompletedNum = model.ProblemCompletedNum;
item.ProblemNotCompletedNum = model.ProblemNotCompletedNum;
item.ProblemRate = "";
item.UnitCheckNum = model.UnitCheckNum;
item.UnitCheckClosedNum = model.UnitCheckClosedNum;
item.UnitCheckNotClosedNum = model.UnitCheckNotClosedNum;
item.BranchCheckNum = model.BranchCheckNum;
item.BranchCheckClosedNum = model.BranchCheckClosedNum;
item.BranchCheckNotClosedNum = model.BranchCheckNotClosedNum;
item.SNum = model.SNum;
item.ANum = model.ANum;
item.BNum = model.BNum;
@@ -322,6 +353,11 @@ namespace BLL
item.SubProjectAcceptOKNum = model.SubProjectAcceptOKNum;
item.SubdivisionalWorksAcceptNum = model.SubdivisionalWorksAcceptNum;
item.SubdivisionalWorksAcceptOKNum = model.SubdivisionalWorksAcceptOKNum;
item.MachineInspectionNum = model.MachineInspectionQualifiedNum;
item.MachineInspectionQualifiedNum = model.MachineInspectionQualifiedNum;
item.InspectionLotNum = model.InspectionLotNum;
item.InspectionMachineNum = model.InspectionMachineNum;
item.InspectionMachineQualifiedNum = model.InspectionMachineQualifiedNum;
}
var cqmsDataItems = new List<CqmsDataItem>();
@@ -371,6 +407,9 @@ namespace BLL
ReportDate = DateTime.Now.Date,
TrainPersonNum = ProjectData.Sum(x => x.TrainPersonNum),
TechnicalDisclosePersonNum = ProjectData.Sum(x => x.TechnicalDisclosePersonNum),
ComprehensiveConTechnologyDisclosureNum = ProjectData.Sum(x => x.ComprehensiveConTechnologyDisclosureNum),
ComprehensiveConTechnologyDisclosurePersonNum = ProjectData.Sum(x => x.ComprehensiveConTechnologyDisclosurePersonNum),
ComprehensiveReviewDrawingsNum = ProjectData.Sum(x => x.ComprehensiveReviewDrawingsNum),
UseNum = ProjectData.Sum(x => x.UseNum),
OKNum = ProjectData.Sum(x => x.OKNum),
CompanyPersonNum = GetCompanyPersonNum(),
@@ -398,6 +437,9 @@ namespace BLL
SubProjectNum = ProjectData.Sum(x => x.SubProjectNum),
SubdivisionalWorksNum = ProjectData.Sum(x => x.SubdivisionalWorksNum),
InspectionLotNum = ProjectData.Sum(x => x.InspectionLotNum),
InspectionMachineNum = ProjectData.Sum(x=>x.InspectionMachineNum),
InspectionMachineQualifiedNum = ProjectData.Sum(x => x.InspectionMachineQualifiedNum),
SpecialEquipmentQualityAssuranceSystemNum = ProjectData.Sum(x => x.SpecialEquipmentQualityAssuranceSystemNum),
CreateMan = Const.sysglyId,
CreateDate = DateTime.Now
};
@@ -446,92 +488,6 @@ namespace BLL
return responeData;
}
public static CQMSData StatisticalData()
{
var thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
var base_Unit = UnitService.GetUnitByUnitId(thisUnitId);
Project_CQMSDataService.StatisticalAllProjectData();
var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
select x).ToList();
var table = new CQMSData_CQMS
{
UnitId = thisUnitId,
CollCropCode = base_Unit.CollCropCode,
UnitName = base_Unit.UnitName,
ReportDate = DateTime.Now.Date,
TrainPersonNum = ProjectData.Sum(x => x.TrainPersonNum),
TechnicalDisclosePersonNum = ProjectData.Sum(x => x.TechnicalDisclosePersonNum),
UseNum = ProjectData.Sum(x => x.UseNum),
OKNum = ProjectData.Sum(x => x.OKNum),
CompanyPersonNum = GetCompanyPersonNum(),
BranchPersonNum = GetBranchPersonNum(),
ProjectPersonNum = ProjectData.Sum(x => x.ProjectPersonNum),
ProblemNum = ProjectData.Sum(x => x.ProblemNum),
ProblemCompletedNum = ProjectData.Sum(x => x.ProblemCompletedNum),
ProblemNotCompletedNum = ProjectData.Sum(x => x.ProblemNotCompletedNum),
SNum = ProjectData.Sum(x => x.SNum),
ANum = ProjectData.Sum(x => x.ANum),
BNum = ProjectData.Sum(x => x.BNum),
CNum = ProjectData.Sum(x => x.CNum),
KeyProcessNum = ProjectData.Sum(x => x.KeyProcessNum),
KeyProcessOKNum = ProjectData.Sum(x => x.KeyProcessOKNum),
SpecialProcessNum = ProjectData.Sum(x => x.SpecialProcessNum),
SpecialProcessOKNum = ProjectData.Sum(x => x.SpecialProcessOKNum),
ConcealedWorksNum = ProjectData.Sum(x => x.ConcealedWorksNum),
ConcealedWorksOKNum = ProjectData.Sum(x => x.ConcealedWorksOKNum),
UnitProjectOnesNum = ProjectData.Sum(x => x.UnitProjectOnesNum),
UnitProjectOnesOKNum = ProjectData.Sum(x => x.UnitProjectOnesOKNum),
MaterialInRecheckNum = ProjectData.Sum(x => x.MaterialInRecheckNum),
MaterialInRecheckOKNum = ProjectData.Sum(x => x.MaterialInRecheckOKNum),
SingleProjectNum = ProjectData.Sum(x => x.SingleProjectNum),
UnitProjectNum = ProjectData.Sum(x => x.UnitProjectNum),
SubProjectNum = ProjectData.Sum(x => x.SubProjectNum),
SubdivisionalWorksNum = ProjectData.Sum(x => x.SubdivisionalWorksNum),
InspectionLotNum = ProjectData.Sum(x => x.InspectionLotNum),
EquipmentInspectionNum = ProjectData.Sum(x => x.EquipmentInspectionNum),
EquipmentInspectionQualifiedNum = ProjectData.Sum(x => x.EquipmentInspectionQualifiedNum),
MachineInspectionNum = ProjectData.Sum(x => x.MachineInspectionNum),
MachineInspectionQualifiedNum = ProjectData.Sum(x => x.MachineInspectionQualifiedNum),
PersonInspectionNum = ProjectData.Sum(x => x.PersonInspectionNum),
PersonInspectionQualifiedNum = ProjectData.Sum(x => x.PersonInspectionQualifiedNum),
MaterialInspectionNum = ProjectData.Sum(x => x.MaterialInspectionNum),
MaterialInspectionQualifiedNum = ProjectData.Sum(x => x.MaterialInspectionQualifiedNum),
ConstructSolutionNum = ProjectData.Sum(x => x.ConstructSolutionNum),
ConstructSolutionProjectApproveNum = ProjectData.Sum(x => x.ConstructSolutionProjectApproveNum),
ConstructSolutionUnitApproveNum = ProjectData.Sum(x => x.ConstructSolutionUnitApproveNum),
SpecialEquipmentQualityAssuranceSystemNum = ProjectData.Sum(x => x.SpecialEquipmentQualityAssuranceSystemNum),
DesignDetailsNum = ProjectData.Sum(x => x.DesignDetailsNum),
UnitProjectAcceptNum = ProjectData.Sum(x => x.UnitProjectAcceptNum),
UnitProjectAcceptOKNum = ProjectData.Sum(x => x.UnitProjectAcceptOKNum),
SubProjectAcceptNum = ProjectData.Sum(x => x.SubProjectAcceptNum),
SubProjectAcceptOKNum = ProjectData.Sum(x => x.SubProjectAcceptOKNum),
SubdivisionalWorksAcceptNum = ProjectData.Sum(x => x.SubdivisionalWorksAcceptNum),
SubdivisionalWorksAcceptOKNum = ProjectData.Sum(x => x.SubdivisionalWorksAcceptOKNum),
CreateMan = Const.sysglyId,
CreateDate = DateTime.Now
};
if (IsReportByToday())
{
table.Id = GetTodayData().Id;
table.State = Const.CNCEC_State_1;
UpdateCQMSData_CQMS(table);
}
else
{
table.Id = SQLHelper.GetNewID();
table.State = Const.CNCEC_State_0;
AddCQMSData_CQMS(table);
}
var data = new CQMSData();
data = GetDataByCQMSData_CQMS(table);
return data;
}
/// <summary>
/// 获取质量统计数据
/// </summary>
@@ -547,11 +503,15 @@ namespace BLL
var branchPersonNumTask = CQMSDataService.GetBranchPersonNumAsync(); //获取分支机构人数
var projectPersonNumTask = CQMSDataService.GetProjectPersonNumAsync(); //获取项目专职人数
var trainPersonNumTask = CQMSDataService.GetTrainPersonNumAsync(); //获取质量培训人次数
var technicalDisclosePersonTask = CQMSDataService.GetTechnicalDisclosePersonNumAsync(); //获取技术交底人次数
var technicalDisclosePersonTask = CQMSDataService.GetTechnicalDisclosePersonNumAsync(); //获取设计交底人次数
var qualityAssuranceNumTask = CQMSDataService.GetQualityAssuranceNumAsync(); //获取特设质保体系数量
var comprehensiveConTechnologyDisclosureTask = CQMSDataService.GetComprehensiveConTechnologyDisclosureAsync(); //获取施工技术交底
var comprehensiveReviewDrawingsTask = CQMSDataService.GetComprehensiveReviewDrawingsAsync(); //获取图纸会审
var inspectionEquipmentTask = CQMSDataService.GetComprehensive_InspectionEquipmentAsync(); //获取设备报验
var inspectionPersonTask = CQMSDataService.GetComprehensive_InspectionPersonAsync(); //获取人员报验
var inspectionMachineTask = CQMSDataService.GetComprehensive_InspectionMachineAsync(); //获取机具报验
var inspectionMachineEquipmentTask = CQMSDataService.GetComprehensive_InspectionMachineEquipmentAsync(); //获取设备报验报检
var useNumTask = CQMSDataService.GetUseNumAsync(); //获取在用计量器具数
var okNumTask = CQMSDataService.GetOkNumAsync(); //获取校准合格数
@@ -562,6 +522,8 @@ namespace BLL
var inspectionLotNumTask = CQMSDataService.GetInspectionLotNumAsync(); //获取检验批个数
var constructSolutionTask = CQMSDataService.GetConstructSolutionAsync(); //施工方案数量
var cqmsProblemTask = CQMSDataService.GetCQMSProblemAsync(); //获取企业级、项目级质量问题
var cqmsBranchMajorCheckTask = CQMSDataService.GetBranchMajorCheckAsync(); //获取分支机构质量大检查次数
var cqmsCompanyMajorCheckTask = CQMSDataService.GetCompanyMajorCheckAsync(); //获取企业质量大检查次数
//质量验收数据
var keyProcessNumTask = CQMSDataService.GetKeyProcessNumAsync(); //获取关键工序验收数
@@ -584,14 +546,16 @@ namespace BLL
await Task.WhenAll(
companyPersonNumTask, branchPersonNumTask, projectPersonNumTask,
trainPersonNumTask, technicalDisclosePersonTask,
comprehensiveConTechnologyDisclosureTask, comprehensiveReviewDrawingsTask,
inspectionEquipmentTask, inspectionPersonTask, inspectionMachineTask,
useNumTask, okNumTask,
singleProjectNumTask, unitProjectNumTask, subProjectNuTask, subdivisionalWorksNuTask, inspectionLotNumTask,
constructSolutionTask,
cqmsProblemTask,
cqmsProblemTask, cqmsBranchMajorCheckTask, cqmsCompanyMajorCheckTask,
keyProcessNumTask, keyProcessOKNumTask, specialProcessNumTask, specialProcessOKNumTask, concealedWorksNumTask, concealedWorksOKNumTask,
unitProjectAcceptNumTask, unitProjectAcceptOKNumTask, subProjectAcceptNumTask, subProjectAcceptOKNumTask, subdivisionalWorksAcceptNumTask, subdivisionalWorksAcceptOKNumTask,
materialInRecheckNumTask, materialInRecheckOKNumTask
materialInRecheckNumTask, materialInRecheckOKNumTask, inspectionMachineEquipmentTask,
qualityAssuranceNumTask
);
// 统一获取异步方法的返回值
@@ -600,10 +564,13 @@ namespace BLL
var projectPersonNumList = await projectPersonNumTask;
var trainPersonNumList = await trainPersonNumTask;
var technicalDisclosePersonList = await technicalDisclosePersonTask;
var comprehensiveConTechnologyDisclosureList = await comprehensiveConTechnologyDisclosureTask;
var comprehensiveReviewDrawingsList = await comprehensiveReviewDrawingsTask;
var inspectionEquipmentList = await inspectionEquipmentTask;
var inspectionPersonList = await inspectionPersonTask;
var inspectionMachineList = await inspectionMachineTask;
var inspectionMachineEquipmentList =await inspectionMachineEquipmentTask;
var useNum = await useNumTask;
var okNum = await okNumTask;
var singleProjectNum = await singleProjectNumTask;
@@ -614,6 +581,8 @@ namespace BLL
var constructSolutionList = await constructSolutionTask;
var cqmsProblemList = await cqmsProblemTask;
var cqmsBranchMajorCheckList = await cqmsBranchMajorCheckTask;
var cqmsCompanyMajorCheckList = await cqmsCompanyMajorCheckTask;
var keyProcessNum = await keyProcessNumTask;
var keyProcessOKNum = await keyProcessOKNumTask;
@@ -630,7 +599,8 @@ namespace BLL
var subdivisionalWorksAcceptOKNum = await subdivisionalWorksAcceptOKNumTask;
var materialInRecheckNum = await materialInRecheckNumTask;
var materialInRecheckOKNum = await materialInRecheckOKNumTask;
var qualityAssuranceNum = await qualityAssuranceNumTask;
// 构造结果对象
var table = new CQMSData_CQMS
{
@@ -640,17 +610,23 @@ namespace BLL
ReportDate = DateTime.Now.Date,
CompanyPersonNum = companyPersonNum,//
BranchPersonNum = branchPersonNum,//
ProjectPersonNum = projectPersonNumList.Count(),
ProjectPersonNum = projectPersonNumList.Count(x => x.IsOffice == true),
ProjectSubPersonNum = projectPersonNumList.Count(x => x.IsOffice == false),
TrainPersonNum = trainPersonNumList.Count(),
TechnicalDisclosePersonNum = technicalDisclosePersonList.Sum(x => x.TrainPersonNum),
ComprehensiveConTechnologyDisclosureNum = comprehensiveConTechnologyDisclosureList.Count(),
ComprehensiveConTechnologyDisclosurePersonNum = comprehensiveConTechnologyDisclosureList.Sum(x => x.TrainPersonNum),
ComprehensiveReviewDrawingsNum = comprehensiveReviewDrawingsList.Count(),
EquipmentInspectionNum = inspectionEquipmentList.Count(),
EquipmentInspectionQualifiedNum = inspectionEquipmentList.Where(x => x.SamplingResult == "1").Count(),
PersonInspectionNum = inspectionPersonList.Count(),
PersonInspectionQualifiedNum = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true).Count(),
MachineInspectionNum = inspectionMachineList.Count(),
MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true).Count(),
MaterialInspectionNum = 0,
MaterialInspectionQualifiedNum = 0,
MaterialInspectionNum = inspectionEquipmentList.Count(),
MaterialInspectionQualifiedNum = inspectionEquipmentList.Where(x => x.SamplingResult == "1").Count(),
UseNum = useNum.Count(),
OKNum = okNum.Count(),
SingleProjectNum = singleProjectNum.Count(),
@@ -662,12 +638,18 @@ namespace BLL
ConstructSolutionNum = constructSolutionList.Count(),
ConstructSolutionProjectApproveNum = constructSolutionList.Where(x => x.State == "1").Count(),
ConstructSolutionUnitApproveNum = 0,//
SpecialEquipmentQualityAssuranceSystemNum = 0,//
SpecialEquipmentQualityAssuranceSystemNum = qualityAssuranceNum.Count(),
DesignDetailsNum = technicalDisclosePersonList.Sum(x => x.TrainPersonNum),
ProblemNum = cqmsProblemList.Count(),
ProblemCompletedNum = cqmsProblemList.Where(x => x.State == "7").Count(),
ProblemNotCompletedNum = cqmsProblemList.Where(x => x.State != "7").Count(),
BranchCheckNum = cqmsBranchMajorCheckList.Count(),
BranchCheckClosedNum = cqmsBranchMajorCheckList.Count(),
BranchCheckNotClosedNum = 0,
UnitCheckNum = cqmsCompanyMajorCheckList.Count(),
UnitCheckClosedNum = cqmsCompanyMajorCheckList.Count(),
UnitCheckNotClosedNum = 0,
KeyProcessNum = keyProcessNum.Count(),
KeyProcessOKNum = keyProcessOKNum.Count(),
@@ -682,7 +664,10 @@ namespace BLL
SubdivisionalWorksAcceptNum = subdivisionalWorksAcceptNum.Count(),
SubdivisionalWorksAcceptOKNum = subdivisionalWorksAcceptOKNum.Count(),
MaterialInRecheckNum = materialInRecheckNum.Count(),
MaterialInRecheckOKNum = materialInRecheckOKNum.Count()
MaterialInRecheckOKNum = materialInRecheckOKNum.Count(),
InspectionMachineNum = inspectionMachineEquipmentList.Count(),
InspectionMachineQualifiedNum = inspectionMachineEquipmentList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true).Count(),
};
#region
@@ -699,9 +684,13 @@ namespace BLL
ReportDate = DateTime.Now.Date,
CompanyPersonNum = companyPersonNum,//
BranchPersonNum = branchPersonNum,//
ProjectPersonNum = projectPersonNumList.Count(x => x.ProjectId == projectid),
ProjectPersonNum = projectPersonNumList.Count(x => x.ProjectId == projectid && x.IsOffice == true),
ProjectSubPersonNum = projectPersonNumList.Count(x => x.ProjectId == projectid && x.IsOffice == false),
TrainPersonNum = trainPersonNumList.Count(x => x.ProjectId == projectid),
TechnicalDisclosePersonNum = technicalDisclosePersonList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
ComprehensiveConTechnologyDisclosureNum = comprehensiveConTechnologyDisclosureList.Count(x => x.ProjectId == projectid),
ComprehensiveConTechnologyDisclosurePersonNum = comprehensiveConTechnologyDisclosureList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
ComprehensiveReviewDrawingsNum = comprehensiveReviewDrawingsList.Count(x => x.ProjectId == projectid),
EquipmentInspectionNum = inspectionEquipmentList.Count(x => x.ProjectId == projectid),
EquipmentInspectionQualifiedNum = inspectionEquipmentList.Where(x => x.SamplingResult == "1" && x.ProjectId == projectid).Count(),
PersonInspectionNum = inspectionPersonList.Count(x => x.ProjectId == projectid),
@@ -721,7 +710,7 @@ namespace BLL
ConstructSolutionNum = constructSolutionList.Count(x => x.ProjectId == projectid),
ConstructSolutionProjectApproveNum = constructSolutionList.Where(x => x.State == "1" && x.ProjectId == projectid).Count(),
ConstructSolutionUnitApproveNum = 0,//
SpecialEquipmentQualityAssuranceSystemNum = 0,//
SpecialEquipmentQualityAssuranceSystemNum = qualityAssuranceNum.Count(x => x.ProjectId == projectid),
DesignDetailsNum = technicalDisclosePersonList.Where(x => x.ProjectId == projectid).Sum(x => x.TrainPersonNum),
ProblemNum = cqmsProblemList.Count(x => x.ProjectId == projectid),
@@ -741,7 +730,10 @@ namespace BLL
SubdivisionalWorksAcceptNum = subdivisionalWorksAcceptNum.Count(x => x.ProjectId == projectid),
SubdivisionalWorksAcceptOKNum = subdivisionalWorksAcceptOKNum.Count(x => x.ProjectId == projectid),
MaterialInRecheckNum = materialInRecheckNum.Count(x => x.ProjectId == projectid),
MaterialInRecheckOKNum = materialInRecheckOKNum.Count(x => x.ProjectId == projectid)
MaterialInRecheckOKNum = materialInRecheckOKNum.Count(x => x.ProjectId == projectid),
InspectionMachineNum = inspectionMachineEquipmentList.Count(x => x.ProjectId == projectid),
InspectionMachineQualifiedNum = inspectionMachineEquipmentList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true && x.ProjectId == projectid).Count(),
};
Project_CQMSDataService.AddProject_CQMSData_CQMS(projectCqmsData);
}
@@ -766,7 +758,6 @@ namespace BLL
return data;
}
public static CQMSData GetDataByCQMSData_CQMS(CQMSData_CQMS table)
{
var data = new CQMSData();
@@ -777,15 +768,25 @@ namespace BLL
item.CollCropCode = table.CollCropCode;
item.TrainPersonNum = table.TrainPersonNum;
item.TechnicalDisclosePersonNum = table.TechnicalDisclosePersonNum;
item.ComprehensiveConTechnologyDisclosureNum = table.ComprehensiveConTechnologyDisclosureNum;
item.ComprehensiveConTechnologyDisclosurePersonNum = table.ComprehensiveConTechnologyDisclosurePersonNum;
item.ComprehensiveReviewDrawingsNum = table.ComprehensiveReviewDrawingsNum;
item.UseNum = table.UseNum;
item.OKNum = table.OKNum;
item.CompanyPersonNum = table.CompanyPersonNum;
item.BranchPersonNum = table.BranchPersonNum;
item.ProjectPersonNum = table.ProjectPersonNum;
item.ProjectSubPersonNum = table.ProjectSubPersonNum;
item.ProblemNum = table.ProblemNum;
item.ProblemCompletedNum = table.ProblemCompletedNum;
item.ProblemNotCompletedNum = table.ProblemNotCompletedNum;
item.ProblemRate = "";
item.UnitCheckNum = table.UnitCheckNum;
item.UnitCheckClosedNum = table.UnitCheckClosedNum;
item.UnitCheckNotClosedNum = table.UnitCheckNotClosedNum;
item.BranchCheckNum = table.BranchCheckNum;
item.BranchCheckClosedNum = table.BranchCheckClosedNum;
item.BranchCheckNotClosedNum = table.BranchCheckNotClosedNum;
item.SNum = table.SNum;
item.ANum = table.ANum;
item.BNum = table.BNum;
@@ -829,6 +830,8 @@ namespace BLL
item.SubProjectAcceptOKNum = table.SubProjectAcceptOKNum;
item.SubdivisionalWorksAcceptNum = table.SubdivisionalWorksAcceptNum;
item.SubdivisionalWorksAcceptOKNum = table.SubdivisionalWorksAcceptOKNum;
item.InspectionMachineNum = table.InspectionMachineNum;
item.InspectionMachineQualifiedNum = table.InspectionMachineQualifiedNum;
var cqmsDataItems = new List<CqmsDataItem>();
cqmsDataItems.Add(item);
data.CQMSDataItems = cqmsDataItems;
@@ -891,6 +894,7 @@ namespace BLL
/// <returns></returns>
public static IEnumerable<Model.OfSafetySupervisorsOutput> GetProjectPersonNum()
{
var mianAndSubUnitList = (from x in Funs.DB.Base_Unit where x.IsThisUnit == true || x.IsBranch == true select x.UnitId).ToList();
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
join p in Funs.DB.Base_Project on x.ProjectId equals p.ProjectId into pGroup
@@ -902,13 +906,15 @@ namespace BLL
{
ProjectId = x.ProjectId,
ProjectName = p.ProjectName,
ProjectFromUnitId=p.UnitId,
UnitId = u.UnitId,
UnitName = u.UnitName,
Name = x.PersonName,
Sex = x.Sex == null ? "" : (x.Sex == "1" ? "男" : "女"),
IdentityCard = x.IdentityCard,
WorkPostName = y.WorkPostName == null ? "" : y.WorkPostName,
Phone = x.Telephone
Phone = x.Telephone,
IsOffice = x.UnitId == null ? false : mianAndSubUnitList.Contains(x.UnitId)
}).ToList();
result = result
.GroupBy(x => x.IdentityCard)
@@ -965,7 +971,7 @@ namespace BLL
}
/// <summary>
/// 获取技术交底人次数
/// 获取设计交底人次数
/// </summary>
/// <returns></returns>
public static int GetTechnicalDisclosePersonNum()
@@ -977,7 +983,7 @@ namespace BLL
}
/// <summary>
/// 获取技术交底人次数
/// 获取设计交底人次数
/// </summary>
/// <returns></returns>
public static List<Model.EduTrainOutput> GetTechnicalDisclosePerson()
@@ -1001,7 +1007,7 @@ namespace BLL
}
/// <summary>
/// 获取技术交底人次数(异步)
/// 获取设计交底人次数(异步)
/// </summary>
/// <returns></returns>
public static async Task<List<EduTrainOutput>> GetTechnicalDisclosePersonNumAsync()
@@ -1009,6 +1015,69 @@ namespace BLL
return await Task.Run(GetTechnicalDisclosePerson);
}
/// <summary>
/// 获取施工技术交底
/// </summary>
/// <returns></returns>
public static List<Model.EduTrainOutput> GetComprehensiveConTechnologyDisclosure()
{
var result = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure
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 Model.EduTrainOutput()
{
ProjectId = x.ProjectId,
ProjectName = p.ProjectName,
UnitName = "",
Id = x.ConTechnologyDisclosureId,
TrainTitle = "",
TrainStartDate = null,
TrainEndDate = null,
TrainPersonNum = x.DisclosurePersonNum ?? 0,
}).ToList();
return result;
}
/// <summary>
/// 获取施工技术交底(异步)
/// </summary>
/// <returns></returns>
public static async Task<List<EduTrainOutput>> GetComprehensiveConTechnologyDisclosureAsync()
{
return await Task.Run(GetComprehensiveConTechnologyDisclosure);
}
/// <summary>
/// 获取图纸会审
/// </summary>
/// <returns></returns>
public static List<Model.EduTrainOutput> GetComprehensiveReviewDrawings()
{
var result = (from x in Funs.DB.Comprehensive_ReviewDrawings
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.CreateDate > Const.DtmarkTime
select new Model.EduTrainOutput()
{
ProjectId = x.ProjectId,
ProjectName = p.ProjectName,
UnitName = "",
Id = x.Id
}).ToList();
return result;
}
/// <summary>
/// 获取图纸会审(异步)
/// </summary>
/// <returns></returns>
public static async Task<List<EduTrainOutput>> GetComprehensiveReviewDrawingsAsync()
{
return await Task.Run(GetComprehensiveReviewDrawings);
}
/// <summary>
/// 获取设备报验
/// </summary>
@@ -1058,7 +1127,19 @@ namespace BLL
public static List<Model.Comprehensive_InspectionMachine> GetComprehensive_InspectionMachine()
{
var result = (from x in Funs.DB.Comprehensive_InspectionMachine
where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime
where BeUnderConstructionList.Contains(x.ProjectId) && x.SType == "机具" && x.CompileDate > Const.DtmarkTime
select x).ToList();
return result;
}
/// <summary>
/// 获取设备报验
/// </summary>
/// <returns></returns>
public static List<Model.Comprehensive_InspectionMachine> GetComprehensive_InspectionMachineEquipment()
{
var result = (from x in Funs.DB.Comprehensive_InspectionMachine
where BeUnderConstructionList.Contains(x.ProjectId) && x.SType == "设备" && x.CompileDate > Const.DtmarkTime
select x).ToList();
return result;
}
@@ -1072,6 +1153,15 @@ namespace BLL
return await Task.Run(GetComprehensive_InspectionMachine);
}
/// <summary>
/// 获取设备报验(异步)
/// </summary>
/// <returns></returns>
public static async Task<List<Comprehensive_InspectionMachine>> GetComprehensive_InspectionMachineEquipmentAsync()
{
return await Task.Run(GetComprehensive_InspectionMachineEquipment);
}
/// <summary>
/// 获取在用计量器具数
/// </summary>
@@ -1730,5 +1820,110 @@ namespace BLL
}
#endregion
/// <summary>
/// 特设质保体系数量
/// </summary>
/// <returns></returns>
public static List<Comprehensive_QualityAssurance> GetQualityAssuranceNum()
{
var result = (from x in Funs.DB.Comprehensive_QualityAssurance
where BeUnderConstructionList.Contains(x.ProjectId)
select x).ToList();
return result;
}
/// <summary>
/// 特设质保体系数量(异步)
/// </summary>
/// <returns></returns>
public static async Task<List<Comprehensive_QualityAssurance>> GetQualityAssuranceNumAsync()
{
return await Task.Run(GetQualityAssuranceNum);
}
#region
#region -
/// <summary>
/// 获取企业质量大检查次数
/// </summary>
/// <returns></returns>
public static List<CheckOutput> GetCompanyMajorCheck()
{
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()
join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
from cu in cuGroup.DefaultIfEmpty()
where cu.IsThisUnit == true && x.CheckMainType == "1" && x.CheckDate > Const.DtmarkTime //&& x.CheckType == "1"
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>> GetCompanyMajorCheckAsync()
{
return await Task.Run(GetCompanyMajorCheck);
}
#endregion
#region
/// <summary>
/// 获取分支机构质量大检查次数
/// </summary>
/// <returns></returns>
public static List<CheckOutput> GetBranchMajorCheck()
{
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()
join cu in Funs.DB.Base_Unit on x.CheckUnitId equals cu.UnitId into cuGroup
from cu in cuGroup.DefaultIfEmpty()
where cu.IsBranch == true && x.CheckMainType == "1" && x.CheckDate > Const.DtmarkTime//&& x.CheckType == "1"
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>> GetBranchMajorCheckAsync()
{
return await Task.Run(GetBranchMajorCheck);
}
#endregion
#endregion
}
}
@@ -1,4 +1,4 @@
using FineUIPro;
using FineUIPro;
using Model;
using Newtonsoft.Json;
using System;
@@ -14,9 +14,7 @@ namespace BLL
{
public static class HJGLData_HJGLService
{
public static SUBQHSEDB 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 List<string> BeUnderConstructionList = BaseDataService.BeUnderConstructionList;
#region
/// <summary>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class LotAPIService
{
/// <summary>
/// 保存环境监测
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string saveEnvironmentCheck(Model.EnvironmentalCheckInput input)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
//使用Emitmapper 将input 映射到实体类db.ZJ_EnvironmentCheck
var entity = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<Model.EnvironmentalCheckInput, Model.EnvironmentalCheck>().Map(input);
entity.Id = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
db.EnvironmentalCheck.InsertOnSubmit(entity);
db.SubmitChanges();
return entity.Id;
}
}
}
}
+96 -83
View File
@@ -10,7 +10,6 @@ namespace BLL
public class MainSevice
{
/// <summary>
/// 在建项目集合
/// </summary>
@@ -41,13 +40,13 @@ namespace BLL
{
_beUnderConstructionList = new List<string>() { "0" };
}
}
}
public MainSevice(string userid, string projectId)
{
var userModel = UserService.GetUserByUserId(userid);
int unitType = 3;
_unitId = userModel.UnitId;
_unitId = userModel.UnitId?? "";
_unitType = unitType;
_beUnderConstructionList = new List<string>() { projectId };
}
@@ -60,8 +59,6 @@ namespace BLL
{
try
{
// 并行执行异步方法
var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption();
var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
@@ -84,6 +81,7 @@ namespace BLL
var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync();
var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync();
var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync();
var hseTechnicalTask = HSSEData_HSSEService.GetHseTechnicalAsync();
var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync();
var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync();
var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync();
@@ -141,7 +139,7 @@ namespace BLL
safeWorkingHourTask,
safeTrainTask,
specialTrainTask,
specialOperationTrainTask,
specialOperationTrainTask, hseTechnicalTask,
headOfficeInspectorGeneralTask,
headOfficeFullTimeTask,
branchInspectorGeneralTask,
@@ -202,6 +200,7 @@ namespace BLL
var safeTrainList = await safeTrainTask;
var specialTrainList = await specialTrainTask;
var specialOperationTrainList = await specialOperationTrainTask;
var hseTechnicalList = await hseTechnicalTask;
var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask;
var headOfficeFullTimeList = await headOfficeFullTimeTask;
var branchInspectorGeneralList = await branchInspectorGeneralTask;
@@ -243,76 +242,79 @@ namespace BLL
var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask;
// 构造结果对象
var table = new HSSEData_HSSE
{
JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
TotalWorkingHour = totalWorkingHour,
LostWorkingHour = lostWorkingHour,
SafeWorkingHour = safeWorkingHour,
SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
EnvironmentalTrainNum = 0,
TotalEnergyConsumption = totalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption,
NewWaterConsumption = newWaterConsumption,
HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(),
HeadOfficeFullTimeNum = headOfficeFullTimeList.Count,
BranchInspectorGeneralNum = branchInspectorGeneralList.Count,
BranchFullTimeNum = branchFullTimeList.Count,
ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId),
CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId),
CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId),
ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectDrillNum = projectDrillList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CostExtract = Convert.ToInt32(costExtractList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)),
CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)),
UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
LicensesCloseNum = licensesCloseList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum),
GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum),
MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum),
MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum),
LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum),
GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum),
MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum),
HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum),
CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum),
TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum),
ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum),
FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum),
SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum),
SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum),
SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum)
};
var table = new HSSEData_HSSE();
table.JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.TotalWorkingHour = totalWorkingHour;
table.LostWorkingHour = lostWorkingHour;
table.SafeWorkingHour = safeWorkingHour;
table.SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum);
table.SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum);
table.SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum);
table.HseTechnicalNum = hseTechnicalList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.EnvironmentalTrainNum = 0;
table.TotalEnergyConsumption = totalEnergyConsumption;
table.IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption;
table.NewWaterConsumption = newWaterConsumption;
table.HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count();
table.HeadOfficeFullTimeNum = headOfficeFullTimeList.Count;
table.BranchInspectorGeneralNum = branchInspectorGeneralList.Count;
table.BranchFullTimeNum = branchFullTimeList.Count;
table.ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId);
table.CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId);
table.CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId);
table.CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId));
table.CompanyDrillPersonNum = companyDrillList.Where(x => x.UnitId.Contains(_unitId)).Sum(x => x.JointPersonNum);
table.ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectDrillNum = projectDrillList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ProjectDrillPersonNum = projectDrillList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.JointPersonNum);
table.CostExtract = Convert.ToInt32(costExtractList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost));
table.CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost));
table.UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.LicensesCloseNum = licensesCloseList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum);
table.GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum);
table.MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum);
table.MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum);
table.LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum);
table.GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum);
table.MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum);
table.HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum);
table.CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum);
table.TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum);
table.OperativesNum = largeEngineeringOutputsTask.Result.Sum(x => x.OperativesNum);
table.ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum);
table.FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum);
table.ArgumentNum = largeEngineeringOutputsTask.Result.Sum(x => x.ArgumentNum);
table.SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum);
table.SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum);
table.SuperOperativesNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperOperativesNum);
table.SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum);
table.SuperFinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperFinishedNum);
table.SuperArgumentNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperArgumentNum);
if (!string.IsNullOrEmpty(_unitId))
{
table.CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId));
}
if (_unitType == 0)
{
table.BeUnderConstructionNum = beUnderConstructionList.Count();
@@ -323,7 +325,6 @@ namespace BLL
table.CertificateBNum = certificateBList.Count();
table.CertificateCNum = certificateCList.Count();
table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count();
}
else if (_unitType == 1)
{
@@ -336,16 +337,16 @@ namespace BLL
table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
}
else if (_unitType ==3)
else if (_unitType == 3)
{
table.BeUnderConstructionNum = beUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.ShutdownNum = shutdownList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) );
table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) );
table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId));
}
_hsseData = table;
@@ -390,7 +391,6 @@ namespace BLL
return result;
}
/// <summary>
/// 质量数据
/// </summary>
@@ -405,6 +405,9 @@ namespace BLL
var projectPersonNumTask = CQMSDataService.GetProjectPersonNumAsync(); //获取项目专职人数
var trainPersonNumTask = CQMSDataService.GetTrainPersonNumAsync(); //获取质量培训人次数
var technicalDisclosePersonTask = CQMSDataService.GetTechnicalDisclosePersonNumAsync(); //获取技术交底人次数
var qualityAssuranceNumTask = CQMSDataService.GetQualityAssuranceNumAsync(); //获取特设质保体系数量
var comprehensiveConTechnologyDisclosureTask = CQMSDataService.GetComprehensiveConTechnologyDisclosureAsync(); //获取施工技术交底
var comprehensiveReviewDrawingsTask = CQMSDataService.GetComprehensiveReviewDrawingsAsync(); //获取图纸会审
var inspectionEquipmentTask = CQMSDataService.GetComprehensive_InspectionEquipmentAsync(); //获取设备报验
var inspectionPersonTask = CQMSDataService.GetComprehensive_InspectionPersonAsync(); //获取人员报验
@@ -438,7 +441,8 @@ namespace BLL
// 等待所有异步方法执行完成
await Task.WhenAll(
companyPersonNumTask, branchPersonNumTask, projectPersonNumTask,
trainPersonNumTask, technicalDisclosePersonTask,
trainPersonNumTask, technicalDisclosePersonTask, qualityAssuranceNumTask,
comprehensiveConTechnologyDisclosureTask, comprehensiveReviewDrawingsTask,
inspectionEquipmentTask, inspectionPersonTask, inspectionMachineTask,
useNumTask, okNumTask,
singleProjectNumTask, unitProjectNumTask, subProjectNuTask, subdivisionalWorksNuTask, inspectionLotNumTask,
@@ -454,6 +458,9 @@ namespace BLL
var projectPersonNumList = await projectPersonNumTask;
var trainPersonNumList = await trainPersonNumTask;
var technicalDisclosePersonList = await technicalDisclosePersonTask;
var qualityAssuranceNum = await qualityAssuranceNumTask;
var comprehensiveConTechnologyDisclosureList = await comprehensiveConTechnologyDisclosureTask;
var comprehensiveReviewDrawingsList = await comprehensiveReviewDrawingsTask;
var inspectionEquipmentList = await inspectionEquipmentTask;
var inspectionPersonList = await inspectionPersonTask;
@@ -488,6 +495,9 @@ namespace BLL
projectPersonNumList = projectPersonNumList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
trainPersonNumList = trainPersonNumList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
technicalDisclosePersonList = technicalDisclosePersonList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
comprehensiveConTechnologyDisclosureList = comprehensiveConTechnologyDisclosureList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
comprehensiveReviewDrawingsList = comprehensiveReviewDrawingsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
qualityAssuranceNum = qualityAssuranceNum.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
inspectionEquipmentList = inspectionEquipmentList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
inspectionPersonList = inspectionPersonList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
inspectionMachineList = inspectionMachineList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).ToList();
@@ -521,6 +531,9 @@ namespace BLL
ProjectPersonNum = projectPersonNumList.Count(),
TrainPersonNum = trainPersonNumList.Count(),
TechnicalDisclosePersonNum = technicalDisclosePersonList.Sum(x => x.TrainPersonNum),
ComprehensiveConTechnologyDisclosureNum = comprehensiveConTechnologyDisclosureList.Count(),
ComprehensiveConTechnologyDisclosurePersonNum = comprehensiveConTechnologyDisclosureList.Sum(x => x.TrainPersonNum),
ComprehensiveReviewDrawingsNum = comprehensiveReviewDrawingsList.Count(),
EquipmentInspectionNum = inspectionEquipmentList.Count(),
EquipmentInspectionQualifiedNum = inspectionEquipmentList.Where(x => x.SamplingResult == "1").Count(),
PersonInspectionNum = inspectionPersonList.Count(),
@@ -535,12 +548,12 @@ namespace BLL
UnitProjectNum = unitProjectNum.Count(),
SubProjectNum = subProjectNum.Count(),
SubdivisionalWorksNum = subdivisionalWorksNum.Count(),
InspectionLotNum = inspectionLotNum.Count(),
InspectionLotNum = inspectionLotNum.Sum(x=>x.Sum),
ConstructSolutionNum = constructSolutionList.Count(),
ConstructSolutionProjectApproveNum = constructSolutionList.Where(x => x.State == "1").Count(),
ConstructSolutionUnitApproveNum = 0,//
SpecialEquipmentQualityAssuranceSystemNum = 0,//
SpecialEquipmentQualityAssuranceSystemNum = qualityAssuranceNum.Count(),
DesignDetailsNum = technicalDisclosePersonList.Sum(x => x.TrainPersonNum),
ProblemNum = cqmsProblemList.Count(),
@@ -60,6 +60,10 @@ namespace BLL
/// </summary>
SpecialEquipmentAndDesignDetails,
/// <summary>
/// 设备报验报检
/// </summary>
InspectionMachineEquipment,
/// <summary>
/// 全部数据
/// </summary>
All
@@ -115,6 +119,9 @@ namespace BLL
x.ReportDate,
x.TrainPersonNum,
x.TechnicalDisclosePersonNum,
x.ComprehensiveConTechnologyDisclosureNum,
x.ComprehensiveConTechnologyDisclosurePersonNum,
x.ComprehensiveReviewDrawingsNum,
x.UseNum,
x.OKNum,
x.CompanyPersonNum,
@@ -142,7 +149,9 @@ namespace BLL
x.SubProjectNum,
x.SubdivisionalWorksNum,
x.InspectionLotNum,
x.InspectionMachineNum,
x.InspectionMachineQualifiedNum,
x.SpecialEquipmentQualityAssuranceSystemNum
};
}
#endregion
@@ -180,11 +189,15 @@ namespace BLL
ReportDate = newtable.ReportDate,
TrainPersonNum = newtable.TrainPersonNum,
TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum,
ComprehensiveReviewDrawingsNum = newtable.ComprehensiveReviewDrawingsNum,
ComprehensiveConTechnologyDisclosureNum = newtable.ComprehensiveConTechnologyDisclosureNum,
ComprehensiveConTechnologyDisclosurePersonNum = newtable.ComprehensiveConTechnologyDisclosurePersonNum,
UseNum = newtable.UseNum,
OKNum = newtable.OKNum,
CompanyPersonNum = newtable.CompanyPersonNum,
BranchPersonNum = newtable.BranchPersonNum,
ProjectPersonNum = newtable.ProjectPersonNum,
ProjectSubPersonNum = newtable.ProjectSubPersonNum,
ProblemNum = newtable.ProblemNum,
ProblemCompletedNum = newtable.ProblemCompletedNum,
ProblemNotCompletedNum = newtable.ProblemNotCompletedNum,
@@ -225,7 +238,9 @@ namespace BLL
SubProjectAcceptNum = newtable.SubProjectAcceptNum,
SubProjectAcceptOKNum = newtable.SubProjectAcceptOKNum,
SubdivisionalWorksAcceptNum = newtable.SubdivisionalWorksAcceptNum,
SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum
SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum,
InspectionMachineNum = newtable.InspectionMachineNum,
InspectionMachineQualifiedNum = newtable.InspectionMachineQualifiedNum,
};
db.Project_CQMSData_CQMS.InsertOnSubmit(table);
db.SubmitChanges();
@@ -251,11 +266,15 @@ namespace BLL
table.ReportDate = newtable.ReportDate;
table.TrainPersonNum = newtable.TrainPersonNum;
table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum;
table.ComprehensiveConTechnologyDisclosureNum = newtable.ComprehensiveConTechnologyDisclosureNum;
table.ComprehensiveConTechnologyDisclosurePersonNum = newtable.ComprehensiveConTechnologyDisclosurePersonNum;
table.ComprehensiveReviewDrawingsNum = newtable.ComprehensiveReviewDrawingsNum;
table.UseNum = newtable.UseNum;
table.OKNum = newtable.OKNum;
table.CompanyPersonNum = newtable.CompanyPersonNum;
table.BranchPersonNum = newtable.BranchPersonNum;
table.ProjectPersonNum = newtable.ProjectPersonNum;
table.ProjectSubPersonNum = newtable.ProjectSubPersonNum;
table.ProblemNum = newtable.ProblemNum;
table.ProblemCompletedNum = newtable.ProblemCompletedNum;
table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum;
@@ -297,6 +316,8 @@ namespace BLL
table.SubProjectAcceptOKNum = newtable.SubProjectAcceptOKNum;
table.SubdivisionalWorksAcceptNum = newtable.SubdivisionalWorksAcceptNum;
table.SubdivisionalWorksAcceptOKNum = newtable.SubdivisionalWorksAcceptOKNum;
table.InspectionMachineNum = newtable.InspectionMachineNum;
table.InspectionMachineQualifiedNum = newtable.InspectionMachineQualifiedNum;
db.SubmitChanges();
}
}
@@ -494,6 +515,14 @@ namespace BLL
{
table.SpecialEquipmentQualityAssuranceSystemNum = GetSpecialEquipmentQualityAssuranceSystemNum(projectid);
table.DesignDetailsNum = GetTechnicalDisclosePersonNum(projectid);
table.ComprehensiveConTechnologyDisclosureNum = GetComprehensiveConTechnologyDisclosureNum(projectid);
table.ComprehensiveConTechnologyDisclosurePersonNum = GetComprehensiveConTechnologyDisclosurePersonNum(projectid);
table.ComprehensiveReviewDrawingsNum = GetComprehensiveReviewDrawings(projectid);
}
if (cQMSDateType == CQMSDateType.InspectionMachineEquipment || cQMSDateType == CQMSDateType.All)
{
table.InspectionMachineNum = GetInspectionMachineEquipmentNum(projectid);
table.InspectionMachineQualifiedNum = GetInspectionMachineEquipmentQualifiedNum(projectid);
}
if (IsReportByToday(projectid))
@@ -518,7 +547,7 @@ namespace BLL
return result;
}
/// <summary>
/// 获取技术交底人次数
/// 获取设计交底人次数
/// </summary>
/// <returns></returns>
public static int GetTechnicalDisclosePersonNum(string projectid)
@@ -529,6 +558,41 @@ namespace BLL
var q = Funs.GetNewIntOrZero(result.ToString());
return q;
}
/// <summary>
/// 获取施工技术交底数
/// </summary>
/// <returns></returns>
public static int GetComprehensiveConTechnologyDisclosureNum(string projectid)
{
var result = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).ToList().Count();
return result;
}
/// <summary>
/// 获取施工技术交底人数
/// </summary>
/// <returns></returns>
public static int GetComprehensiveConTechnologyDisclosurePersonNum(string projectid)
{
var result = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.DisclosurePersonNum).ToList().Sum(x => x.Value);
var q = Funs.GetNewIntOrZero(result.ToString());
return q;
}
/// <summary>
/// 获取图纸会审
/// </summary>
/// <returns></returns>
public static int GetComprehensiveReviewDrawings(string projectid)
{
var result = (from x in Funs.DB.Comprehensive_ReviewDrawings
where x.ProjectId == projectid && x.CreateDate > Const.DtmarkTime
select x).ToList().Count();
return result;
}
/// <summary>
/// 获取在用计量器具数
/// </summary>
@@ -901,6 +965,7 @@ namespace BLL
{
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
&& x.SType == "机具"
select x).Count();
return result;
}
@@ -913,7 +978,34 @@ namespace BLL
public static int GetComprehensiveInspectionMachineOKNum(string projectid)
{
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.ProjectId == projectid && x.IsCheckOK.HasValue && x.IsCheckOK == true && x.CompileDate > Const.DtmarkTime
where x.ProjectId == projectid && x.SType=="机具" && x.IsCheckOK.HasValue && x.IsCheckOK == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取机具设备报验-设备报验数
/// </summary>
/// <param name="projectid"></param>
/// <returns></returns>
public static int GetInspectionMachineEquipmentNum(string projectid)
{
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
&& x.SType == "设备"
select x).Count();
return result;
}
/// <summary>
/// 获取机具设备报验-设备报验合格数
/// </summary>
/// <param name="projectid"></param>
/// <returns></returns>
public static int GetInspectionMachineEquipmentQualifiedNum(string projectid)
{
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.ProjectId == projectid && x.SType == "设备" && x.IsCheckOK.HasValue && x.IsCheckOK == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -948,7 +1040,9 @@ namespace BLL
/// <returns></returns>
public static int GetComprehensiveInspectionMaterialNum(string projectid)
{
var result = 0;
int result = (from x in Funs.DB.Comprehensive_InspectionEquipment
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -958,7 +1052,9 @@ namespace BLL
/// <returns></returns>
public static int GetComprehensiveInspectionMaterialOKNum(string projectid)
{
var result = 0;
int result = (from x in Funs.DB.Comprehensive_InspectionEquipment
where x.ProjectId == projectid && x.SamplingResult == "1" && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1004,11 +1100,13 @@ namespace BLL
/// <returns></returns>
public static int GetSpecialEquipmentQualityAssuranceSystemNum(string projectid)
{
var result = 0;
var result = (from x in Funs.DB.Solution_CQMSConstructSolution
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).ToList().Count();
return result;
}
#region
@@ -1039,5 +1137,348 @@ namespace BLL
}
#endregion
#region
/// <summary>
/// 推送项目质量巡检数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectHazardRegisterData()
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.View_Hazard_HazardRegister
where x.IsUpdate == null || x.IsUpdate == false
select new Model.Hazard_HazardRegisterItem
{
HazardRegisterId = x.HazardRegisterId,
SourceUnitId = thisUnit.UnitId,
RegisterDate = x.RegisterDate,
RegisterDef = x.RegisterDef,
Rectification = x.Rectification,
WorkAreaName = x.WorkAreaName,
ResponsibilityUnitName = x.ResponsibilityUnitName,
ResponsibilityUnitCollCropCode = x.ResponsibilityUnitCollCropCode,
Risk_Level = x.Risk_Level,
ProjectId = x.ProjectId,
ProjectName = x.ProjectName,
States = x.States,
StatesStr = x.StatesStr,
ResponsibilityManName = x.ResponsibilityManName,
CheckManName = x.CheckManName,
CheckTime = x.CheckTime,
RectificationPeriod = x.RectificationPeriod,
ImageUrl = x.ImageUrl,
ImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.ImageUrl),
RectificationImageUrl = x.RectificationImageUrl,
RectificationImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.RectificationImageUrl),
RectificationTime = x.RectificationTime,
ConfirmManName = x.ConfirmManName,
ConfirmDate = x.ConfirmDate,
HandleIdea = x.HandleIdea,
CutPayment = x.CutPayment,
CheckCycle = x.CheckCycle,
RegisterTypesName = x.RegisterTypesName,
Requirements = x.Requirements
}).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/SaveProjectHazardRegisterData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
var list = from x in db.HSSE_Hazard_HazardRegister
where x.IsUpdate == null || x.IsUpdate == false
select x;
foreach (var item in list)
{
item.IsUpdate = true;
}
db.SubmitChanges();
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目质量巡检数据";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 推送项目质量隐患数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectQualityProblemData(int pushNum)
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.Check_CheckControl
join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ
from unit in unitJ.DefaultIfEmpty()
join cNProfessional in db.Base_CNProfessional on x.CNProfessionalCode equals cNProfessional.CNProfessionalId into cNProfessionalJ
from cNProfessional in cNProfessionalJ.DefaultIfEmpty()
join unitWork in db.WBS_UnitWork on x.UnitWorkId equals unitWork.UnitWorkId into unitWorkJ
from unitWork in unitWorkJ.DefaultIfEmpty()
join QualityQuestionType in db.Base_QualityQuestionType on x.QuestionType equals QualityQuestionType.QualityQuestionTypeId
where (x.IsUpdate == null || x.IsUpdate == false) && x.CheckDate > BLL.Const.DtmarkTime
select new Model.QualityProblemItem
{
Id = x.CheckControlCode,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CheckDate,
CheckDate = x.CheckDate,
UnitWorkName = unitWork.UnitWorkName + (unitWork.ProjectType == "1" ? "(建筑)" : "(安装)"),
UnitName = unit.UnitName,
ProfessionalName = cNProfessional.ProfessionalName,
QuestionType = QualityQuestionType.QualityQuestionType,
ImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString()),
RectificationImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString() + "r"),
CheckSite = x.CheckSite,
States = x.State,
StatesStr = x.State == "5" || x.State == "6" ? "未确认" :
x.State == "7" ? "已闭环" :
Convert.ToDateTime(x.LimitDate).AddDays(1) < DateTime.Now ? "超期未整改" : "未整改",
}).Take(pushNum).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/CQMSData/SaveProjectQualityProblemData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
foreach (var item in items)
{
var data = db.Check_CheckControl.FirstOrDefault(x =>
x.CheckControlCode == item.Id && (x.IsUpdate == null || x.IsUpdate == false));
data.IsUpdate = true;
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目质量隐患数据";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 删除项目质量隐患数据
/// </summary>
/// <returns></returns>
public static ReturnData DeleteProjectQualityProblemData(string Id)
{
Model.ReturnData responeData = new Model.ReturnData();
try
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.Check_CheckControl
join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ
from unit in unitJ.DefaultIfEmpty()
join cNProfessional in db.Base_CNProfessional on x.CNProfessionalCode equals cNProfessional.CNProfessionalId into cNProfessionalJ
from cNProfessional in cNProfessionalJ.DefaultIfEmpty()
join unitWork in db.WBS_UnitWork on x.UnitWorkId equals unitWork.UnitWorkId into unitWorkJ
from unitWork in unitWorkJ.DefaultIfEmpty()
join QualityQuestionType in db.Base_QualityQuestionType on x.QuestionType equals QualityQuestionType.QualityQuestionTypeId
where x.CheckControlCode == Id
select new Model.QualityProblemItem
{
Id = x.CheckControlCode,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CheckDate,
CheckDate = x.CheckDate,
UnitWorkName = unitWork.UnitWorkName + (unitWork.ProjectType == "1" ? "(建筑)" : "(安装)"),
UnitName = unit.UnitName,
ProfessionalName = cNProfessional.ProfessionalName,
QuestionType = QualityQuestionType.QualityQuestionType,
ImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString()),
RectificationImageUrl = AttachFileService.getFileUrl(x.CheckControlCode.ToString() + "r"),
CheckSite = x.CheckSite,
States = x.State,
StatesStr = x.State == "5" || x.State == "6" ? "未确认" :
x.State == "7" ? "已闭环" :
Convert.ToDateTime(x.LimitDate).AddDays(1) < DateTime.Now ? "超期未整改" : "未整改",
}).ToList();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/CQMSData/DeleteProjectQualityProblemData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
}
catch (Exception)
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
return responeData;
}
#endregion
#region QC活动注册数据
/// <summary>
/// 推送质量QC活动注册数据
/// </summary>
/// <returns></returns>
public static ReturnData PushQCRegistrationData(int pushNum)
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.QCManage_QCGroupRegistration
join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ
from u in unitJ.DefaultIfEmpty()
join s in db.Sys_User on x.CompileMan equals s.UserId into userJ
from s in userJ.DefaultIfEmpty()
where (x.IsUpdate == null || x.IsUpdate == false) && x.CompileDate > BLL.Const.DtmarkTime
select new Model.QCRegistrationItem
{
Id = x.QCGroupRegistrationId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CompileDate,
AttachFile = AttachFileService.getFileUrl(x.QCGroupRegistrationId.ToString()),
Code = x.Code,
Name = x.Name,
CompileManName = s.UserName,
CompileDate = x.CompileDate,
UnitName = u.UnitName,
UnitCollCropCode = Funs.DB.Base_Unit.FirstOrDefault(e => e.UnitId == x.UnitId).CollCropCode,
Subjects = x.Subjects,
Process = x.Process,
Achievement = x.Achievement,
AwardName = x.AwardName,
AwardType = x.AwardType,
AwardLevel = x.AwardLevel,
AwardingUnit = x.AwardingUnit,
}).Take(pushNum).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/CQMSData/SaveQCRegistrationData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
foreach (var item in items)
{
var data = db.QCManage_QCGroupRegistration.FirstOrDefault(x =>
x.QCGroupRegistrationId == item.Id && (x.IsUpdate == null || x.IsUpdate == false));
data.IsUpdate = true;
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有质量QC活动注册数据";
}
return responeData;
}
#endregion
#region QC活动注册数据
/// <summary>
/// 删除质量QC活动注册数据
/// </summary>
/// <returns></returns>
public static ReturnData DeleteQCRegistrationData(string Id)
{
Model.ReturnData responeData = new Model.ReturnData();
try
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.QCManage_QCGroupRegistration
join unit in db.Base_Unit on x.UnitId equals unit.UnitId into unitJ
from u in unitJ.DefaultIfEmpty()
join s in db.Sys_User on x.CompileMan equals s.UserId into userJ
from s in userJ.DefaultIfEmpty()
where x.QCGroupRegistrationId == Id
select new Model.QCRegistrationItem
{
Id = x.QCGroupRegistrationId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CompileDate,
AttachFile = AttachFileService.getFileUrl(x.QCGroupRegistrationId.ToString()),
Code = x.Code,
Name = x.Name,
CompileManName = s.UserName,
CompileDate = x.CompileDate,
UnitName = u.UnitName,
UnitCollCropCode = Funs.DB.Base_Unit.FirstOrDefault(e => e.UnitId == x.UnitId).CollCropCode,
Subjects = x.Subjects,
Process = x.Process,
Achievement = x.Achievement,
AwardName = x.AwardName,
AwardLevel = x.AwardLevel,
AwardingUnit = x.AwardingUnit,
}).ToList();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/CQMSData/DeleteQCRegistrationData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
}
catch (Exception)
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
return responeData;
}
#endregion
}
}
@@ -1,5 +1,4 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
@@ -89,30 +88,30 @@ namespace BLL
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
}
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
@@ -263,7 +262,7 @@ namespace BLL
{
var db = Funs.DB;
var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList();
var projectids = HJGLData_HJGLService.BeUnderConstructionList;
var thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
@@ -285,8 +284,7 @@ namespace BLL
}).ToList();
DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有
var projectHjglDataDefect = new List<Project_HJGLData_Defect>();
foreach (var item in data
)
foreach (var item in data)
{
var table = new Project_HJGLData_Defect
{
@@ -168,6 +168,18 @@ namespace BLL
}
}
}
public static void DeleteProject_HJGLData_HJGLByDate(DateTime? reportDate)
{
using (var db = new SUBQHSEDB(Funs.ConnString))
{
var table = db.Project_HJGLData_HJGL.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.Project_HJGLData_HJGL.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断该项目的该日期是否统计数据
/// </summary>
@@ -356,11 +368,11 @@ namespace BLL
public static ReturnData PushProjectHJGLData()
{
var items = (from x in Funs.DB.Project_HJGLData_HJGL
where x.ReportDate == DateTime.Now.Date
select x).ToList();
where x.ReportDate == DateTime.Now.Date
select x).ToList();
var defectItems = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate == DateTime.Now.Date
select x).ToList();
where x.ReportDate == DateTime.Now.Date
select x).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0 || defectItems.Count() > 0)
{
@@ -379,20 +391,5 @@ namespace BLL
}
#endregion
public static void DeleteProject_HJGLData_HJGLByDate(DateTime? reportDate)
{
using (var db = new SUBQHSEDB(Funs.ConnString))
{
var table = db.Project_HJGLData_HJGL.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.Project_HJGLData_HJGL.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}
}
@@ -101,8 +101,6 @@ namespace BLL
DangerousProject
}
public static SUBQHSEDB db = Funs.DB;
/// <summary>
/// 新增实体
/// </summary>
@@ -139,11 +137,13 @@ namespace BLL
BranchFullTimeNum = newtable.BranchFullTimeNum,
ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum,
ProjectFullTimeNum = newtable.ProjectFullTimeNum,
ProjectSubFullTimeNum = newtable.ProjectSubFullTimeNum,
ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum,
SafetyInjectionEngineer = newtable.SafetyInjectionEngineer,
CertificateANum = newtable.CertificateANum,
CertificateBNum = newtable.CertificateBNum,
CertificateCNum = newtable.CertificateCNum,
QualityPersonNum = newtable.QualityPersonNum,
SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum,
EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum,
ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum,
@@ -151,6 +151,9 @@ namespace BLL
CompanyLeadShiftCheckNum = newtable.CompanyLeadShiftCheckNum,
CompanyComprehensiveCheckNum = newtable.CompanyComprehensiveCheckNum,
CompanySpecialCheckNum = newtable.CompanySpecialCheckNum,
BranchLeadShiftCheckNum = newtable.BranchLeadShiftCheckNum,
BranchComprehensiveCheckNum = newtable.BranchComprehensiveCheckNum,
BranchSpecialCheckNum = newtable.BranchSpecialCheckNum,
ProjectLeadShiftCheckNum = newtable.ProjectLeadShiftCheckNum,
ProjectSpecialCheckNum = newtable.ProjectSpecialCheckNum,
ProjectMajorCheckNum = newtable.ProjectMajorCheckNum,
@@ -163,8 +166,13 @@ namespace BLL
CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum,
CompanySpecialPlanNum = newtable.CompanySpecialPlanNum,
CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan,
BranchComprehensivePlanNum = newtable.BranchComprehensivePlanNum,
BranchSpecialPlanNum = newtable.BranchSpecialPlanNum,
BranchOnSiteDisposalPlan = newtable.BranchOnSiteDisposalPlan,
CompanyDrillNum = newtable.CompanyDrillNum,
CompanyDrillPersonNum = newtable.CompanyDrillPersonNum,
BranchDrillNum = newtable.BranchDrillNum,
BranchDrillPersonNum = newtable.BranchDrillPersonNum,
ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum,
ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum,
ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan,
@@ -186,11 +194,13 @@ namespace BLL
HighRiskNum = newtable.HighRiskNum,
CompletedNum = newtable.CompletedNum,
TrainPersonNum = newtable.TrainPersonNum,
OperativesNum = newtable.OperativesNum,
ConstructionNum = newtable.ConstructionNum,
FinishedNum = newtable.FinishedNum,
ArgumentNum = newtable.ArgumentNum,
SuperCompletedNum = newtable.SuperCompletedNum,
SuperTrainPersonNum = newtable.SuperTrainPersonNum,
SuperOperativesNum = newtable.SuperOperativesNum,
SuperConstructionNum = newtable.SuperConstructionNum,
SuperFinishedNum = newtable.SuperFinishedNum,
SuperArgumentNum = newtable.SuperArgumentNum
@@ -200,7 +210,6 @@ namespace BLL
}
}
/// <summary>
/// 删除实体
/// </summary>
@@ -225,7 +234,7 @@ namespace BLL
/// <returns></returns>
public static Project_HSSEData_HSSE GetProject_HSSEData_HSSEById(string Id)
{
return db.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == Id);
return Funs.DB.Project_HSSEData_HSSE.FirstOrDefault(x => x.Id == Id);
}
public static List<Project_HSSEData_HSSE> GetProject_HSSEData_HSSEByProjectid(string Projectid)
@@ -271,11 +280,13 @@ namespace BLL
table.BranchFullTimeNum = newtable.BranchFullTimeNum;
table.ProjectInspectorGeneralNum = newtable.ProjectInspectorGeneralNum;
table.ProjectFullTimeNum = newtable.ProjectFullTimeNum;
table.ProjectSubFullTimeNum = newtable.ProjectSubFullTimeNum;
table.ProjectSafetyMonitorNum = newtable.ProjectSafetyMonitorNum;
table.SafetyInjectionEngineer = newtable.SafetyInjectionEngineer;
table.CertificateANum = newtable.CertificateANum;
table.CertificateBNum = newtable.CertificateBNum;
table.CertificateCNum = newtable.CertificateCNum;
table.QualityPersonNum = newtable.QualityPersonNum;
table.SafetyCommitteeMeetingNum = newtable.SafetyCommitteeMeetingNum;
table.EnterpriseTopicsMeetingNum = newtable.EnterpriseTopicsMeetingNum;
table.ProjectSafetyLeadingGroupMeetingNum = newtable.ProjectSafetyLeadingGroupMeetingNum;
@@ -295,7 +306,13 @@ namespace BLL
table.CompanyComprehensivePlanNum = newtable.CompanyComprehensivePlanNum;
table.CompanySpecialPlanNum = newtable.CompanySpecialPlanNum;
table.CompanyOnSiteDisposalPlan = newtable.CompanyOnSiteDisposalPlan;
table.BranchComprehensivePlanNum = newtable.BranchComprehensivePlanNum;
table.BranchSpecialPlanNum = newtable.BranchSpecialPlanNum;
table.BranchOnSiteDisposalPlan = newtable.BranchOnSiteDisposalPlan;
table.CompanyDrillNum = newtable.CompanyDrillNum;
table.CompanyDrillPersonNum = newtable.CompanyDrillPersonNum;
table.BranchDrillNum = newtable.BranchDrillNum;
table.BranchDrillPersonNum = newtable.BranchDrillPersonNum;
table.ProjectComprehensivePlanNum = newtable.ProjectComprehensivePlanNum;
table.ProjectSpecialPlanNum = newtable.ProjectSpecialPlanNum;
table.ProjectOnSiteDisposalPlan = newtable.ProjectOnSiteDisposalPlan;
@@ -316,10 +333,12 @@ namespace BLL
table.HighRiskNum = newtable.HighRiskNum;
table.CompletedNum = newtable.CompletedNum;
table.TrainPersonNum = newtable.TrainPersonNum;
table.OperativesNum = newtable.OperativesNum;
table.ConstructionNum = newtable.ConstructionNum;
table.FinishedNum = newtable.FinishedNum;
table.SuperCompletedNum = newtable.SuperCompletedNum;
table.SuperTrainPersonNum = newtable.SuperTrainPersonNum;
table.SuperOperativesNum = newtable.SuperOperativesNum;
table.SuperConstructionNum = newtable.SuperConstructionNum;
table.SuperFinishedNum = newtable.SuperFinishedNum;
db.SubmitChanges();
@@ -458,6 +477,7 @@ namespace BLL
table.CertificateANum = GetCertificateANum(projectid);
table.CertificateBNum = GetCertificateBNum(projectid);
table.CertificateCNum = GetCertificateCNum(projectid);
table.QualityPersonNum = GetQualityPersonNum(projectid);
}
if (hSseDateType == HSSEDateType.SafetyMeeting || hSseDateType == HSSEDateType.All)
@@ -493,11 +513,18 @@ namespace BLL
table.CompanyComprehensivePlanNum = GetCompanyComprehensivePlanNum(projectid);
table.CompanySpecialPlanNum = GetCompanySpecialPlanNum(projectid);
table.CompanyOnSiteDisposalPlan = GetCompanyOnSiteDisposalPlan(projectid);
table.BranchComprehensivePlanNum = GetBranchComprehensivePlanNum(projectid);
table.BranchSpecialPlanNum = GetBranchSpecialPlanNum(projectid);
table.BranchOnSiteDisposalPlan = GetBranchOnSiteDisposalPlan(projectid);
table.CompanyDrillNum = GetCompanyDrillNum(projectid);
table.CompanyDrillPersonNum = GetCompanyDrillPersonNum(projectid);
table.BranchDrillNum = GetBranchDrillNum(projectid);
table.BranchDrillPersonNum = GetBranchDrillPersonNum(projectid);
table.ProjectComprehensivePlanNum = GetProjectComprehensivePlanNum(projectid);
table.ProjectSpecialPlanNum = GetProjectSpecialPlanNum(projectid);
table.ProjectOnSiteDisposalPlan = GetProjectOnSiteDisposalPlan(projectid);
table.ProjectDrillNum = GetProjectDrillNum(projectid);
table.ProjectDrillNum = GetProjectDrillNum(projectid);
}
if (hSseDateType == HSSEDateType.SecurityCost || hSseDateType == HSSEDateType.All)
@@ -580,10 +607,12 @@ namespace BLL
{
table.CompletedNum = GetCompletedNum(projectid);
table.TrainPersonNum = GetTrainPersonNum(projectid);
table.OperativesNum = GetOperativesNum(projectid);
table.ConstructionNum = GetConstructionNum(projectid);
table.FinishedNum = GetFinishedNum(projectid);
table.SuperCompletedNum = GetSuperCompletedNum(projectid);
table.SuperTrainPersonNum = GetSuperTrainPersonNum(projectid);
table.SuperOperativesNum = GetSuperOperativesNum(projectid);
table.SuperConstructionNum = GetSuperConstructionNum(projectid);
table.SuperFinishedNum = GetSuperFinishedNum(projectid);
}
@@ -904,6 +933,19 @@ namespace BLL
return result;
}
/// <summary>
/// 获取在岗特种作业人员数量
/// </summary>
/// <returns></returns>
public static int GetQualityPersonNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
join m in Funs.DB.Base_WorkPost on x.WorkPostId equals m.WorkPostId
where x.ProjectId == projectid && m.PostType == Const.PostType_2 && x.IsUsed == true && (y.LimitDate == null || y.LimitDate < DateTime.Now)
select x).Count();
return result;
}
/// <summary>
/// 获取企业安委会会议数
/// </summary>
@@ -1122,6 +1164,36 @@ namespace BLL
return result;
}
/// <summary>
/// 获取分支机构综合预案数
/// </summary>
/// <returns></returns>
public static int GetBranchComprehensivePlanNum(string projectid)
{
var result = 0;
return result;
}
/// <summary>
/// 获取分支机构专项预案数
/// </summary>
/// <returns></returns>
public static int GetBranchSpecialPlanNum(string projectid)
{
var result = 0;
return result;
}
/// <summary>
/// 获取分支机构现场处置预案
/// </summary>
/// <returns></returns>
public static int GetBranchOnSiteDisposalPlan(string projectid)
{
var result = 0;
return result;
}
/// <summary>
/// 获取企业级演练次数
/// </summary>
@@ -1131,6 +1203,33 @@ namespace BLL
var result = 0;
return result;
}
/// <summary>
/// 获取企业级演练人次数
/// </summary>
/// <returns></returns>
public static int GetCompanyDrillPersonNum(string projectid)
{
var result = 0;
return result;
}
/// <summary>
/// 获取分支机构演练次数
/// </summary>
/// <returns></returns>
public static int GetBranchDrillNum(string projectid)
{
var result = 0;
return result;
}
/// <summary>
/// 获取分支机构演练人次数
/// </summary>
/// <returns></returns>
public static int GetBranchDrillPersonNum(string projectid)
{
var result = 0;
return result;
}
/// <summary>
/// 获取项目级综合预案
@@ -1183,6 +1282,17 @@ namespace BLL
select x).Count();
return result;
}
/// <summary>
/// 获取项目级参演人数
/// </summary>
/// <returns></returns>
public static int GetProjectDrillPersonNum(string projectid)
{
var result = (from x in Funs.DB.Emergency_DrillRecordList
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.JointPersonNum ?? 0).ToList().Sum();
return result;
}
/// <summary>
/// 获取费用提取(万元)
@@ -1394,6 +1504,17 @@ namespace BLL
select x.TrainPersonNum).ToList().Sum(x => x.Value);
return result;
}
/// <summary>
/// 获取危大工程作业人次数
/// </summary>
/// <returns></returns>
public static int GetOperativesNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime
select x.OperativesNum).ToList().Sum(x => x.Value);
return result;
}
/// <summary>
/// 获取危大工程施工个数
@@ -1445,6 +1566,18 @@ namespace BLL
where x.ProjectId == 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 GetSuperOperativesNum(string projectid)
{
var result =
(from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime
select x.OperativesNum).ToList().Sum(x => x.Value);
return result;
}
/// <summary>
@@ -1482,7 +1615,7 @@ namespace BLL
public static List<Project_HSSEData_HSSE> GetProject_HSSEData_HSSEByModle(Project_HSSEData_HSSE table)
{
var q = from x in db.Project_HSSEData_HSSE
var q = from x in Funs.DB.Project_HSSEData_HSSE
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) &&
@@ -1538,6 +1671,7 @@ namespace BLL
x.CertificateANum,
x.CertificateBNum,
x.CertificateCNum,
x.QualityPersonNum,
x.SafetyCommitteeMeetingNum,
x.EnterpriseTopicsMeetingNum,
x.ProjectSafetyLeadingGroupMeetingNum,
@@ -1557,7 +1691,13 @@ namespace BLL
x.CompanyComprehensivePlanNum,
x.CompanySpecialPlanNum,
x.CompanyOnSiteDisposalPlan,
x.BranchComprehensivePlanNum,
x.BranchSpecialPlanNum,
x.BranchOnSiteDisposalPlan,
x.CompanyDrillNum,
x.CompanyDrillPersonNum,
x.BranchDrillNum,
x.BranchDrillPersonNum,
x.ProjectComprehensivePlanNum,
x.ProjectSpecialPlanNum,
x.ProjectOnSiteDisposalPlan,
@@ -1578,10 +1718,12 @@ namespace BLL
x.HighRiskNum,
x.CompletedNum,
x.TrainPersonNum,
x.OperativesNum,
x.ConstructionNum,
x.FinishedNum,
x.SuperCompletedNum,
x.SuperTrainPersonNum,
x.SuperOperativesNum,
x.SuperConstructionNum,
x.SuperFinishedNum
};
@@ -1589,7 +1731,7 @@ namespace BLL
#endregion
#region
#region
/// <summary>
/// 推送项目安全隐患风险数据
@@ -1597,10 +1739,10 @@ namespace BLL
/// <returns></returns>
public static ReturnData PushProjectHSSEData()
{
var items = (from x in db.Project_HSSEData_HSSE
var items = (from x in Funs.DB.Project_HSSEData_HSSE
where x.ReportDate == DateTime.Now.Date
select x).ToList();
var detailItems = (from x in db.Project_HSSEData_HiddenDangerDetail
var detailItems = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail
where x.ReportDate == DateTime.Now.Date
select x).ToList();
Model.ReturnData responeData = new Model.ReturnData();
@@ -1621,5 +1763,650 @@ namespace BLL
}
#endregion
#region
/// <summary>
/// 推送项目安全隐患数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectHazardRegisterData(int pushNum)
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.View_Hazard_HazardRegister
where (x.IsUpdate == null || x.IsUpdate == false) && x.CheckTime > BLL.Const.DtmarkTime
&& x.ProblemTypes == "1"
&& x.ProjectState == "1"
// && x.IsBranch.Value == true
&& (x.IsDelete == null || x.IsDelete == false)
select new Model.Hazard_HazardRegisterItem
{
HazardRegisterId = x.HazardRegisterId,
SourceUnitId = thisUnit.UnitId,
RegisterDate = x.RegisterDate,
RegisterDef = x.RegisterDef,
Rectification = x.Rectification,
WorkAreaName = x.WorkAreaName,
ResponsibilityUnitName = x.ResponsibilityUnitName,
ResponsibilityUnitCollCropCode = x.ResponsibilityUnitCollCropCode,
Risk_Level = x.Risk_Level,
ProjectId = x.ProjectId,
ProjectName = x.ProjectName,
States = x.States,
StatesStr = x.StatesStr,
ResponsibilityManName = x.ResponsibilityManName,
CheckManName = x.CheckManName,
CheckTime = x.CheckTime,
RectificationPeriod = x.RectificationPeriod,
ImageUrl = x.ImageUrl,
// ImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.ImageUrl),
RectificationImageUrl = x.RectificationImageUrl,
// RectificationImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.RectificationImageUrl),
RectificationTime = x.RectificationTime,
ConfirmManName = x.ConfirmManName,
ConfirmDate = x.ConfirmDate,
HandleIdea = x.HandleIdea,
CutPayment = x.CutPayment,
CheckCycle = x.CheckCycle,
RegisterTypesName = x.RegisterTypesName,
Requirements = x.Requirements
}).Take(pushNum).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/SaveProjectHazardRegisterData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
foreach (var item in items)
{
var data = db.HSSE_Hazard_HazardRegister.FirstOrDefault(x =>
x.HazardRegisterId == item.HazardRegisterId && (x.IsUpdate == null || x.IsUpdate == false));
data.IsUpdate = true;
db.SubmitChanges();
}
// var list = from x in db.HSSE_Hazard_HazardRegister
// where x.IsUpdate == null || x.IsUpdate == false
// select x;
// foreach (var item in list)
// {
// item.IsUpdate = true;
// }
// db.SubmitChanges();
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目安全隐患数据";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 删除项目安全隐患数据
/// </summary>
/// <returns></returns>
public static ReturnData DeleteProjectHazardRegisterData(string hazardRegisterId)
{
Model.ReturnData responeData = new Model.ReturnData();
try
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.View_Hazard_HazardRegister
where x.HazardRegisterId == hazardRegisterId
select new Model.Hazard_HazardRegisterItem
{
HazardRegisterId = x.HazardRegisterId,
SourceUnitId = thisUnit.UnitId,
RegisterDate = x.RegisterDate,
RegisterDef = x.RegisterDef,
Rectification = x.Rectification,
WorkAreaName = x.WorkAreaName,
ResponsibilityUnitName = x.ResponsibilityUnitName,
ResponsibilityUnitCollCropCode = x.ResponsibilityUnitCollCropCode,
Risk_Level = x.Risk_Level,
ProjectId = x.ProjectId,
ProjectName = x.ProjectName,
States = x.States,
StatesStr = x.StatesStr,
ResponsibilityManName = x.ResponsibilityManName,
CheckManName = x.CheckManName,
CheckTime = x.CheckTime,
RectificationPeriod = x.RectificationPeriod,
ImageUrl = x.ImageUrl,
ImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.ImageUrl),
RectificationImageUrl = x.RectificationImageUrl,
RectificationImageUrlFileContext = AttachFileService.GetMoreFileStructByAttachUrl(x.RectificationImageUrl),
RectificationTime = x.RectificationTime,
ConfirmManName = x.ConfirmManName,
ConfirmDate = x.ConfirmDate,
HandleIdea = x.HandleIdea,
CutPayment = x.CutPayment,
CheckCycle = x.CheckCycle,
RegisterTypesName = x.RegisterTypesName,
Requirements = x.Requirements
}).ToList();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/DeleteProjectHazardRegisterData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
}
catch (Exception)
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 推送危大工程业务明细数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectLargeEngineeringData(int pushNum)
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.Solution_LargerHazard
where (x.IsUpdate == null || x.IsUpdate == false) && x.RecordTime > BLL.Const.DtmarkTime
select new Model.LargeEngineeringItem
{
Id = x.HazardId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.RecordTime,
AttachFile = AttachFileService.getFileUrl(x.HazardId.ToString()),
HazardName = x.HazardName,
TypeName = db.Sys_Const.FirstOrDefault(y =>
y.ConstValue == x.HazardType && y.GroupId == ConstValue.Group_LargerHazardType).ConstText,
IsSuperLargerHazard = x.IsSuperLargerHazard,
IsArgument = x.IsArgument,
Address = x.Address,
Descriptions = x.Descriptions,
TrainPersonNum = x.TrainPersonNum,
RecordTime = x.RecordTime,
ExpectedTime = x.ExpectedTime,
States = x.States,
StatesStr = x.States == "0" ? "已取消" :
x.States == "1" ? "未开始" :
x.States == "2" ? "作业中" :
x.States == "3" ? "已完工" : "",
}).Take(pushNum).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/SaveProjectLargeEngineeringData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
foreach (var item in items)
{
var data = db.Solution_LargerHazard.FirstOrDefault(x =>
x.HazardId == item.Id && (x.IsUpdate == null || x.IsUpdate == false));
data.IsUpdate = true;
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目危大工程业务明细数据";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 删除危大工程业务明细数据
/// </summary>
/// <returns></returns>
public static ReturnData DeleteProjectLargeEngineeringData(string Id)
{
Model.ReturnData responeData = new Model.ReturnData();
try
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.Solution_LargerHazard
where x.HazardId == Id
select new Model.LargeEngineeringItem
{
Id = x.HazardId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.RecordTime,
AttachFile = AttachFileService.getFileUrl(x.HazardId.ToString()),
HazardName = x.HazardName,
TypeName = db.Sys_Const.FirstOrDefault(y =>
y.ConstValue == x.HazardType && y.GroupId == ConstValue.Group_LargerHazardType).ConstText,
IsSuperLargerHazard = x.IsSuperLargerHazard,
IsArgument = x.IsArgument,
Address = x.Address,
Descriptions = x.Descriptions,
TrainPersonNum = x.TrainPersonNum,
OperativesNum = x.OperativesNum,
RecordTime = x.RecordTime,
ExpectedTime = x.ExpectedTime,
States = x.States,
StatesStr = x.States == "0" ? "已取消" :
x.States == "1" ? "未开始" :
x.States == "2" ? "作业中" :
x.States == "3" ? "已完工" : "",
}).ToList();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/DeleteProjectLargeEngineeringData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
}
catch (Exception)
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 推送安全作业许可业务明细数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectLicenseData(int pushNum)
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.View_License_LicenseManager
where (x.IsUpdate == null || x.IsUpdate == false) && x.CompileDate > BLL.Const.DtmarkTime
select new Model.ProjectLicenseItem
{
Id = x.LicenseManagerId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CompileDate,
AttachFile = AttachFileService.getFileUrl(x.LicenseManagerId.ToString()),
LicenseManagerCode = x.LicenseManagerCode,
UnitId = x.UnitId,
UnitName = x.UnitName,
LicenseTypeName = x.LicenseTypeName,
UnitTypeName = x.UnitTypeName,
IsHighRisk = x.IsHighRisk,
WorkAreaName = x.WorkAreaName,
CompileDate = x.CompileDate,
StartDate = x.StartDate,
EndDate = x.EndDate,
WorkStatesStr = x.WorkStatesStr,
}).Take(pushNum).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/SaveProjectLicenseData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
foreach (var item in items)
{
var data = db.License_LicenseManager.FirstOrDefault(x =>
x.LicenseManagerId == item.Id && (x.IsUpdate == null || x.IsUpdate == false));
data.IsUpdate = true;
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目安全作业许可业务明细数据";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 删除安全作业许可业务明细数据
/// </summary>
/// <returns></returns>
public static ReturnData DeleteProjectLicenseData(string Id)
{
Model.ReturnData responeData = new Model.ReturnData();
try
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.View_License_LicenseManager
where x.LicenseManagerId == Id
select new Model.ProjectLicenseItem
{
Id = x.LicenseManagerId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CompileDate,
AttachFile = AttachFileService.getFileUrl(x.LicenseManagerId.ToString()),
LicenseManagerCode = x.LicenseManagerCode,
UnitId = x.UnitId,
UnitName = x.UnitName,
LicenseTypeName = x.LicenseTypeName,
UnitTypeName = x.UnitTypeName,
IsHighRisk = x.IsHighRisk,
WorkAreaName = x.WorkAreaName,
CompileDate = x.CompileDate,
StartDate = x.StartDate,
EndDate = x.EndDate,
WorkStatesStr = x.WorkStatesStr,
}).ToList();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/DeleteProjectLicenseData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
}
catch (Exception)
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
return responeData;
}
#endregion
#region
/// <summary>
/// 推送安全风险数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectSecurityRiskData(int pushNum)
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.Hazard_HazardSelectedItem
join List in db.Hazard_HazardList on x.HazardListId equals List.HazardListId into ListJ
from list in ListJ.DefaultIfEmpty()
join Level in db.Base_RiskLevel on x.HazardLevel equals Level.RiskLevelId into LevelJ
from level in LevelJ.DefaultIfEmpty()
where (x.IsUpdate == null || x.IsUpdate == false) && level.RiskLevelName != "" && list.States == BLL.Const.State_2
select new Model.ProjectSecurityRiskItem
{
Id = x.HazardSelectedItemId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CheckStartDate,
// AttachFile = AttachFileService.getFileUrl(x.HazardListId.ToString()),
WorkAreaName = list.WorkAreaName,
WorkStageName = ConvertWorkStage(x.WorkStage),
SupHazardListType = ConvertSupHazardListTypeId(x.HazardListTypeId),
HazardListType = ConvertHazardListTypeId(x.HazardListTypeId),
Hazard = ConvertHazardCode(x.HazardId),
HazardItems = x.HazardItems,
DefectsType = x.DefectsType,
MayLeadAccidents = x.MayLeadAccidents,
HelperMethod = x.HelperMethod,
HazardJudge_L = x.HazardJudge_L,
HazardJudge_E = x.HazardJudge_E,
HazardJudge_C = x.HazardJudge_C,
HazardJudge_D = x.HazardJudge_D,
RiskLevelName = level.RiskLevelName,
RiskLevel = level.RiskLevel,
ControlMeasures = x.ControlMeasures,
}).Take(pushNum).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/SaveProjectSecurityRiskData";
responeData = ServerService.PushCNCEC(str, baseurl);
if (responeData.code == 1)
{
foreach (var item in items)
{
var data = db.Hazard_HazardSelectedItem.FirstOrDefault(x =>
x.HazardSelectedItemId == item.Id && (x.IsUpdate == null || x.IsUpdate == false));
data.IsUpdate = true;
db.SubmitChanges();
}
}
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目安全风险数据";
}
return responeData;
}
#region
/// <summary>
/// 转换工作阶段
/// </summary>
/// <param name="workStage"></param>
/// <returns></returns>
public static string ConvertWorkStage(object workStage)
{
if (workStage != null)
{
string workStages = string.Empty;
string[] strList = workStage.ToString().Split(',');
foreach (string str in strList)
{
Model.Base_WorkStage c = BLL.WorkStageService.GetWorkStageById(str);
if (c != null)
{
workStages += c.WorkStageName + ",";
}
}
if (!string.IsNullOrEmpty(workStages))
{
workStages = workStages.Substring(0, workStages.LastIndexOf(","));
}
return workStages;
}
return "";
}
/// <summary>
/// 获取危险源编号
/// </summary>
/// <param name="WorkStage"></param>
/// <returns></returns>
public static string ConvertHazardCode(object HazardId)
{
string hazardCode = string.Empty;
if (HazardId != null)
{
Model.Technique_HazardList hazardList = BLL.HazardListService.GetHazardListById(HazardId.ToString());
if (hazardList != null)
{
hazardCode = hazardList.HazardCode;
}
}
return hazardCode;
}
/// <summary>
/// 获取危险源类别
/// </summary>
/// <param name="hazardListTypeId"></param>
/// <returns></returns>
public static string ConvertSupHazardListTypeId(object hazardListTypeId)
{
if (hazardListTypeId != null)
{
Model.Technique_HazardListType hazardListType =
BLL.HazardListTypeService.GetHazardListTypeById(hazardListTypeId.ToString());
if (hazardListType != null)
{
var hazard = BLL.HazardListTypeService.GetHazardListTypeById(hazardListType.SupHazardListTypeId);
if (hazard != null)
{
return hazard.HazardListTypeName;
}
}
}
return null;
}
/// <summary>
/// 获取危险源项
/// </summary>
/// <param name="hazardListTypeId"></param>
/// <returns></returns>
public static string ConvertHazardListTypeId(object hazardListTypeId)
{
if (hazardListTypeId != null)
{
Model.Technique_HazardListType hazardListType =
BLL.HazardListTypeService.GetHazardListTypeById(hazardListTypeId.ToString());
if (hazardListType != null)
{
return hazardListType.HazardListTypeName;
}
}
return null;
}
#endregion
#endregion
#region
/// <summary>
/// 删除安全风险数据
/// </summary>
/// <returns></returns>
public static ReturnData DeleteProjectSecurityRiskData(string Id)
{
Model.ReturnData responeData = new Model.ReturnData();
try
{
var thisUnit = CommonService.GetIsThisUnit();
Model.SUBQHSEDB db = Funs.DB;
var items = (from x in db.Hazard_HazardSelectedItem
join List in db.Hazard_HazardList on x.HazardListId equals List.HazardListId into ListJ
from list in ListJ.DefaultIfEmpty()
join Level in db.Base_RiskLevel on x.HazardLevel equals Level.RiskLevelId into LevelJ
from level in LevelJ.DefaultIfEmpty()
where x.HazardSelectedItemId == Id
select new Model.ProjectSecurityRiskItem
{
Id = x.HazardSelectedItemId,
SourceUnitId = thisUnit.UnitId,
ProjectId = x.ProjectId,
CollCropCode = thisUnit.CollCropCode,
DataDate = x.CheckStartDate,
// AttachFile = AttachFileService.getFileUrl(x.HazardListId.ToString()),
WorkAreaName = list.WorkAreaName,
WorkStageName = ConvertWorkStage(x.WorkStage),
SupHazardListType = ConvertSupHazardListTypeId(x.HazardListTypeId),
HazardListType = ConvertHazardListTypeId(x.HazardListTypeId),
Hazard = ConvertHazardCode(x.HazardId),
HazardItems = x.HazardItems,
DefectsType = x.DefectsType,
MayLeadAccidents = x.MayLeadAccidents,
HelperMethod = x.HelperMethod,
HazardJudge_L = x.HazardJudge_L,
HazardJudge_E = x.HazardJudge_E,
HazardJudge_C = x.HazardJudge_C,
HazardJudge_D = x.HazardJudge_D,
RiskLevelName = level.RiskLevelName,
RiskLevel = level.RiskLevel,
ControlMeasures = x.ControlMeasures,
}).ToList();
if (items.Count() > 0)
{
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/DeleteProjectSecurityRiskData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
}
catch (Exception)
{
responeData.code = 0;
responeData.message = "集团数据删除失败";
}
return responeData;
}
#endregion
}
}
@@ -1,5 +1,4 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using System;
using System.Collections;
@@ -36,6 +36,8 @@ namespace BLL
UnitId = superviseCheckReport.UnitId,
CheckTeam = superviseCheckReport.CheckTeam,
EvaluationResult = superviseCheckReport.EvaluationResult,
CheckUnitId = superviseCheckReport.CheckUnitId,
CheckMainType = superviseCheckReport.CheckMainType,
CheckType = superviseCheckReport.CheckType,
AttachUrl = superviseCheckReport.AttachUrl,
IsIssued = superviseCheckReport.IsIssued
@@ -59,9 +61,12 @@ namespace BLL
newSuperviseCheckReport.UnitId = superviseCheckReport.UnitId;
newSuperviseCheckReport.CheckTeam = superviseCheckReport.CheckTeam;
newSuperviseCheckReport.EvaluationResult = superviseCheckReport.EvaluationResult;
newSuperviseCheckReport.CheckUnitId = superviseCheckReport.CheckUnitId;
newSuperviseCheckReport.CheckMainType = superviseCheckReport.CheckMainType;
newSuperviseCheckReport.CheckType = superviseCheckReport.CheckType;
newSuperviseCheckReport.AttachUrl = superviseCheckReport.AttachUrl;
newSuperviseCheckReport.IsIssued = superviseCheckReport.IsIssued;
newSuperviseCheckReport.IsUpdate = null;
Funs.DB.SubmitChanges();
}
}