diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx index 04cdafa1..a98e1a1b 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx @@ -16,8 +16,8 @@ RegionPercent="20%" Title="项目工序质量控制点" TitleToolTip="项目工序质量控制点" ShowBorder="true" ShowHeader="false" BodyPadding="10px"> - + diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs index 473ad95f..40d9df79 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs @@ -55,10 +55,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl this.SelectedList = new List(); this.NoSelectedList = new List(); string cnProfessionalId = Request.Params["CNPrefessionalId"]; - if (!string.IsNullOrEmpty(cnProfessionalId)) - { - InitTreeMenu(cnProfessionalId); - } + InitTreeMenu(); } } @@ -66,54 +63,135 @@ namespace FineUIPro.Web.CQMS.ProcessControl /// 加载树 /// /// - 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 展开树 + /// + /// 展开树 + /// + /// + /// + 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 /// /// /// - 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 /// /// /// - 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("values"); diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.designer.cs b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.designer.cs index 2c808345..7b4b9c4d 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.designer.cs @@ -49,13 +49,13 @@ namespace FineUIPro.Web.CQMS.ProcessControl { protected global::FineUIPro.Panel panelLeftRegion; /// - /// tvControlItem 控件。 + /// trWBS 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Tree tvControlItem; + protected global::FineUIPro.Tree trWBS; /// /// panelCenterRegion 控件。 diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index e084b543..59045930 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -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.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 +