using BLL;
using System;
using System.Data;
using System.Linq;
namespace FineUIPro.Web.DigData
{
public partial class WBSDW : PageBase
{
///
/// 加载页面
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void changeTree(object sender, EventArgs e)
{
this.hdWorkPackageCode.Text = this.ucTree.WorkPackageCode;
initControlItem();
}
protected void ckType_SelectedIndexChanged(object sender, EventArgs e)
{
this.gpCQMS.Hidden = true;
this.gpLW.Hidden = true;
SetData();
}
///
/// 加载工作包
///
protected void initControlItem()
{
var getControlItem = from x in Funs.DB.WBS_ControlItemInit
where x.WorkPackageCode == this.hdWorkPackageCode.Text
select x;
cblControlItem.DataValueField = "ControlItemCode";
cblControlItem.DataTextField = "ControlItemContent";
cblControlItem.DataSource = getControlItem;
cblControlItem.DataBind();
SetData();
}
///
///
///
///
///
protected void cblControlItem_SelectedIndexChanged(object sender, EventArgs e)
{
SetData();
}
///
/// 数据展示
///
private void SetData()
{
string workPackageId = this.hdWorkPackageCode.Text;
string controlItemAndCycleId = this.cblControlItem.SelectedValue;
if (workPackageId == "1" || workPackageId == "2")
{
workPackageId = "Type" + workPackageId;
}
else
{
workPackageId = "[" + workPackageId + "]";
}
if (!string.IsNullOrEmpty(workPackageId))
{
foreach (var item in this.ckType.SelectedValueArray)
{
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 x.WorkPackageId.Contains(workPackageId) && y.State == "8"
select x;
if (!string.IsNullOrEmpty(controlItemAndCycleId))
{
getSpotCheckDetail = getSpotCheckDetail.Where(x => x.WorkPackageId.Contains(controlItemAndCycleId));
}
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%";
//// 质量检查问题整改率
var getCheck_CheckControl = from x in Funs.DB.Check_CheckControl
where x.WorkPackageId.Contains(workPackageId)
select x;
if (!string.IsNullOrEmpty(controlItemAndCycleId))
{
getCheck_CheckControl = getCheck_CheckControl.Where(x => x.WorkPackageId.Contains(controlItemAndCycleId));
}
this.lbCheckControlCount.Text = getCheck_CheckControl.Count().ToString();
}
if (item == "LW")
{
this.gpLW.Hidden = false;
}
}
}
}
}
}