SGGL_SHJ/SGGL/FineUIPro.Web/DigData/ProjectDataDW.aspx.cs

192 lines
10 KiB
C#
Raw Normal View History

using BLL;
using System;
using System.Data;
2023-09-07 08:51:08 +08:00
using System.Data.SqlTypes;
using System.Linq;
namespace FineUIPro.Web.DigData
{
public partial class ProjectDataDW : PageBase
{
/// <summary>
/// 项目ID
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ckType_SelectedIndexChanged(object sender, EventArgs e)
{
this.gpHSSE.Hidden = true;
this.gpCQMS.Hidden = true;
this.gpJDGL.Hidden = true;
this.gpHTGL.Hidden = true;
this.gpLW.Hidden = true;
SetData();
}
/// <summary>
/// 数据展示
/// </summary>
private void SetData()
{
if (!string.IsNullOrEmpty(this.ProjectId))
{
foreach (var item in this.ckType.SelectedValueArray)
{
if (item == "HSSE")
{
this.gpHSSE.Hidden = false;
2023-09-07 08:51:08 +08:00
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.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.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()
+ Funs.DB.Meeting_MonthMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count()
+ Funs.DB.Meeting_SpecialMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count()
+ Funs.DB.Meeting_WeekMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count()).ToString();
var getCostManges = Funs.DB.CostGoods_CostManage.Where(x => x.ProjectId == this.ProjectId && x.States == Const.State_2);
if (getCostManges.Count() > 0)
{
this.lbHSECost.Text = getCostManges.Sum(x => x.SumMoney ?? 0).ToString();
}
else
{
this.lbHSECost.Text = "0";
}
}
if (item == "CQMS")
{
this.gpCQMS.Hidden = false;
//// 实体验收 资料验收
var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
2023-09-07 08:51:08 +08:00
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();
2023-09-07 08:51:08 +08:00
// this.lbSpotCheck1.Text = all.ToString();
int onesOKCount = getSpotCheckDetail.Where(x => x.IsOnesOK == true).Count(); //一次合格
// this.lbSpotCheck2.Text= okCount.ToString();
2023-09-07 08:51:08 +08:00
this.lbSpotCheckRate.Text = all > 0 ? Math.Round(onesOKCount * 100.0 / (all * 1.0)).ToString() + "%" : "0%";
/// 资料验收合格项目
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%";
}
if (item == "JDGL")
{
this.gpJDGL.Hidden = false;
2023-09-07 08:51:08 +08:00
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%";
}
if (item == "HTGL")
{
this.gpHTGL.Hidden = false;
}
if (item == "LW")
{
this.gpLW.Hidden = false;
}
}
}
}
}
}