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

232 lines
12 KiB
C#
Raw Normal View History

using BLL;
using System;
using System.Data;
using System.Linq;
namespace FineUIPro.Web.DigData
{
public partial class ProjectWBSDW : 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)
{
2023-08-24 10:59:39 +08:00
this.ProjectId = this.CurrUser.LoginProjectId;
////权限按钮方法
2023-08-24 10:59:39 +08:00
// this.ucTree.WorkPackageCode = this.WorkPackageCode;
this.ucTree.ProjectId = this.ProjectId;
2023-09-04 17:13:55 +08:00
//this.btnNew.OnClientClick = Window1.GetShowReference("ShowProjectWBSPackage.aspx") + "return false;";
}
}
protected void changeTree(object sender, EventArgs e)
{
2023-08-31 16:37:09 +08:00
this.hdWorkPackageId.Text = this.ucTree.WorkPackageId;
initControlItem();
}
2023-08-31 16:37:09 +08:00
/// <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;
2023-08-31 16:37:09 +08:00
SetData();
}
/// <summary>
/// 加载工作包
/// </summary>
protected void initControlItem()
{
2023-08-31 16:37:09 +08:00
var getControlItem = from x in Funs.DB.WBS_ControlItemAndCycle
where x.WorkPackageId == this.hdWorkPackageId.Text
select x;
cblControlItem.DataValueField = "ControlItemAndCycleId";
cblControlItem.DataTextField = "ControlItemContent";
cblControlItem.DataSource = getControlItem;
2023-08-31 16:37:09 +08:00
cblControlItem.DataBind();
SetData();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void cblControlItem_SelectedIndexChanged(object sender, EventArgs e)
{
SetData();
}
/// <summary>
/// 数据展示
/// </summary>
private void SetData()
{
string workPackageId = this.hdWorkPackageId.Text;
string controlItemAndCycleId = this.cblControlItem.SelectedValue;
if (workPackageId == "1" || workPackageId == "2")
{
workPackageId = "Type" + workPackageId;
}
if (!string.IsNullOrEmpty(workPackageId))
{
foreach (var item in this.ckType.SelectedValueArray)
{
if (item == "HSSE")
{
this.gpHSSE.Hidden = false;
this.lbExpertArgument.Text = (from x in Funs.DB.Solution_LargerHazardListItem
join y in Funs.DB.Solution_LargerHazardList on x.LargerHazardListId equals y.LargerHazardListId
2023-09-04 17:13:55 +08:00
where y.ProjectId == this.ProjectId && x.WorkPackageId.Contains(workPackageId)
&& y.States == Const.State_1
&& (controlItemAndCycleId == null || x.WorkPackageId.Contains(controlItemAndCycleId))
select x).Count().ToString();
this.lbAccident.Text = (from x in Funs.DB.Accident_AccidentPersonRecord
where x.ProjectId == this.ProjectId && x.WorkPackageId.Contains(workPackageId)
&& x.States == Const.State_2
2023-08-31 16:37:09 +08:00
&& (controlItemAndCycleId == null || x.WorkPackageId.Contains(controlItemAndCycleId))
select x).Count().ToString();
2023-09-07 08:51:08 +08:00
this.lbHSEProblemCount.Text= (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == this.ProjectId && x.States != null && x.States !="4" && x.States != "0"
select x).Count().ToString();
2023-08-31 16:37:09 +08:00
}
if (item == "CQMS")
{
this.gpCQMS.Hidden = false;
2023-09-04 17:13:55 +08:00
//// 实体验收 资料验收
var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
2023-08-31 16:37:09 +08:00
join y in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals y.SpotCheckCode
2023-09-04 17:13:55 +08:00
where y.ProjectId == this.ProjectId && x.WorkPackageId.Contains(workPackageId)
&& (controlItemAndCycleId == null || x.WorkPackageId.Contains(controlItemAndCycleId))
&& y.State == "8"
2023-08-31 16:37:09 +08:00
select x;
2023-09-04 17:13:55 +08:00
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= 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%";
2023-08-31 16:37:09 +08:00
2023-09-04 17:13:55 +08:00
////控制点
//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() };
2023-08-31 16:37:09 +08:00
2023-09-04 17:13:55 +08:00
//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%";
2023-08-31 16:37:09 +08:00
}
if (item == "JDGL")
{
this.gpJDGL.Hidden = false;
2023-09-04 17:13:55 +08:00
//double totalSJCost = 0; ////累计实际费用
//decimal totalPlanCost = 0; ////计划费用
//var getWorkPackageDetail = Funs.DB.WBS_WorkPackageDetail.FirstOrDefault(x => x.WorkPackageId == workPackageId);
//if (getWorkPackageDetail != null)
//{
// ///末级节点
// var getMaxSJCost = Funs.DB.View_WBS_WorkPackageDetail.Where(x => x.WorkPackageId == workPackageId).OrderByDescending(x => x.Months).FirstOrDefault();
// if (getMaxSJCost != null)
// {
// totalSJCost = getMaxSJCost.TotalThisValue ?? 0;
// totalPlanCost = getMaxSJCost.PlanCost ?? 0;
// }
//}
//else
//{
// ///非末级节点
// var getMaxSJCost = Funs.DB.View_WBS_WorkPackageParentDetail.Where(x =>x.ProjectId == this.ProjectId
// && x.ParentId == workPackageId).OrderByDescending(x => x.Months).FirstOrDefault();
// if (getMaxSJCost != null)
// {
// totalSJCost = getMaxSJCost.TotalThisValue ?? 0;
// totalPlanCost = getMaxSJCost.PlanCost ?? 0;
// }
//}
////// 根 节点 建筑工程 安装工程
//if (workPackageId == "1" || workPackageId == "2")
//{
// var getUnitWorkByType = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.ProjectId && x.ProjectType == workPackageId select x;
// if (getUnitWorkByType.Count() > 0)
// {
// totalPlanCost = getUnitWorkByType.Sum(x => x.PlanCost ?? 0);
// }
//}
//var getUnitWork = Funs.DB.WBS_UnitWork.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.UnitWorkId == workPackageId);
//if (getUnitWork != null)
//{
// totalPlanCost= getUnitWork.PlanCost ?? 0;
//}
/////项目进度完成百分比
//decimal s = Convert.ToDecimal(totalSJCost);
//this.lbJDRate.Text = totalPlanCost > 0 ? Math.Round(s / totalPlanCost).ToString() + "%" : "0%";
2023-08-31 16:37:09 +08:00
}
if (item == "HTGL")
{
this.gpHTGL.Hidden = false;
}
if (item == "LW")
{
this.gpLW.Hidden = false;
}
}
}
}
}
}