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
@@ -86,31 +86,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage
int a = 0;
if (cbAllPipeline.Checked)
{
a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
}
else
{
a = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
&& (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0
select x).Count();
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);
}
}
}
@@ -121,14 +114,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
int a = 0;
if (cbAllPipeline.Checked)
{
a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
}
else
{
a = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
&& (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0
select x).Count();
a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
}
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode();
@@ -139,17 +129,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage
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);
}
}
}
@@ -158,27 +144,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage
private void BindNodes(TreeNode node)
{
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).ToList();
if (cbAllPipeline.Checked)
{
pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).ToList();
pipeline = GetTestPackagePipelineList(node.NodeID);
}
else
{
pipeline = (from x in Funs.DB.HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
&& (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0
orderby x.PipelineCode
select x).ToList();
pipeline = GetTestPackagePipelineList(node.NodeID);
}
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
@@ -224,6 +196,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
newNode.ToolTip = "管线号【焊口数】";
newNode.NodeID = item.PipelineId;
newNode.CommandName = "管线";
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
@@ -240,6 +213,65 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
{
var testPackages = (from x in Funs.DB.PTP_TestPackage
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitWorkId == unitWorkId
select x.PTP_ID).ToList();
return testPackages.Select(x => GetTestPackagePipelineList(x).Count()).Sum();
}
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)
{
var pipeline = (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.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
orderby x.PipelineCode
select x).Distinct().ToList();
if (!cbAllPipeline.Checked)
{
pipeline = pipeline.Where(x => (from y in Funs.DB.HJGL_WeldJoint where y.PipelineId == x.PipelineId && y.IsTwoJoint == true select y).Count() > 0).ToList();
}
return pipeline;
}
#region TreeView
/// <summary>
/// 点击TreeView
@@ -263,12 +295,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
this.BindGrid();
}
else
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
this.hdUnitWorkId.Text = e.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
NoAuditBindGrid();
}
@@ -362,8 +394,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage
WHERE IsTwoJoint = 1";
List<SqlParameter> listStr = new List<SqlParameter> { };
strSql += " AND UnitWorkId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
strSql += " AND EXISTS(SELECT 1 FROM PTP_PipelineList ptpPipe WHERE ptpPipe.PipelineId = View_HJGL_WeldJoint.PipelineId AND ptpPipe.PTP_ID = @PTP_ID)";
listStr.Add(new SqlParameter("@PTP_ID", this.tvControlItem.SelectedNodeID));
}
else
{
strSql += " AND UnitWorkId =@UnitWorkId";
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
}
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
{
@@ -417,12 +457,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
this.BindGrid();
}
else
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
NoAuditBindGrid();
}
@@ -1228,12 +1268,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
this.BindGrid();
}
else
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
NoAuditBindGrid();
}
}
@@ -1244,14 +1284,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
this.hdUnitWorkId.Text = string.Empty;
if (pipeline != null)
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
this.BindGrid();
}
else
{
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.CommandName.Split('|').Length == 2 ? this.tvControlItem.SelectedNode.ParentNode.NodeID : this.tvControlItem.SelectedNodeID;
NoAuditBindGrid();
}
}
}
}
}