合并最新
This commit is contained in:
@@ -74,18 +74,16 @@ namespace FineUIPro.Web.ProjectData
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string projectId = string.Empty;
|
||||
string projectId = this.CurrUser.LoginProjectId;
|
||||
string superInstallationId = string.Empty;
|
||||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(superId);
|
||||
Model.Project_Installation parInstallation = BLL.Project_InstallationService.GetInstallationByInstallationId(superId);
|
||||
if (project != null)
|
||||
{
|
||||
projectId = project.ProjectId;
|
||||
superInstallationId = "0";
|
||||
}
|
||||
else if (parInstallation != null)
|
||||
{
|
||||
projectId = parInstallation.ProjectId;
|
||||
superInstallationId = superId;
|
||||
}
|
||||
|
||||
@@ -107,101 +105,102 @@ namespace FineUIPro.Web.ProjectData
|
||||
{
|
||||
installation.InstallationId = SQLHelper.GetNewID(typeof(Model.Project_Installation));
|
||||
BLL.Project_InstallationService.AddInstallation(installation);
|
||||
if (parInstallation != null)
|
||||
//if (parInstallation != null)
|
||||
//{
|
||||
// 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 != 23 select x;
|
||||
foreach (var cnProfessionInit in cnProfessionInits)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
//获取对应的专业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);
|
||||
}
|
||||
//拷贝分部/子分部/分项/子分项
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
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 != 23 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;
|
||||
//获取对应的专业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;
|
||||
unitProject.SortIndex = unitProjectInit.SortIndex;
|
||||
BLL.UnitProjectService.AddUnitProject(unitProject);
|
||||
}
|
||||
//拷贝分部/子分部/分项/子分项
|
||||
wbsSetInits = (from x in Funs.DB.WBS_WbsSetInit where x.CnProfessionId != 23 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// }
|
||||
//}
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, installation.InstallationId, installation.InstallationId, BLL.Const.ProjectInstallationMenuId, "增加装置/单元!");
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(installation.InstallationId) + ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
@@ -211,37 +210,133 @@ namespace FineUIPro.Web.ProjectData
|
||||
installation.InstallationId = id;
|
||||
installation.SuperInstallationId = installation1.SuperInstallationId;
|
||||
BLL.Project_InstallationService.UpdateInstallation(installation);
|
||||
//更新子级WBS内容计划时间
|
||||
if (!BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(id)) //末级装置节点
|
||||
var cnProfessionOld = Funs.DB.WBS_CnProfession.FirstOrDefault(x => x.InstallationId == id);
|
||||
if (cnProfessionOld == null)
|
||||
{
|
||||
var cns = BLL.CnProfessionService.GetCnProfessionByInstallation(id);
|
||||
if (cns.Count > 0)
|
||||
installationId = installation.InstallationId;
|
||||
startDate = installation.StartDate;
|
||||
endDate = installation.EndDate;
|
||||
//拷贝专业
|
||||
var cnProfessionInits = from x in Funs.DB.WBS_CnProfessionInit where x.CnProfessionId != 23 select x;
|
||||
foreach (var cnProfessionInit in cnProfessionInits)
|
||||
{
|
||||
foreach (var cn in cns)
|
||||
{
|
||||
cn.StartDate = installation.StartDate;
|
||||
cn.EndDate = installation.EndDate;
|
||||
BLL.CnProfessionService.UpdateCnProfession(cn);
|
||||
}
|
||||
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 unitProjects = BLL.UnitProjectService.GetUnitProjectsByInstallationId(id);
|
||||
if (unitProjects.Count > 0)
|
||||
//拷贝单位工程及子单位工程
|
||||
var unitProjectInits = from x in Funs.DB.Wbs_UnitProjectInit where x.CnProfessionId != 23 orderby x.SuperUnitProject select x;
|
||||
foreach (var unitProjectInit in unitProjectInits)
|
||||
{
|
||||
foreach (var up 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 = 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)
|
||||
{
|
||||
up.StartDate = installation.StartDate;
|
||||
up.EndDate = installation.EndDate;
|
||||
BLL.UnitProjectService.UpdateUnitProject(up);
|
||||
unitProject.SuperUnitProjectId = null;
|
||||
}
|
||||
}
|
||||
var wbsSets = BLL.WbsSetService.GetWbsSetsByInstallationId(id);
|
||||
if (wbsSets.Count > 0)
|
||||
{
|
||||
foreach (var ws in wbsSets)
|
||||
else
|
||||
{
|
||||
ws.StartDate = installation.StartDate;
|
||||
ws.EndDate = installation.EndDate;
|
||||
BLL.WbsSetService.UpdateWbsSet(ws);
|
||||
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;
|
||||
unitProject.SortIndex = unitProjectInit.SortIndex;
|
||||
BLL.UnitProjectService.AddUnitProject(unitProject);
|
||||
}
|
||||
//拷贝分部/子分部/分项/子分项
|
||||
wbsSetInits = (from x in Funs.DB.WBS_WbsSetInit where x.CnProfessionId != 23 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//更新子级WBS内容计划时间
|
||||
if (!BLL.Project_InstallationService.IsExitsInstallationsBySuperInstallationId(id)) //末级装置节点
|
||||
{
|
||||
var cns = BLL.CnProfessionService.GetCnProfessionByInstallation(id);
|
||||
if (cns.Count > 0)
|
||||
{
|
||||
foreach (var cn in cns)
|
||||
{
|
||||
cn.StartDate = installation.StartDate;
|
||||
cn.EndDate = installation.EndDate;
|
||||
BLL.CnProfessionService.UpdateCnProfession(cn);
|
||||
}
|
||||
}
|
||||
var unitProjects = BLL.UnitProjectService.GetUnitProjectsByInstallationId(id);
|
||||
if (unitProjects.Count > 0)
|
||||
{
|
||||
foreach (var up in unitProjects)
|
||||
{
|
||||
up.StartDate = installation.StartDate;
|
||||
up.EndDate = installation.EndDate;
|
||||
BLL.UnitProjectService.UpdateUnitProject(up);
|
||||
}
|
||||
}
|
||||
var wbsSets = BLL.WbsSetService.GetWbsSetsByInstallationId(id);
|
||||
if (wbsSets.Count > 0)
|
||||
{
|
||||
foreach (var ws in wbsSets)
|
||||
{
|
||||
ws.StartDate = installation.StartDate;
|
||||
ws.EndDate = installation.EndDate;
|
||||
BLL.WbsSetService.UpdateWbsSet(ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user