xinjiang/SGGL/FineUIPro.Web/HJGL/HotProessManage/ShowHotProessSearch.aspx.cs

174 lines
6.6 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HJGL.HotProessManage
{
public partial class ShowHotProessSearch : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string unitId = Request.Params["unitId"];
string installationId = Request.Params["installationId"];
var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
{
BLL.WorkAreaService.GetWorkAreaListByInstallSupervisorUnit(this.drpWorkArea, this.CurrUser.LoginProjectId, installationId, unitId, this.CurrUser.UnitId, true);
}
else
{
BLL.WorkAreaService.GetWorkAreaListByInstallUnit(this.drpWorkArea, this.CurrUser.LoginProjectId, installationId, unitId, true);
}
}
}
#endregion
#region
/// <summary>
///查询按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpWorkArea.SelectedValue))
{
this.InitTreeMenu(this.drpWorkArea.SelectedValue);//加载树
}
else
{
Alert.ShowInTop("请选择区域!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 加载树节点
/// </summary>
/// <param name="selectedValue"></param>
private void InitTreeMenu(string workAreaId)
{
string unitId = Request.Params["unitId"];
List<Model.PW_IsoInfo> isoInfos = new List<Model.PW_IsoInfo>();
if (!string.IsNullOrEmpty(workAreaId))
{
this.tvControlItem.Nodes.Clear();
TreeNode rootNode = new TreeNode();
rootNode.Text = BLL.WorkAreaService.GetWorkAreaCodeByWorkAreaId(workAreaId);
rootNode.NodeID = workAreaId;
rootNode.Expanded = true;
this.tvControlItem.Nodes.Add(rootNode);
isoInfos = (from x in Funs.DB.PW_IsoInfo
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitId == unitId
&& x.WorkAreaId == workAreaId
select x).ToList();
if (!string.IsNullOrEmpty(this.txtISO_ID.Text.Trim()))
{
isoInfos = isoInfos.Where(x => x.ISO_IsoNo.Contains(this.txtISO_ID.Text.Trim())).ToList();
}
if (isoInfos.Count() > 0)
{
foreach (var item in isoInfos)
{
var hot = from x in Funs.DB.PW_JointInfo
where x.ISO_ID == item.ISO_ID
&& (x.JOT_HotRpt == null || x.JOT_HotRpt == "") && x.DReportID != null
&& x.IS_Proess == "1"
select x;
if (hot.Count() > 0)
{
TreeNode newNode = new TreeNode();
newNode.Text = item.ISO_IsoNo;
newNode.NodeID = item.ISO_ID;
newNode.Expanded = true;
newNode.EnableClickEvent = true;
rootNode.Nodes.Add(newNode);
}
}
}
}
}
#endregion
#region Tree点击事件
/// <summary>
/// 点击Tree
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
string isoId = this.tvControlItem.SelectedNodeID;
BindGrid(isoId);
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
/// <param name="isoId"></param>
private void BindGrid(string isoId)
{
string strSql = @"SELECT HotProessItem.JOT_ID,
HotProessItem.ISO_ID,
HotProessItem.JOT_JointNo,
HotProessItem.ISO_IsoNo,
HotProessItem.JOT_WeldDate "
+ @" FROM View_HotProessItem AS HotProessItem "
+ @" WHERE HotProessItem.JOT_HotRpt IS NULL AND HotProessItem.DReportID IS NOT NULL AND HotProessItem.IS_Proess='1'"
+ @" AND HotProessItem.ISO_ID=@isoId";
List<SqlParameter> listStr = new List<SqlParameter>
{
new SqlParameter("@isoId", isoId),
};
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
//var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = tb;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 确定按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSure_Click(object sender, EventArgs e)
{
string selectedList = string.Empty;
foreach (var item in Grid1.SelectedRowIDArray)
{
selectedList += item + ",";
}
if (!string.IsNullOrEmpty(selectedList))
{
selectedList = selectedList.Substring(0, selectedList.LastIndexOf(","));
}
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(selectedList)
+ ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}