using BLL; using FineUIPro.Web.CQMS.WBS; 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.gpHSSE.Hidden = true; this.gpCQMS.Hidden = true; this.gpJDGL.Hidden = true; this.gpHTGL.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 == "HSSE") { this.gpHSSE.Hidden = false; var getLargerHazardListItem = from x in Funs.DB.Solution_LargerHazardListItem join y in Funs.DB.Solution_LargerHazardList on x.LargerHazardListId equals y.LargerHazardListId where x.WorkPackageId.Contains(workPackageId) && y.States == Const.State_1 select x; if (!string.IsNullOrEmpty(controlItemAndCycleId)) { getLargerHazardListItem = getLargerHazardListItem.Where(x => x.WorkPackageId.Contains(controlItemAndCycleId)); } this.lbExpertArgument.Text = getLargerHazardListItem.Count().ToString(); var getAccidentPersonRecord = from x in Funs.DB.Accident_AccidentPersonRecord where x.WorkPackageId.Contains(workPackageId) && x.States == Const.State_2 select x; if (!string.IsNullOrEmpty(controlItemAndCycleId)) { getAccidentPersonRecord = getAccidentPersonRecord.Where(x => x.WorkPackageId.Contains(controlItemAndCycleId)); } this.lbAccident.Text = getAccidentPersonRecord.Count().ToString(); var getHazardRegister = from x in Funs.DB.HSSE_Hazard_HazardRegister where x.WorkPackageId.Contains(workPackageId) && x.States != null && x.States != "4" && x.States != "0" select x; if (!string.IsNullOrEmpty(controlItemAndCycleId)) { getHazardRegister = getHazardRegister.Where(x => x.WorkPackageId.Contains(controlItemAndCycleId)); } this.lbHazardRegisterCount.Text= getHazardRegister.Count().ToString(); } 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 == "JDGL") { this.gpJDGL.Hidden = false; //double totalSJCost = 0; ////累计实际费用 //decimal totalPlanCost = 0; ////计划费用 //var getViewWorkPackageParentDetail = from x in Funs.DB.View_WBS_WorkPackageParentDetail // where (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 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; } } } } } }