优化共检通知单加载wbs

This commit is contained in:
高飞 2023-10-22 18:11:29 +08:00
parent f8a2745bf7
commit aa4f2bbe25
4 changed files with 178 additions and 55 deletions

View File

@ -16,8 +16,8 @@
RegionPercent="20%" Title="项目工序质量控制点" TitleToolTip="项目工序质量控制点" ShowBorder="true" ShowHeader="false"
BodyPadding="10px">
<Items>
<f:Tree ID="tvControlItem" EnableCollapse="true" ShowHeader="true" AutoLeafIdentification="true"
runat="server" OnNodeCommand="tvControlItem_NodeCommand" >
<f:Tree ID="trWBS" EnableCollapse="true" ShowHeader="true" AutoLeafIdentification="true"
runat="server" OnNodeCommand="trWBS_NodeCommand" OnNodeExpand="trWBS_NodeExpand">
</f:Tree>
</Items>
</f:Panel>

View File

@ -55,10 +55,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
this.SelectedList = new List<string>();
this.NoSelectedList = new List<string>();
string cnProfessionalId = Request.Params["CNPrefessionalId"];
if (!string.IsNullOrEmpty(cnProfessionalId))
{
InitTreeMenu(cnProfessionalId);
}
InitTreeMenu();
}
}
@ -66,54 +63,135 @@ namespace FineUIPro.Web.CQMS.ProcessControl
/// 加载树
/// </summary>
/// <param name="cnProfessionalId"></param>
private void InitTreeMenu(string cnProfessionalId)
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
this.tvControlItem.ShowHeader = false;
this.tvControlItem.ShowBorder = false;
this.tvControlItem.EnableIcons = true;
this.tvControlItem.AutoScroll = true;
this.tvControlItem.EnableSingleClickExpand = true;
this.trWBS.Nodes.Clear();
this.trWBS.ShowBorder = false;
this.trWBS.ShowHeader = false;
this.trWBS.EnableIcons = true;
this.trWBS.AutoScroll = true;
this.trWBS.EnableSingleClickExpand = true;
var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId orderby x.UnitWorkCode select x;
if (unitWorks.Count() > 0)
foreach (var q in unitWorks)
{
foreach (var q in unitWorks)
TreeNode newNode = new TreeNode();
newNode.Text = q.UnitWorkName;
newNode.NodeID = q.UnitWorkId;
newNode.CommandName = "UnitWork";
newNode.EnableExpandEvent = true;
newNode.EnableClickEvent = true;
this.trWBS.Nodes.Add(newNode);
TreeNode emptyNode = new TreeNode();
emptyNode.Text = "";
emptyNode.NodeID = "";
newNode.Nodes.Add(emptyNode);
}
}
#endregion
#region
/// <summary>
/// 展开树
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trWBS_NodeExpand(object sender, TreeNodeEventArgs e)
{
e.Node.Nodes.Clear();
Model.SGGLDB db = Funs.DB;
if (e.Node.CommandName == "UnitWork") //展开工程类型
{
string cnProfessionalId = Request.Params["CNPrefessionalId"];
var divisions = (from x in db.WBS_DivisionProject
where x.CNProfessionalId == cnProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == e.NodeID && x.IsSelected == true
orderby x.SortIndex
select x).ToList();
Model.Base_CNProfessional cNProfessional = new Model.Base_CNProfessional();
if (divisions.Count() == 0 && cnProfessionalId == BLL.Const.CNProfessionalCVId)
{
TreeNode rootNode = new TreeNode();
rootNode.Text = q.UnitWorkName;
rootNode.NodeID = q.UnitWorkId;
rootNode.EnableExpandEvent = true;
rootNode.EnableClickEvent = true;
rootNode.Expanded = true;
rootNode.CommandName = "单位工程";
this.tvControlItem.Nodes.Add(rootNode);
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
where x.CNProfessionalId == cnProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == q.UnitWorkId && x.IsSelected == true
orderby x.SortIndex
select x).ToList();
Model.Base_CNProfessional cNProfessional = new Model.Base_CNProfessional();
if (divisions.Count() == 0 && cnProfessionalId == BLL.Const.CNProfessionalCVId)
cNProfessional = (from x in db.Base_CNProfessional where x.CNProfessionalId == BLL.Const.CNProfessionalConstructId orderby x.SortIndex select x).FirstOrDefault();
}
else
{
cNProfessional = (from x in db.Base_CNProfessional where x.CNProfessionalId == cnProfessionalId orderby x.SortIndex select x).FirstOrDefault();
}
if (cNProfessional != null)
{
TreeNode newNode = new TreeNode();
newNode.Text = cNProfessional.ProfessionalName;
newNode.NodeID = cNProfessional.CNProfessionalId + "|" + e.NodeID;
newNode.CommandName = "CNProfessional";
newNode.EnableExpandEvent = true;
newNode.EnableClickEvent = true;
newNode.EnableExpandEvent = true;
e.Node.Nodes.Add(newNode);
TreeNode tempNode = new TreeNode();
tempNode.NodeID = "";
tempNode.Text = "";
newNode.Nodes.Add(tempNode);
}
}
else if (e.Node.CommandName == "CNProfessional") //展开专业
{
string unitWorkId = e.Node.ParentNode.NodeID;
string cNProfessionalId = Request.Params["CNPrefessionalId"];
var divisions = (from x in db.WBS_DivisionProject
where x.CNProfessionalId == cNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
orderby x.SortIndex
select x).ToList();
foreach (var q in divisions)
{
TreeNode newNode = new TreeNode();
newNode.Text = q.DivisionName;
newNode.NodeID = q.DivisionProjectId;
newNode.CommandName = "DivisionProject";
newNode.EnableExpandEvent = true;
newNode.EnableClickEvent = true;
newNode.EnableExpandEvent = true;
e.Node.Nodes.Add(newNode);
var list = (from x in Funs.DB.WBS_DivisionProject
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
&& x.IsSelected == true
orderby x.SortIndex
select x).ToList();
if (list.Count > 0)
{
cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId == BLL.Const.CNProfessionalConstructId orderby x.SortIndex select x).FirstOrDefault();
TreeNode tempNode = new TreeNode();
tempNode.NodeID = "";
tempNode.Text = "";
newNode.Nodes.Add(tempNode);
}
else
}
}
else if (e.Node.CommandName == "DivisionProject") //展开分部节点
{
string parentId = e.NodeID;
var childDivisions = (from x in db.WBS_DivisionProject
where x.SuperDivisionId == parentId && x.ProjectId == this.CurrUser.LoginProjectId
&& x.IsSelected == true
orderby x.SortIndex
select x).ToList();
foreach (var q in childDivisions)
{
TreeNode newNode = new TreeNode();
newNode.Text = q.DivisionName;
newNode.NodeID = q.DivisionProjectId;
newNode.CommandName = "DivisionProject";
newNode.EnableExpandEvent = true;
newNode.EnableClickEvent = true;
newNode.EnableExpandEvent = true;
e.Node.Nodes.Add(newNode);
var list = (from x in Funs.DB.WBS_DivisionProject
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
&& x.IsSelected == true
orderby x.SortIndex
select x).ToList();
if (list.Count > 0)
{
cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId == cnProfessionalId orderby x.SortIndex select x).FirstOrDefault();
}
if (cNProfessional != null)
{
TreeNode newNode = new TreeNode();
newNode.Text = cNProfessional.ProfessionalName;
newNode.NodeID = cNProfessional.CNProfessionalId+"|"+ q.UnitWorkId;
newNode.CommandName = "专业";
newNode.EnableExpandEvent = true;
newNode.EnableClickEvent = true;
newNode.Expanded = true;
rootNode.Nodes.Add(newNode);
this.GetNodes(newNode.Nodes, cNProfessional.CNProfessionalId, newNode, q.UnitWorkId);
TreeNode tempNode = new TreeNode();
tempNode.NodeID = "";
tempNode.Text = "";
newNode.Nodes.Add(tempNode);
}
}
}
@ -128,11 +206,11 @@ namespace FineUIPro.Web.CQMS.ProcessControl
/// <param name="parentId"></param>
/// <param name="node"></param>
/// <param name="unitWorkId"></param>
private void GetNodes(TreeNodeCollection nodes, string parentId, TreeNode node, string unitWorkId)
private void GetNodes(TreeNodeCollection nodes, string parentId, TreeNode node, string unitWorkId,Model.SGGLDB db)
{
if (!string.IsNullOrEmpty(unitWorkId))
{
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
var divisions = (from x in db.WBS_DivisionProject
where x.CNProfessionalId == parentId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
orderby x.SortIndex
select x).ToList();
@ -149,7 +227,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
}
else
{
var childDivisions = (from x in BLL.Funs.DB.WBS_DivisionProject
var childDivisions = (from x in db.WBS_DivisionProject
where x.SuperDivisionId == parentId && x.ProjectId == this.CurrUser.LoginProjectId
&& x.IsSelected == true
orderby x.SortIndex
@ -167,7 +245,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
}
for (int i = 0; i < nodes.Count; i++)
{
GetNodes(nodes[i].Nodes, nodes[i].NodeID, nodes[i], string.Empty);
GetNodes(nodes[i].Nodes, nodes[i].NodeID, nodes[i], string.Empty,db);
}
}
#endregion
@ -178,9 +256,9 @@ namespace FineUIPro.Web.CQMS.ProcessControl
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
{
this.hdDivisionProjectId.Text = this.tvControlItem.SelectedNode.NodeID;
this.hdDivisionProjectId.Text = this.trWBS.SelectedNode.NodeID;
foreach (JObject mergedRow in Grid1.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");

View File

@ -49,13 +49,13 @@ namespace FineUIPro.Web.CQMS.ProcessControl {
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// tvControlItem 控件。
/// trWBS 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree tvControlItem;
protected global::FineUIPro.Tree trWBS;
/// <summary>
/// panelCenterRegion 控件。

View File

@ -3335,3 +3335,48 @@ IP地址:::1
出错时间:10/19/2023 22:12:46
错误信息开始=====>
错误类型:NullReferenceException
错误信息:未将对象引用设置到对象的实例。
错误堆栈:
在 System.Data.Linq.SqlClient.QueryConverter.VisitInvocation(InvocationExpression invoke)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitBinary(BinaryExpression b)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitExpression(Expression exp)
在 System.Data.Linq.SqlClient.QueryConverter.VisitWhere(Expression sequence, LambdaExpression predicate)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitMethodCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.VisitOrderBy(Expression sequence, LambdaExpression expression, SqlOrderType orderType)
在 System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitMethodCall(MethodCallExpression mc)
在 System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
在 System.Data.Linq.SqlClient.QueryConverter.ConvertOuter(Expression node)
在 System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
在 System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
在 FineUIPro.Web.CQMS.ProcessControl.ShowUnitWork.trWBS_NodeExpand(Object sender, TreeNodeEventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\CQMS\ProcessControl\ShowUnitWork.aspx.cs:行号 154
在 FineUIPro.Tree.OnNodeExpand(TreeNodeEventArgs e)
在 (Tree , TreeNodeEventArgs )
在 FineUIPro.Tree.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:10/22/2023 17:53:02
出错文件:http://localhost:8579/CQMS/ProcessControl/ShowUnitWork.aspx?CNPrefessionalId=F41C5022-F499-4BD7-84B6-E87E4CE53CAC
IP地址:::1
操作人员:JT
出错时间:10/22/2023 17:53:02