209 lines
7.6 KiB
C#
209 lines
7.6 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.WeldingProcess.PMI
|
|||
|
{
|
|||
|
public partial class PMISelectList : PageBase
|
|||
|
{
|
|||
|
string UnitId = string.Empty;
|
|||
|
string ProjectId = string.Empty;
|
|||
|
string PMIId = string.Empty;
|
|||
|
string weldJointIds=string.Empty;
|
|||
|
#region 加载页面
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.UnitId = Request.Params["unitId"] ??"";
|
|||
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
this.PMIId = Request.Params["PMIId"]??"";
|
|||
|
this.weldJointIds = Request.Params["weldJointIds"] ?? "";
|
|||
|
this.InitTreeMenu();//加载树
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载管线信息
|
|||
|
/// <summary>
|
|||
|
/// 加载树
|
|||
|
/// </summary>
|
|||
|
private void InitTreeMenu()
|
|||
|
{
|
|||
|
this.tvControlItem.Nodes.Clear();
|
|||
|
TreeNode rootNode = new TreeNode();
|
|||
|
rootNode.Text = Resources.Lan.PipelineCode;
|
|||
|
rootNode.NodeID = "0";
|
|||
|
rootNode.ToolTip = Resources.Lan.SeachTip;
|
|||
|
rootNode.Expanded = true;
|
|||
|
this.tvControlItem.Nodes.Add(rootNode);
|
|||
|
|
|||
|
//排除已经委托过的
|
|||
|
var listData= (from a in Funs.DB.PMI_Delegation.AsQueryable() join
|
|||
|
b in Funs.DB.PMI_DelegationDetails.AsQueryable() on
|
|||
|
a.Id equals b.PMIId
|
|||
|
select b.JointId
|
|||
|
).Distinct().ToList();
|
|||
|
|
|||
|
//查询带有PMI处理的管线数据
|
|||
|
var iso = from x in Funs.DB.View_Pipeline_WeldJoint
|
|||
|
where x.ProjectId == this.ProjectId && x.IsPMI == true && x.UnitId == this.UnitId
|
|||
|
select new { x.PipelineCode, x.PipelineId,x.WeldJointId }; //from x in Funs.DB.Pipeline_Pipeline where x.ProjectId == this.ProjectId && x.UnitId == this.UnitId select x;
|
|||
|
|
|||
|
if (listData.Count > 0)
|
|||
|
{
|
|||
|
iso = iso.Where(e => !listData.Contains(e.WeldJointId));
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtIsono.Text))
|
|||
|
{
|
|||
|
iso = iso.Where(e => e.PipelineCode.Contains(this.txtIsono.Text.Trim()));
|
|||
|
}
|
|||
|
var isoList = iso.Select(x => new {x.PipelineId,x.PipelineCode }).OrderBy(x => x.PipelineCode).Distinct().ToList();
|
|||
|
if (isoList.Count > 0)
|
|||
|
{
|
|||
|
foreach (var q in isoList)
|
|||
|
{
|
|||
|
TreeNode newNode = new TreeNode();
|
|||
|
newNode.NodeID = q.PipelineId;
|
|||
|
newNode.Text = q.PipelineCode;
|
|||
|
newNode.EnableClickEvent = true;
|
|||
|
rootNode.Nodes.Add(newNode);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 管线查询
|
|||
|
/// <summary>
|
|||
|
/// 查询
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Tree_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.InitTreeMenu();
|
|||
|
}
|
|||
|
protected void Tree2_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region 点击TreeView
|
|||
|
/// <summary>
|
|||
|
/// 点击TreeView
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|||
|
{
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 数据绑定
|
|||
|
/// <summary>
|
|||
|
/// 数据绑定
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
string sql = @"SELECT WeldJointId,ProjectId,PipelineId,WeldJointCode,WPQCode,DetectionType,
|
|||
|
convert(int,dbo.Fun_GetParseInt(WeldJointCode)) AS ConvertJointNo,
|
|||
|
dbo.Fun_GetParseString(WeldJointCode) AS PreJotNo,
|
|||
|
PipingClassCode,PipeSegment,JointAttribute,PageNum,
|
|||
|
ComponentsCode1,ComponentsCode2,Is_hjName,IsHotProessStr,Material1Code,Material2Code,
|
|||
|
WeldTypeCode,Specification,HeartNo1,HeartNo2,Size,Dia,Thickness,GrooveTypeCode,
|
|||
|
WeldingMethodCode,WeldSilkId,WeldMatCode,WeldingDate,WeldingDailyCode,DoneDin,
|
|||
|
BackingWelderCode,CoverWelderCode,SystemNumber,TestPackageNo,Remark,
|
|||
|
MaterialCode,WeldingDate,
|
|||
|
(CASE WHEN IsCancel=1 THEN '是' ELSE '否' END) AS IsCancel,isPMI
|
|||
|
FROM View_Pipeline_WeldJoint WHERE isPMI=1 ";
|
|||
|
|
|||
|
List<SqlParameter> paramsList = new List<SqlParameter>();
|
|||
|
if (!string.IsNullOrEmpty(this.txtJointNo.Text))
|
|||
|
{
|
|||
|
sql += @" and WeldJointCode=@WeldJointCode";
|
|||
|
paramsList.Add(new SqlParameter("@WeldJointCode", txtJointNo.Text.Trim()));
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|||
|
{
|
|||
|
sql += @" and PipelineId=@PipelineId ";
|
|||
|
paramsList.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID));
|
|||
|
}
|
|||
|
var dt = SQLHelper.GetDataTableRunText(sql, paramsList.ToArray());
|
|||
|
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[] selectRowId = Grid1.SelectedRowIDArray;
|
|||
|
int n = 0;
|
|||
|
int j = 0;
|
|||
|
int[] selections = new int[selectRowId.Count()];
|
|||
|
foreach (GridRow row in Grid1.Rows)
|
|||
|
{
|
|||
|
if (selectRowId.Contains(row.DataKeys[0]))
|
|||
|
{
|
|||
|
selections[n] = j;
|
|||
|
n++;
|
|||
|
}
|
|||
|
j++;
|
|||
|
}
|
|||
|
var select = selections.Distinct();
|
|||
|
string jotIds = Request.Params["jotIds"];
|
|||
|
if (!string.IsNullOrEmpty(jotIds))
|
|||
|
{
|
|||
|
string[] jots = jotIds.Split('|');
|
|||
|
foreach (string jotId in jots)
|
|||
|
{
|
|||
|
itemsString += jotId + "|";
|
|||
|
}
|
|||
|
}
|
|||
|
foreach (int i in select)
|
|||
|
{
|
|||
|
string rowID = Grid1.DataKeys[i][0].ToString();
|
|||
|
if (!itemsString.Contains(rowID))
|
|||
|
{
|
|||
|
itemsString += rowID + "|";
|
|||
|
}
|
|||
|
}
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
|
|||
|
+ ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|