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

119 lines
4.3 KiB
C#
Raw Normal View History

using BLL;
using System;
using System.Data;
using System.Linq;
namespace FineUIPro.Web.DigData
{
public partial class WBSDW : PageBase
2023-08-31 16:37:09 +08:00
{
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
2023-08-31 16:37:09 +08:00
{
}
}
protected void changeTree(object sender, EventArgs e)
{
2023-08-31 16:37:09 +08:00
this.hdWorkPackageCode.Text = this.ucTree.WorkPackageCode;
//新增UnitId
//this.UnitId = this.ucTree.UnitId;
////判断 当有WorkPackageCode的时候单位id为空
//if (!string.IsNullOrEmpty(this.WorkPackageCode))
//{
// this.UnitId = "";
//}
// this.BindGrid();
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;
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_ControlItemInit
where x.WorkPackageCode == this.hdWorkPackageCode.Text
select x;
cblControlItem.DataValueField = "ControlItemCode";
cblControlItem.DataTextField = "ControlItemContent";
cblControlItem.DataSource = getControlItem;
2023-08-31 16:37:09 +08:00
cblControlItem.DataBind();
SetData();
}
/// <summary>
/// 数据展示
/// </summary>
private void SetData()
{
string workPackageId = this.hdWorkPackageCode.Text;
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;
this.lbExpertArgument.Text = (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).Count().ToString();
}
if (item == "CQMS")
{
this.gpCQMS.Hidden = false;
var getDetail = 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.States == Const.State_1
select x;
int all = getDetail.Count();
this.lbSpotCheck1.Text = all.ToString();
int okCount = getDetail.Where(x => x.IsOK == true).Count();
this.lbSpotCheck2.Text = okCount.ToString();
this.lbSpotCheck.Text = all > 0 ? Math.Round(okCount * 1.0 / (all * 1.0)).ToString() : "0";
}
if (item == "JDGL")
{
this.gpJDGL.Hidden = false;
}
if (item == "HTGL")
{
this.gpHTGL.Hidden = false;
}
if (item == "LW")
{
this.gpLW.Hidden = false;
}
}
}
}
}
}