2021-04-30 10:28:37 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using BLL;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using AspNet = System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CQMS.WBS
|
|
|
|
|
{
|
|
|
|
|
public partial class ProjectControlPoint : PageBase
|
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
#region 定义变量
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 被选择项列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> SelectedList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (List<string>)ViewState["SelectedList"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["SelectedList"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 未被选择项列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> NoSelectedList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (List<string>)ViewState["NoSelectedList"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["NoSelectedList"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-31 14:33:55 +08:00
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
|
|
|
|
#region 页面加载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页面加载
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
this.SelectedList = new List<string>();
|
|
|
|
|
this.NoSelectedList = new List<string>();
|
|
|
|
|
GetButtonPower();
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
this.Grid1.Columns[2].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[3].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[4].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[5].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[7].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[8].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[9].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[10].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[11].Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载树
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载树
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void InitTreeMenu()
|
|
|
|
|
{
|
|
|
|
|
this.trWBS.Nodes.Clear();
|
|
|
|
|
this.trWBS.ShowBorder = false;
|
|
|
|
|
this.trWBS.ShowHeader = false;
|
|
|
|
|
this.trWBS.EnableIcons = true;
|
|
|
|
|
this.trWBS.AutoScroll = true;
|
|
|
|
|
this.trWBS.EnableSingleClickExpand = true;
|
2023-10-31 14:33:55 +08:00
|
|
|
|
|
2021-04-30 10:28:37 +08:00
|
|
|
|
var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId 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
|
|
|
|
|
|
|
|
|
|
#region 展开树
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 展开树
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void trWBS_NodeExpand(object sender, TreeNodeEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
e.Node.Nodes.Clear();
|
|
|
|
|
if (e.Node.CommandName == "UnitWork") //展开工程类型
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode1 = new TreeNode();
|
|
|
|
|
newNode1.Text = "建筑工程";
|
2023-04-24 17:18:08 +08:00
|
|
|
|
newNode1.NodeID = e.NodeID + "|" + "1";
|
|
|
|
|
newNode1.CommandName = "ProjectType";
|
2021-04-30 10:28:37 +08:00
|
|
|
|
newNode1.EnableExpandEvent = true;
|
|
|
|
|
newNode1.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode1);
|
|
|
|
|
TreeNode tempNode1 = new TreeNode();
|
|
|
|
|
tempNode1.NodeID = "";
|
|
|
|
|
tempNode1.Text = "";
|
|
|
|
|
tempNode1.EnableExpandEvent = true;
|
|
|
|
|
tempNode1.EnableClickEvent = true;
|
|
|
|
|
newNode1.Nodes.Add(tempNode1);
|
|
|
|
|
TreeNode newNode2 = new TreeNode();
|
|
|
|
|
newNode2.Text = "安装工程";
|
|
|
|
|
newNode2.NodeID = e.NodeID + "|" + "2";
|
|
|
|
|
newNode2.CommandName = "ProjectType";
|
|
|
|
|
newNode2.EnableExpandEvent = true;
|
|
|
|
|
newNode2.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode2);
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
tempNode2.EnableExpandEvent = true;
|
|
|
|
|
tempNode2.EnableClickEvent = true;
|
|
|
|
|
newNode2.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
else if (e.Node.CommandName == "ProjectType") //展开工程类型
|
|
|
|
|
{
|
2023-04-24 17:18:08 +08:00
|
|
|
|
if (e.NodeID.Split('|')[1] == "1")
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2023-04-24 17:18:08 +08:00
|
|
|
|
var cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId == Const.CNProfessionalCVId orderby x.SortIndex select x).ToList();
|
|
|
|
|
foreach (var c in cNProfessional)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newCNProfessionalNode = new TreeNode();
|
|
|
|
|
newCNProfessionalNode.Text = c.ProfessionalName;
|
|
|
|
|
newCNProfessionalNode.NodeID = e.NodeID.Split('|')[0] + "|" + c.CNProfessionalId;
|
|
|
|
|
newCNProfessionalNode.CommandName = "CNProfessional";
|
|
|
|
|
newCNProfessionalNode.EnableExpandEvent = true;
|
|
|
|
|
newCNProfessionalNode.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newCNProfessionalNode);
|
|
|
|
|
TreeNode tempNode = new TreeNode();
|
|
|
|
|
tempNode.NodeID = "";
|
|
|
|
|
tempNode.Text = "";
|
|
|
|
|
tempNode.EnableExpandEvent = true;
|
|
|
|
|
tempNode.EnableClickEvent = true;
|
|
|
|
|
newCNProfessionalNode.Nodes.Add(tempNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId != Const.CNProfessionalConstructId && x.CNProfessionalId != Const.CNProfessionalCVId orderby x.SortIndex select x).ToList();
|
|
|
|
|
foreach (var c in cNProfessional)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newCNProfessionalNode = new TreeNode();
|
|
|
|
|
newCNProfessionalNode.Text = c.ProfessionalName;
|
|
|
|
|
newCNProfessionalNode.NodeID = e.NodeID.Split('|')[0] + "|" + c.CNProfessionalId;
|
|
|
|
|
newCNProfessionalNode.CommandName = "CNProfessional";
|
|
|
|
|
newCNProfessionalNode.EnableExpandEvent = true;
|
|
|
|
|
newCNProfessionalNode.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newCNProfessionalNode);
|
|
|
|
|
TreeNode tempNode = new TreeNode();
|
|
|
|
|
tempNode.NodeID = "";
|
|
|
|
|
tempNode.Text = "";
|
|
|
|
|
tempNode.EnableExpandEvent = true;
|
|
|
|
|
tempNode.EnableClickEvent = true;
|
|
|
|
|
newCNProfessionalNode.Nodes.Add(tempNode);
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (e.Node.CommandName == "CNProfessional") //展开专业
|
|
|
|
|
{
|
|
|
|
|
string unitWorkId = e.Node.ParentNode.NodeID;
|
|
|
|
|
if (string.IsNullOrEmpty(unitWorkId))
|
|
|
|
|
{
|
|
|
|
|
unitWorkId = e.Node.ParentNode.ParentNode.NodeID;
|
|
|
|
|
}
|
|
|
|
|
Model.WBS_UnitWork unitWork1 = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(unitWorkId);
|
|
|
|
|
if (unitWork1 == null)
|
|
|
|
|
{
|
|
|
|
|
unitWorkId = e.Node.ParentNode.ParentNode.NodeID;
|
|
|
|
|
}
|
|
|
|
|
string cNProfessionalId = e.NodeID;
|
|
|
|
|
if (e.NodeID.Contains("|"))
|
|
|
|
|
{
|
|
|
|
|
cNProfessionalId = e.NodeID.Split('|')[1];
|
|
|
|
|
}
|
|
|
|
|
if (cNProfessionalId == BLL.Const.CNProfessionalConstructId)
|
|
|
|
|
{
|
|
|
|
|
var divisionsCV = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == BLL.Const.CNProfessionalCVId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (divisionsCV.Count > 0) //建筑工程下存在土建内容
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
|
|
|
|
newNode.Text = "土建";
|
|
|
|
|
newNode.NodeID = BLL.Const.CNProfessionalCVId;
|
|
|
|
|
newNode.CommandName = "CNProfessional";
|
|
|
|
|
newNode.EnableExpandEvent = true;
|
|
|
|
|
newNode.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
|
TreeNode tempNode = new TreeNode();
|
|
|
|
|
tempNode.NodeID = "";
|
|
|
|
|
tempNode.Text = "";
|
|
|
|
|
tempNode.EnableExpandEvent = true;
|
|
|
|
|
tempNode.EnableClickEvent = true;
|
|
|
|
|
newNode.Nodes.Add(tempNode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == cNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
|
|
|
|
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.EnableCheckEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
|
if (q.IsSelected == true)
|
|
|
|
|
{
|
|
|
|
|
newNode.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
var list = (from x in Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
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 BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == cNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
|
|
|
|
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.EnableCheckBox = true;
|
|
|
|
|
newNode.EnableCheckEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
|
if (q.IsSelected == true)
|
|
|
|
|
{
|
|
|
|
|
newNode.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
var list = (from x in Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode = new TreeNode();
|
|
|
|
|
tempNode.NodeID = "";
|
|
|
|
|
tempNode.Text = "";
|
|
|
|
|
newNode.Nodes.Add(tempNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (e.Node.CommandName == "DivisionProject") //展开分部节点
|
|
|
|
|
{
|
|
|
|
|
var childDivisions = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.SuperDivisionId == e.Node.NodeID && x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
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.EnableCheckBox = true;
|
|
|
|
|
newNode.EnableCheckEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
|
if (q.IsSelected == true)
|
|
|
|
|
{
|
|
|
|
|
newNode.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
var list = (from x in Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode = new TreeNode();
|
|
|
|
|
tempNode.NodeID = "";
|
|
|
|
|
tempNode.Text = "";
|
|
|
|
|
newNode.Nodes.Add(tempNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 树节点复选框勾选事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 树节点复选框勾选事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void trWBS_NodeCheck(object sender, FineUIPro.TreeCheckEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(e.NodeID);
|
|
|
|
|
divisionProject.IsSelected = e.Checked;
|
|
|
|
|
BLL.DivisionProjectService.UpdateDivisionProject(divisionProject);
|
|
|
|
|
this.UpdateParentDivision(divisionProject.SuperDivisionId, e.Checked);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有保存(勾选)这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新分部的选择状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="superDivisionId"></param>
|
|
|
|
|
private void UpdateParentDivision(string superDivisionId, bool b)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_DivisionProject superDivisionProject = BLL.DivisionProjectService.GetDivisionProjectById(superDivisionId);
|
|
|
|
|
if (superDivisionProject != null)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(superDivisionProject.SuperDivisionId))
|
|
|
|
|
{
|
2023-06-26 11:16:55 +08:00
|
|
|
|
// if (!string.IsNullOrEmpty(superDivisionProject.CNProfessionalId))
|
|
|
|
|
//{
|
|
|
|
|
if (b == false)
|
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
var selectedDivisionProject = Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.SuperDivisionId == superDivisionProject.DivisionProjectId && x.IsSelected == true);
|
2023-06-26 11:16:55 +08:00
|
|
|
|
if (selectedDivisionProject != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
superDivisionProject.IsSelected = b;
|
|
|
|
|
BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
superDivisionProject.IsSelected = b;
|
|
|
|
|
BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
superDivisionProject.IsSelected = b;
|
|
|
|
|
BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
|
|
|
|
|
this.UpdateParentDivision(superDivisionProject.SuperDivisionId, b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Tree点击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tree点击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (this.Grid1.SelectedRowIDArray.Contains(this.Grid1.Rows[i].RowID))
|
|
|
|
|
{
|
|
|
|
|
SelectedList.Add(this.Grid1.Rows[i].RowID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NoSelectedList.Add(this.Grid1.Rows[i].RowID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string divisionProjectId = this.trWBS.SelectedNode.NodeID;
|
|
|
|
|
var temp = BLL.DivisionProjectService.GetDivisionProjectById(divisionProjectId);
|
|
|
|
|
if (temp == null)
|
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
this.btnMenuCopy.Hidden = true;
|
|
|
|
|
string cNProfessionalId = this.trWBS.SelectedNodeID;
|
|
|
|
|
if (cNProfessionalId.Contains("|"))
|
|
|
|
|
{
|
|
|
|
|
cNProfessionalId = e.NodeID.Split('|')[1];
|
|
|
|
|
}
|
|
|
|
|
var cnp = CNProfessionalService.GetCNProfessional(cNProfessionalId);
|
|
|
|
|
if (cnp != null)
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuPaste.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuPaste.Hidden = true;
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2023-10-31 14:33:55 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuCopy.Hidden = false;
|
|
|
|
|
this.btnMenuPaste.Hidden = false;
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
if (temp.CNProfessionalId != null && temp.CNProfessionalId == Const.CNProfessionalConstructId)
|
|
|
|
|
{
|
|
|
|
|
this.Grid1.Columns[2].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[3].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[4].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[5].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[7].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[8].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[9].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[10].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[11].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[12].Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Grid1.Columns[2].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[3].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[4].Hidden = false;
|
|
|
|
|
this.Grid1.Columns[5].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[7].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[8].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[9].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[10].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[11].Hidden = true;
|
|
|
|
|
this.Grid1.Columns[12].Hidden = true;
|
|
|
|
|
}
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 修改关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("修改成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
|
|
|
|
GetSelectTreeNode();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 增加关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加关闭窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("增加成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
|
|
|
|
GetSelectTreeNode();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window3_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 右键增加、修改、删除方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键修改事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode.CommandName != "ProjectType" && this.trWBS.SelectedNode.CommandName != "UnitWork" && this.trWBS.SelectedNode.CommandName != "CNProfessional") //非工程类型和单位工程、专业节点可以修改
|
|
|
|
|
{
|
|
|
|
|
this.hdSelectId.Text = this.trWBS.SelectedNode.NodeID;
|
|
|
|
|
string unitWorkId = this.GetUnitWorkId(this.trWBS.SelectedNode);
|
|
|
|
|
string openUrl = String.Format("EditDivisionProject.aspx?type=modify&selectedCode={0}&unitWorkId={1}", this.trWBS.SelectedNode.NodeID, unitWorkId, "编辑 - ");
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdSelectId.ClientID)
|
|
|
|
|
+ Window1.GetShowReference(openUrl));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("单位工程、工程类型和专业节点无法修改!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据选择节点获取单位工程Id
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="node"></param>
|
|
|
|
|
private string GetUnitWorkId(TreeNode node)
|
|
|
|
|
{
|
|
|
|
|
string id = string.Empty;
|
|
|
|
|
TreeNode parentNode = node.ParentNode;
|
|
|
|
|
if (parentNode != null)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_UnitWork i = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(parentNode.NodeID);
|
|
|
|
|
if (i != null)
|
|
|
|
|
{
|
|
|
|
|
id = i.UnitWorkId;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
id = this.GetUnitWorkId(parentNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuAdd_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnAdd))
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode.CommandName != "ProjectType" && this.trWBS.SelectedNode.CommandName != "UnitWork") //非工程类型和单位工程节点可以增加
|
|
|
|
|
{
|
|
|
|
|
string unitWorkId = this.GetUnitWorkId(this.trWBS.SelectedNode);
|
|
|
|
|
string openUrl = String.Format("EditDivisionProject.aspx?type=add&selectedCode={0}&unitWorkId={1}", this.trWBS.SelectedNode.NodeID, unitWorkId, "增加 - ");
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
|
|
|
|
|
+ Window2.GetShowReference(openUrl));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("单位工程、工程类型节点无法增加!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键删除事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode.CommandName != "ProjectType" && this.trWBS.SelectedNode.CommandName != "UnitWork" && this.trWBS.SelectedNode.CommandName != "CNProfessional") //非工程类型和单位工程、专业节点可以删除
|
|
|
|
|
{
|
|
|
|
|
string id = this.trWBS.SelectedNodeID;
|
|
|
|
|
//var workPackage = Funs.DB.WBS_WorkPackage.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.InitWorkPackageCode == this.trWBS.SelectedNodeID);
|
|
|
|
|
//if (workPackage != null)
|
|
|
|
|
//{
|
|
|
|
|
// ShowNotify("WBS定制中已使用该数据,无法删除!", MessageBoxIcon.Warning);
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
DeleteData();
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("单位工程、工程类型和专业节点无法删除!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void DeleteData()
|
|
|
|
|
{
|
|
|
|
|
string id = this.trWBS.SelectedNodeID;
|
|
|
|
|
this.hdSelectId.Text = this.trWBS.SelectedNode.ParentNode.NodeID;
|
|
|
|
|
if (this.trWBS.SelectedNode.CommandName == "DivisionProject")
|
|
|
|
|
{
|
|
|
|
|
string divisionProjectId = this.trWBS.SelectedNode.NodeID;
|
|
|
|
|
Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(divisionProjectId);
|
|
|
|
|
this.hdUnitWorkId.Text = divisionProject.UnitWorkId;
|
|
|
|
|
if (divisionProject != null)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(divisionProject.CNProfessionalId)) //删除分部
|
|
|
|
|
{
|
|
|
|
|
var q = from x in Funs.DB.WBS_DivisionProject where x.SuperDivisionId == divisionProjectId select x;
|
|
|
|
|
if (q.Count() > 0) //分部含有子分部
|
|
|
|
|
{
|
|
|
|
|
foreach (var d in q)
|
|
|
|
|
{
|
|
|
|
|
var q2 = from x in Funs.DB.WBS_DivisionProject where x.SuperDivisionId == d.DivisionProjectId select x;
|
|
|
|
|
if (q2.Count() > 0) //子分部还有子级
|
|
|
|
|
{
|
|
|
|
|
foreach (var d2 in q2)
|
|
|
|
|
{
|
|
|
|
|
BLL.BreakdownProjectService.DeleteAllBreakdown(d2.DivisionProjectId);
|
|
|
|
|
BLL.DivisionProjectService.DeleteDivisionProject(d2.DivisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BLL.BreakdownProjectService.DeleteAllBreakdown(d.DivisionProjectId);
|
|
|
|
|
BLL.DivisionProjectService.DeleteDivisionProject(d.DivisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else //分部不包含子分部
|
|
|
|
|
{
|
|
|
|
|
BLL.BreakdownProjectService.DeleteAllBreakdown(divisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
BLL.DivisionProjectService.DeleteDivisionProject(divisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
else //删除子分部
|
|
|
|
|
{
|
|
|
|
|
var q = from x in Funs.DB.WBS_DivisionProject where x.SuperDivisionId == divisionProjectId select x;
|
|
|
|
|
if (q.Count() > 0) //子分部含有子级
|
|
|
|
|
{
|
|
|
|
|
foreach (var d in q)
|
|
|
|
|
{
|
|
|
|
|
BLL.BreakdownProjectService.DeleteAllBreakdown(d.DivisionProjectId);
|
|
|
|
|
BLL.DivisionProjectService.DeleteDivisionProject(d.DivisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else //子分部不包含子级
|
|
|
|
|
{
|
|
|
|
|
BLL.BreakdownProjectService.DeleteAllBreakdown(divisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
BLL.DivisionProjectService.DeleteDivisionProject(divisionProjectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.ProjectControlPointMenuId, "删除分部或子分部工程及其下所有内容!");
|
|
|
|
|
}
|
|
|
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
|
|
|
GetSelectTreeNode();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2023-10-31 14:33:55 +08:00
|
|
|
|
#region 增加按钮
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
//if (this.trWBS.SelectedNode.Nodes.Count == 0) //末级节点
|
|
|
|
|
if (this.trWBS.SelectedNode.CommandName == "DivisionProject")
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("EditBreakdownProject.aspx?type=add&divisionProjectId={0}", this.trWBS.SelectedNode.NodeID, "新增 - ")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("不是末级,无法添加分项!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-31 14:33:55 +08:00
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
|
|
|
|
#region Grid双击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grid行双击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
btnMenuModify_Click(null, null);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-10-31 14:33:55 +08:00
|
|
|
|
|
2021-04-30 10:28:37 +08:00
|
|
|
|
#region 编辑
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuModify_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("EditBreakdownProject.aspx?type=modify&breakdownProjectId={0}&divisionProjectId={1}", this.Grid1.SelectedRowID, this.trWBS.SelectedNodeID, "新增 - ")));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuDel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//var controlItemAndCycle = Funs.DB.WBS_ControlItemAndCycle.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.InitControlItemCode == Grid1.SelectedRowID);
|
|
|
|
|
//if (controlItemAndCycle != null)
|
|
|
|
|
//{
|
|
|
|
|
// ShowNotify("WBS定制中已使用该数据,无法删除!", MessageBoxIcon.Warning);
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
BLL.BreakdownProjectService.DeleteBreakdown(Grid1.SelectedRowID);
|
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, Grid1.SelectedRowID, Grid1.SelectedRowID, BLL.Const.ProjectControlPointMenuId, "删除分项");
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
BindGrid();
|
|
|
|
|
Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 绑定数据
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grid1排序
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.SortDirection = e.SortDirection;
|
|
|
|
|
Grid1.SortField = e.SortField;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页下拉选择事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载Grid
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
|
|
|
|
string strSql = @"SELECT BreakdownProjectId,BreakdownCode,BreakdownName,Basis,CheckPoints,RecordAndCode,Class,FenBao,WuHuan,JianLi,YeZhu,Remark,ModelURL"
|
|
|
|
|
+ @" FROM WBS_BreakdownProject ";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
strSql += " where DivisionProjectId = @DivisionProjectId and ProjectId=@ProjectId";
|
|
|
|
|
listStr.Add(new SqlParameter("@DivisionProjectId", this.trWBS.SelectedNodeID));
|
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
var selectIds = (from x in Funs.DB.WBS_BreakdownProject where x.DivisionProjectId == this.trWBS.SelectedNodeID && x.IsSelected == true select x.BreakdownProjectId).ToList();
|
|
|
|
|
if (selectIds.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
this.Grid1.SelectedRowIDArray = selectIds.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 根据所给Id定位到对应分部分项
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据所给Id定位到对应具体的工程类型、单位工程、子单位工程、分部、子分部、分项、子分项
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void GetSelectTreeNode()
|
|
|
|
|
{
|
|
|
|
|
string projectType = string.Empty;
|
|
|
|
|
string cNProfessionalId = string.Empty;
|
|
|
|
|
string projectTypeId = string.Empty;
|
|
|
|
|
string unitWorkId = string.Empty;
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(this.hdSelectId.Text);
|
|
|
|
|
if (divisionProject != null)
|
|
|
|
|
{
|
|
|
|
|
list = GetDivisionProjectIds(divisionProject);
|
|
|
|
|
list.Add(this.hdSelectId.Text);
|
|
|
|
|
cNProfessionalId = GetCNProfessionalId(divisionProject);
|
|
|
|
|
if (cNProfessionalId == Const.CNProfessionalConstructId || cNProfessionalId == Const.CNProfessionalCVId)
|
|
|
|
|
{
|
|
|
|
|
projectTypeId = Const.CNProfessionalConstructId;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
projectTypeId = "2";
|
|
|
|
|
}
|
|
|
|
|
list.Add(cNProfessionalId);
|
|
|
|
|
unitWorkId = divisionProject.UnitWorkId;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cNProfessionalId = this.hdSelectId.Text;
|
|
|
|
|
if (cNProfessionalId == Const.CNProfessionalConstructId || cNProfessionalId == Const.CNProfessionalCVId)
|
|
|
|
|
{
|
|
|
|
|
projectTypeId = Const.CNProfessionalConstructId;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
projectTypeId = "2";
|
|
|
|
|
}
|
|
|
|
|
unitWorkId = this.hdUnitWorkId.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
for (int i = 0; i < trWBS.Nodes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (trWBS.Nodes[i].NodeID == unitWorkId)
|
|
|
|
|
{
|
|
|
|
|
trWBS.Nodes[i].Expanded = true;
|
|
|
|
|
trWBS.Nodes[i].Nodes.Clear();
|
|
|
|
|
TreeNode newNode1 = new TreeNode();
|
|
|
|
|
newNode1.Text = "建筑工程";
|
|
|
|
|
newNode1.NodeID = Const.CNProfessionalConstructId;
|
|
|
|
|
newNode1.CommandName = "CNProfessional";
|
|
|
|
|
newNode1.EnableExpandEvent = true;
|
|
|
|
|
newNode1.EnableClickEvent = true;
|
|
|
|
|
trWBS.Nodes[i].Nodes.Add(newNode1);
|
|
|
|
|
TreeNode newNode2 = new TreeNode();
|
|
|
|
|
newNode2.Text = "安装工程";
|
|
|
|
|
newNode2.NodeID = "2";
|
|
|
|
|
newNode2.CommandName = "ProjectType";
|
|
|
|
|
newNode2.EnableExpandEvent = true;
|
|
|
|
|
newNode2.EnableClickEvent = true;
|
|
|
|
|
trWBS.Nodes[i].Nodes.Add(newNode2);
|
|
|
|
|
if (!string.IsNullOrEmpty(projectTypeId))
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < trWBS.Nodes[i].Nodes.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
if (trWBS.Nodes[i].Nodes[j].NodeID == projectTypeId)
|
|
|
|
|
{
|
|
|
|
|
trWBS.Nodes[i].Nodes[j].Expanded = true;
|
|
|
|
|
if (trWBS.Nodes[i].Nodes[j].NodeID == BLL.Const.CNProfessionalConstructId) //建筑工程
|
|
|
|
|
{
|
|
|
|
|
var divisionsCV = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == BLL.Const.CNProfessionalCVId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (divisionsCV.Count > 0) //建筑工程下存在土建内容
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode3 = new TreeNode();
|
|
|
|
|
newNode3.Text = "土建";
|
|
|
|
|
newNode3.NodeID = BLL.Const.CNProfessionalCVId;
|
|
|
|
|
newNode3.CommandName = "CNProfessional";
|
|
|
|
|
newNode3.EnableExpandEvent = true;
|
|
|
|
|
newNode3.EnableClickEvent = true;
|
|
|
|
|
trWBS.Nodes[i].Nodes[j].Nodes.Add(newNode3);
|
|
|
|
|
newNode3.Expanded = true;
|
|
|
|
|
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == BLL.Const.CNProfessionalCVId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
foreach (var q in divisions)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode4 = new TreeNode();
|
|
|
|
|
newNode4.Text = q.DivisionName;
|
|
|
|
|
newNode4.NodeID = q.DivisionProjectId;
|
|
|
|
|
newNode4.CommandName = "DivisionProject";
|
|
|
|
|
newNode4.EnableExpandEvent = true;
|
|
|
|
|
newNode4.EnableClickEvent = true;
|
|
|
|
|
if (q.IsSelected == true)
|
|
|
|
|
{
|
|
|
|
|
newNode4.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
newNode3.Nodes.Add(newNode4);
|
|
|
|
|
var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(q.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode4.Expanded = true;
|
|
|
|
|
foreach (var division1 in division1s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode5 = new TreeNode();
|
|
|
|
|
newNode5.Text = division1.DivisionName;
|
|
|
|
|
newNode5.NodeID = division1.DivisionProjectId;
|
|
|
|
|
newNode5.CommandName = "DivisionProject";
|
|
|
|
|
newNode5.EnableExpandEvent = true;
|
|
|
|
|
newNode5.EnableClickEvent = true;
|
|
|
|
|
newNode4.Nodes.Add(newNode5);
|
|
|
|
|
var division2s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division1.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(division1.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode5.Expanded = true;
|
|
|
|
|
foreach (var division2 in division2s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode6 = new TreeNode();
|
|
|
|
|
newNode6.Text = division2.DivisionName;
|
|
|
|
|
newNode6.NodeID = division2.DivisionProjectId;
|
|
|
|
|
newNode6.CommandName = "DivisionProject";
|
|
|
|
|
newNode6.EnableExpandEvent = true;
|
|
|
|
|
newNode6.EnableClickEvent = true;
|
|
|
|
|
newNode5.Nodes.Add(newNode6);
|
|
|
|
|
var division3s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division2.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(division2.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode6.Expanded = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division3s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode6.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division2s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode5.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division1s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode4.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == BLL.Const.CNProfessionalConstructId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
foreach (var q in divisions)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode4 = new TreeNode();
|
|
|
|
|
newNode4.Text = q.DivisionName;
|
|
|
|
|
newNode4.NodeID = q.DivisionProjectId;
|
|
|
|
|
newNode4.CommandName = "DivisionProject";
|
|
|
|
|
newNode4.EnableExpandEvent = true;
|
|
|
|
|
newNode4.EnableClickEvent = true;
|
|
|
|
|
trWBS.Nodes[i].Nodes[j].Nodes.Add(newNode4);
|
|
|
|
|
if (q.IsSelected == true)
|
|
|
|
|
{
|
|
|
|
|
newNode4.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(q.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode4.Expanded = true;
|
|
|
|
|
foreach (var division1 in division1s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode5 = new TreeNode();
|
|
|
|
|
newNode5.Text = division1.DivisionName;
|
|
|
|
|
newNode5.NodeID = division1.DivisionProjectId;
|
|
|
|
|
newNode5.CommandName = "DivisionProject";
|
|
|
|
|
newNode5.EnableExpandEvent = true;
|
|
|
|
|
newNode5.EnableClickEvent = true;
|
|
|
|
|
newNode4.Nodes.Add(newNode5);
|
|
|
|
|
var division2s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division1.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(division1.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode5.Expanded = true;
|
|
|
|
|
foreach (var division2 in division2s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode6 = new TreeNode();
|
|
|
|
|
newNode6.Text = division2.DivisionName;
|
|
|
|
|
newNode6.NodeID = division2.DivisionProjectId;
|
|
|
|
|
newNode6.CommandName = "DivisionProject";
|
|
|
|
|
newNode6.EnableExpandEvent = true;
|
|
|
|
|
newNode6.EnableClickEvent = true;
|
|
|
|
|
newNode5.Nodes.Add(newNode6);
|
|
|
|
|
var division3s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division2.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(division2.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode6.Expanded = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division3s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode6.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division2s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode5.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division1s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode4.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else //安装工程
|
|
|
|
|
{
|
|
|
|
|
var cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId != Const.CNProfessionalConstructId && x.CNProfessionalId != Const.CNProfessionalCVId orderby x.SortIndex select x).ToList();
|
|
|
|
|
foreach (var c in cNProfessional)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newCNProfessionalNode = new TreeNode();
|
|
|
|
|
newCNProfessionalNode.Text = c.ProfessionalName;
|
|
|
|
|
newCNProfessionalNode.NodeID = c.CNProfessionalId;
|
|
|
|
|
newCNProfessionalNode.CommandName = "CNProfessional";
|
|
|
|
|
newCNProfessionalNode.EnableExpandEvent = true;
|
|
|
|
|
newCNProfessionalNode.EnableClickEvent = true;
|
|
|
|
|
trWBS.Nodes[i].Nodes[j].Nodes.Add(newCNProfessionalNode);
|
|
|
|
|
if (c.CNProfessionalId == cNProfessionalId)
|
|
|
|
|
{
|
|
|
|
|
newCNProfessionalNode.Expanded = true;
|
|
|
|
|
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == c.CNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
foreach (var q in divisions)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode4 = new TreeNode();
|
|
|
|
|
newNode4.Text = q.DivisionName;
|
|
|
|
|
newNode4.NodeID = q.DivisionProjectId;
|
|
|
|
|
newNode4.CommandName = "DivisionProject";
|
|
|
|
|
newNode4.EnableExpandEvent = true;
|
|
|
|
|
newNode4.EnableClickEvent = true;
|
|
|
|
|
newCNProfessionalNode.Nodes.Add(newNode4);
|
|
|
|
|
if (q.IsSelected == true)
|
|
|
|
|
{
|
|
|
|
|
newNode4.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(q.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode4.Expanded = true;
|
|
|
|
|
foreach (var division1 in division1s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode5 = new TreeNode();
|
|
|
|
|
newNode5.Text = division1.DivisionName;
|
|
|
|
|
newNode5.NodeID = division1.DivisionProjectId;
|
|
|
|
|
newNode5.CommandName = "DivisionProject";
|
|
|
|
|
newNode5.EnableExpandEvent = true;
|
|
|
|
|
newNode5.EnableClickEvent = true;
|
|
|
|
|
newNode4.Nodes.Add(newNode5);
|
|
|
|
|
var division2s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division1.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(division1.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode5.Expanded = true;
|
|
|
|
|
foreach (var division2 in division2s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode6 = new TreeNode();
|
|
|
|
|
newNode6.Text = division2.DivisionName;
|
|
|
|
|
newNode6.NodeID = division2.DivisionProjectId;
|
|
|
|
|
newNode6.CommandName = "DivisionProject";
|
|
|
|
|
newNode6.EnableExpandEvent = true;
|
|
|
|
|
newNode6.EnableClickEvent = true;
|
|
|
|
|
newNode5.Nodes.Add(newNode6);
|
|
|
|
|
var division3s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division2.DivisionProjectId
|
|
|
|
|
orderby x.SortIndex
|
|
|
|
|
select x).ToList();
|
|
|
|
|
if (list.Contains(division2.DivisionProjectId))
|
|
|
|
|
{
|
|
|
|
|
newNode6.Expanded = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division3s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode6.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division2s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode5.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (division1s.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newNode4.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
newCNProfessionalNode.Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode2 = new TreeNode();
|
|
|
|
|
tempNode2.NodeID = "";
|
|
|
|
|
tempNode2.Text = "";
|
|
|
|
|
trWBS.Nodes[i].Nodes[j].Nodes.Add(tempNode2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TreeNode tempNode1 = new TreeNode();
|
|
|
|
|
tempNode1.NodeID = "";
|
|
|
|
|
tempNode1.Text = "";
|
|
|
|
|
trWBS.Nodes[i].Nodes.Add(tempNode1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.trWBS.SelectedNodeID = this.hdSelectId.Text;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetCNProfessionalId(Model.WBS_DivisionProject divisionProject)
|
|
|
|
|
{
|
|
|
|
|
string id = string.Empty;
|
|
|
|
|
if (divisionProject != null && !string.IsNullOrEmpty(divisionProject.CNProfessionalId))
|
|
|
|
|
{
|
|
|
|
|
id = divisionProject.CNProfessionalId;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_DivisionProject superDivisionProject = BLL.DivisionProjectService.GetDivisionProjectById(divisionProject.SuperDivisionId);
|
|
|
|
|
id = GetCNProfessionalId(superDivisionProject);
|
|
|
|
|
}
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<string> GetDivisionProjectIds(Model.WBS_DivisionProject divisionProject)
|
|
|
|
|
{
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
if (divisionProject != null && !string.IsNullOrEmpty(divisionProject.SuperDivisionId))
|
|
|
|
|
{
|
|
|
|
|
list.Add(divisionProject.SuperDivisionId);
|
|
|
|
|
Model.WBS_DivisionProject superDivisionProject = BLL.DivisionProjectService.GetDivisionProjectById(divisionProject.SuperDivisionId);
|
|
|
|
|
list.AddRange(GetDivisionProjectIds(superDivisionProject));
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 行点击事件
|
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string id = e.RowID;
|
|
|
|
|
if (e.CommandName.Equals("download"))
|
|
|
|
|
{
|
|
|
|
|
string menuId = Const.ProjectControlPointMenuId;
|
|
|
|
|
PageContext.RegisterStartupScript(Windowtt.GetShowReference(
|
|
|
|
|
String.Format("../../AttachFile/webuploader.aspx?type=-1&source=1&toKeyId={0}&path=FileUpload/BreakdownProject&menuId={1}", id, menuId)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存事件
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-08-03 15:05:16 +08:00
|
|
|
|
SelectedList.Clear();
|
|
|
|
|
NoSelectedList.Clear();
|
2021-04-30 10:28:37 +08:00
|
|
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (this.Grid1.SelectedRowIDArray.Contains(this.Grid1.Rows[i].RowID))
|
|
|
|
|
{
|
|
|
|
|
SelectedList.Add(this.Grid1.Rows[i].RowID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NoSelectedList.Add(this.Grid1.Rows[i].RowID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in SelectedList.Distinct())
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_BreakdownProject breakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectById(item);
|
|
|
|
|
breakdownProject.IsSelected = true;
|
|
|
|
|
BLL.BreakdownProjectService.UpdateBreakdownProject(breakdownProject);
|
|
|
|
|
}
|
|
|
|
|
NoSelectedList = NoSelectedList.Distinct().ToList();
|
|
|
|
|
var q = NoSelectedList.Distinct().ToList();
|
|
|
|
|
foreach (var item in q)
|
|
|
|
|
{
|
|
|
|
|
foreach (var i in SelectedList.Distinct())
|
|
|
|
|
{
|
|
|
|
|
if (item == i)
|
|
|
|
|
{
|
|
|
|
|
NoSelectedList.Remove(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in NoSelectedList)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_BreakdownProject breakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectById(item);
|
|
|
|
|
breakdownProject.IsSelected = null;
|
|
|
|
|
BLL.BreakdownProjectService.UpdateBreakdownProject(breakdownProject);
|
|
|
|
|
}
|
|
|
|
|
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
{
|
|
|
|
|
this.btnNew.Hidden = false;
|
|
|
|
|
this.btnMenuAdd.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
this.btnMenuModify.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
this.btnSave.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
|
this.btnMenuDel.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-08-29 09:44:00 +08:00
|
|
|
|
|
2023-10-31 14:33:55 +08:00
|
|
|
|
#region 拷贝单位工程下勾选状态及明细
|
|
|
|
|
#region 定义变量
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 选中节点ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string treeSelectId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["treeSelectId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["treeSelectId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 单位工程id
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string unitWorkId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["unitWorkId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["unitWorkId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 专业Id
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string CNProfessionalId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["CNProfessionalId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["CNProfessionalId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2023-08-29 09:44:00 +08:00
|
|
|
|
/// <summary>
|
2023-10-31 14:33:55 +08:00
|
|
|
|
/// 复制
|
2023-08-29 09:44:00 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuCopy_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trWBS.SelectedNode != null)
|
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
treeSelectId = this.trWBS.SelectedNodeID;
|
|
|
|
|
var divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(treeSelectId);
|
|
|
|
|
if (divisionProject != null)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
unitWorkId = divisionProject.UnitWorkId;
|
|
|
|
|
CNProfessionalId = divisionProject.CNProfessionalId;
|
2023-08-29 09:44:00 +08:00
|
|
|
|
}
|
2023-10-31 14:33:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 粘贴
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuPaste_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(treeSelectId))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(this.trWBS.SelectedNodeID))
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
string cNProfessionalId = this.trWBS.SelectedNodeID;
|
|
|
|
|
if (cNProfessionalId.Contains("|"))
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
cNProfessionalId = cNProfessionalId.Split('|')[1];
|
2023-08-29 09:44:00 +08:00
|
|
|
|
}
|
2023-10-31 14:33:55 +08:00
|
|
|
|
var divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(cNProfessionalId);
|
|
|
|
|
if (divisionProject != null)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
var division = (from x in Funs.DB.WBS_DivisionProject where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.CNProfessionalId == CNProfessionalId && x.DivisionProjectId == treeSelectId select x).FirstOrDefault();
|
|
|
|
|
if (division != null)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
var oldDivisionProject = (from x in Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == divisionProject.CNProfessionalId
|
|
|
|
|
&& x.UnitWorkId == divisionProject.UnitWorkId
|
|
|
|
|
&& x.SuperDivisionId != null
|
|
|
|
|
&& x.DivisionName == division.DivisionName
|
|
|
|
|
select x);
|
|
|
|
|
if (oldDivisionProject.Count() == 0)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
Model.WBS_DivisionProject newDiv = new Model.WBS_DivisionProject();
|
|
|
|
|
newDiv.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject));
|
|
|
|
|
newDiv.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
newDiv.DivisionCode = division.DivisionCode;
|
|
|
|
|
newDiv.DivisionName = division.DivisionName;
|
|
|
|
|
newDiv.SortIndex = division.SortIndex;
|
|
|
|
|
newDiv.SuperDivisionId = this.trWBS.SelectedNodeID;
|
|
|
|
|
newDiv.CNProfessionalId = divisionProject.CNProfessionalId;
|
|
|
|
|
newDiv.UnitWorkId = divisionProject.UnitWorkId;
|
|
|
|
|
newDiv.OldDivisionId = division.OldDivisionId;
|
|
|
|
|
newDiv.SubItemType = division.SubItemType;
|
|
|
|
|
BLL.DivisionProjectService.AddDivisionProject(newDiv);
|
|
|
|
|
|
|
|
|
|
var divisions = BLL.DivisionProjectService.GetDivisionProjectBySupId(division.DivisionProjectId);
|
|
|
|
|
if (divisions.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
List<Model.WBS_DivisionProject> divisions2 = (from x in Funs.DB.WBS_DivisionProject where x.SuperDivisionId == division.DivisionProjectId select x).ToList();
|
|
|
|
|
if (divisions2.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
this.InsertDivisionDetail(divisions2, newDiv.DivisionProjectId, newDiv.UnitWorkId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var breakLists = BLL.BreakdownProjectService.GetBreakdownProjectsByDivisionProjectId(division.DivisionProjectId);
|
|
|
|
|
if (breakLists.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in breakLists)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject();
|
|
|
|
|
bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject));
|
|
|
|
|
bp.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
bp.BreakdownCode = item.BreakdownCode;
|
|
|
|
|
bp.BreakdownName = item.BreakdownName;
|
|
|
|
|
bp.DivisionProjectId = newDiv.DivisionProjectId;
|
|
|
|
|
bp.Basis = item.Basis;
|
|
|
|
|
bp.CheckPoints = item.CheckPoints;
|
|
|
|
|
bp.RecordAndCode = item.RecordAndCode;
|
|
|
|
|
bp.Class = item.Class;
|
|
|
|
|
bp.SortIndex = item.SortIndex;
|
|
|
|
|
bp.Remark = item.Remark;
|
|
|
|
|
bp.IsSelected = item.IsSelected;
|
|
|
|
|
bp.ModelURL = item.ModelURL;
|
|
|
|
|
bp.UnitWorkId = newDiv.UnitWorkId;
|
|
|
|
|
bp.IsAcceptance = item.IsAcceptance;
|
|
|
|
|
bp.IsYellow = item.IsYellow;
|
|
|
|
|
bp.WuHuan = item.WuHuan;
|
|
|
|
|
bp.JianLi = item.JianLi;
|
|
|
|
|
bp.FenBao = item.FenBao;
|
|
|
|
|
bp.YeZhu = item.YeZhu;
|
|
|
|
|
BLL.BreakdownProjectService.AddBreakdownProject(bp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-29 09:44:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
#region 复制末级节点
|
|
|
|
|
var d1 = BLL.DivisionProjectService.GetDivisionProjectById(treeSelectId);
|
|
|
|
|
if (d1 != null)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
if (divisionProject.DivisionName != d1.DivisionName)
|
|
|
|
|
{
|
|
|
|
|
//粘贴分部
|
|
|
|
|
Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject();
|
|
|
|
|
newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject));
|
|
|
|
|
newDivisionProject.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
newDivisionProject.DivisionCode = d1.DivisionCode;
|
|
|
|
|
newDivisionProject.DivisionName = d1.DivisionName;
|
|
|
|
|
newDivisionProject.SortIndex = d1.SortIndex;
|
|
|
|
|
newDivisionProject.SuperDivisionId = divisionProject.DivisionProjectId;
|
|
|
|
|
newDivisionProject.CNProfessionalId = d1.CNProfessionalId;
|
|
|
|
|
newDivisionProject.UnitWorkId = divisionProject.UnitWorkId;
|
|
|
|
|
newDivisionProject.OldDivisionId = d1.OldDivisionId;
|
|
|
|
|
newDivisionProject.SubItemType = d1.SubItemType;
|
|
|
|
|
BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);
|
|
|
|
|
|
|
|
|
|
//粘贴分项
|
|
|
|
|
var breakLists = BLL.BreakdownProjectService.GetBreakdownProjectsByDivisionProjectId(d1.DivisionProjectId);
|
|
|
|
|
if (breakLists.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in breakLists)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject();
|
|
|
|
|
bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject));
|
|
|
|
|
bp.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
bp.BreakdownCode = item.BreakdownCode;
|
|
|
|
|
bp.BreakdownName = item.BreakdownName;
|
|
|
|
|
bp.DivisionProjectId = newDivisionProject.DivisionProjectId;
|
|
|
|
|
bp.Basis = item.Basis;
|
|
|
|
|
bp.CheckPoints = item.CheckPoints;
|
|
|
|
|
bp.RecordAndCode = item.RecordAndCode;
|
|
|
|
|
bp.Class = item.Class;
|
|
|
|
|
bp.SortIndex = item.SortIndex;
|
|
|
|
|
bp.Remark = item.Remark;
|
|
|
|
|
bp.IsSelected = item.IsSelected;
|
|
|
|
|
bp.ModelURL = item.ModelURL;
|
|
|
|
|
bp.UnitWorkId = newDivisionProject.UnitWorkId;
|
|
|
|
|
bp.IsAcceptance = item.IsAcceptance;
|
|
|
|
|
bp.IsYellow = item.IsYellow;
|
|
|
|
|
bp.WuHuan = item.WuHuan;
|
|
|
|
|
bp.JianLi = item.JianLi;
|
|
|
|
|
bp.FenBao = item.FenBao;
|
|
|
|
|
bp.YeZhu = item.YeZhu;
|
|
|
|
|
BLL.BreakdownProjectService.AddBreakdownProject(bp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else //粘贴到专业下
|
|
|
|
|
{
|
|
|
|
|
string professionId = this.trWBS.SelectedNodeID;
|
|
|
|
|
if (professionId.Contains("|"))
|
|
|
|
|
{
|
|
|
|
|
professionId = professionId.Split('|')[1];
|
|
|
|
|
}
|
|
|
|
|
var cnPro = BLL.CNProfessionalService.GetCNProfessional(professionId);
|
|
|
|
|
if (cnPro != null)
|
|
|
|
|
{
|
|
|
|
|
var division = (from x in Funs.DB.WBS_DivisionProject where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.CNProfessionalId == CNProfessionalId && x.DivisionProjectId == treeSelectId select x).FirstOrDefault();
|
|
|
|
|
if (division != null)
|
|
|
|
|
{
|
|
|
|
|
var oldDivisionProject = (from x in Funs.DB.WBS_DivisionProject
|
|
|
|
|
where x.CNProfessionalId == professionId
|
|
|
|
|
&& x.UnitWorkId == this.trWBS.SelectedNode.ParentNode.ParentNode.NodeID
|
|
|
|
|
&& x.SuperDivisionId == null
|
|
|
|
|
&& x.DivisionName == division.DivisionName
|
|
|
|
|
select x);
|
|
|
|
|
if (oldDivisionProject.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject();
|
|
|
|
|
newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject));
|
|
|
|
|
newDivisionProject.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
newDivisionProject.DivisionCode = division.DivisionCode;
|
|
|
|
|
newDivisionProject.DivisionName = division.DivisionName;
|
|
|
|
|
newDivisionProject.SortIndex = division.SortIndex;
|
|
|
|
|
newDivisionProject.SuperDivisionId = null;
|
|
|
|
|
newDivisionProject.CNProfessionalId = cnPro.CNProfessionalId;
|
|
|
|
|
newDivisionProject.UnitWorkId = this.trWBS.SelectedNode.ParentNode.ParentNode.NodeID;
|
|
|
|
|
newDivisionProject.OldDivisionId = division.OldDivisionId;
|
|
|
|
|
newDivisionProject.SubItemType = division.SubItemType;
|
|
|
|
|
BLL.DivisionProjectService.AddDivisionProject(newDivisionProject);
|
|
|
|
|
|
|
|
|
|
var divisions = BLL.DivisionProjectService.GetDivisionProjectBySupId(division.DivisionProjectId);
|
|
|
|
|
if (divisions.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
List<Model.WBS_DivisionProject> divisions2 = (from x in Funs.DB.WBS_DivisionProject where x.SuperDivisionId == division.DivisionProjectId select x).ToList();
|
|
|
|
|
if (divisions2.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, newDivisionProject.UnitWorkId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var breakLists = BLL.BreakdownProjectService.GetBreakdownProjectsByDivisionProjectId(division.DivisionProjectId);
|
|
|
|
|
if (breakLists.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in breakLists)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject();
|
|
|
|
|
bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject));
|
|
|
|
|
bp.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
bp.BreakdownCode = item.BreakdownCode;
|
|
|
|
|
bp.BreakdownName = item.BreakdownName;
|
|
|
|
|
bp.DivisionProjectId = newDivisionProject.DivisionProjectId;
|
|
|
|
|
bp.Basis = item.Basis;
|
|
|
|
|
bp.CheckPoints = item.CheckPoints;
|
|
|
|
|
bp.RecordAndCode = item.RecordAndCode;
|
|
|
|
|
bp.Class = item.Class;
|
|
|
|
|
bp.SortIndex = item.SortIndex;
|
|
|
|
|
bp.Remark = item.Remark;
|
|
|
|
|
bp.IsSelected = item.IsSelected;
|
|
|
|
|
bp.ModelURL = item.ModelURL;
|
|
|
|
|
bp.UnitWorkId = newDivisionProject.UnitWorkId;
|
|
|
|
|
bp.IsAcceptance = item.IsAcceptance;
|
|
|
|
|
bp.IsYellow = item.IsYellow;
|
|
|
|
|
bp.WuHuan = item.WuHuan;
|
|
|
|
|
bp.JianLi = item.JianLi;
|
|
|
|
|
bp.FenBao = item.FenBao;
|
|
|
|
|
bp.YeZhu = item.YeZhu;
|
|
|
|
|
BLL.BreakdownProjectService.AddBreakdownProject(bp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-29 09:44:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-31 14:33:55 +08:00
|
|
|
|
ShowNotify("粘贴成功!", MessageBoxIcon.Success);
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInParent("请先复制节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-29 09:44:00 +08:00
|
|
|
|
|
2023-10-31 14:33:55 +08:00
|
|
|
|
//循环拷贝子级
|
|
|
|
|
private void InsertDivisionDetail(List<Model.WBS_DivisionProject> divisions, string superDivisionId, string unitWorkId)
|
|
|
|
|
{
|
|
|
|
|
foreach (var d in divisions)
|
|
|
|
|
{
|
|
|
|
|
var oldDivisionProject = BLL.DivisionProjectService.GetDivisionProjectByName(d.CNProfessionalId, unitWorkId,superDivisionId, d.DivisionName);
|
|
|
|
|
if (oldDivisionProject == null)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
Model.WBS_DivisionProject newDivisionProject = new Model.WBS_DivisionProject();
|
|
|
|
|
newDivisionProject.DivisionProjectId = SQLHelper.GetNewID(typeof(Model.WBS_DivisionProject));
|
|
|
|
|
newDivisionProject.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
newDivisionProject.DivisionCode = d.DivisionCode;
|
|
|
|
|
newDivisionProject.DivisionName = d.DivisionName;
|
|
|
|
|
newDivisionProject.SortIndex = d.SortIndex;
|
|
|
|
|
newDivisionProject.SuperDivisionId = superDivisionId;
|
|
|
|
|
newDivisionProject.CNProfessionalId = d.CNProfessionalId;
|
|
|
|
|
newDivisionProject.UnitWorkId = unitWorkId;
|
|
|
|
|
newDivisionProject.OldDivisionId = d.OldDivisionId;
|
|
|
|
|
newDivisionProject.SubItemType = d.SubItemType;
|
|
|
|
|
BLL.DivisionProjectService.AddDivisionProject(newDivisionProject); //子级分部
|
|
|
|
|
List<Model.WBS_DivisionProject> divisions2 = (from x in Funs.DB.WBS_DivisionProject where x.SuperDivisionId == d.DivisionProjectId select x).ToList();
|
|
|
|
|
if (divisions2.Count() > 0)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, unitWorkId);
|
|
|
|
|
}
|
2023-08-29 09:44:00 +08:00
|
|
|
|
|
2023-10-31 14:33:55 +08:00
|
|
|
|
//拷贝分项
|
|
|
|
|
var breakdowns = from x in Funs.DB.WBS_BreakdownProject
|
|
|
|
|
join y in Funs.DB.WBS_DivisionProject on x.DivisionProjectId equals y.DivisionProjectId
|
|
|
|
|
where y.DivisionProjectId == d.DivisionProjectId
|
|
|
|
|
select x;
|
|
|
|
|
foreach (var b in breakdowns)
|
|
|
|
|
{
|
|
|
|
|
var oldBreakdownProject = BLL.BreakdownProjectService.GetBreakdownProjectByName(newDivisionProject.DivisionProjectId,b.BreakdownName);
|
|
|
|
|
if (oldBreakdownProject == null)
|
2023-08-29 09:44:00 +08:00
|
|
|
|
{
|
2023-10-31 14:33:55 +08:00
|
|
|
|
Model.WBS_BreakdownProject bp = new Model.WBS_BreakdownProject();
|
|
|
|
|
bp.BreakdownProjectId = SQLHelper.GetNewID(typeof(Model.WBS_BreakdownProject));
|
|
|
|
|
bp.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
bp.BreakdownCode = b.BreakdownCode;
|
|
|
|
|
bp.BreakdownName = b.BreakdownName;
|
|
|
|
|
bp.DivisionProjectId = newDivisionProject.DivisionProjectId;
|
|
|
|
|
bp.Basis = b.Basis;
|
|
|
|
|
bp.CheckPoints = b.CheckPoints;
|
|
|
|
|
bp.RecordAndCode = b.RecordAndCode;
|
|
|
|
|
bp.Class = b.Class;
|
|
|
|
|
bp.SortIndex = b.SortIndex;
|
|
|
|
|
bp.Remark = b.Remark;
|
|
|
|
|
bp.ModelURL = b.ModelURL;
|
|
|
|
|
bp.UnitWorkId = newDivisionProject.UnitWorkId;
|
|
|
|
|
bp.IsAcceptance = b.IsAcceptance;
|
|
|
|
|
bp.IsYellow = b.IsYellow;
|
|
|
|
|
bp.WuHuan = b.WuHuan;
|
|
|
|
|
bp.JianLi = b.JianLi;
|
|
|
|
|
bp.FenBao = b.FenBao;
|
|
|
|
|
bp.YeZhu = b.YeZhu;
|
|
|
|
|
bp.SourceBreakdownId = b.SourceBreakdownId;
|
|
|
|
|
|
|
|
|
|
BLL.BreakdownProjectService.AddBreakdownProject(bp);
|
2023-08-29 09:44:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|