2021-04-30 10:28:37 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
using BLL;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2021-10-19 17:50:34 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.ProjectData
|
|
|
|
|
{
|
|
|
|
|
public partial class Installation : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 页面加载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页面加载
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
GetButtonPower();
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#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.ProjectInstallationMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
{
|
2021-10-19 17:50:34 +08:00
|
|
|
|
this.btnMenuDown.Hidden = false;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.btnMenuAdd.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载树
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载树
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void InitTreeMenu()
|
|
|
|
|
{
|
|
|
|
|
this.trProjects.Nodes.Clear();
|
|
|
|
|
this.trProjects.ShowBorder = false;
|
|
|
|
|
this.trProjects.ShowHeader = false;
|
|
|
|
|
this.trProjects.EnableIcons = true;
|
|
|
|
|
this.trProjects.AutoScroll = true;
|
|
|
|
|
this.trProjects.EnableSingleClickExpand = true;
|
|
|
|
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
if (project != null)
|
|
|
|
|
{
|
|
|
|
|
TreeNode node = new TreeNode();
|
|
|
|
|
node.Text = project.ProjectName;
|
|
|
|
|
node.NodeID = project.ProjectId;
|
|
|
|
|
node.CommandName = "project";
|
|
|
|
|
node.EnableClickEvent = true;
|
|
|
|
|
node.EnableExpandEvent = true;
|
|
|
|
|
this.trProjects.Nodes.Add(node);
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
node.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 展开树
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 展开树
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void trProjects_NodeExpand(object sender, TreeNodeEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
e.Node.Nodes.Clear();
|
|
|
|
|
if (e.Node.CommandName == "project") //展开项目节点
|
|
|
|
|
{
|
|
|
|
|
var installations = from x in Funs.DB.Project_Installation
|
|
|
|
|
where x.ProjectId == e.Node.NodeID && x.SuperInstallationId == "0"
|
|
|
|
|
orderby x.InstallationCode
|
|
|
|
|
select x;
|
|
|
|
|
foreach (var installation in installations)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
2021-10-22 10:10:15 +08:00
|
|
|
|
newNode.Text = "[" + installation.InstallationCode + "]" + installation.InstallationName;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
newNode.NodeID = installation.InstallationId;
|
|
|
|
|
newNode.CommandName = "installation";
|
|
|
|
|
newNode.EnableExpandEvent = true;
|
|
|
|
|
newNode.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
|
var installation2s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation.InstallationId orderby x.InstallationCode select x;
|
|
|
|
|
if (installation2s.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
newNode.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (e.Node.CommandName == "installation") //展开装置/单元节点
|
|
|
|
|
{
|
|
|
|
|
var installations = from x in Funs.DB.Project_Installation
|
|
|
|
|
where x.SuperInstallationId == e.Node.NodeID
|
|
|
|
|
orderby x.InstallationCode
|
|
|
|
|
select x;
|
|
|
|
|
foreach (var installation in installations)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode = new TreeNode();
|
2021-10-22 10:10:15 +08:00
|
|
|
|
newNode.Text = "[" + installation.InstallationCode + "]" + installation.InstallationName;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
newNode.NodeID = installation.InstallationId;
|
|
|
|
|
newNode.CommandName = "installation";
|
|
|
|
|
newNode.EnableExpandEvent = true;
|
|
|
|
|
newNode.EnableClickEvent = true;
|
|
|
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
|
var installation3s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation.InstallationId orderby x.InstallationCode select x;
|
|
|
|
|
if (installation3s.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
newNode.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Tree点击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tree点击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void trProjects_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.Grid1.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
SaveData();
|
|
|
|
|
}
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SaveData()
|
|
|
|
|
{
|
|
|
|
|
//string rowId = this.Grid1.Rows[0].RowID;
|
|
|
|
|
//string type = this.Grid1.Rows[0].Values[4].ToString();
|
|
|
|
|
|
|
|
|
|
//if (type == "unitProject")
|
|
|
|
|
//{
|
|
|
|
|
// Model.Wbs_UnitProjectInit unitProject = BLL.UnitProjectInitService.GetUnitProjectInitByUnitProjectCode(rowId);
|
|
|
|
|
// if (unitProject != null)
|
|
|
|
|
// {
|
|
|
|
|
// BLL.UnitProjectInitService.UpdateUnitProjectInit(unitProject);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else if (type == "wbsSet")
|
|
|
|
|
//{
|
|
|
|
|
// Model.WBS_WbsSetInit wbsSet = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(rowId);
|
|
|
|
|
// if (wbsSet != null)
|
|
|
|
|
// {
|
|
|
|
|
// var childWbsSets = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(this.trProjects.SelectedNodeID);
|
|
|
|
|
// //wbsSet.StartDate = Convert.ToDateTime(this.Grid1.Rows[0].Values[2].ToString());
|
|
|
|
|
// //wbsSet.EndDate = Convert.ToDateTime(this.Grid1.Rows[0].Values[3].ToString());
|
|
|
|
|
// BLL.WbsSetInitService.UpdateWbsSetInit(wbsSet);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 修改关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("修改成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
|
|
|
|
getWBSSet();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 拷贝关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 拷贝关闭窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("增加成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
|
|
|
|
getWBSSet();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2021-10-19 17:50:34 +08:00
|
|
|
|
#region 右键抽取、增加、修改、删除方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 抽取
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuDown_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trProjects.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnAdd))
|
|
|
|
|
{
|
2022-01-10 10:55:18 +08:00
|
|
|
|
Model.Project_Installation installation1 = BLL.Project_InstallationService.GetProjectInstallationByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
if (installation1 != null)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("项目已存在装置,无法抽取!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
2021-10-19 17:50:34 +08:00
|
|
|
|
string contenttype = "application/json;charset=utf-8";
|
2023-10-07 16:58:43 +08:00
|
|
|
|
var returndata0 = BLL.APIGetHttpService.ControlHttp(Funs.ControlApiUrl + "/Projects/GetProjectList?Code=" + project.KZProjectCode, "GET", contenttype, null, null);
|
|
|
|
|
//string returndata0 = "{'result':{'items':[{'code':'22373','name':'甘肃能化金昌能源化工开发有限公司低阶煤高效利用制氢及50万吨尿基复合肥项目','shortName':'金昌能化50万吨尿基复合肥项目','projTypeId':1,'projType':'工程咨询','projPhaseId':65,'projPhase':'工程咨询','ownerName':'甘肃能化金昌能源化工开发有限公司','address':'境内','nature':'新建','level':'3级','productId':0,'productName':'','productSize':'','initiationDate':'2023-01-19T00:00:00','planStart':'2023-01-19T00:00:00','planFinish':'2023-02-10T00:00:00','realStart':null,'realFinish':null,'contractAmount':0.0000,'contractNumber':'','basicProcess':'','remark':'','isFinished':false,'communityArea':'2亿Nm3/年氢气,30万吨/年合成氨,50万吨/年尿基复合肥','isBreakdown':false,'isSpecial':false,'isKey':false,'status':'COMPLETION','guid':'73c4f36d-1ed2-41ba-9c6e-04619de214de','createdAt':'2023-01-19T09:21:20.213','updatedAt':'2023-01-19T09:21:20.213','id':34961},{'code':'22373','name':'甘肃能化金昌能源化工开发有限公司低阶煤高效利用制氢及50万吨尿基复合肥项目','shortName':'低阶煤高效利用制氢及50 万吨/年高浓度尿基复合肥项目','projTypeId':5,'projType':'工程总承包','projPhaseId':14,'projPhase':'EPC','ownerName':'甘肃能化金昌能源化工开发有限公司','address':'境内','nature':'新建','level':'1级','productId':0,'productName':'合成氨、尿素(中间产品)、尿基复合肥、氢气','productSize':'合成氨40万吨/年; 尿素30万吨/年; 氢气2亿m3/年; 尿基复合肥50万吨/年','initiationDate':'2023-04-23T00:00:00','planStart':'2023-04-23T00:00:00','planFinish':'2025-06-30T00:00:00','realStart':null,'realFinish':null,'contractAmount':0.0000,'contractNumber':'','basicProcess':'氨合成采用南京聚拓专利,尿素装置采用中国五环自有尿素专利技术。','remark':'','isFinished':false,'communityArea':'1.总体院;\n2.40万吨/年合成氨装置:合成气压缩、冷冻、氨合成、氨回收、PSA制氢(2亿m3/年氢气)、尾气压缩、输煤CO2压缩、尿素CO2压缩;\n3.30万吨/年尿素装置:主装置、原料贮运、成品包装贮运;\n4.50万吨/年尿基复合肥装置;\n5.公用工程:循环水、脱盐水、污水、中水回用、零排放、变电所、机柜间、中控室、综合泵站、生产消防水池等;\n6.辅助生产设施:生产分析室、维修车间、综合仓库、危废暂存库、化学品库、火炬等;\n7.储运系统:液氨常压罐、事故甲醇罐、液氨球罐、装车栈台、泡沫站等。','isBreakdown':true,'isSpecial':false,'isKey':false,'status':'EXECUTION','guid':'10142090-f850-47ae-be6c-43597e6dc4d1','createdAt':'2023-04-23T14:39:53.98','updatedAt':'2023-08-16T18:45:05.997','id':35120},{'code':'22373','name':'甘肃能化金昌能源化工开发有限公司低阶煤高效利用制氢及50万吨尿基复合肥项目','shortName':'甘肃能化金昌能化阶煤高效利用制氢及尿基复合肥项目','projTypeId':6,'projType':'投标','projPhaseId':18,'projPhase':'EPC投标','ownerName':'甘肃能化金昌能源化工开发有限公司','address':'境内','nature':'新建','level':'','productId':0,'productName':'合成氨及尿基复合肥','productSize':'合成氨30万吨/年(其中17.4万吨生产尿素)、尿素30万吨/年(中间产品)、尿基复合肥50万吨/年','initiationDate':'2023-02-01T00:00:00','planStart':'2023-02-01T00:00:00','planFinish':'2023-04-15T00:00:00','realStart':null,'realFinish':null,'contractAmount':0.0000,'contractNumber':'','basicProcess':'合成氨采用国有专利,尿素采用五环公司高效合成、低能耗尿素工艺技术。\n','remark':'','isFinished':true,'communityArea':'一、气化采用航天粉煤气化技术,生产氢气2亿Nm3/年、合成氨30万吨/年(其中17.4万吨生产尿素)、尿素30万吨/年、尿基复合肥50万吨/年、硫磺2.24万吨/年。\n二、本次投标范围为:空分装置,净
|
|
|
|
|
if (!string.IsNullOrEmpty(returndata0))
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
JObject obj0 = JObject.Parse(returndata0);
|
|
|
|
|
JArray arr0 = JArray.Parse(obj0["result"]["items"].ToString());
|
|
|
|
|
string proId = string.Empty;
|
|
|
|
|
foreach (var item in arr0)
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
string projType = item["projType"].ToString();
|
|
|
|
|
string projPhase = item["projPhase"].ToString();
|
|
|
|
|
if (project.ProjType == projType && project.ProjPhase == projPhase)
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
proId= item["id"].ToString();
|
2021-10-22 10:10:15 +08:00
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
}
|
|
|
|
|
var returndata = BLL.APIGetHttpService.ControlHttp(Funs.ControlApiUrl + "/Projects/GetConstructionWbsList?ProjId=" + proId, "GET", contenttype, null, null);
|
|
|
|
|
if (!string.IsNullOrEmpty(returndata))
|
|
|
|
|
{
|
|
|
|
|
JObject obj = JObject.Parse(returndata);
|
|
|
|
|
JArray arr = JArray.Parse(obj["result"].ToString());
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
//专业
|
|
|
|
|
var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
|
|
|
|
|
//单位工程及子单位工程
|
|
|
|
|
var unitProjectInits = from x in db.Wbs_UnitProjectInit orderby x.SuperUnitProject select x;
|
|
|
|
|
//分部/子分部/分项/子分项
|
|
|
|
|
var wbsSetInits = (from x in db.WBS_WbsSetInit orderby x.SuperWbsSetCode select x).ToList();
|
|
|
|
|
//费用清单对应关系
|
|
|
|
|
var wbsSetMatchCostControlInits = from x in db.WBS_WbsSetMatchCostControlInit orderby x.WbsSetCode select x;
|
|
|
|
|
//费用清单项
|
|
|
|
|
var totalCostControlInits = from x in db.WBS_CostControlInit orderby x.CostControlInitCode select x;
|
|
|
|
|
string sgId = string.Empty;
|
|
|
|
|
foreach (var item in arr)
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
string id = item["id"].ToString(); //记录Id,主键
|
|
|
|
|
string parentId = item["parentId"].ToString(); //上一级记录Id
|
|
|
|
|
string code = item["code"].ToString(); //WBS编码
|
|
|
|
|
string name = item["name"].ToString(); //WBS名称
|
|
|
|
|
string level = item["level"].ToString(); //级别,0-7依次表示:项目、阶段(施工)、装置、工序、主项、专业、分部工程、分项工程
|
|
|
|
|
string isLeaf = item["isLeaf"].ToString(); //是否末级
|
|
|
|
|
string ppsId = item["ppsId"].ToString(); //阶段ID,3代表施工
|
|
|
|
|
string projId = item["projId"].ToString(); //项目ID
|
|
|
|
|
string planStart = item["planStart"].ToString(); //计划开始日期
|
|
|
|
|
string planFinish = item["planFinish"].ToString(); //计划完成日期
|
|
|
|
|
string remark = item["remark"].ToString(); //备注
|
|
|
|
|
if (level == "0" || level == "1" || level == "2" || level == "3" || level == "4")
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Project_Installation installation = new Model.Project_Installation();
|
|
|
|
|
installation.InstallationId = id;
|
|
|
|
|
installation.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
installation.InstallationCode = code;
|
|
|
|
|
installation.InstallationName = name;
|
|
|
|
|
installation.SuperInstallationId = parentId == "-1" ? "0" : parentId;
|
|
|
|
|
installation.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
installation.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
installation.IsEnd = Convert.ToBoolean(isLeaf);
|
|
|
|
|
installation.Def = remark;
|
|
|
|
|
db.Project_Installation.InsertOnSubmit(installation);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
if (name == "施工")
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
sgId = id;
|
2021-12-29 15:03:49 +08:00
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
}
|
|
|
|
|
else if (level == "5")
|
|
|
|
|
{
|
|
|
|
|
var cn = cnProfessionInits.FirstOrDefault(x => x.CnProfessionName.Contains(name.Substring(0, 2)));
|
|
|
|
|
//拷贝专业
|
|
|
|
|
if (cn != null)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
if (cn.CnProfessionName != "防腐绝热" && cn.CnProfessionName != "地勘" && cn.CnProfessionName != "全厂地下主管网" && cn.CnProfessionName != "临时设施" && cn.CnProfessionName != "总图")
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.WBS_CnProfession cnProfession = new Model.WBS_CnProfession();
|
|
|
|
|
cnProfession.CnProfessionId = id;
|
|
|
|
|
cnProfession.CnProfessionName = cn.CnProfessionName;
|
|
|
|
|
cnProfession.CnProfessionCode = cn.CnProfessionCode;
|
|
|
|
|
cnProfession.InstallationId = parentId;
|
|
|
|
|
cnProfession.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
cnProfession.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
cnProfession.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
cnProfession.OldId = cn.CnProfessionId;
|
|
|
|
|
db.WBS_CnProfession.InsertOnSubmit(cnProfession);
|
2021-12-29 15:03:49 +08:00
|
|
|
|
db.SubmitChanges();
|
2023-10-07 16:58:43 +08:00
|
|
|
|
//单位工程
|
2021-12-29 15:03:49 +08:00
|
|
|
|
var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
|
|
|
|
foreach (var unitProjectInit in unitProjects)
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2021-12-29 15:03:49 +08:00
|
|
|
|
Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
|
|
|
|
|
unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
|
|
|
|
|
unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
|
|
|
|
|
unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
|
2023-10-07 16:58:43 +08:00
|
|
|
|
unitProject.InstallationId = parentId;
|
2021-12-29 15:03:49 +08:00
|
|
|
|
unitProject.SortIndex = unitProjectInit.SortIndex;
|
2023-10-07 16:58:43 +08:00
|
|
|
|
unitProject.SuperUnitProjectId = null;
|
2021-12-29 15:03:49 +08:00
|
|
|
|
unitProject.ProjectId = this.CurrUser.LoginProjectId;
|
2023-10-07 16:58:43 +08:00
|
|
|
|
unitProject.CnProfessionId = id;
|
2021-12-29 15:03:49 +08:00
|
|
|
|
unitProject.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
unitProject.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
unitProject.Remark = unitProjectInit.Remark;
|
|
|
|
|
unitProject.IsIn = true;
|
|
|
|
|
db.Wbs_UnitProject.InsertOnSubmit(unitProject);
|
2021-10-22 10:10:15 +08:00
|
|
|
|
db.SubmitChanges();
|
2021-12-29 15:03:49 +08:00
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
//分部分项
|
2021-12-29 15:03:49 +08:00
|
|
|
|
var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
|
|
|
|
foreach (var wbsSetInit in wbsSets)
|
|
|
|
|
{
|
|
|
|
|
Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
|
|
|
|
|
wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
|
|
|
|
|
wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
|
|
|
|
|
wbsSet.WbsSetName = wbsSetInit.WbsSetName;
|
2023-10-07 16:58:43 +08:00
|
|
|
|
wbsSet.InstallationId = parentId;
|
|
|
|
|
wbsSet.CnProfessionId = id;
|
|
|
|
|
wbsSet.UnitProjectId = (from x in db.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.CnProfessionId == id select x.UnitProjectId).FirstOrDefault();
|
2021-12-29 15:03:49 +08:00
|
|
|
|
if (wbsSetInit.SuperWbsSetCode == null)
|
2021-10-22 10:10:15 +08:00
|
|
|
|
{
|
2021-12-29 15:03:49 +08:00
|
|
|
|
wbsSet.SuperWbsSetId = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
wbsSet.SuperWbsSetId = (from x in db.Wbs_WbsSet
|
|
|
|
|
where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == parentId && x.CnProfessionId == id
|
2021-12-29 15:03:49 +08:00
|
|
|
|
select x.WbsSetId).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
wbsSet.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
wbsSet.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
wbsSet.Flag = wbsSetInit.Flag;
|
|
|
|
|
wbsSet.Way = wbsSetInit.Way;
|
|
|
|
|
wbsSet.Weights = wbsSetInit.Weights;
|
|
|
|
|
wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
|
|
|
|
|
wbsSet.ControlPoint = wbsSetInit.ControlPoint;
|
|
|
|
|
wbsSet.Remark = wbsSetInit.Remark;
|
|
|
|
|
wbsSet.IsIn = true;
|
|
|
|
|
db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
|
|
|
|
|
foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
|
|
|
|
|
wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
|
|
|
|
|
wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
|
|
|
|
|
wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
|
|
|
|
|
if (wbsSetMatchCostControl.WbsSetId != null)
|
|
|
|
|
{
|
|
|
|
|
db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
//拷贝费用清单项
|
|
|
|
|
var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
|
|
|
|
|
foreach (var costControlInit in costControlInits)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_CostControl costControl = new Model.WBS_CostControl();
|
|
|
|
|
costControl.CostControlId = SQLHelper.GetNewID();
|
|
|
|
|
costControl.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
|
|
|
|
|
costControl.CostControlCode = costControlInit.CostControlInitCode;
|
|
|
|
|
costControl.CostControlName = costControlInit.CostControlInitName;
|
|
|
|
|
costControl.Unit = costControlInit.Unit;
|
|
|
|
|
db.WBS_CostControl.InsertOnSubmit(costControl);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
else
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
|
|
|
|
|
if (oldInstallation == null)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Project_Installation installation = new Model.Project_Installation();
|
|
|
|
|
installation.InstallationId = id;
|
|
|
|
|
installation.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
installation.InstallationCode = code;
|
|
|
|
|
installation.InstallationName = name;
|
|
|
|
|
installation.SuperInstallationId = sgId;
|
|
|
|
|
installation.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
installation.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
installation.IsEnd = true;
|
|
|
|
|
installation.Def = remark;
|
|
|
|
|
db.Project_Installation.InsertOnSubmit(installation);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
// 拷贝总图等专业下WBS内容
|
|
|
|
|
//拷贝单位工程及子单位工程
|
|
|
|
|
var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
|
|
|
|
foreach (var unitProjectInit in unitProjects)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
|
|
|
|
|
unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
|
|
|
|
|
unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
|
|
|
|
|
unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
|
|
|
|
|
if (unitProjectInit.SuperUnitProject == null)
|
|
|
|
|
{
|
|
|
|
|
unitProject.SuperUnitProjectId = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
|
|
|
|
|
where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.InstallationId == id
|
|
|
|
|
select x.UnitProjectId).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
unitProject.InstallationId = id;
|
|
|
|
|
unitProject.SortIndex = unitProjectInit.SortIndex;
|
|
|
|
|
unitProject.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
unitProject.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
unitProject.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
unitProject.Remark = unitProjectInit.Remark;
|
|
|
|
|
unitProject.IsIn = true;
|
|
|
|
|
db.Wbs_UnitProject.InsertOnSubmit(unitProject);
|
|
|
|
|
db.SubmitChanges();
|
2021-12-29 15:03:49 +08:00
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
//拷贝分部/子分部/分项/子分项
|
|
|
|
|
var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
|
|
|
|
foreach (var wbsSetInit in wbsSets)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
|
|
|
|
|
wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
|
|
|
|
|
wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
|
|
|
|
|
wbsSet.WbsSetName = wbsSetInit.WbsSetName;
|
|
|
|
|
wbsSet.InstallationId = id;
|
|
|
|
|
wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.InstallationId == id select x.UnitProjectId).FirstOrDefault();
|
|
|
|
|
if (wbsSetInit.SuperWbsSetCode == null)
|
|
|
|
|
{
|
|
|
|
|
wbsSet.SuperWbsSetId = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
|
|
|
|
|
where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == id
|
|
|
|
|
select x.WbsSetId).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
wbsSet.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
wbsSet.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
wbsSet.Flag = wbsSetInit.Flag;
|
|
|
|
|
wbsSet.Way = wbsSetInit.Way;
|
|
|
|
|
wbsSet.Weights = wbsSetInit.Weights;
|
|
|
|
|
wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
|
|
|
|
|
wbsSet.ControlPoint = wbsSetInit.ControlPoint;
|
|
|
|
|
wbsSet.Remark = wbsSetInit.Remark;
|
|
|
|
|
wbsSet.IsIn = true;
|
|
|
|
|
db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
|
|
|
|
|
foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
|
|
|
|
|
wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
|
|
|
|
|
wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
|
|
|
|
|
wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
|
|
|
|
|
if (wbsSetMatchCostControl.WbsSetId != null)
|
|
|
|
|
{
|
|
|
|
|
db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
//拷贝费用清单项
|
|
|
|
|
var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
|
|
|
|
|
foreach (var costControlInit in costControlInits)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_CostControl costControl = new Model.WBS_CostControl();
|
|
|
|
|
costControl.CostControlId = SQLHelper.GetNewID();
|
|
|
|
|
costControl.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
|
|
|
|
|
costControl.CostControlCode = costControlInit.CostControlInitCode;
|
|
|
|
|
costControl.CostControlName = costControlInit.CostControlInitName;
|
|
|
|
|
costControl.Unit = costControlInit.Unit;
|
|
|
|
|
db.WBS_CostControl.InsertOnSubmit(costControl);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-29 15:03:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (level == "6" || level == "7")
|
|
|
|
|
{
|
|
|
|
|
if (name.Contains("防腐绝热") || name.Contains("地勘") || name.Contains("全厂地下主管网") || name.Contains("临时设施") || name.Contains("总图"))
|
|
|
|
|
{
|
|
|
|
|
var cn = cnProfessionInits.FirstOrDefault(x => x.CnProfessionName.Contains(name.Substring(0, 2)));
|
|
|
|
|
if (cn != null)
|
|
|
|
|
{
|
|
|
|
|
var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
|
|
|
|
|
if (oldInstallation == null)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Project_Installation installation = new Model.Project_Installation();
|
|
|
|
|
installation.InstallationId = id;
|
|
|
|
|
installation.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
installation.InstallationCode = code;
|
|
|
|
|
installation.InstallationName = name;
|
|
|
|
|
installation.SuperInstallationId = sgId;
|
|
|
|
|
installation.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
installation.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
installation.IsEnd = true;
|
|
|
|
|
installation.Def = remark;
|
|
|
|
|
db.Project_Installation.InsertOnSubmit(installation);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
// 拷贝总图等专业下WBS内容
|
|
|
|
|
//拷贝单位工程及子单位工程
|
|
|
|
|
var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
|
|
|
|
foreach (var unitProjectInit in unitProjects)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
|
|
|
|
|
unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
|
|
|
|
|
unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
|
|
|
|
|
unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
|
|
|
|
|
if (unitProjectInit.SuperUnitProject == null)
|
|
|
|
|
{
|
|
|
|
|
unitProject.SuperUnitProjectId = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
|
|
|
|
|
where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.InstallationId == id
|
|
|
|
|
select x.UnitProjectId).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
unitProject.InstallationId = id;
|
|
|
|
|
unitProject.SortIndex = unitProjectInit.SortIndex;
|
|
|
|
|
unitProject.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
unitProject.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
unitProject.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
unitProject.Remark = unitProjectInit.Remark;
|
|
|
|
|
unitProject.IsIn = true;
|
|
|
|
|
db.Wbs_UnitProject.InsertOnSubmit(unitProject);
|
|
|
|
|
db.SubmitChanges();
|
2021-12-29 15:03:49 +08:00
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
//拷贝分部/子分部/分项/子分项
|
|
|
|
|
var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
|
|
|
|
foreach (var wbsSetInit in wbsSets)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
|
|
|
|
|
wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
|
|
|
|
|
wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
|
|
|
|
|
wbsSet.WbsSetName = wbsSetInit.WbsSetName;
|
|
|
|
|
wbsSet.InstallationId = id;
|
|
|
|
|
wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.InstallationId == id select x.UnitProjectId).FirstOrDefault();
|
|
|
|
|
if (wbsSetInit.SuperWbsSetCode == null)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
wbsSet.SuperWbsSetId = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
|
|
|
|
|
where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == id
|
|
|
|
|
select x.WbsSetId).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
wbsSet.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
wbsSet.StartDate = Funs.GetNewDateTime(planStart);
|
|
|
|
|
wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
|
|
|
|
|
wbsSet.Flag = wbsSetInit.Flag;
|
|
|
|
|
wbsSet.Way = wbsSetInit.Way;
|
|
|
|
|
wbsSet.Weights = wbsSetInit.Weights;
|
|
|
|
|
wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
|
|
|
|
|
wbsSet.ControlPoint = wbsSetInit.ControlPoint;
|
|
|
|
|
wbsSet.Remark = wbsSetInit.Remark;
|
|
|
|
|
wbsSet.IsIn = true;
|
|
|
|
|
db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
|
|
|
|
|
foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
|
|
|
|
|
wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
|
|
|
|
|
wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
|
|
|
|
|
wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
|
|
|
|
|
if (wbsSetMatchCostControl.WbsSetId != null)
|
2021-12-29 15:03:49 +08:00
|
|
|
|
{
|
2023-10-07 16:58:43 +08:00
|
|
|
|
db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
|
2021-12-29 15:03:49 +08:00
|
|
|
|
db.SubmitChanges();
|
2023-10-07 16:58:43 +08:00
|
|
|
|
//拷贝费用清单项
|
|
|
|
|
var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
|
|
|
|
|
foreach (var costControlInit in costControlInits)
|
|
|
|
|
{
|
|
|
|
|
Model.WBS_CostControl costControl = new Model.WBS_CostControl();
|
|
|
|
|
costControl.CostControlId = SQLHelper.GetNewID();
|
|
|
|
|
costControl.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
|
|
|
|
|
costControl.CostControlCode = costControlInit.CostControlInitCode;
|
|
|
|
|
costControl.CostControlName = costControlInit.CostControlInitName;
|
|
|
|
|
costControl.Unit = costControlInit.Unit;
|
|
|
|
|
db.WBS_CostControl.InsertOnSubmit(costControl);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
2021-12-29 15:03:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-22 10:10:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-07 16:58:43 +08:00
|
|
|
|
ShowNotify("抽取成功!", MessageBoxIcon.Success);
|
|
|
|
|
InitTreeMenu();
|
2021-10-22 10:10:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-19 17:50:34 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键修改事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trProjects.SelectedNode != null && this.trProjects.SelectedNode.CommandName != "project")
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
if (this.trProjects.SelectedNode.Text != "总图") //非专业节点可以修改
|
|
|
|
|
{
|
|
|
|
|
this.hdSelectId.Text = this.trProjects.SelectedNode.NodeID;
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("InstallationSave.aspx?operating=modify&Id={0}", this.trProjects.SelectedNode.NodeID, "编辑 - ")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("总图节点无法修改!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("项目节点无法修改!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuAdd_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trProjects.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnAdd))
|
|
|
|
|
{
|
|
|
|
|
if (BLL.Project_InstallationService.IsCanAddInstallation(this.trProjects.SelectedNode.NodeID) && this.trProjects.SelectedNode.Text != "总图") //可增加子级
|
|
|
|
|
{
|
|
|
|
|
string openUrl = String.Format("InstallationSave.aspx?operating=add&SuperId={0}", this.trProjects.SelectedNode.NodeID, "增加 - ");
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
|
|
|
|
|
+ Window2.GetShowReference(openUrl));
|
|
|
|
|
//PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WBSSetCopy.aspx?Id={0}&Type={1}", this.trProjects.SelectedNode.NodeID, this.trProjects.SelectedNode.CommandName, "拷贝 - ")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-08-13 11:15:59 +08:00
|
|
|
|
ShowNotify("总图和末级节点无法增加子级!", MessageBoxIcon.Warning);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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.trProjects.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
if (this.trProjects.SelectedNode.CommandName != "project") //非专业节点可以删除
|
|
|
|
|
{
|
|
|
|
|
string id = this.trProjects.SelectedNode.NodeID;
|
|
|
|
|
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(id);
|
|
|
|
|
if (installation.SuperInstallationId == "0") //删除一级装置
|
|
|
|
|
{
|
2022-03-23 09:55:32 +08:00
|
|
|
|
if (installation.InstallationName == "总图" || installation.InstallationName == "防腐绝热" || installation.InstallationName == "地勘" || installation.InstallationName == "临时设施" || installation.InstallationName == "全厂地下主管网")
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
|
|
|
|
DeleteZTData(installation.InstallationId);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-08-13 11:15:59 +08:00
|
|
|
|
DeleteBaseData(id);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-08-13 11:15:59 +08:00
|
|
|
|
DeleteBaseData(id);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("项目节点无法删除!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-13 11:15:59 +08:00
|
|
|
|
private void DeleteBaseData(string installationId)
|
|
|
|
|
{
|
2021-10-19 17:50:34 +08:00
|
|
|
|
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(installationId);
|
2021-08-13 11:15:59 +08:00
|
|
|
|
if (installation.IsEnd == false)
|
|
|
|
|
{
|
|
|
|
|
BLL.Project_InstallationService.DeleteInstallation(installationId);
|
|
|
|
|
var installations = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installationId select x;
|
|
|
|
|
foreach (var item in installations)
|
|
|
|
|
{
|
|
|
|
|
DeleteBaseData(item.InstallationId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DeleteData(installationId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void DeleteData(string installationId)
|
|
|
|
|
{
|
|
|
|
|
var wbsSets = (from x in Funs.DB.Wbs_WbsSet join y in Funs.DB.WBS_CnProfession on x.CnProfessionId equals y.CnProfessionId where y.InstallationId == installationId && x.CnProfessionId != null select x).ToList();
|
|
|
|
|
foreach (var wbsSet in wbsSets)
|
|
|
|
|
{
|
2021-08-13 11:15:59 +08:00
|
|
|
|
BLL.CostControlService.DeleteCostControlByWbsSetId(wbsSet.WbsSetId); //删除费控项
|
2021-04-30 10:28:37 +08:00
|
|
|
|
BLL.WbsDetailHistoryService.DeleteWbsDetailHistoryByToWbs(wbsSet.WbsSetId); //删除进度历史版本记录
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(wbsSet.WbsSetId); //删除进度记录
|
|
|
|
|
BLL.WbsSetService.DeleteWbsSet(wbsSet.WbsSetId);
|
2021-08-13 11:15:59 +08:00
|
|
|
|
BLL.WbsSetMatchCostControlService.DeleteWbsSetMatchCostControlByWbsSetId(wbsSet.WbsSetId); //删除费控项对应关系
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除单位工程及子单位工程
|
|
|
|
|
var unitProjects = from x in Funs.DB.Wbs_UnitProject join y in Funs.DB.WBS_CnProfession on x.CnProfessionId equals y.CnProfessionId where y.InstallationId == installationId && x.CnProfessionId != null select x;
|
|
|
|
|
foreach (var unitProject in unitProjects)
|
|
|
|
|
{
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(unitProject.UnitProjectId); //删除进度记录
|
|
|
|
|
BLL.UnitProjectService.DeleteUnitProject(unitProject.UnitProjectId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除专业
|
|
|
|
|
var cnProfessions = from x in Funs.DB.WBS_CnProfession where x.InstallationId == installationId select x;
|
|
|
|
|
foreach (var cnProfession in cnProfessions)
|
|
|
|
|
{
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(cnProfession.CnProfessionId); //删除进度记录
|
|
|
|
|
BLL.CnProfessionService.DeleteCnProfession(cnProfession.CnProfessionId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(installationId); //删除进度记录
|
|
|
|
|
BLL.Project_InstallationService.DeleteInstallation(installationId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void DeleteZTData(string installationId)
|
|
|
|
|
{
|
|
|
|
|
var wbsSets = (from x in Funs.DB.Wbs_WbsSet where x.InstallationId == installationId && x.CnProfessionId == null select x).ToList();
|
|
|
|
|
foreach (var wbsSet in wbsSets)
|
|
|
|
|
{
|
2022-03-23 09:55:32 +08:00
|
|
|
|
BLL.CostControlService.DeleteCostControlByWbsSetId(wbsSet.WbsSetId); //删除费控项
|
2021-04-30 10:28:37 +08:00
|
|
|
|
BLL.WbsDetailHistoryService.DeleteWbsDetailHistoryByToWbs(wbsSet.WbsSetId); //删除进度历史版本记录
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(wbsSet.WbsSetId); //删除进度记录
|
|
|
|
|
BLL.WbsSetService.DeleteWbsSet(wbsSet.WbsSetId);
|
2022-03-23 09:55:32 +08:00
|
|
|
|
BLL.WbsSetMatchCostControlService.DeleteWbsSetMatchCostControlByWbsSetId(wbsSet.WbsSetId); //删除费控项对应关系
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除单位工程及子单位工程
|
|
|
|
|
var unitProjects = from x in Funs.DB.Wbs_UnitProject where x.InstallationId == installationId && x.CnProfessionId == null select x;
|
|
|
|
|
foreach (var unitProject in unitProjects)
|
|
|
|
|
{
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(unitProject.UnitProjectId); //删除进度记录
|
|
|
|
|
BLL.UnitProjectService.DeleteUnitProject(unitProject.UnitProjectId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除专业
|
|
|
|
|
//var cnProfessions = from x in Funs.DB.WBS_CnProfession where x.InstallationId == installationId select x;
|
|
|
|
|
//foreach (var cnProfession in cnProfessions)
|
|
|
|
|
//{
|
|
|
|
|
// BLL.WbsDetailService.DeleteWbsDetailByToWbs(cnProfession.CnProfessionId); //删除进度记录
|
|
|
|
|
// BLL.CnProfessionService.DeleteCnProfession(cnProfession.CnProfessionId);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
BLL.WbsDetailService.DeleteWbsDetailByToWbs(installationId); //删除进度记录
|
|
|
|
|
BLL.Project_InstallationService.DeleteInstallation(installationId);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
if (this.Grid1.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
SaveData();
|
|
|
|
|
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#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()
|
|
|
|
|
{
|
|
|
|
|
List<Model.WBSSetInitItem> items = new List<Model.WBSSetInitItem>();
|
|
|
|
|
if (this.trProjects.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (this.trProjects.SelectedNode.CommandName == "installation")
|
|
|
|
|
{
|
|
|
|
|
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(this.trProjects.SelectedNode.NodeID);
|
|
|
|
|
Model.WBSSetInitItem item = new Model.WBSSetInitItem();
|
|
|
|
|
if (installation != null)
|
|
|
|
|
{
|
|
|
|
|
item.Code = installation.InstallationCode;
|
|
|
|
|
item.Name = installation.InstallationName;
|
|
|
|
|
item.StartDate = installation.StartDate;
|
|
|
|
|
item.EndDate = installation.EndDate;
|
|
|
|
|
item.Type = "installation";
|
|
|
|
|
items.Add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.Grid1.DataSource = items;
|
|
|
|
|
this.Grid1.DataBind();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 根据所给Id定位到对应装置
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据所给Id定位到对应装置
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void getWBSSet()
|
|
|
|
|
{
|
|
|
|
|
string installationId = string.Empty;
|
|
|
|
|
string pInstallationId = string.Empty;
|
|
|
|
|
string ppInstallationId = string.Empty;
|
|
|
|
|
string projectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
string id = this.hdSelectId.Text;
|
2021-08-13 11:15:59 +08:00
|
|
|
|
//Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(id);
|
|
|
|
|
//if (installation.SuperInstallationId == "0") //一级装置
|
|
|
|
|
//{
|
|
|
|
|
// ppInstallationId = id;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// if (BLL.Project_InstallationService.IsCanAddInstallation(id)) //二级装置
|
|
|
|
|
// {
|
|
|
|
|
// pInstallationId = id;
|
|
|
|
|
// ppInstallationId = installation.SuperInstallationId;
|
|
|
|
|
// }
|
|
|
|
|
// else //三级装置
|
|
|
|
|
// {
|
|
|
|
|
// installationId = id;
|
|
|
|
|
// pInstallationId = installation.SuperInstallationId;
|
|
|
|
|
// Model.Project_Installation pInstallation = BLL.Project_InstallationService.GetInstallationByInstallationId(installation.SuperInstallationId);
|
|
|
|
|
// if (pInstallation != null)
|
|
|
|
|
// {
|
|
|
|
|
// ppInstallationId = pInstallation.SuperInstallationId;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
string ids = BLL.Project_InstallationService.GetParentInstallationIds(id);
|
|
|
|
|
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.trProjects.Nodes.Clear();
|
|
|
|
|
this.trProjects.ShowBorder = false;
|
|
|
|
|
this.trProjects.ShowHeader = false;
|
|
|
|
|
this.trProjects.EnableIcons = true;
|
|
|
|
|
this.trProjects.AutoScroll = true;
|
|
|
|
|
this.trProjects.EnableSingleClickExpand = true;
|
|
|
|
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
if (project != null)
|
|
|
|
|
{
|
|
|
|
|
TreeNode node = new TreeNode();
|
|
|
|
|
node.Text = project.ProjectName;
|
|
|
|
|
node.NodeID = project.ProjectId;
|
|
|
|
|
node.EnableClickEvent = true;
|
|
|
|
|
this.trProjects.Nodes.Add(node);
|
|
|
|
|
node.Expanded = true;
|
|
|
|
|
var installation1s = from x in Funs.DB.Project_Installation
|
|
|
|
|
where x.ProjectId == projectId && x.SuperInstallationId == "0"
|
|
|
|
|
orderby x.InstallationCode
|
|
|
|
|
select x;
|
|
|
|
|
foreach (var installation1 in installation1s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode1 = new TreeNode();
|
|
|
|
|
newNode1.Text = installation1.InstallationName;
|
|
|
|
|
newNode1.NodeID = installation1.InstallationId;
|
|
|
|
|
newNode1.CommandName = "installation";
|
|
|
|
|
newNode1.EnableExpandEvent = true;
|
|
|
|
|
newNode1.EnableClickEvent = true;
|
|
|
|
|
node.Nodes.Add(newNode1);
|
2021-08-13 11:15:59 +08:00
|
|
|
|
if (ids.Contains(installation1.InstallationId))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
|
|
|
|
newNode1.Expanded = true;
|
|
|
|
|
var installation2s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation1.InstallationId orderby x.InstallationCode select x;
|
|
|
|
|
foreach (var installation2 in installation2s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode2 = new TreeNode();
|
|
|
|
|
newNode2.Text = installation2.InstallationName;
|
|
|
|
|
newNode2.NodeID = installation2.InstallationId;
|
|
|
|
|
newNode2.CommandName = "installation";
|
|
|
|
|
newNode2.EnableExpandEvent = true;
|
|
|
|
|
newNode2.EnableClickEvent = true;
|
|
|
|
|
newNode1.Nodes.Add(newNode2);
|
2021-08-13 11:15:59 +08:00
|
|
|
|
if (ids.Contains(installation2.InstallationId))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
|
|
|
|
newNode2.Expanded = true;
|
|
|
|
|
var installation3s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation2.InstallationId orderby x.InstallationCode select x;
|
|
|
|
|
foreach (var installation3 in installation3s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode3 = new TreeNode();
|
|
|
|
|
newNode3.Text = installation3.InstallationName;
|
|
|
|
|
newNode3.NodeID = installation3.InstallationId;
|
|
|
|
|
newNode3.CommandName = "installation";
|
|
|
|
|
newNode3.EnableExpandEvent = true;
|
|
|
|
|
newNode3.EnableClickEvent = true;
|
|
|
|
|
newNode2.Nodes.Add(newNode3);
|
2021-08-13 11:15:59 +08:00
|
|
|
|
if (ids.Contains(installation3.InstallationId))
|
|
|
|
|
{
|
|
|
|
|
newNode3.Expanded = true;
|
|
|
|
|
var installation4s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation3.InstallationId orderby x.InstallationCode select x;
|
|
|
|
|
foreach (var installation4 in installation4s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode4 = new TreeNode();
|
|
|
|
|
newNode4.Text = installation4.InstallationName;
|
|
|
|
|
newNode4.NodeID = installation4.InstallationId;
|
|
|
|
|
newNode4.CommandName = "installation";
|
|
|
|
|
newNode4.EnableExpandEvent = true;
|
|
|
|
|
newNode4.EnableClickEvent = true;
|
|
|
|
|
newNode3.Nodes.Add(newNode4);
|
|
|
|
|
if (ids.Contains(installation4.InstallationId))
|
|
|
|
|
{
|
|
|
|
|
newNode4.Expanded = true;
|
|
|
|
|
var installation5s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation4.InstallationId orderby x.InstallationCode select x;
|
|
|
|
|
foreach (var installation5 in installation5s)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode5 = new TreeNode();
|
|
|
|
|
newNode5.Text = installation5.InstallationName;
|
|
|
|
|
newNode5.NodeID = installation5.InstallationId;
|
|
|
|
|
newNode5.CommandName = "installation";
|
|
|
|
|
newNode5.EnableExpandEvent = true;
|
|
|
|
|
newNode5.EnableClickEvent = true;
|
|
|
|
|
newNode4.Nodes.Add(newNode5);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(installation4.InstallationId))
|
|
|
|
|
{
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
newNode4.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(installation3.InstallationId))
|
|
|
|
|
{
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
newNode3.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(installation2.InstallationId))
|
|
|
|
|
{
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
newNode2.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(installation1.InstallationId))
|
|
|
|
|
{
|
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
|
|
|
emptyNode.Text = "";
|
|
|
|
|
emptyNode.NodeID = "";
|
|
|
|
|
newNode1.Nodes.Add(emptyNode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.trProjects.SelectedNodeID = this.hdSelectId.Text;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|