大数据数据绑定

This commit is contained in:
2023-09-18 13:47:38 +08:00
parent 9dc9075142
commit 338b874e85
14 changed files with 278 additions and 203 deletions
@@ -1,4 +1,6 @@
using BLL;
using FineUIPro.Web.HJGL.WeldingReport;
using Model;
using System;
using System.Data;
using System.Data.SqlTypes;
@@ -67,27 +69,14 @@ namespace FineUIPro.Web.DigData
this.lbSitePersons.Text = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == this.ProjectId //&& y.States == Const.State_1
select x).Count().ToString();
var getPersonInOutNumber = (from x in Funs.DB.SitePerson_PersonInOutNumber
where x.ProjectId == this.ProjectId
select x).OrderByDescending(x => x.InOutDate).FirstOrDefault();
if (getPersonInOutNumber != null)
{
this.lbWorkHours.Text = (getPersonInOutNumber.WorkHours ?? 0).ToString();
}
else
{
this.lbWorkHours.Text = "0";
}
///安全工时
this.lbWorkHours.Text = HSEDataDWService.getProjecctSafeHours(this.ProjectId).ToString();
///安全教育
this.lbEduCount.Text = (from x in Funs.DB.EduTrain_TrainRecord
where x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2
select x).Count().ToString();
var getAllHazardRegister = from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == this.ProjectId && x.States != null && x.States != "4" && x.States != "0"
select x;
int allHazardCount = getAllHazardRegister.Count();
int cHazardCount = getAllHazardRegister.Where(x => x.States == "3").Count();
this.lbRectifyRate.Text = allHazardCount > 0 ? Math.Round(cHazardCount * 100.0 / (allHazardCount * 1.0)).ToString() + "%" : "0%";
///问题整改
this.lbRectifyRate.Text = HSEDataDWService.getProblemRate(this.ProjectId);
this.lbMeetingCount.Text = (Funs.DB.Meeting_AttendMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count()
+ Funs.DB.Meeting_ClassMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count()
@@ -108,74 +97,21 @@ namespace FineUIPro.Web.DigData
if (item == "CQMS")
{
this.gpCQMS.Hidden = false;
//// 实体验收 资料验收
var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
join y in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals y.SpotCheckCode
where y.ProjectId == this.ProjectId && y.State == "8"
select x;
int all = getSpotCheckDetail.Count();
// this.lbSpotCheck1.Text = all.ToString();
int onesOKCount = getSpotCheckDetail.Where(x => x.IsOnesOK == true).Count(); //一次合格
// this.lbSpotCheck2.Text= okCount.ToString();
///质量验收问题整改率
this.lbSpotCheckRate.Text = CQMSDataDWService.getSpotCheckRate(this.ProjectId);
///控制点完成率
this.lbSpotCheckDataRate.Text = CQMSDataDWService.getSpotCheckDataRate(this.ProjectId);
this.lbSpotCheckRate.Text = all > 0 ? Math.Round(onesOKCount * 100.0 / (all * 1.0)).ToString() + "%" : "0%";
//// 质量检查问题整改率
this.lbCheckControlStates.Text = CQMSDataDWService.getCheckControlStates(this.ProjectId);
/// 资料验收合格项目
var getOKSpotCheckDetail = getSpotCheckDetail.Where(x => x.IsOK == true);
int okYSCount = getOKSpotCheckDetail.Count(); //验收合格
int okDateCount = getSpotCheckDetail.Where(x => x.IsDataOK == "1").Count(); //资料合格
this.lbSpotCheckDataRate.Text = okYSCount > 0 ? Math.Round(okDateCount * 100.0 / (okYSCount * 1.0)).ToString() + "%" : "0%";
///实体质量问题整改率
//int allNoOk = all - onesOKCount; ///问题数
//int oKCount = getSpotCheckDetail.Where(x => x.IsOK == true).Count(); //合格数
//int zgCount = oKCount - onesOKCount; ///整改数
//this.lbSpotCheckOkRate.Text = allNoOk > 0 ? Math.Round(zgCount * 100.0 / (allNoOk * 1.0)).ToString() + "%" : "0%";
////控制点
//var getControlItemAndCycle=from x in Funs.DB.WBS_ControlItemAndCycle
// where x.ProjectId == this.ProjectId && x.WorkPackageId.Contains(workPackageId)
// && (controlItemAndCycleId == null || x.WorkPackageId.Contains(controlItemAndCycleId))
// && x.ControlPoint.Contains("A") && x.CheckNum >0
// select x;
/////A级控制点总量
//int allControlItemCount = getControlItemAndCycle.Count();
/////已完成A级控制点数
//var getOKSpotCheckDetailCheckNum = from x in getOKSpotCheckDetail
// group x by x.ControlItemAndCycleId
// into g select new { g.First().ControlItemAndCycleId, num = g.Count() };
//var getOKControlItemAndCycle = from x in getControlItemAndCycle
// join y in getOKSpotCheckDetailCheckNum on x.ControlItemAndCycleId equals y.ControlItemAndCycleId
// where x.CheckNum == y.num
// select x;
//int okControlItemCount= getOKControlItemAndCycle.Count();
//this.lbControlItemRate.Text = allControlItemCount > 0 ? Math.Round(okControlItemCount * 100.0 / (allControlItemCount * 1.0)).ToString() + "%" : "0%";
///焊接一次合格率
this.lbFirstPassRate.Text = CQMSDataDWService.getFirstPassRate(this.ProjectId);
}
if (item == "JDGL")
{
this.gpJDGL.Hidden = false;
double totalSJCost = 0; ////累计实际费用
decimal totalPlanCost = 0; ////计划费用
var getViewWorkPackageParentDetail = from x in Funs.DB.View_WBS_WorkPackageParentDetail
where x.ProjectId == this.ProjectId && (x.ParentId == "1" || x.ParentId == "2")
select x;
if (getViewWorkPackageParentDetail.Count() > 0)
{
totalSJCost = getViewWorkPackageParentDetail.Sum(x => x.TotalThisValue ?? 0);
}
var getUnitWork = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.ProjectId select x;
if (getUnitWork.Count() > 0)
{
totalPlanCost = getUnitWork.Sum(x => x.PlanCost ?? 0);
}
///项目进度完成百分比
decimal s = Convert.ToDecimal(totalSJCost);
this.lbJDRate.Text = totalPlanCost > 0 ? Math.Round(s / totalPlanCost).ToString() + "%" : "0%";
this.lbJDRate.Text = JDGLDataDWService.getJDRate(this.ProjectId, null, null);
}
if (item == "HTGL")
{