208 lines
9.0 KiB
C#
208 lines
9.0 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Collections.Generic;
|
|
using System.Collections;
|
|
using System.Reflection;
|
|
using System.ComponentModel;
|
|
using System.Web.UI;
|
|
using System.Linq;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
{
|
|
public partial class IsoInfoFrame : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.InitTreeMenu();//加载树
|
|
}
|
|
}
|
|
|
|
#region 加载树装置-单位-工作区
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.leftTree.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "装置-单位-工作区";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.leftTree.Nodes.Add(rootNode);
|
|
////装置
|
|
var pInstallation = (from x in Funs.DB.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
////区域
|
|
var pWorkArea = (from x in Funs.DB.Project_WorkArea where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
////单位
|
|
var pUnits = (from x in Funs.DB.Project_Unit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
|
|
if (!string.IsNullOrEmpty(this.txtIsono.Text))
|
|
{
|
|
var workAreaIdList = (from x in BLL.Funs.DB.HJGL_PW_IsoInfo
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.ISO_IsoNo.Contains(this.txtIsono.Text.Trim())
|
|
orderby x.ISO_IsoNo
|
|
select x.BAW_ID).Distinct().ToList();
|
|
pWorkArea = pWorkArea.Where(x => workAreaIdList.Contains(x.WorkAreaId)).OrderBy(x => x.WorkAreaCode).ToList();
|
|
pInstallation = (from x in pInstallation
|
|
join y in pWorkArea on x.InstallationId equals y.InstallationId
|
|
select x).Distinct().ToList();
|
|
pUnits = (from x in pUnits
|
|
join y in pWorkArea on x.UnitId equals y.UnitId
|
|
select x).Distinct().ToList();
|
|
}
|
|
this.BindNodes(rootNode, pInstallation, pWorkArea, pUnits);
|
|
}
|
|
#endregion
|
|
|
|
#region 绑定树节点
|
|
#region 绑定树节点
|
|
/// <summary>
|
|
/// 绑定树节点
|
|
/// </summary>
|
|
/// <param name="node"></param>
|
|
private void BindNodes(TreeNode node, List<Model.Project_Installation> pInstallation, List<Model.Project_WorkArea> pWorkArea, List<Model.Project_Unit> pUnits)
|
|
{
|
|
if (string.IsNullOrEmpty(node.ToolTip))
|
|
{
|
|
List<Model.Project_Installation> installations = pInstallation;
|
|
var pUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
|
if (pUnit != null && pUnit.UnitType != Const.UnitType_5)
|
|
{
|
|
installations = (from x in pInstallation
|
|
join y in pWorkArea on x.InstallationId equals y.InstallationId
|
|
where y.UnitId == this.CurrUser.UnitId
|
|
orderby x.InstallationId
|
|
select x).Distinct().ToList();
|
|
}
|
|
|
|
foreach (var q in installations)
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.NodeID = q.InstallationId;
|
|
newNode.Text = q.InstallationName;
|
|
newNode.ToolTip = "装置";
|
|
newNode.Expanded = true;
|
|
node.Nodes.Add(newNode);
|
|
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
|
|
}
|
|
}
|
|
else if (node.ToolTip == "装置")
|
|
{
|
|
List<Model.Project_Unit> units = null;
|
|
var pUnitDepth = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
|
if (pUnitDepth == null || pUnitDepth.UnitType == Const.UnitType_5)
|
|
{
|
|
units = (from x in pUnits
|
|
join y in pWorkArea on x.UnitId equals y.UnitId
|
|
where y.InstallationId == node.NodeID && x.UnitType == Const.UnitType_3
|
|
select x).ToList();
|
|
}
|
|
else
|
|
{
|
|
units = (from x in pUnits
|
|
join y in pWorkArea on x.UnitId equals y.UnitId
|
|
where y.InstallationId == node.NodeID && x.UnitType == Const.UnitType_3 && x.UnitId == this.CurrUser.UnitId
|
|
select x).ToList();
|
|
}
|
|
|
|
units = units.OrderBy(x => x.InTime).Distinct().ToList();
|
|
foreach (var q in units)
|
|
{
|
|
var unit = BLL.Base_UnitService.GetUnit(q.UnitId);
|
|
if (unit != null)
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = unit.UnitName;
|
|
newNode.NodeID = q.UnitId + "|" + node.NodeID;
|
|
newNode.ToolTip = "单位";
|
|
node.Nodes.Add(newNode);
|
|
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
|
|
}
|
|
}
|
|
}
|
|
else if (node.ToolTip == "单位")
|
|
{
|
|
var workAreas = (from x in pWorkArea
|
|
where x.InstallationId == node.ParentNode.NodeID && x.UnitId == node.NodeID.Split('|')[0]
|
|
select x);
|
|
workAreas = workAreas.OrderByDescending(x => x.WorkAreaCode);
|
|
foreach (var q in workAreas)
|
|
{
|
|
int a = (from x in BLL.Funs.DB.HJGL_PW_IsoInfo where x.ProjectId == this.CurrUser.LoginProjectId && x.BSU_ID == node.NodeID.Split('|')[0] && x.BAW_ID == q.WorkAreaId select x).Count();
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = q.WorkAreaCode + "【" + a.ToString() + "】管线";
|
|
newNode.NodeID = q.WorkAreaId;
|
|
newNode.EnableExpandEvent = true;
|
|
newNode.ToolTip = "区域";
|
|
node.Nodes.Add(newNode);
|
|
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
|
|
}
|
|
}
|
|
else if (node.ToolTip == "区域")
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "管线";
|
|
newNode.NodeID = "管线";
|
|
node.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 树展开事件
|
|
/// <summary>
|
|
/// 树展开事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void leftTree_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
|
{
|
|
if (e.Node.ToolTip == "区域")
|
|
{
|
|
e.Node.Nodes.Clear();
|
|
List<Model.HJGL_PW_IsoInfo> isoInfo = new List<Model.HJGL_PW_IsoInfo>();
|
|
if (!string.IsNullOrEmpty(this.txtIsono.Text))
|
|
{
|
|
isoInfo = (from x in BLL.Funs.DB.HJGL_PW_IsoInfo
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.BAW_ID == e.Node.NodeID
|
|
&& x.ISO_IsoNo.Contains(this.txtIsono.Text.Trim())
|
|
orderby x.ISO_IsoNo
|
|
select x).ToList();
|
|
}
|
|
else
|
|
{
|
|
isoInfo = (from x in BLL.Funs.DB.HJGL_PW_IsoInfo
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.BAW_ID == e.Node.NodeID
|
|
orderby x.ISO_IsoNo
|
|
select x).ToList();
|
|
}
|
|
foreach (var item in isoInfo)
|
|
{
|
|
var jotCount = (from x in Funs.DB.HJGL_PW_JointInfo where x.ISO_ID == item.ISO_ID select x).Count();
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = item.ISO_IsoNo;
|
|
newNode.Text += "【" + jotCount.ToString() + "焊口】";
|
|
newNode.ToolTip = "管线";
|
|
newNode.NodeID = item.ISO_ID;
|
|
newNode.NavigateUrl = "../../FileManage/ReadCad.aspx?officetype=1&url=" + item.ISO_ID;
|
|
newNode.Target = "mainframe";
|
|
e.Node.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
protected void Tree_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
|
|
|
|
}
|
|
} |