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 加载 /// /// 加载页面 /// /// /// 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 查询 /// ///查询按钮 /// /// /// 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 加载树 /// /// 加载树节点 /// /// private void InitTreeMenu(string workAreaId) { string unitId = Request.Params["unitId"]; List isoInfos = new List(); 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点击事件 /// /// 点击Tree /// /// /// protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e) { string isoId = this.tvControlItem.SelectedNodeID; BindGrid(isoId); } #endregion #region 数据绑定 /// /// 数据绑定 /// /// 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 listStr = new List { 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 确定按钮 /// /// 确定按钮 /// /// /// 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 } }