1229-gaofei
This commit is contained in:
@@ -249,15 +249,16 @@ namespace FineUIPro.Web.ProjectData
|
||||
JArray arr = JArray.Parse(obj["result"].ToString());
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
//专业
|
||||
var cnProfessionInits = from x in db.WBS_CnProfessionInit where x.CnProfessionId < 19 select x;
|
||||
var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
|
||||
//单位工程及子单位工程
|
||||
var unitProjectInits = from x in db.Wbs_UnitProjectInit where x.CnProfessionId < 19 orderby x.SuperUnitProject select x;
|
||||
var unitProjectInits = from x in db.Wbs_UnitProjectInit orderby x.SuperUnitProject select x;
|
||||
//分部/子分部/分项/子分项
|
||||
var wbsSetInits = (from x in db.WBS_WbsSetInit where x.CnProfessionId < 19 orderby x.SuperWbsSetCode select x).ToList();
|
||||
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,主键
|
||||
@@ -285,6 +286,10 @@ namespace FineUIPro.Web.ProjectData
|
||||
installation.Def = remark;
|
||||
db.Project_Installation.InsertOnSubmit(installation);
|
||||
db.SubmitChanges();
|
||||
if (name == "施工")
|
||||
{
|
||||
sgId = id;
|
||||
}
|
||||
}
|
||||
else if (level == "5")
|
||||
{
|
||||
@@ -292,94 +297,320 @@ namespace FineUIPro.Web.ProjectData
|
||||
//拷贝专业
|
||||
if (cn != null)
|
||||
{
|
||||
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)
|
||||
if (cn.CnProfessionName != "防腐绝热" && cn.CnProfessionName != "地勘" && cn.CnProfessionName != "全厂地下主管网" && cn.CnProfessionName != "临时设施" && cn.CnProfessionName != "总图")
|
||||
{
|
||||
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);
|
||||
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 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)
|
||||
//单位工程
|
||||
var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
||||
foreach (var unitProjectInit in unitProjects)
|
||||
{
|
||||
wbsSet.SuperWbsSetId = null;
|
||||
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();
|
||||
}
|
||||
else
|
||||
//分部分项
|
||||
var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
|
||||
foreach (var wbsSetInit in wbsSets)
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,6 +619,7 @@ namespace FineUIPro.Web.ProjectData
|
||||
}
|
||||
}
|
||||
ShowNotify("抽取成功!", MessageBoxIcon.Success);
|
||||
InitTreeMenu();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user