diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs index 6745f3ea..66dc4015 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs @@ -59,6 +59,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl this.drpUnitWorkId.DataSource = q; this.drpUnitWorkId.DataBind(); Funs.FineUIPleaseSelect(this.drpUnitWorkId);//单位工程 + Funs.FineUIPleaseSelect(this.drpChirldUnitWorkId);//子单位工程 Funs.FineUIPleaseSelect(this.drpBranch);//分部工程 Funs.FineUIPleaseSelect(this.drpChildBranch);//子分部工程 diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs index 735f3404..8fdcd994 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/ShowUnitWork.aspx.cs @@ -71,20 +71,49 @@ namespace FineUIPro.Web.CQMS.ProcessControl 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 && (x.SuperUnitWork == null || x.SuperUnitWork == "0") orderby x.UnitWorkCode select x; - foreach (var q in unitWorks) + if (this.CurrUser.UserId == BLL.Const.hfnbdId)//测试账号用 { - 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); + var unitWorks = from x in Funs.DB.WBS_UnitWork + join y in Funs.DB.WBS_DivisionDivide on x.UnitWorkId equals y.UnitWorkId + where x.ProjectId == this.CurrUser.LoginProjectId + && (x.SuperUnitWork == null || x.SuperUnitWork == "0") + orderby x.UnitWorkCode select new + { + x.UnitWorkId, + x.UnitWorkName + }; + foreach (var q in unitWorks.Distinct()) + { + 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); + } + } + else + { + var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId && (x.SuperUnitWork == null || x.SuperUnitWork == "0") orderby x.UnitWorkCode select x; + 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 @@ -102,64 +131,174 @@ namespace FineUIPro.Web.CQMS.ProcessControl 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) + if (this.CurrUser.UserId == BLL.Const.hfnbdId) { - cNProfessional = (from x in db.Base_CNProfessional where x.CNProfessionalId == BLL.Const.CNProfessionalConstructId orderby x.SortIndex select x).FirstOrDefault(); + string professionalName = string.Empty; + var pointCropping = from x in db.Control_PointCropping where x.ControlId == cnProfessionalId select x; + if (pointCropping.FirstOrDefault(x => x.DetectionItems.Contains("设备")) != null) + { + professionalName = "设备"; + } + else + { + professionalName = pointCropping.FirstOrDefault().DetectionItems; + } + var divisions = (from x in db.WBS_DivisionProject + join y in db.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId + where y.ProfessionalName == professionalName + && x.ProjectId == this.CurrUser.LoginProjectId + && x.SuperDivisionId == null + && x.UnitWorkId == e.NodeID + && x.IsSelected == true + orderby x.SortIndex + select x).ToList(); + //} + //if (this.CurrUser.UserId == BLL.Const.hfnbdId)//测试阶段,仅hfnbd账号使用 + //{ + //Model.Control_PointCropping pc = new Model.Control_PointCropping(); + Model.Base_CNProfessional cNProfessional = new Model.Base_CNProfessional(); + var pc = Funs.DB.Control_PointCropping.FirstOrDefault(x => (x.ParentId == null || x.ParentId == "") && x.DetectionItems == "土建"); + if (divisions.Count() == 0 && pc != null) + { + cNProfessional = (from x in db.Base_CNProfessional where x.ProfessionalName == "土建" orderby x.SortIndex select x).FirstOrDefault(); + //pc = (from x in db.Control_PointCropping where (x.ParentId == null || x.ParentId == "") && x.ControlId == "E9AC9563-E338-48B7-867D-488222AD0557" orderby x.OperateTime select x).FirstOrDefault(); + } + else + { + cNProfessional = (from x in db.Base_CNProfessional + where x.ProfessionalName.Contains(professionalName) + orderby x.SortIndex + select x).FirstOrDefault(); + //pc = (from x in db.Control_PointCropping where (x.ParentId == null || x.ParentId == "") && x.ControlId == cnProfessionalId orderby x.OperateTime select x).FirstOrDefault(); + } + if (pc != 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 { - 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); + 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) + { + 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) + if (this.CurrUser.UserId == BLL.Const.hfnbdId) { - 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) + string professionalName = string.Empty; + var pointCropping = from x in db.Control_PointCropping where x.ControlId == cNProfessionalId select x; + if (pointCropping.FirstOrDefault(x => x.DetectionItems.Contains("设备")) != null) { - TreeNode tempNode = new TreeNode(); - tempNode.NodeID = ""; - tempNode.Text = ""; - newNode.Nodes.Add(tempNode); + professionalName = "设备"; + } + else + { + professionalName = pointCropping.FirstOrDefault().DetectionItems; + } + var divisions = (from x in db.WBS_DivisionProject + join y in db.Base_CNProfessional on x.CNProfessionalId equals y.CNProfessionalId + where y.ProfessionalName.Contains(professionalName) && 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) + { + TreeNode tempNode = new TreeNode(); + tempNode.NodeID = ""; + tempNode.Text = ""; + newNode.Nodes.Add(tempNode); + } + } + } + else + { + 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) + { + TreeNode tempNode = new TreeNode(); + tempNode.NodeID = ""; + tempNode.Text = ""; + newNode.Nodes.Add(tempNode); + } } } } diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index 8735e5df..4036b78c 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -11,7 +11,7 @@ - + diff --git a/SGGL/WebAPI/WebAPI.csproj.user b/SGGL/WebAPI/WebAPI.csproj.user index 59ad2199..d989db4f 100644 --- a/SGGL/WebAPI/WebAPI.csproj.user +++ b/SGGL/WebAPI/WebAPI.csproj.user @@ -1,7 +1,7 @@  - Release|Any CPU + Debug|Any CPU true