feat(hjgl): 按试压包重构管线树并调整菜单

管线与试压包存在明确业务归属,相关焊接管理页面统一按
“单位工程-试压包-管线”展示和筛选,避免管线在单位工程下直接平铺。
This commit is contained in:
2026-05-25 14:41:26 +08:00
parent 950fc49cf8
commit 913b9cdee4
12 changed files with 418 additions and 221 deletions
@@ -89,23 +89,19 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
foreach (var q in unitWork1)
{
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count();
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId;
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn1.CommandName = "单位工程";
tn1.EnableClickEvent = true;
tn1.EnableExpandEvent = true;
rootNode1.Nodes.Add(tn1);
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
tn1.Nodes.Add(newNode);
BindTestPackageNodes(tn1);
}
//if (a > 0)
//{
@@ -117,7 +113,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
foreach (var q in unitWork2)
{
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count();
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId;
@@ -127,17 +123,13 @@ namespace FineUIPro.Web.HJGL.PreDesign
tn2.Expanded = true;
}
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
tn2.CommandName = "单位工程";
tn2.EnableClickEvent = true;
tn2.EnableExpandEvent = true;
rootNode2.Nodes.Add(tn2);
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
tn2.Nodes.Add(newNode);
BindTestPackageNodes(tn2);
}
//if (a > 0)
//{
@@ -152,10 +144,11 @@ namespace FineUIPro.Web.HJGL.PreDesign
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
var pipelines = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" select x;
pipeline = (from x in pipelines
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
where y.PTP_ID == node.NodeID
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).ToList();
select x).Distinct().ToList();
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
if (pageindex <= pageCount)
@@ -187,6 +180,61 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
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
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitWorkId == unitWorkId
&& z.UnitWorkId == unitWorkId
&& x.PipeArea == "1"
&& x.PipelineCode.Contains(txtPipelineCode.Text.Trim())
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 = GetTestPackagePipelineCount(item.PTP_ID);
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 int GetTestPackagePipelineCount(string ptpId)
{
return (from x in Funs.DB.HJGL_Pipeline
join y in Funs.DB.PTP_PipelineList on x.PipelineId equals y.PipelineId
where y.PTP_ID == ptpId
&& x.ProjectId == this.CurrUser.LoginProjectId
&& x.PipeArea == "1"
&& x.PipelineCode.Contains(txtPipelineCode.Text.Trim())
select x.PipelineId).Distinct().Count();
}
#endregion
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
@@ -205,20 +253,26 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (e.CommandName.Split('|').Length == 2)
if (e.CommandName == "单位工程")
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
WeldingDailyService.InitDownListByUnitWortId(drpWeldingDailyCode, true, this.tvControlItem.SelectedNodeID);
}
else if (e.CommandName.Split('|').Length == 2)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
WeldingDailyService.InitDownListByUnitWortId(drpWeldingDailyCode, true, this.hdUnitWorkId.Text);
}
else if (e.CommandName == "管线")
{
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
}
}
else if (e.CommandName == "加载")
@@ -255,12 +309,17 @@ namespace FineUIPro.Web.HJGL.PreDesign
List<SqlParameter> listStr = new List<SqlParameter>();
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
if (tvControlItem.SelectedNode.CommandName == "单位工程")
{
strSql += " and pipe.UnitWorkId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
}
else if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " and exists(select 1 from PTP_PipelineList ptpPipe where ptpPipe.PipelineId = pipe.PipelineId and ptpPipe.PTP_ID = @PTP_ID)";
listStr.Add(new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID));
}
else if (tvControlItem.SelectedNode.CommandName == "管线")
{
strSql += " and com.PipelineId = @PipelineId ";
@@ -708,4 +767,4 @@ if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.
}
}
}
}