feat(hjgl): 按试压包重构管线树并调整菜单
管线与试压包存在明确业务归属,相关焊接管理页面统一按 “单位工程-试压包-管线”展示和筛选,避免管线在单位工程下直接平铺。
This commit is contained in:
@@ -155,22 +155,20 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
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 == PipeArea && x.WarehouseId == WarehouseId 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.EnableExpandEvent = true;
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableCheckBox = false;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +176,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
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 == PipeArea && x.WarehouseId == WarehouseId select x).Count();
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
// var NowComPipelineCode = PipelineService.GetNoComPipelinesByUnitWordId(q.UnitWorkId);
|
||||
//int a = NowComPipelineCode.Count();
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
@@ -190,7 +188,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
tn2.Expanded = true;
|
||||
}
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.CommandName = "单位工程";
|
||||
tn2.EnableExpandEvent = true;
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableCheckBox = false;
|
||||
@@ -198,11 +196,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn2);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn2.Nodes.Add(newNode);
|
||||
BindTestPackageNodes(tn2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,22 +209,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
// node.Text += "|" + NowComPipelineCode.Count();
|
||||
|
||||
//}
|
||||
var CompleteInOutPlanDetail_RelationList = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where y.State == (int)TwConst.State.已完成 && y.WarehouseCode == drpWarehouse.SelectedValue
|
||||
select x;
|
||||
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
join y in CompleteInOutPlanDetail_RelationList on x.PipelineId equals y.PipelineId into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where y == null && x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) && x.WarehouseId==WarehouseId
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
|
||||
{
|
||||
pipeline = pipeline.Where(x => x.FlowingSection == drpFlowingSection.SelectedValue).ToList();
|
||||
}
|
||||
var pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
//pipeline= pipeline.Where(x => NowComPipelineCode.Contains(x.PipelineCode)).ToList();
|
||||
if (!node.Text.Contains("|"))
|
||||
{
|
||||
@@ -268,6 +247,74 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
private int GetUnitWorkTestPackagePipelineCount(string unitWorkId)
|
||||
{
|
||||
var testPackageIds = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == unitWorkId
|
||||
select x.PTP_ID).ToList();
|
||||
|
||||
return testPackageIds.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;
|
||||
newNode.EnableCheckBox = false;
|
||||
unitWorkNode.Nodes.Add(newNode);
|
||||
|
||||
TreeNode loadNode = new TreeNode();
|
||||
loadNode.Text = "加载管线...";
|
||||
loadNode.NodeID = "加载管线...";
|
||||
loadNode.EnableCheckBox = false;
|
||||
newNode.Nodes.Add(loadNode);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Model.HJGL_Pipeline> GetTestPackagePipelineList(string ptpId)
|
||||
{
|
||||
var completeInOutPlanDetailRelationList = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where y.State == (int)TwConst.State.已完成 && y.WarehouseCode == drpWarehouse.SelectedValue
|
||||
select x;
|
||||
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
join p in Funs.DB.PTP_PipelineList on x.PipelineId equals p.PipelineId
|
||||
join y in completeInOutPlanDetailRelationList on x.PipelineId equals y.PipelineId into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where y == null
|
||||
&& p.PTP_ID == ptpId
|
||||
&& x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.PipeArea == PipeArea
|
||||
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
||||
&& x.WarehouseId == WarehouseId
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
|
||||
{
|
||||
pipeline = pipeline.Where(x => x.FlowingSection == drpFlowingSection.SelectedValue).ToList();
|
||||
}
|
||||
return pipeline.Distinct().ToList();
|
||||
}
|
||||
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
@@ -491,7 +538,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
parameter3D.TagNum = "";
|
||||
parameter3D.ButtonType = "3";
|
||||
|
||||
if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)
|
||||
if (this.tvControlItem.SelectedNode.CommandName == "单位工程")
|
||||
{
|
||||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
@@ -517,7 +564,7 @@ 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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user