大屏看板

This commit is contained in:
2025-04-17 16:01:19 +08:00
parent 510b04d2fa
commit 163a94de69
27 changed files with 4902 additions and 20273 deletions
+247 -494
View File
@@ -1,525 +1,278 @@
using BLL;
using Newtonsoft.Json;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Web.Services;
using System.Linq;
using System.Web.UI.WebControls;
using System.Threading.Tasks;
using FineUIPro.Web.ProjectData;
namespace FineUIPro.Web.common
{
public partial class mainProject : PageBase
{
#region ID
/// <summary>
/// 项目ID
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//public string userId;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = string.Empty;
if (this.CurrUser != null)
string userId = this.CurrUser.UserId;
}
}
/// <summary>
/// 看板数据
/// </summary>
/// <returns></returns>
[WebMethod]
public static object GetHSSEData()
{
try
{
var db = Funs.DB;
var page = new mainProject();
string userId = page.CurrUser.UserId;
string projectId = page.CurrUser.LoginProjectId;
MainSevice mainSevice = new MainSevice(userId, projectId);
var project = ProjectService.GetProjectByProjectId(projectId);
//获取HSSE数据
var hsseData = Task.Run(() => mainSevice.GetHsseDataAsync()).Result;
//班前会
var classMeetingList = HSSEData_HSSEService.GetProjectClassMeeting(projectId);
//周前会
var weekMeetingList = HSSEData_HSSEService.GetProjectWeekMeeting(projectId);
//项目总工期
int projectDays = 0;
if (project.StartDate.HasValue)
{
this.ProjectId = this.CurrUser.LoginProjectId;
}
/// 获取安全人工时
getPersonWorkTime();
///劳务统计
getSitePerson();
///项目概况
getProjectInfo();
/// 获取质量问题
getCQMSProblem();
////ToDO 资质取数
this.divQualityWarningNum.InnerHtml = (from x in Funs.DB.QualityAudit_PersonQuality
join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId
where y.ProjectId == this.ProjectId && y.IsUsed == true && x.LimitDate < DateTime.Now
select x).Count().ToString();
///产值
getOutputValues();
///获取天气
getWeatherValues();
/// 获取风险管控
getHazard();
//获取质量培训人数
getIPersonNum();
//获取技术交底人数
getDesignNum();
//获取焊工总数
getHJPersonNum();
//获取总达因数、完成达因数、总片数、合格片数
getTotalDineNum();
getCompleteDineNum();
getTotalFilmNum();
getOkFilmNum();
}
}
#region
private void getIPersonNum()
{
var IPersonNum = Funs.DB.Comprehensive_InspectionPerson
.Where(x => x.IsTrain == true && x.ProjectId == this.ProjectId).Count();
this.divIPersonNum.InnerHtml = IPersonNum.ToString();
}
#endregion
#region
private void getDesignNum()
{
var DesignNum = Funs.DB.Comprehensive_DesignDetails
.Where(x => x.ProjectId == this.ProjectId).Select(x => x.JoinPersonNum).ToList().Sum();
this.divDesignNum.InnerHtml = DesignNum.ToString();
}
#endregion
#region
private void getHJPersonNum()
{
var HjPersonNum = Funs.DB.BS_Welder.Where(x => x.ProjectId == this.ProjectId && x.WED_IfOnGuard == true)
.Count();
this.divHjPersonNum.InnerHtml = HjPersonNum.ToString();
}
#endregion
#region
/// <summary>
/// 总达因数
/// </summary>
private void getTotalDineNum()
{
this.divTotalDineNum.InnerHtml = Project_HJGLData_HJGLService.GetTotalDineNum(this.ProjectId).ToString();
}
/// <summary>
/// 完成达因数
/// </summary>
private void getCompleteDineNum()
{
this.divCompleteDineNum.InnerHtml = Project_HJGLData_HJGLService.GetCompleteDineNum(this.ProjectId).ToString();
}
/// <summary>
/// 总片数
/// </summary>
private void getTotalFilmNum()
{
this.divTotalFilmNum.InnerHtml = Project_HJGLData_HJGLService.GetTotalFilmNum(this.ProjectId).ToString();
}
/// <summary>
/// 合格片数
/// </summary>
private void getOkFilmNum()
{
this.divOkFilmNum.InnerHtml = Project_HJGLData_HJGLService.GetOKFilmNum(this.ProjectId).ToString();
}
#endregion
#region
protected string swiper_One
{
get
{
var getDataList = Funs.DB.Sp_APP_GetToDoItems(this.CurrUser.LoginProjectId, CurrUser.UserId).ToList();
string strNoticeHtml = string.Empty;
foreach (var item in getDataList)
{
string url = item.PCUrl;
strNoticeHtml += "<li data-id=\"" + url + "\" notice-id=\"" + item.DataId + "\" class=\"c-item swiper-slide\"><div class=\"tit\" title=\"" + item.MenuName + "\"><div class=\"flex\" ><div class=\"tit-t flex1\">" + item.MenuName + "</div><div class=\"tit-v\">" + string.Format("{0:yyyy-MM-dd}", item.DataTime) + "</div></div></div></li>";
}
return "<ul class=\"content-ul swiper-wrapper\">" + strNoticeHtml + "</ul>";
}
}
#endregion
#region
/// <summary>
/// 获取安全人工时
/// </summary>
private void getPersonWorkTime()
{
this.divSafeWorkTime.InnerHtml = "0000000000";
var getMax = from x in Funs.DB.SitePerson_DayReportDetail
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
where y.ProjectId == this.CurrUser.LoginProjectId
select x;
int wHours = 0;
if (getMax.Count() > 0)
{
wHours = Convert.ToInt32(getMax.Sum(x => x.PersonWorkTime) ?? 0);
}
if (wHours > 0)
{
this.divSafeWorkTime.InnerHtml = ((wHours % 100000000) / 10000000).ToString() + ((wHours % 10000000) / 1000000).ToString() + ((wHours % 1000000) / 100000).ToString()
+ ((wHours % 100000) / 10000).ToString() + ((wHours % 10000) / 1000).ToString() + ((wHours % 1000) / 100).ToString() + ((wHours % 100) / 10).ToString() + (wHours % 10).ToString();
}
///整改单
var getRectify = from x in Funs.DB.Check_RectifyNotices
where x.ProjectId == this.ProjectId && x.States != Const.State_0 && x.States != null
select x;
int allcout = getRectify.Count();
if (allcout > 0)
{
this.divAllRectify.InnerHtml = allcout.ToString();
int ccount = getRectify.Where(x => x.States == Const.State_5).Count();
this.divCRectify.InnerHtml = ccount.ToString();
this.divUCRectify.InnerHtml = (allcout - ccount).ToString();
}
}
#endregion
#region
protected string WorkPostS;
protected string InPostCounts;
protected string InDutyCounts;
/// <summary>
/// 劳务统计
/// </summary>
private void getSitePerson()
{
int AllCount = 0;
int MCount = 0;
//var getallin = APIPageDataService.getPersonInOutNum(this.ProjectId, DateTime.Now.AddDays(-1));
DateTime dateValue = DateTime.Now.AddDays(-1);
List<Model.PageDataPersonInOutItem> getallin = new List<Model.PageDataPersonInOutItem>();
var getInMaxs = from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
select new Model.PageDataPersonInOutItem
{
PersonId = x.PersonId,
PostType = y.PostType,
WorkPostId = x.WorkPostId,
};
if (getInMaxs.Count() > 0)
{
getallin = getInMaxs.Distinct().ToList();
}
AllCount = getallin.Count();
if (AllCount > 0)
{
this.divALLPerson.InnerHtml = AllCount.ToString();
MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count();
/////管理人数
this.divGLPerson.InnerHtml = MCount.ToString();
/////作业人数
this.divZYPerson.InnerHtml = (AllCount - MCount).ToString();
}
WorkPostS = "[]";
InPostCounts = "[]";
InDutyCounts = "[]";
List<int> InPostCountList = new List<int>();
List<int> InDutyCountList = new List<int>();
List<string> worksList = new List<string>();
//if (this.CurrUser.UserId != Const.hfnbdId)
//{
var getPersons = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == this.ProjectId && x.IsUsed == true && x.InTime <= DateTime.Now
&& !x.OutTime.HasValue);
if (getPersons.Count() > 0)
{
var getWorkIds = getPersons.Where(x => x.WorkPostId != null).Select(x => x.WorkPostId).Distinct();
if (getWorkIds.Count() > 0)
{
foreach (var item in getWorkIds)
int pdays = (project.EndDate.Value - project.StartDate.Value).Days;
if (pdays >= 0)
{
worksList.Add(WorkPostService.getWorkPostNameById(item));
int isPost = getPersons.Where(x => x.WorkPostId == item).Count();
InPostCountList.Add(isPost);
int inDuty = 0;
if (getallin.Count() > 0)
{
inDuty = getallin.Where(x => x.WorkPostId == item).Count();
}
InDutyCountList.Add(inDuty);
projectDays = pdays;
}
}
}
else
{
worksList.Add(" ");
InPostCountList.Add(0);
InDutyCountList.Add(0);
}
//}
//合同倒计时
int endDays = (project.EndDate.Value - DateTime.Now).Days;
WorkPostS = JsonConvert.SerializeObject(worksList);
InPostCounts = JsonConvert.SerializeObject(InPostCountList);
InDutyCounts = JsonConvert.SerializeObject(InDutyCountList);
}
#endregion
// 计算整改率
string hsseZGRate = "0";
double generalRectificationRate = 0;
#region
protected string divProjectNameTitle;
protected string divProjectAddressTitle;
protected string divProjectMoneyTitle;
protected string divOwnUnitTitle;
protected string divSGUnitTitle;
protected string divJLUnitTitle;
protected string divProjectImg;
/// <summary>
///
/// </summary>
private void getProjectInfo()
{
divProjectNameTitle = "";
divProjectAddressTitle = "";
divProjectMoneyTitle = "";
divOwnUnitTitle = "";
divSGUnitTitle = "";
divJLUnitTitle = "";
divProjectImg = "../res/indexv2/assets/image/index6/center-bg.jpeg";
var project = ProjectService.GetProjectByProjectId(this.ProjectId);
if (project != null)
{
this.divProjectName.InnerHtml = project.ShortName;
divProjectNameTitle = project.ProjectName;
if (!string.IsNullOrEmpty(project.ProjectAddress))
if (hsseData.GeneralClosedNum.HasValue && hsseData.GeneralNotClosedNum.HasValue)
{
this.divProjectAddress.InnerHtml = project.ProjectAddress.Length > 8 ? project.ProjectAddress.Substring(0, 8) + "..." : project.ProjectAddress;
divProjectAddressTitle = project.ProjectAddress;
}
string unit_yz = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_4);
if (!string.IsNullOrEmpty(unit_yz))
{
this.divOwnUnit.InnerHtml = unit_yz.Length > 8 ? unit_yz.Substring(0, 8) + "..." : unit_yz;
divOwnUnitTitle = unit_yz;
}
string unit_JL = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_3);
if (!string.IsNullOrEmpty(unit_JL))
{
this.divJLUnit.InnerHtml = unit_JL.Length > 8 ? unit_JL.Substring(0, 8) + "..." : unit_JL;
divJLUnitTitle = unit_JL;
}
string unit_FB = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_2);
if (!string.IsNullOrEmpty(unit_FB))
{
this.divSGUnit.InnerHtml = unit_FB.Length > 8 ? unit_FB.Substring(0, 8) + "..." : unit_FB + "...";
}
var getSGName = from x in Funs.DB.Project_ProjectUnit
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ProjectId == project.ProjectId && x.UnitType == Const.ProjectUnitType_2
select y.UnitName;
foreach (var item in getSGName)
{
divSGUnitTitle += item + "";
}
this.divProjectMoney.InnerHtml = divProjectMoneyTitle = project.ProjectMoney.ToString() + "万元";
if (project.EndDate.HasValue)
{
this.divEndDate.InnerHtml = string.Format("{0:yyyy-MM-dd}", project.EndDate);
int endDays = (project.EndDate.Value - DateTime.Now).Days;
if (endDays >= 0)
double total = hsseData.GeneralClosedNum.Value + hsseData.GeneralNotClosedNum.Value;
if (total > 0)
{
this.divRemainingDays.InnerHtml = endDays.ToString() + "<span>天</span>";
}
if (project.StartDate.HasValue)
{
int pdays = (project.EndDate.Value - project.StartDate.Value).Days;
if (pdays >= 0)
{
this.divProjectDays.InnerHtml = pdays.ToString() + "<span>天</span>";
}
generalRectificationRate = 100.0 * hsseData.GeneralClosedNum.Value / total;
hsseZGRate = String.Format("{0:N2}", generalRectificationRate);
}
}
var getImag = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == project.ProjectId);
if (getImag != null && !string.IsNullOrEmpty(getImag.AttachUrl))
//设计交底
var designDetailsList = (from x in db.Comprehensive_DesignDetails where x.ProjectId == projectId select x).ToList();
//施工方案
var cqmsConstructSolutionList = (from x in db.Solution_CQMSConstructSolution where x.ProjectId == projectId select x).ToList();
//设备报验
var inspectionEquipmentList = (from x in db.Comprehensive_InspectionEquipment where x.ProjectId == projectId select x).ToList();
//人员报验
var inspectionPersonList = (from x in db.Comprehensive_InspectionPerson where x.ProjectId == projectId select x).ToList();
//机具报验
var inspectionMachineList = (from x in db.Comprehensive_InspectionMachine where x.ProjectId == projectId select x).ToList();
//质量
var cqmsProjectData = (from x in Funs.DB.Project_CQMSData_CQMS
where x.ProjectId == projectId
select x).OrderByDescending(x => x.ReportDate).FirstOrDefault();
//质量培训人数
//var cqmsTrainPersonNum = cqmsProjectData.TrainPersonNum;
var cqmsTrainPersonNum = Funs.DB.Comprehensive_InspectionPerson.Where(x => x.IsTrain == true && x.ProjectId == projectId).Count();
//var getJointCheckDetail = from x in Funs.DB.Check_JointCheckDetail
// join y in Funs.DB.Check_JointCheck on x.JointCheckId equals y.JointCheckId
// where y.ProjectId == projectId
// select x;
//var getCheckControl = from x in Funs.DB.Check_CheckControl
// where x.ProjectId == projectId
// select x;
// 问题总数
int cqmsProblemNum = cqmsProjectData.ProblemNum ?? 0;
int cqmsCompletedNum = cqmsProjectData.ProblemCompletedNum ?? 0;
int cqmsNotCompletedNumt = cqmsProjectData.ProblemNotCompletedNum ?? 0;
//int cqmsAllCount = getJointCheckDetail.Count() + getCheckControl.Count();
//int cqmsOkNum = 0;//已完成
//int cqmsIncompleteNum = 0; //未完成
double cqmsZGRate = 0;//整改率
if (cqmsCompletedNum > 0)
{
string url = getImag.AttachUrl.Replace('\\', '/');
string firtstUrl = Funs.GetStrListByStr(url, ',').FirstOrDefault();
if (!string.IsNullOrEmpty(firtstUrl))
cqmsZGRate = Math.Round(100 * (double)(cqmsCompletedNum / cqmsProblemNum), 2);
///问题完成数
//var getJOk = getJointCheckDetail.Where(x => x.State == "6").Count();
//var getCOk = getCheckControl.Where(x => x.State == "7").Count();
//cqmsOkNum = getJOk + getCOk;
//cqmsIncompleteNum = cqmsAllCount - cqmsOkNum;
//if (cqmsOkNum > 0)
//{
// cqmsZGRate = Math.Round(cqmsOkNum * 1.0 / cqmsAllCount * 100, 2);
//}
}
classMeetingList = classMeetingList.Where(x => x.ProjectId == projectId).ToList();
weekMeetingList = weekMeetingList.Where(x => x.ProjectId == projectId).ToList();
designDetailsList = designDetailsList.Where(x => x.ProjectId == projectId).ToList();
cqmsConstructSolutionList = cqmsConstructSolutionList.Where(x => x.ProjectId == projectId).ToList();
inspectionEquipmentList = inspectionEquipmentList.Where(x => x.ProjectId == projectId).ToList();
inspectionPersonList = inspectionPersonList.Where(x => x.ProjectId == projectId).ToList();
inspectionMachineList = inspectionMachineList.Where(x => x.ProjectId == projectId).ToList();
int inspectionEquipment = inspectionEquipmentList.Count();
int inspectionPerson = inspectionPersonList.Count();
int inspectionMachine = inspectionMachineList.Count();
int inspectionEquipmentIsCheckOk = inspectionEquipmentList.Where(x => x.SamplingResult == "1").Count();
int inspectionPersonIsCheckOk = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true).Count();
int inspectionMachineIsCheckOk = inspectionMachineList.Where(x => x.IsCheckOK.HasValue && x.IsCheckOK == true).Count();
double inspectionEquipmentRate = inspectionEquipmentIsCheckOk > 0 ? Math.Round((100 * (double)(inspectionEquipmentIsCheckOk / inspectionEquipment)), 2) : 0;
double inspectionPersonRate = inspectionPersonIsCheckOk > 0 ? Math.Round((100 * (double)(inspectionPersonIsCheckOk / inspectionPerson)), 2) : 0;
double inspectionMachineRate = inspectionMachineIsCheckOk > 0 ? Math.Round((100 * (double)(inspectionMachineIsCheckOk / inspectionMachine)), 2) : 0;
// 构造返回数据
var returnData = new
{
success = true,
data = new
{
string atturl = Funs.RootPath + firtstUrl.Replace(';', ' ').Trim();
if (File.Exists(atturl))
{
divProjectImg = "../" + firtstUrl.Replace(';', ' ').Trim();
}
educationIdx = 0,
checkIdx = 0,
org = new
{//组织机构人员
projectSum = (hsseData.ProjectInspectorGeneralNum ?? 0) + (hsseData.ProjectFullTimeNum ?? 0) + (hsseData.ProjectSafetyMonitorNum ?? 0),//项目总人数
projectDirector = hsseData.ProjectInspectorGeneralNum ?? 0,//项目总监
projectFullTime = hsseData.ProjectFullTimeNum ?? 0,//项目专职
projectSafetyMonitoring = hsseData.ProjectSafetyMonitorNum ?? 0,//项目安全监护
projectSecurity = 0,//项目安管人员【待汇总】
projectPersonRatio = "1:5",//项目安管人员与作业人员配比【待汇总】
},
warning = new
{//预警警报【待汇总】
hydropower = 0,//水电监测
hydropower2 = 0,//水电监测
towercrane = 0,//塔式起重机预警
foundationpit = 0,//基坑监测预警
car = 0,//车辆冲洗监测
},
hsseCheck = new
{//安全检查
generalNum = (hsseData.GeneralClosedNum ?? 0) + (hsseData.GeneralNotClosedNum ?? 0),//安全问题
notClosedNum = hsseData.GeneralNotClosedNum ?? 0,//未完成
closedNum = hsseData.GeneralClosedNum ?? 0,//整改闭环
rectificationRate = Convert.ToDouble(hsseZGRate),//整改率
},
cqmsCheck = new
{//质量检查
generalNum = cqmsProblemNum,//质量问题
notClosedNum = cqmsNotCompletedNumt,//未完成
closedNum = cqmsCompletedNum,//整改闭环
rectificationRate = cqmsZGRate,//整改率
},
riskClassification = new
{//风险分级管控
highRiskNum = hsseData.HighRiskNum ?? 0,//重大风险
mediumRiskNum = hsseData.MediumRiskNum ?? 0,//较大风险
generalRiskNum = hsseData.GeneralRiskNum ?? 0,//一般风险
lowRiskNum = hsseData.LowRiskNum ?? 0//低风险
},
costEquipmentMeeting = new
{//费用、机具及会议
expenseExtraction = hsseData.CostExtract.HasValue ? Math.Round(hsseData.CostExtract.Value / 100000000m, 2) : 0,//安全费用-费用提取(亿元)
costUtilization = hsseData.CostUse.HasValue ? Math.Round(hsseData.CostUse.Value / 100000000m, 2) : 0,//安全费用-费用使用(亿元)
usingNumbers = hsseData.UseEquipmentNum ?? 0,//施工机具设备-在用个数
specialEquipment = hsseData.SpecialEquipmentNum ?? 0,//施工机具设备-特种设备
classMeeting = classMeetingList.Count(),//会议-班前会
weekMeeting = weekMeetingList.Count()//会议-周例会
},
projectInfo = new
{//项目数据
projectDays = projectDays,//项目总工期
projectEndDate = string.Format("{0:yyyy-MM-dd}", project.EndDate),//项目到期时间
projectEndDays = endDays > 0 ? endDays : 0,//合同倒计时
},
//xmjdData = new {//项目进度计划【待汇总】
//},
dangerousProject = new
{//危大工程管控数据
approvalCompleted = hsseData.CompletedNum ?? 0,//审批完成
construction = hsseData.ConstructionNum ?? 0,//施工个数
training = hsseData.TrainPersonNum ?? 0,//培训人次
completed = hsseData.FinishedNum ?? 0,//完工个数
reasoning = 0//论证个数【待汇总】
},
meetAnEmergency = new
{//应急管理数据
comprehensive = hsseData.CompanyComprehensivePlanNum ?? 0,//综合预案
special = hsseData.CompanySpecialPlanNum ?? 0,//专项预案
scene = hsseData.CompanyOnSiteDisposalPlan ?? 0,//现场处置
drill = hsseData.CompanyDrillNum ?? 0//演练次数
},
engineeringDivision = new
{//工程划分
unitNum = cqmsProjectData.UnitProjectNum ?? 0,//单位工程数
branchNum = cqmsProjectData.SubProjectNum ?? 0,//分部工程数
itemizeNum = cqmsProjectData.SubdivisionalWorksNum ?? 0,//分项工程数
},
//质量验收数据【待汇总】
specialEquipmentSys = 0,//特种设备质保体系【待汇总】
designBriefing = designDetailsList.Count(),//图纸会审、设计交底
hsseEduTrain = new
{//安全教育
safeWorkingHour = hsseData.SafeWorkingHour ?? 0,//安全工时数
specialTrainNum = hsseData.SpecialTrainNum ?? 0,//专项培训
safeTrainNum = hsseData.SafeTrainNum ?? 0,//三级安全教育培训
specialOperationTrainNum = hsseData.SpecialOperationTrainNum ?? 0,//特种作业培训
safetyTechnicalBriefing = 0//安全技术交底次数【待汇总】
},
cqmsTrainPersonNum = cqmsTrainPersonNum,//质量教育-培训人数
inspectionRecord = new
{//报验记录
equipmentNum = inspectionEquipment,//设备报验
equipmentRate = inspectionEquipmentRate,//设备报验合格率
personNum = inspectionPerson,//人员报验
personRate = inspectionPersonRate,//人员报验合格率
machineNum = inspectionMachine,//机具报验
machineRate = inspectionMachineRate,//机具报验合格率
},
constructSolution = new
{//施工方案
total = cqmsConstructSolutionList.Count(),//总数
projectApprove = cqmsConstructSolutionList.Where(x => x.State == "1").Count(),//项目审批数(审批状态:已闭合)
enterpriseApprove = 0//企业审批数【待汇总】
},
highRisk = new
{//高风险作业许可
closeItem = hsseData.LicensesCloseNum ?? 0,//关闭项
licenseItem = hsseData.LicensesNum ?? 0//许可项
},
measuringInstrumentsData = new
{//计量器具数据
useNum = cqmsProjectData.UseNum ?? 0,//计量器具
okNum = cqmsProjectData.OKNum ?? 0,//校准合格
},
}
}
};
return returnData;
}
catch (Exception ex)
{
return new { success = false, msg = ex.Message };
}
}
#endregion
#region
///整改率
protected double CRectificationRate;
///合格率
protected double CQualifiedRate;
/// 焊接一次合格率
protected double FirstPassRate;
/// <summary>
/// 获取质量问题
/// </summary>
private void getCQMSProblem()
{
CRectificationRate = 0;
CQualifiedRate = 0;
FirstPassRate = 0;
var getJointCheckDetail = from x in Funs.DB.Check_JointCheckDetail
join y in Funs.DB.Check_JointCheck on x.JointCheckId equals y.JointCheckId
where y.ProjectId == this.ProjectId
select x;
var getCheckControl = from x in Funs.DB.Check_CheckControl
where x.ProjectId == this.ProjectId
select x;
///问题总数
int AllCount = getJointCheckDetail.Count() + getCheckControl.Count();
this.divCQMSAllNum.InnerHtml = AllCount.ToString();
if (AllCount > 0)
{
///问题完成数
var getJOk = getJointCheckDetail.Where(x => x.State == "6").Count();
var getCOk = getCheckControl.Where(x => x.State == "7").Count();
int CCount = getJOk + getCOk;
this.divCQMSCAllNum.InnerHtml = CCount.ToString();
this.divCQMSUCAllNum.InnerHtml = (AllCount - CCount).ToString();
if (CCount > 0)
{
CRectificationRate = Math.Round(CCount * 1.0 / AllCount * 100, 1);
}
}
//var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
// // join z in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals z.SpotCheckCode
// join y in Funs.DB.WBS_ControlItemAndCycle on x.ControlItemAndCycleId equals y.ControlItemAndCycleId
// where y.ProjectId == this.ProjectId && x.IsOK != null
// && y.ControlPoint != "C" && y.ControlPoint != "CR"
// //&& z.ProjectId == this.ProjectId
// select x;
//int AllSpotCount = getSpotCheckDetail.Count();
//if (AllSpotCount > 0)
//{
// int okSpotCount = getSpotCheckDetail.Where(x => x.IsOK == true).Count();
// if (okSpotCount > 0)
// {
// CQualifiedRate = Math.Round(okSpotCount * 1.0 / AllSpotCount * 100, 1);
// }
//}
var inspectionManagements = from x in Funs.DB.ProcessControl_InspectionManagement where x.ProjectId == this.ProjectId select x;
if (inspectionManagements.Count() > 0)
{
int okInspectionManagements = inspectionManagements.Where(x => x.IsOnceQualified == true).Count();
if (okInspectionManagements > 0)
{
CQualifiedRate = Math.Round(okInspectionManagements * 1.0 / inspectionManagements.Count() * 100, 1);
}
}
///焊接一次合格率
var getJots = from x in Funs.DB.HJGL_Batch_NDEItem
join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
join z in Funs.DB.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId
join a in Funs.DB.HJGL_Batch_NDE on x.NDEID equals a.NDEID
where z.PointDate != null && z.PointState == "1" && y.RepairRecordId == null
&& a.ProjectId == this.ProjectId
select x;
int allHJCount = getJots.Count();
if (allHJCount > 0)
{
var getOk = getJots.Where(x => x.CheckResult == "1");
int okHJCount = getOk.Count();
if (okHJCount > 0)
{
FirstPassRate = Math.Round(okHJCount * 1.0 / allHJCount * 100, 1);
}
}
}
#endregion
#region
protected string SubUnitNames;
protected string OutputValues;
private void getOutputValues()
{
SubUnitNames = "[]";
OutputValues = "[]";
List<string> UnitNameList = new List<string>();
List<int> OutputValueList = new List<int>();
var getUnits = from x in Funs.DB.Project_ProjectUnit
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ProjectId == this.ProjectId && x.UnitType == Const.ProjectUnitType_2
select new { x.UnitId, y.ShortUnitName };
if (getUnits.Count() > 0)
{
Random ro = new Random();
foreach (var item in getUnits)
{
UnitNameList.Add(item.ShortUnitName ?? " ");
int OutputValue = ro.Next(100);////获取分包单位产值
OutputValueList.Add(OutputValue);
}
}
else
{
UnitNameList.Add(" ");
OutputValueList.Add(0);
}
SubUnitNames = JsonConvert.SerializeObject(UnitNameList);
OutputValues = JsonConvert.SerializeObject(OutputValueList);
}
#endregion
/// <summary>
/// 获取天气
/// </summary>
private void getWeatherValues()
{
var getW = WeatherService.GetWeather(this.ProjectId);
if (getW != null)
{
this.divInfo.InnerHtml = getW.WeatherRef;
this.divTEMP.InnerHtml = getW.AllTem;
this.divHJ1.InnerHtml = getW.CurrTem;
this.divHJ3.InnerHtml = getW.Humidity;
this.divHJ5.InnerHtml = getW.Power;
this.divHJ4.InnerHtml = getW.Aqi;
this.divHJ6.InnerHtml = getW.Aqi;
}
}
#region
protected string riskData1;
protected string riskData2;
protected string riskData3;
protected string riskData4;
/// <summary>
/// 获取风险管控
/// </summary>
private void getHazard()
{
var getHazards = from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == this.ProjectId
select new { x.HazardSelectedItemId, y.RiskLevel };
riskData1 = getHazards.Count(x => x.RiskLevel == 1).ToString();
riskData2 = getHazards.Count(x => x.RiskLevel == 2).ToString();
riskData3 = getHazards.Count(x => x.RiskLevel == 3).ToString();
riskData4 = getHazards.Count(x => x.RiskLevel == 4).ToString();
}
#endregion
}
}