五环二期集团数据对接
This commit is contained in:
@@ -15,7 +15,20 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
public partial class ProjectControlPoint : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 被选择项列表
|
||||
/// </summary>
|
||||
@@ -45,7 +58,6 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
ViewState["NoSelectedList"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 页面加载
|
||||
/// <summary>
|
||||
@@ -59,7 +71,19 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
this.SelectedList = new List<string>();
|
||||
this.NoSelectedList = new List<string>();
|
||||
GetButtonPower();
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
this.ucTree.UnitId = this.CurrUser.UnitId;
|
||||
this.ucTree.ProjectId = this.ProjectId;
|
||||
if (!string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
this.panelLeftRegion.Hidden = true;
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
}
|
||||
InitTreeMenu();
|
||||
this.Grid1.Columns[2].Hidden = false;
|
||||
this.Grid1.Columns[3].Hidden = true;
|
||||
@@ -67,12 +91,30 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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[9].Hidden = false;
|
||||
//this.Grid1.Columns[10].Hidden = false;
|
||||
//this.Grid1.Columns[11].Hidden = false;
|
||||
//this.Grid1.Columns[12].Hidden = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 公司级树加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void changeTree(object sender, EventArgs e)
|
||||
{
|
||||
this.ProjectId = this.ucTree.ProjectId;
|
||||
this.GetButtonPower();
|
||||
if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
btnNew.Hidden = true;
|
||||
btnSave.Hidden = true;
|
||||
}
|
||||
this.InitTreeMenu();
|
||||
}
|
||||
|
||||
#region 加载树
|
||||
/// <summary>
|
||||
@@ -86,12 +128,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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;
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.ProjectId orderby x.UnitWorkCode select x;
|
||||
foreach (var q in unitWorks)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
@@ -207,103 +244,43 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
cNProfessionalId = e.NodeID.Split('|')[1];
|
||||
}
|
||||
if (cNProfessionalId == BLL.Const.CNProfessionalConstructId)
|
||||
var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
|
||||
where x.CNProfessionalId == cNProfessionalId && x.ProjectId == this.ProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
foreach (var q in divisions)
|
||||
{
|
||||
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 = 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.ProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.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
|
||||
where x.SuperDivisionId == e.Node.NodeID && x.ProjectId == this.ProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
foreach (var q in childDivisions)
|
||||
@@ -322,7 +299,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newNode.Checked = true;
|
||||
}
|
||||
var list = (from x in Funs.DB.WBS_DivisionProject
|
||||
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
|
||||
where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.ProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Count > 0)
|
||||
@@ -345,7 +322,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
/// <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))
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnSave))
|
||||
{
|
||||
Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(e.NodeID);
|
||||
divisionProject.IsSelected = e.Checked;
|
||||
@@ -372,24 +349,8 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
// if (!string.IsNullOrEmpty(superDivisionProject.CNProfessionalId))
|
||||
//{
|
||||
if (b == false)
|
||||
{
|
||||
var selectedDivisionProject = Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.SuperDivisionId == superDivisionProject.DivisionProjectId && x.IsSelected == true);
|
||||
if (selectedDivisionProject != null)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
superDivisionProject.IsSelected = b;
|
||||
BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
superDivisionProject.IsSelected = b;
|
||||
BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
|
||||
}
|
||||
superDivisionProject.IsSelected = b;
|
||||
BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -424,28 +385,8 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
var temp = BLL.DivisionProjectService.GetDivisionProjectById(divisionProjectId);
|
||||
if (temp == null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.btnMenuCopy.Hidden = false;
|
||||
this.btnMenuPaste.Hidden = false;
|
||||
}
|
||||
if (temp.CNProfessionalId != null && temp.CNProfessionalId == Const.CNProfessionalConstructId)
|
||||
{
|
||||
this.Grid1.Columns[2].Hidden = false;
|
||||
@@ -498,7 +439,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
/// <param name="e"></param>
|
||||
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
ShowNotify("增加成功!", MessageBoxIcon.Success);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
|
||||
GetSelectTreeNode();
|
||||
}
|
||||
@@ -527,7 +468,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
if (this.trWBS.SelectedNode != null)
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnModify))
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.ProjectId, 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") //非工程类型和单位工程、专业节点可以修改
|
||||
{
|
||||
@@ -585,7 +526,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
if (this.trWBS.SelectedNode != null)
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnAdd))
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnAdd))
|
||||
{
|
||||
if (this.trWBS.SelectedNode.CommandName != "ProjectType" && this.trWBS.SelectedNode.CommandName != "UnitWork") //非工程类型和单位工程节点可以增加
|
||||
{
|
||||
@@ -619,12 +560,12 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
if (this.trWBS.SelectedNode != null)
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnDelete))
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.ProjectId, 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);
|
||||
//var workPackage = Funs.DB.WBS_WorkPackage.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.InitWorkPackageCode == this.trWBS.SelectedNodeID);
|
||||
//if (workPackage != null)
|
||||
//{
|
||||
// ShowNotify("WBS定制中已使用该数据,无法删除!", MessageBoxIcon.Warning);
|
||||
@@ -707,6 +648,8 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
BLL.DivisionProjectService.DeleteDivisionProject(divisionProjectId);
|
||||
}
|
||||
// Project_CQMSDataService.StatisticalData(this.ProjectId, Project_CQMSDataService.CQMSDateType.QualityControlPoint);
|
||||
// Project_CQMSDataService.StatisticalData(this.ProjectId, Project_CQMSDataService.CQMSDateType.ProjectDivision);
|
||||
}
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.ProjectControlPointMenuId, "删除分部或子分部工程及其下所有内容!");
|
||||
}
|
||||
@@ -715,7 +658,6 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 增加按钮
|
||||
/// <summary>
|
||||
/// 增加
|
||||
/// </summary>
|
||||
@@ -740,7 +682,6 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
Alert.ShowInTop("请选择树节点!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Grid双击事件
|
||||
/// <summary>
|
||||
@@ -753,7 +694,6 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
btnMenuModify_Click(null, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑
|
||||
/// <summary>
|
||||
/// 编辑按钮
|
||||
@@ -771,6 +711,35 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 拷贝
|
||||
/// <summary>
|
||||
/// 拷贝
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.trWBS.SelectedNode != null)
|
||||
{
|
||||
if (this.trWBS.SelectedNode.CommandName != "UnitWork" && this.trWBS.SelectedNode.CommandName != "ProjectType" && this.trWBS.SelectedNode.CommandName != "CNProfessional") //非单位工程、工程类型、专业节点可以拷贝
|
||||
{
|
||||
string openUrl = String.Format("WBSCopy.aspx?Id={0}", this.trWBS.SelectedNode.NodeID, "拷贝 - ");
|
||||
|
||||
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
|
||||
+ Window2.GetShowReference(openUrl));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("单位工程、工程类型、专业节点无法拷贝!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 删除
|
||||
@@ -784,7 +753,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//var controlItemAndCycle = Funs.DB.WBS_ControlItemAndCycle.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.InitControlItemCode == Grid1.SelectedRowID);
|
||||
//var controlItemAndCycle = Funs.DB.WBS_ControlItemAndCycle.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.InitControlItemCode == Grid1.SelectedRowID);
|
||||
//if (controlItemAndCycle != null)
|
||||
//{
|
||||
// ShowNotify("WBS定制中已使用该数据,无法删除!", MessageBoxIcon.Warning);
|
||||
@@ -792,6 +761,8 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
//else
|
||||
//{
|
||||
BLL.BreakdownProjectService.DeleteBreakdown(Grid1.SelectedRowID);
|
||||
//Project_CQMSDataService.StatisticalData(this.ProjectId, Project_CQMSDataService.CQMSDateType.QualityControlPoint);
|
||||
//Project_CQMSDataService.StatisticalData(this.ProjectId, Project_CQMSDataService.CQMSDateType.ProjectDivision);
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, Grid1.SelectedRowID, Grid1.SelectedRowID, BLL.Const.ProjectControlPointMenuId, "删除分项");
|
||||
Grid1.DataBind();
|
||||
BindGrid();
|
||||
@@ -845,12 +816,16 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT BreakdownProjectId,BreakdownCode,BreakdownName,Basis,CheckPoints,RecordAndCode,Class,FenBao,WuHuan,JianLi,YeZhu,Remark,ModelURL"
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string strSql = @"SELECT BreakdownProjectId,BreakdownCode,BreakdownName,Basis,CheckPoints,RecordAndCode,Class,FenBao,WuHuan,JianLi,YeZhu,Remark,ModelURL,CheckAcceptType"
|
||||
+ @" 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));
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
@@ -886,7 +861,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
cNProfessionalId = GetCNProfessionalId(divisionProject);
|
||||
if (cNProfessionalId == Const.CNProfessionalConstructId || cNProfessionalId == Const.CNProfessionalCVId)
|
||||
{
|
||||
projectTypeId = Const.CNProfessionalConstructId;
|
||||
projectTypeId ="1";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -918,14 +893,14 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
trWBS.Nodes[i].Nodes.Clear();
|
||||
TreeNode newNode1 = new TreeNode();
|
||||
newNode1.Text = "建筑工程";
|
||||
newNode1.NodeID = Const.CNProfessionalConstructId;
|
||||
newNode1.CommandName = "CNProfessional";
|
||||
newNode1.NodeID = trWBS.Nodes[i].NodeID + "|" + "1";
|
||||
newNode1.CommandName = "ProjectType";
|
||||
newNode1.EnableExpandEvent = true;
|
||||
newNode1.EnableClickEvent = true;
|
||||
trWBS.Nodes[i].Nodes.Add(newNode1);
|
||||
TreeNode newNode2 = new TreeNode();
|
||||
newNode2.Text = "安装工程";
|
||||
newNode2.NodeID = "2";
|
||||
newNode2.NodeID = trWBS.Nodes[i].NodeID + "|" + "2";
|
||||
newNode2.CommandName = "ProjectType";
|
||||
newNode2.EnableExpandEvent = true;
|
||||
newNode2.EnableClickEvent = true;
|
||||
@@ -934,27 +909,27 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
for (int j = 0; j < trWBS.Nodes[i].Nodes.Count; j++)
|
||||
{
|
||||
if (trWBS.Nodes[i].Nodes[j].NodeID == projectTypeId)
|
||||
if (trWBS.Nodes[i].Nodes[j].NodeID.Split('|')[1] == projectTypeId)
|
||||
{
|
||||
trWBS.Nodes[i].Nodes[j].Expanded = true;
|
||||
if (trWBS.Nodes[i].Nodes[j].NodeID == BLL.Const.CNProfessionalConstructId) //建筑工程
|
||||
if (trWBS.Nodes[i].Nodes[j].NodeID.Split('|')[1] == "1") //建筑工程
|
||||
{
|
||||
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
|
||||
where x.CNProfessionalId == BLL.Const.CNProfessionalCVId && x.ProjectId == this.ProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (divisionsCV.Count > 0) //建筑工程下存在土建内容
|
||||
{
|
||||
TreeNode newNode3 = new TreeNode();
|
||||
newNode3.Text = "土建";
|
||||
newNode3.NodeID = BLL.Const.CNProfessionalCVId;
|
||||
newNode3.NodeID = trWBS.Nodes[i].Nodes[j].NodeID.Split('|')[0] + "|" + 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
|
||||
where x.CNProfessionalId == BLL.Const.CNProfessionalCVId && x.ProjectId == this.ProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
foreach (var q in divisions)
|
||||
@@ -971,7 +946,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
newNode3.Nodes.Add(newNode4);
|
||||
var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == q.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(q.DivisionProjectId))
|
||||
@@ -987,7 +962,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == division1.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(division1.DivisionProjectId))
|
||||
@@ -1003,7 +978,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == division2.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(division2.DivisionProjectId))
|
||||
@@ -1049,7 +1024,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.CNProfessionalId == BLL.Const.CNProfessionalConstructId && x.ProjectId == this.ProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
foreach (var q in divisions)
|
||||
@@ -1066,7 +1041,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newNode4.Checked = true;
|
||||
}
|
||||
var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == q.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(q.DivisionProjectId))
|
||||
@@ -1082,7 +1057,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == division1.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(division1.DivisionProjectId))
|
||||
@@ -1098,7 +1073,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == division2.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(division2.DivisionProjectId))
|
||||
@@ -1149,7 +1124,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
TreeNode newCNProfessionalNode = new TreeNode();
|
||||
newCNProfessionalNode.Text = c.ProfessionalName;
|
||||
newCNProfessionalNode.NodeID = c.CNProfessionalId;
|
||||
newCNProfessionalNode.NodeID = trWBS.Nodes[i].Nodes[j].NodeID.Split('|')[0] + "|" + c.CNProfessionalId;
|
||||
newCNProfessionalNode.CommandName = "CNProfessional";
|
||||
newCNProfessionalNode.EnableExpandEvent = true;
|
||||
newCNProfessionalNode.EnableClickEvent = true;
|
||||
@@ -1158,7 +1133,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
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
|
||||
where x.CNProfessionalId == c.CNProfessionalId && x.ProjectId == this.ProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
foreach (var q in divisions)
|
||||
@@ -1175,7 +1150,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newNode4.Checked = true;
|
||||
}
|
||||
var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == q.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(q.DivisionProjectId))
|
||||
@@ -1191,7 +1166,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == division1.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(division1.DivisionProjectId))
|
||||
@@ -1207,7 +1182,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
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
|
||||
where x.ProjectId == this.ProjectId && x.SuperDivisionId == division2.DivisionProjectId
|
||||
orderby x.SortIndex
|
||||
select x).ToList();
|
||||
if (list.Contains(division2.DivisionProjectId))
|
||||
@@ -1326,8 +1301,6 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
#region 保存事件
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedList.Clear();
|
||||
NoSelectedList.Clear();
|
||||
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
||||
{
|
||||
if (this.Grid1.SelectedRowIDArray.Contains(this.Grid1.Rows[i].RowID))
|
||||
@@ -1379,12 +1352,13 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId);
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
//this.btnMenuCopy.Hidden = false;
|
||||
this.btnMenuAdd.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
@@ -1405,369 +1379,37 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 拷贝单位工程下勾选状态及明细
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 选中节点ID
|
||||
/// </summary>
|
||||
public string treeSelectId
|
||||
protected string ConvertCheckAcceptType(object CheckAcceptType)
|
||||
{
|
||||
get
|
||||
string name = string.Empty;
|
||||
if (CheckAcceptType != null)
|
||||
{
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// 复制
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.trWBS.SelectedNode != null)
|
||||
{
|
||||
treeSelectId = this.trWBS.SelectedNodeID;
|
||||
var divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(treeSelectId);
|
||||
if (divisionProject != null)
|
||||
if (CheckAcceptType.ToString() == "1")
|
||||
{
|
||||
unitWorkId = divisionProject.UnitWorkId;
|
||||
CNProfessionalId = divisionProject.CNProfessionalId;
|
||||
name = "关键工序验收";
|
||||
}
|
||||
else if (CheckAcceptType.ToString() == "2")
|
||||
{
|
||||
name = "特殊过程验收";
|
||||
}
|
||||
else if (CheckAcceptType.ToString() == "3")
|
||||
{
|
||||
name = "隐蔽工程验收";
|
||||
}
|
||||
else if (CheckAcceptType.ToString() == "4")
|
||||
{
|
||||
name = "单位工程验收";
|
||||
}
|
||||
else if (CheckAcceptType.ToString() == "5")
|
||||
{
|
||||
name = "分部工程验收";
|
||||
}
|
||||
else if (CheckAcceptType.ToString() == "6")
|
||||
{
|
||||
name = "分项工程验收";
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/// <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))
|
||||
{
|
||||
string cNProfessionalId = this.trWBS.SelectedNodeID;
|
||||
if (cNProfessionalId.Contains("|"))
|
||||
{
|
||||
cNProfessionalId = cNProfessionalId.Split('|')[1];
|
||||
}
|
||||
var divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(cNProfessionalId);
|
||||
if (divisionProject != 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 == divisionProject.CNProfessionalId
|
||||
&& x.UnitWorkId == divisionProject.UnitWorkId
|
||||
&& x.SuperDivisionId != null
|
||||
&& x.DivisionName == division.DivisionName
|
||||
select x);
|
||||
if (oldDivisionProject.Count() == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#region 复制末级节点
|
||||
var d1 = BLL.DivisionProjectService.GetDivisionProjectById(treeSelectId);
|
||||
if (d1 != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ShowNotify("粘贴成功!", MessageBoxIcon.Success);
|
||||
InitTreeMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent("请先复制节点!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
//循环拷贝子级
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
this.InsertDivisionDetail(divisions2, newDivisionProject.DivisionProjectId, unitWorkId);
|
||||
}
|
||||
|
||||
//拷贝分项
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user