提交代码
This commit is contained in:
@@ -241,410 +241,84 @@ namespace FineUIPro.Web.ProjectData
|
||||
{
|
||||
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnAdd))
|
||||
{
|
||||
Model.Project_Installation installation1 = BLL.Project_InstallationService.GetProjectInstallationByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (installation1 != null)
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.JDGL_WBS wbs1 = db.JDGL_WBS.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId);
|
||||
if (wbs1 != null)
|
||||
{
|
||||
ShowNotify("项目已存在装置,无法抽取!", MessageBoxIcon.Warning);
|
||||
ShowNotify("项目已存在数据,无法抽取!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||
string contenttype = "application/json;charset=utf-8";
|
||||
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二、本次投标范围为:空分装置,净化装置,合成氨装置,罐区,尿素装置,尿基复合肥装置,硫回收装置,锅炉装置(2x220t/h循环流化床锅炉)、水处理系统装置等全厂公辅,全厂总图、外线、地管、道路、控制室、变电所等,总体院。','isBreakdown':false,'isSpecial':false,'isKey':false,'status':'COMPLETION','guid':'9ffcd266-7196-4df1-9432-b818a5c91a6f','createdAt':'2023-02-01T15:30:18.013','updatedAt':'2023-07-27T16:58:14.37','id':34964}]},'targetUrl':null,'success':true,'error':null,'unAuthorizedRequest':false,'__abp':true}";
|
||||
var returndata0 = BLL.APIGetHttpService.ControlHttp(Funs.ControlApiUrl + "/project/api/hcoud-wuhuan/projectwbsconstruct/constructionTree?wuId=" + project.KZProjectCode, "GET", contenttype, null, null);
|
||||
var returndata1 = BLL.APIGetHttpService.ControlHttp(Funs.ControlApiUrl + "/project/api/hcoud-wuhuan/projectwbsconstruct/checkPointList?wuId=" + project.KZProjectCode, "GET", contenttype, null, null);
|
||||
List<Model.JDGL_WBS> wbss = new List<Model.JDGL_WBS>();
|
||||
List<Model.JDGL_WBSDetail> wbsDetails = new List<Model.JDGL_WBSDetail>();
|
||||
if (!string.IsNullOrEmpty(returndata0))
|
||||
{
|
||||
JObject obj0 = JObject.Parse(returndata0);
|
||||
JArray arr0 = JArray.Parse(obj0["result"]["items"].ToString());
|
||||
string proId = string.Empty;
|
||||
foreach (var item in arr0)
|
||||
if (obj0["code"].ToString() == "200")
|
||||
{
|
||||
string projType = item["projType"].ToString();
|
||||
string projPhase = item["projPhase"].ToString();
|
||||
if (project.ProjType == projType && project.ProjPhase == projPhase)
|
||||
JArray arr0 = JArray.Parse(obj0["data"].ToString());
|
||||
string proId = string.Empty;
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (var item in arr0)
|
||||
{
|
||||
proId= item["id"].ToString();
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
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")
|
||||
Model.JDGL_WBS wBS = new Model.JDGL_WBS();
|
||||
wBS.Id = item["id"].ToString();
|
||||
wBS.ProjectId = this.CurrUser.LoginProjectId;
|
||||
wBS.ParentId = item["parentId"].ToString();
|
||||
wBS.Leave = Funs.GetNewInt(item["leave"].ToString());
|
||||
wBS.PathCode = item["pathCode"].ToString();
|
||||
wBS.ItemName = item["itemName"].ToString();
|
||||
wBS.PlanQuantities = Funs.GetNewDecimal(item["planQuantities"].ToString());
|
||||
wBS.PlanEnd = Funs.GetNewDateTime(item["planEnd"].ToString());
|
||||
wBS.RealityEnd = Funs.GetNewDateTime(item["realityEnd"].ToString());
|
||||
wBS.RealityPrice = Funs.GetNewDecimal(item["realityPrice"].ToString());
|
||||
wBS.Total= Funs.GetNewDecimal(item["total"].ToString());
|
||||
wBS.Num = Funs.GetNewDecimal(item["num"].ToString());
|
||||
wBS.Cycle = item["cycle"].ToString();
|
||||
wBS.PlanPrice= Funs.GetNewDecimal(item["planPrice"].ToString());
|
||||
if (!list.Contains(wBS.Id))
|
||||
{
|
||||
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 == "施工")
|
||||
{
|
||||
sgId = id;
|
||||
}
|
||||
}
|
||||
else if (level == "5")
|
||||
{
|
||||
var cn = cnProfessionInits.FirstOrDefault(x => x.CnProfessionName.Contains(name.Substring(0, 2)));
|
||||
//拷贝专业
|
||||
if (cn != null)
|
||||
{
|
||||
if (cn.CnProfessionName != "防腐绝热" && cn.CnProfessionName != "地勘" && cn.CnProfessionName != "全厂地下主管网" && cn.CnProfessionName != "临时设施" && cn.CnProfessionName != "总图")
|
||||
{
|
||||
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);
|
||||
db.SubmitChanges();
|
||||
//单位工程
|
||||
var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
||||
foreach (var unitProjectInit in unitProjects)
|
||||
{
|
||||
Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
|
||||
unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
|
||||
unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
|
||||
unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
|
||||
unitProject.InstallationId = parentId;
|
||||
unitProject.SortIndex = unitProjectInit.SortIndex;
|
||||
unitProject.SuperUnitProjectId = null;
|
||||
unitProject.ProjectId = this.CurrUser.LoginProjectId;
|
||||
unitProject.CnProfessionId = id;
|
||||
unitProject.StartDate = Funs.GetNewDateTime(planStart);
|
||||
unitProject.EndDate = Funs.GetNewDateTime(planFinish);
|
||||
unitProject.Remark = unitProjectInit.Remark;
|
||||
unitProject.IsIn = true;
|
||||
db.Wbs_UnitProject.InsertOnSubmit(unitProject);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
//分部分项
|
||||
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;
|
||||
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();
|
||||
if (wbsSetInit.SuperWbsSetCode == null)
|
||||
{
|
||||
wbsSet.SuperWbsSetId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
wbsSet.SuperWbsSetId = (from x in db.Wbs_WbsSet
|
||||
where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == parentId && x.CnProfessionId == 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
|
||||
if (oldInstallation == null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
//拷贝分部/子分部/分项/子分项
|
||||
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;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
//拷贝分部/子分部/分项/子分项
|
||||
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;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
wbss.Add(wBS);
|
||||
list.Add(wBS.Id);
|
||||
}
|
||||
}
|
||||
ShowNotify("抽取成功!", MessageBoxIcon.Success);
|
||||
InitTreeMenu();
|
||||
//InitTreeMenu();
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(returndata1))
|
||||
{
|
||||
JObject obj0 = JObject.Parse(returndata1);
|
||||
if (obj0["code"].ToString() == "200")
|
||||
{
|
||||
JArray arr0 = JArray.Parse(obj0["data"].ToString());
|
||||
string proId = string.Empty;
|
||||
|
||||
List<string> list = new List<string>();
|
||||
foreach (var item in arr0)
|
||||
{
|
||||
Model.JDGL_WBSDetail wBSDetail = new Model.JDGL_WBSDetail();
|
||||
wBSDetail.Id = item["id"].ToString();
|
||||
wBSDetail.ProjectId = this.CurrUser.LoginProjectId;
|
||||
wBSDetail.CompletionTime = Funs.GetNewDateTime(item["completionTime"].ToString());
|
||||
wBSDetail.WorkPackageId = item["workPackageId"].ToString();
|
||||
wBSDetail.Name = item["name"].ToString();
|
||||
wBSDetail.RealityCompletePercent = Funs.GetNewDecimal(item["realityCompletePercent"].ToString());
|
||||
//if (!list.Contains(wBS.Id))
|
||||
//{
|
||||
// wbss.Add(wBS);
|
||||
// list.Add(wBS.Id);
|
||||
//}
|
||||
}
|
||||
//InitTreeMenu();
|
||||
}
|
||||
}
|
||||
db.JDGL_WBS.InsertAllOnSubmit(wbss);
|
||||
db.SubmitChanges();
|
||||
ShowNotify("抽取成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user