This commit is contained in:
gaofei
2021-08-13 11:15:59 +08:00
parent 43acc57060
commit d8dff88c39
320 changed files with 37219 additions and 4678 deletions
@@ -62,6 +62,14 @@ namespace FineUIPro.Web.ProjectData
{
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", installation1.EndDate);
}
if (installation1.IsEnd == true)
{
this.drpIsEnd.SelectedValue = "True";
}
else
{
this.drpIsEnd.SelectedValue = "False";
}
this.txtRemark.Text = installation1.Def;
}
}
@@ -102,103 +110,127 @@ namespace FineUIPro.Web.ProjectData
{
installation.EndDate = Convert.ToDateTime(txtEndDate.Text.Trim());
}
installation.IsEnd = Convert.ToBoolean(this.drpIsEnd.SelectedValue);
installation.Def = txtRemark.Text.Trim();
if (string.IsNullOrEmpty(id))
{
installation.InstallationId = SQLHelper.GetNewID(typeof(Model.Project_Installation));
BLL.Project_InstallationService.AddInstallation(installation);
if (parInstallation != null)
if (this.drpIsEnd.SelectedValue == "True")
{
Model.Project_Installation pparInstallation = BLL.Project_InstallationService.GetInstallationByInstallationId(parInstallation.SuperInstallationId);
if (pparInstallation != null && pparInstallation.SuperInstallationId == "0") //当前装置级别为主项,拷贝WBS数据
installationId = installation.InstallationId;
startDate = installation.StartDate;
endDate = installation.EndDate;
//拷贝专业
var cnProfessionInits = from x in Funs.DB.WBS_CnProfessionInit where x.CnProfessionId != 20 select x;
foreach (var cnProfessionInit in cnProfessionInits)
{
installationId = installation.InstallationId;
startDate = installation.StartDate;
endDate = installation.EndDate;
//拷贝专业
var cnProfessionInits = from x in Funs.DB.WBS_CnProfessionInit where x.CnProfessionId != 20 select x;
foreach (var cnProfessionInit in cnProfessionInits)
Model.WBS_CnProfession cnProfession = new Model.WBS_CnProfession();
cnProfession.CnProfessionName = cnProfessionInit.CnProfessionName;
cnProfession.CnProfessionCode = cnProfessionInit.CnProfessionCode;
cnProfession.InstallationId = installationId;
cnProfession.ProjectId = projectId;
cnProfession.StartDate = startDate;
cnProfession.EndDate = endDate;
cnProfession.OldId = cnProfessionInit.CnProfessionId;
BLL.CnProfessionService.AddCnProfession(cnProfession);
}
//拷贝单位工程及子单位工程
var unitProjectInits = from x in Funs.DB.Wbs_UnitProjectInit where x.CnProfessionId != 20 orderby x.SuperUnitProject select x;
foreach (var unitProjectInit in unitProjectInits)
{
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 = installationId;
unitProject.SortIndex = unitProjectInit.SortIndex;
//获取对应的专业Id
string cnProfessionId = (from x in Funs.DB.WBS_CnProfession
where x.InstallationId == installationId && x.OldId == unitProjectInit.CnProfessionId
select x.CnProfessionId).FirstOrDefault();
if (unitProjectInit.SuperUnitProject == null)
{
Model.WBS_CnProfession cnProfession = new Model.WBS_CnProfession();
cnProfession.CnProfessionName = cnProfessionInit.CnProfessionName;
cnProfession.CnProfessionCode = cnProfessionInit.CnProfessionCode;
cnProfession.InstallationId = installationId;
cnProfession.ProjectId = projectId;
cnProfession.StartDate = startDate;
cnProfession.EndDate = endDate;
cnProfession.OldId = cnProfessionInit.CnProfessionId;
BLL.CnProfessionService.AddCnProfession(cnProfession);
unitProject.SuperUnitProjectId = null;
}
//拷贝单位工程及子单位工程
var unitProjectInits = from x in Funs.DB.Wbs_UnitProjectInit where x.CnProfessionId != 20 orderby x.SuperUnitProject select x;
foreach (var unitProjectInit in unitProjectInits)
else
{
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 = installationId;
//获取对应的专业Id
string cnProfessionId = (from x in Funs.DB.WBS_CnProfession
where x.InstallationId == installationId && x.OldId == unitProjectInit.CnProfessionId
select x.CnProfessionId).FirstOrDefault();
if (unitProjectInit.SuperUnitProject == null)
{
unitProject.SuperUnitProjectId = null;
}
else
{
unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.CnProfessionId == cnProfessionId
select x.UnitProjectId).FirstOrDefault();
}
unitProject.ProjectId = projectId;
unitProject.CnProfessionId = cnProfessionId;
unitProject.StartDate = startDate;
unitProject.EndDate = endDate;
unitProject.Remark = unitProjectInit.Remark;
unitProject.IsIn = true;
BLL.UnitProjectService.AddUnitProject(unitProject);
unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.CnProfessionId == cnProfessionId
select x.UnitProjectId).FirstOrDefault();
}
//拷贝分部/子分部/分项/子分项
wbsSetInits = (from x in Funs.DB.WBS_WbsSetInit where x.CnProfessionId != 20 orderby x.SuperWbsSetCode select x).ToList();
foreach (var wbsSetInit in wbsSetInits)
unitProject.ProjectId = projectId;
unitProject.CnProfessionId = cnProfessionId;
unitProject.StartDate = startDate;
unitProject.EndDate = endDate;
unitProject.Remark = unitProjectInit.Remark;
unitProject.IsIn = true;
BLL.UnitProjectService.AddUnitProject(unitProject);
}
//拷贝分部/子分部/分项/子分项
wbsSetInits = (from x in Funs.DB.WBS_WbsSetInit where x.CnProfessionId != 20 orderby x.SuperWbsSetCode select x).ToList();
foreach (var wbsSetInit in wbsSetInits)
{
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 = installationId;
//获取对应的专业Id
string cnProfessionId = (from x in Funs.DB.WBS_CnProfession
where x.InstallationId == installationId && x.OldId == wbsSetInit.CnProfessionId
select x.CnProfessionId).FirstOrDefault();
wbsSet.CnProfessionId = cnProfessionId;
wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.CnProfessionId == cnProfessionId select x.UnitProjectId).FirstOrDefault();
if (wbsSetInit.SuperWbsSetCode == 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 = installationId;
//获取对应的专业Id
string cnProfessionId = (from x in Funs.DB.WBS_CnProfession
where x.InstallationId == installationId && x.OldId == wbsSetInit.CnProfessionId
select x.CnProfessionId).FirstOrDefault();
wbsSet.CnProfessionId = cnProfessionId;
wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.CnProfessionId == cnProfessionId 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 == installationId && x.CnProfessionId == cnProfessionId
select x.WbsSetId).FirstOrDefault();
}
if (projectId.Contains("?"))
{
projectId = projectId.Substring(0, projectId.LastIndexOf("?"));
}
wbsSet.ProjectId = projectId;
wbsSet.StartDate = startDate;
wbsSet.EndDate = endDate;
wbsSet.Flag = wbsSetInit.Flag;
wbsSet.Way = wbsSetInit.Way;
wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
wbsSet.ControlPoint = wbsSetInit.ControlPoint;
wbsSet.Remark = wbsSetInit.Remark;
wbsSet.IsIn = true;
BLL.WbsSetService.AddWbsSet(wbsSet);
wbsSet.SuperWbsSetId = null;
}
else
{
wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == installationId && x.CnProfessionId == cnProfessionId
select x.WbsSetId).FirstOrDefault();
}
if (projectId.Contains("?"))
{
projectId = projectId.Substring(0, projectId.LastIndexOf("?"));
}
wbsSet.ProjectId = projectId;
wbsSet.StartDate = startDate;
wbsSet.EndDate = endDate;
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;
BLL.WbsSetService.AddWbsSet(wbsSet);
}
var totalCostControlInits = from x in Funs.DB.WBS_CostControlInit orderby x.CostControlInitCode select x;
//拷贝费用清单对应关系
var wbsSetMatchCostControlInits = from x in Funs.DB.WBS_WbsSetMatchCostControlInit orderby x.WbsSetCode select x;
foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControlInits)
{
Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
wbsSetMatchCostControl.WbsSetId = (from x in Funs.DB.Wbs_WbsSet
where x.WbsSetCode == wbsSetMatchCostControlInit.WbsSetCode && x.InstallationId == installationId
select x.WbsSetId).FirstOrDefault();
wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
BLL.WbsSetMatchCostControlService.AddWbsSetMatchCostControl(wbsSetMatchCostControl);
//拷贝费用清单项
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.ProjectId = projectId;
costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
costControl.CostControlCode = costControlInit.CostControlInitCode;
costControl.CostControlName = costControlInit.CostControlInitName;
costControl.Unit = costControlInit.Unit;
BLL.CostControlService.AddCostControl(costControl);
}
}
}
@@ -212,7 +244,7 @@ namespace FineUIPro.Web.ProjectData
installation.SuperInstallationId = installation1.SuperInstallationId;
BLL.Project_InstallationService.UpdateInstallation(installation);
//更新子级WBS内容计划时间
if (!BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(id)) //末级装置节点
if (this.drpIsEnd.SelectedValue == "True") //末级装置节点
{
var cns = BLL.CnProfessionService.GetCnProfessionByInstallation(id);
if (cns.Count > 0)