feat(hjgl): 按试压包重构管线树并调整菜单
管线与试压包存在明确业务归属,相关焊接管理页面统一按 “单位工程-试压包-管线”展示和筛选,避免管线在单位工程下直接平铺。
This commit is contained in:
@@ -90,26 +90,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
{
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
string strSql = " SELECT DISTINCT [t0].[PipelineId] FROM [dbo].[HJGL_Pipeline] AS [t0]\r\nleft JOIN [dbo].[HJGL_PipeLineMat] AS [t1] ON [t0].[PipelineId] = [t1].[PipelineId]";
|
||||
strSql += "where [t0].[UnitWorkId] =@UnitWorkId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
||||
|
||||
if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t1].[MaterialCode] like @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvPipeCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t0].[PipelineCode] like @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + tvPipeCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
var a = dt.Rows.Count;
|
||||
var a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
|
||||
//int a = (from x in DBpipeline
|
||||
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
|
||||
@@ -121,16 +102,13 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.CommandName = "单位工程";
|
||||
tn1.EnableExpandEvent = true;
|
||||
tn1.EnableClickEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,27 +117,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
string strSql = " SELECT DISTINCT [t0].[PipelineId] FROM [dbo].[HJGL_Pipeline] AS [t0]\r\nleft JOIN [dbo].[HJGL_PipeLineMat] AS [t1] ON [t0].[PipelineId] = [t1].[PipelineId]";
|
||||
strSql += "where [t0].[UnitWorkId] =@UnitWorkId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
||||
|
||||
if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t1].[MaterialCode] like @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvPipeCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t0].[PipelineCode] like @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + tvPipeCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
var a = dt.Rows.Count;
|
||||
var a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
|
||||
//var b = (from x in Funs.DB.HJGL_Pipeline
|
||||
// join y in Funs.DB.HJGL_PipeLineMat on x.PipelineId equals y.PipelineId
|
||||
@@ -184,18 +142,14 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
// tn2.Expanded = true;
|
||||
//}
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.CommandName = "单位工程";
|
||||
tn2.EnableExpandEvent = true;
|
||||
tn2.EnableClickEvent = true;
|
||||
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn2);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,10 +159,99 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
#region 暂不有
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
BLL.PipelineService.BindTreeNodes(node, this.tvPipeCode.Text.Trim(), txtMaterialCode.Text.Trim(), this.CurrUser.LoginProjectId, pageSize);
|
||||
var pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
||||
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
||||
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
||||
if (pageindex <= pageCount)
|
||||
{
|
||||
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
||||
foreach (var item in pipeline)
|
||||
{
|
||||
var jotCount = (from x in hJGL_WeldJoints where x.PipelineId == item.PipelineId select x).Count();
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
||||
newNode.NodeID = item.PipelineId;
|
||||
newNode.CommandName = "管线";
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
if (pageindex < pageCount)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载";
|
||||
newNode.NodeID = SQLHelper.GetNewID();
|
||||
newNode.CommandName = "加载";
|
||||
newNode.Icon = Icon.ArrowDown;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
join z in Funs.DB.PTP_TestPackage on y.PTP_ID equals z.PTP_ID
|
||||
join m in Funs.DB.HJGL_PipeLineMat.Where(e => e.MaterialCode.Contains(txtMaterialCode.Text.Trim()))
|
||||
on x.PipelineId equals m.PipelineId into temp
|
||||
from m in temp.DefaultIfEmpty()
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkId
|
||||
&& z.UnitWorkId == unitWorkId
|
||||
&& x.PipelineCode.Contains(tvPipeCode.Text.Trim())
|
||||
&& (string.IsNullOrEmpty(txtMaterialCode.Text.Trim()) || m != null)
|
||||
select x.PipelineId).Distinct().Count();
|
||||
}
|
||||
|
||||
private void BindTestPackageNodes(TreeNode unitWorkNode)
|
||||
{
|
||||
var testPackages = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkNode.NodeID
|
||||
orderby x.TestPackageNo
|
||||
select x).ToList();
|
||||
|
||||
foreach (var item in testPackages)
|
||||
{
|
||||
int pipelineCount = GetTestPackagePipelineList(item.PTP_ID).Count();
|
||||
if (pipelineCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = (string.IsNullOrEmpty(item.TestPackageNo) ? "未知" : item.TestPackageNo) + "【" + pipelineCount.ToString() + "】管线";
|
||||
newNode.NodeID = item.PTP_ID;
|
||||
newNode.CommandName = 1 + "|" + Funs.GetEndPageNumber(pipelineCount, pageSize);
|
||||
newNode.EnableClickEvent = true;
|
||||
newNode.EnableExpandEvent = true;
|
||||
unitWorkNode.Nodes.Add(newNode);
|
||||
|
||||
TreeNode loadNode = new TreeNode();
|
||||
loadNode.Text = "加载管线...";
|
||||
loadNode.NodeID = "加载管线...";
|
||||
newNode.Nodes.Add(loadNode);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Model.HJGL_Pipeline> GetTestPackagePipelineList(string ptpId)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
|
||||
join m in Funs.DB.HJGL_PipeLineMat.Where(e => e.MaterialCode.Contains(txtMaterialCode.Text.Trim()))
|
||||
on x.PipelineId equals m.PipelineId into temp
|
||||
from m in temp.DefaultIfEmpty()
|
||||
where y.PTP_ID == ptpId
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.PipelineCode.Contains(tvPipeCode.Text.Trim())
|
||||
&& (string.IsNullOrEmpty(txtMaterialCode.Text.Trim()) || m != null)
|
||||
orderby x.PipelineCode
|
||||
select x).Distinct().ToList();
|
||||
}
|
||||
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
@@ -246,7 +289,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
|
||||
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
@@ -696,7 +739,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string pipelineid = "";
|
||||
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.CommandName != "单位工程")
|
||||
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.CommandName == "管线")
|
||||
{
|
||||
pipelineid = this.tvControlItem.SelectedNodeID;
|
||||
}
|
||||
@@ -1021,4 +1064,4 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user