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
@@ -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
}
}
}
}
@@ -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.
}
}
}
}
@@ -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();
}
}
}
}
}
@@ -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();
}