244 lines
7.1 KiB
C#
244 lines
7.1 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using Model;
|
|||
|
using static NPOI.HSSF.Util.HSSFColor;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HJGL.TrustManage
|
|||
|
{
|
|||
|
public partial class PMIShowTrustSearch : PageBase
|
|||
|
{
|
|||
|
#region 定义项
|
|||
|
/// <summary>
|
|||
|
/// 区域主键
|
|||
|
/// </summary>
|
|||
|
public string WorkAreaId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["WorkAreaId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["WorkAreaId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//public string MaterialId
|
|||
|
//{
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return (string)ViewState["MaterialId"];
|
|||
|
// }
|
|||
|
// set
|
|||
|
// {
|
|||
|
// ViewState["MaterialId"] = value;
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 装置主键
|
|||
|
/// </summary>
|
|||
|
//public string InstallationId
|
|||
|
//{
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return (string)ViewState["InstallationId"];
|
|||
|
// }
|
|||
|
// set
|
|||
|
// {
|
|||
|
// ViewState["InstallationId"] = value;
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 项目ID
|
|||
|
/// </summary>
|
|||
|
//public string ProjectId
|
|||
|
//{
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return (string)ViewState["ProjectId"];
|
|||
|
// }
|
|||
|
// set
|
|||
|
// {
|
|||
|
// ViewState["ProjectId"] = value;
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 被选择项列表
|
|||
|
/// </summary>
|
|||
|
public List<string> SelectedList
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (List<string>)ViewState["SelectedList"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["SelectedList"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载页面
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.SelectedList = new List<string>();
|
|||
|
string strList = Request.Params["strList"];
|
|||
|
List<string> list = Funs.GetStrListByStr(strList, '|');
|
|||
|
if (list.Count() == 3)
|
|||
|
{
|
|||
|
//this.ProjectId = list[0];
|
|||
|
this.WorkAreaId = list[0];
|
|||
|
//this.DReportID = list[2];
|
|||
|
//this.InstallationId = list[3];
|
|||
|
}
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
protected void txtJOT_JointNo_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
#region 数据绑定
|
|||
|
/// <summary>
|
|||
|
/// 数据绑定
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
|
|||
|
string strSql = @"SELECT [MaterialId]
|
|||
|
,[Discpline]
|
|||
|
,[UnitId]
|
|||
|
,[AreaId]
|
|||
|
,[Pipeline]
|
|||
|
,[ItemRule]
|
|||
|
,[CommoidyCode]
|
|||
|
,[Size1]
|
|||
|
,[Size2]
|
|||
|
,[IdentCode]
|
|||
|
,[TagNumber]
|
|||
|
,[IdentName]
|
|||
|
,[ShortDescription]
|
|||
|
,[Quantity]
|
|||
|
,[UnitNum]
|
|||
|
,[PipeRun]
|
|||
|
,[Category]
|
|||
|
,[Material]
|
|||
|
,[Spec]
|
|||
|
,[NominalDiameter]
|
|||
|
,[THK]
|
|||
|
,[Painting]
|
|||
|
,[WeightNum]
|
|||
|
,[WeightUnit]
|
|||
|
,[Remark]
|
|||
|
,[ProjectId]
|
|||
|
FROM [dbo].[PMI_MaterialTemplate] WHERE ProjectId=@ProjectId";
|
|||
|
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(txtJOT_JointNo.Text))
|
|||
|
{
|
|||
|
strSql += " and Pipeline like '%" + txtJOT_JointNo.Text + "%'";
|
|||
|
}
|
|||
|
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
|
|||
|
string MaterialId = Request.Params["MaterialId"];
|
|||
|
if (!string.IsNullOrEmpty(MaterialId))
|
|||
|
{
|
|||
|
string[] jots = MaterialId.Split('|');
|
|||
|
foreach (string jotId in jots)
|
|||
|
{
|
|||
|
DataRow r = dt.Select("MaterialId = '" + jotId + "'").FirstOrDefault();
|
|||
|
if (r != null)
|
|||
|
{
|
|||
|
dt.Rows.Remove(r);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 2.获取当前分页数据
|
|||
|
Grid1.RecordCount = dt.Rows.Count;
|
|||
|
Grid1.DataSource = dt;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 排序
|
|||
|
/// <summary>
|
|||
|
/// 排序
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|||
|
{
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 提交按钮
|
|||
|
/// <summary>
|
|||
|
/// 提交按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnAccept_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string itemsString = string.Empty;
|
|||
|
string[] selectRowId = Grid1.SelectedRowIDArray;
|
|||
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|||
|
{
|
|||
|
string rowId = this.Grid1.Rows[i].DataKeys[0].ToString();
|
|||
|
if (selectRowId.Contains(rowId))
|
|||
|
{
|
|||
|
SelectedList.Add(rowId);
|
|||
|
}
|
|||
|
}
|
|||
|
string MaterialId = Request.Params["MaterialId"];
|
|||
|
if (!string.IsNullOrEmpty(MaterialId))
|
|||
|
{
|
|||
|
string[] jots = MaterialId.Split('|');
|
|||
|
foreach (string jotId in jots)
|
|||
|
{
|
|||
|
SelectedList.Add(jotId);
|
|||
|
}
|
|||
|
}
|
|||
|
foreach (var item in SelectedList)
|
|||
|
{
|
|||
|
if (!itemsString.Contains(item))
|
|||
|
{
|
|||
|
itemsString += item + "|";
|
|||
|
}
|
|||
|
}
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
|
|||
|
+ ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|