1221-002-gaofei

This commit is contained in:
gaofei
2021-12-21 16:10:02 +08:00
parent 6887e55225
commit 0bf6d1efd7
22 changed files with 1553 additions and 548 deletions
+331 -289
View File
@@ -24,7 +24,7 @@ namespace FineUIPro.Web.JDGL.WBS
GetButtonPower();
InitTreeMenu();
this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
Funs.FineUIPleaseSelect(this.drpWeek);
//Funs.FineUIPleaseSelect(this.drpWeek);
}
}
@@ -316,6 +316,51 @@ namespace FineUIPro.Web.JDGL.WBS
}
#endregion
#region
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
ShowNotify("录入成功!", MessageBoxIcon.Success);
}
#endregion
/// <summary>
/// 右键录入事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (this.trWBS.SelectedNode != null)
{
if (this.trWBS.SelectedNode.CommandName != "project" && this.trWBS.SelectedNode.CommandName != "installation" && this.trWBS.SelectedNode.CommandName != "cnProfession") //非项目、装置、专业节点可以修改
{
this.hdSelectId.Text = this.trWBS.SelectedNode.NodeID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WorkloadInputEdit.aspx?Id={0}", this.trWBS.SelectedNode.NodeID, "编辑 - ")));
}
else
{
if (this.trWBS.SelectedNode.Text == "总图")
{
this.hdSelectId.Text = this.trWBS.SelectedNode.NodeID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WBSSetAuditEdit.aspx?Id={0}&Type={1}&oper=modify", this.trWBS.SelectedNode.NodeID, this.trWBS.SelectedNode.CommandName, "编辑 - ")));
}
else
{
ShowNotify("项目、装置、专业节点无法修改!", MessageBoxIcon.Warning);
}
}
}
else
{
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
}
}
#region
/// <summary>
/// 保存
@@ -336,231 +381,231 @@ namespace FineUIPro.Web.JDGL.WBS
oldThisPlanValue = 0, oldThisRealCost = 0, oldThisPlanCost = 0,
thisPlanValue = 0, thisRealCost = 0, thisPlanCost = 0;
JArray mergedData = Grid1.GetMergedData();
if (this.drpWeek.SelectedValue == BLL.Const._Null) //保存月记录
//if (this.drpWeek.SelectedValue == BLL.Const._Null) //保存月记录
//{
foreach (JObject mergedRow in mergedData)
{
foreach (JObject mergedRow in mergedData)
oldThisPlanValue = 0;
oldThisRealCost = 0;
oldThisPlanCost = 0;
JObject values = mergedRow.Value<JObject>("values");
string costControlDetailId = values.Value<string>("CostControlDetailId");
string costControlId = values.Value<string>("CostControlId");
string thisNum = values.Value<string>("ThisNum");
string planPrice = values.Value<string>("PlanPrice");
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlDetailId(costControlDetailId);
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
if (costControlDetail != null)
{
oldThisPlanValue = 0;
oldThisRealCost = 0;
oldThisPlanCost = 0;
JObject values = mergedRow.Value<JObject>("values");
string costControlDetailId = values.Value<string>("CostControlDetailId");
string costControlId = values.Value<string>("CostControlId");
string thisNum = values.Value<string>("ThisNum");
string planPrice = values.Value<string>("PlanPrice");
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlDetailId(costControlDetailId);
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
if (costControlDetail != null)
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
if (!string.IsNullOrEmpty(thisNum))
{
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
if (!string.IsNullOrEmpty(thisNum))
{
costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
}
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.UpdateCostControlDetail(costControlDetail);
costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
}
else
{
costControlDetail = new Model.WBS_CostControlDetail();
costControlDetail.CostControlDetailId = costControlDetailId;
costControlDetail.CostControlId = costControlId;
costControlDetail.Months = months;
if (!string.IsNullOrEmpty(thisNum))
{
costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
}
thisPlanValue = 0;
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
}
//累加变化值,计算总的变化值
changeThisRealCost += thisRealCost - oldThisRealCost;
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
}
//累计所有子节点的计划值
var costControls = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
foreach (var item in costControls)
{
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(item.CostControlId, months);
if (costControlDetail != null)
{
changeThisPlanValue += (costControlDetail.PlanNum ?? 0) * (item.PlanPrice ?? 0);
}
}
Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(this.trWBS.SelectedNodeID, months);
if (parentDetail != null) //如果工作项节点存在,则计算计划值差异值
{
changeThisPlanValue = changeThisPlanValue - (parentDetail.ThisPlanValue ?? 0);
}
//更新树节点
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
//更新工作包、工作项
UpdateWbsSetDetail(this.trWBS.SelectedNodeID, months, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//更新分部
Model.WBS_CostControlParentDetail unitProjectDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.UnitProjectId, months);
if (unitProjectDetail != null)
{
unitProjectDetail.ThisPlanValue += changeThisPlanValue;
unitProjectDetail.ThisRealCost += changeThisRealCost;
unitProjectDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(unitProjectDetail);
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.UpdateCostControlDetail(costControlDetail);
}
else
{
unitProjectDetail = new Model.WBS_CostControlParentDetail();
unitProjectDetail.CostControlParentDetailId = SQLHelper.GetNewID();
unitProjectDetail.ParentId = wbsSet.UnitProjectId;
unitProjectDetail.Months = months;
unitProjectDetail.ThisPlanValue = changeThisPlanValue;
unitProjectDetail.ThisRealCost = changeThisRealCost;
unitProjectDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(unitProjectDetail);
costControlDetail = new Model.WBS_CostControlDetail();
costControlDetail.CostControlDetailId = costControlDetailId;
costControlDetail.CostControlId = costControlId;
costControlDetail.Months = months;
if (!string.IsNullOrEmpty(thisNum))
{
costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
}
thisPlanValue = 0;
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
}
//更新专业
Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.CnProfessionId, months);
if (cnProfessionDetail != null)
{
cnProfessionDetail.ThisPlanValue += changeThisPlanValue;
cnProfessionDetail.ThisRealCost += changeThisRealCost;
cnProfessionDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(cnProfessionDetail);
}
else
{
cnProfessionDetail = new Model.WBS_CostControlParentDetail();
cnProfessionDetail.CostControlParentDetailId = SQLHelper.GetNewID();
cnProfessionDetail.ParentId = wbsSet.CnProfessionId;
cnProfessionDetail.Months = months;
cnProfessionDetail.ThisPlanValue = changeThisPlanValue;
cnProfessionDetail.ThisRealCost = changeThisRealCost;
cnProfessionDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(cnProfessionDetail);
}
//更新装置
UpdateInstallationDetail(wbsSet.InstallationId, months, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//累加变化值,计算总的变化值
changeThisRealCost += thisRealCost - oldThisRealCost;
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
}
else //保存周记录
//累计所有子节点的计划值
var costControls = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
foreach (var item in costControls)
{
string[] strs = this.drpWeek.SelectedValue.Split(',');
DateTime startDate = Convert.ToDateTime(strs[0]);
DateTime endDate = Convert.ToDateTime(strs[1]);
foreach (JObject mergedRow in mergedData)
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(item.CostControlId, months);
if (costControlDetail != null)
{
oldThisPlanValue = 0;
oldThisRealCost = 0;
oldThisPlanCost = 0;
JObject values = mergedRow.Value<JObject>("values");
string costControlDetailId = values.Value<string>("CostControlDetailId");
string costControlId = values.Value<string>("CostControlId");
string thisNum = values.Value<string>("ThisNum");
string planPrice = values.Value<string>("PlanPrice");
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlDetailId(costControlDetailId);
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
if (costControlDetail != null)
{
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
if (!string.IsNullOrEmpty(thisNum))
{
costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
}
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.UpdateCostControlDetail(costControlDetail);
}
else
{
costControlDetail = new Model.WBS_CostControlDetail();
costControlDetail.CostControlDetailId = costControlDetailId;
costControlDetail.CostControlId = costControlId;
costControlDetail.Months = months;
costControlDetail.StartDate = startDate;
costControlDetail.EndDate = endDate;
if (!string.IsNullOrEmpty(thisNum))
{
costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
}
thisPlanValue = 0;
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
}
//累加变化值,计算总的变化值
changeThisRealCost += thisRealCost - oldThisRealCost;
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
changeThisPlanValue += (costControlDetail.PlanNum ?? 0) * (item.PlanPrice ?? 0);
}
//累计所有子节点的计划值
var costControls = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
foreach (var item in costControls)
{
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonthsWeek(item.CostControlId, months, startDate);
if (costControlDetail != null)
{
changeThisPlanValue += (costControlDetail.PlanNum ?? 0) * (item.PlanPrice ?? 0);
}
}
Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(this.trWBS.SelectedNodeID, months, startDate);
if (parentDetail != null) //如果工作项节点存在,则计算计划值差异值
{
changeThisPlanValue = changeThisPlanValue - (parentDetail.ThisPlanValue ?? 0);
}
//更新树节点
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
//更新工作包、工作项
UpdateWeekWbsSetDetail(this.trWBS.SelectedNodeID, months, startDate, endDate, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//更新分部
Model.WBS_CostControlParentDetail unitProjectDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(wbsSet.UnitProjectId, months, startDate);
if (unitProjectDetail != null)
{
unitProjectDetail.ThisPlanValue += changeThisPlanValue;
unitProjectDetail.ThisRealCost += changeThisRealCost;
unitProjectDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(unitProjectDetail);
}
else
{
unitProjectDetail = new Model.WBS_CostControlParentDetail();
unitProjectDetail.CostControlParentDetailId = SQLHelper.GetNewID();
unitProjectDetail.ParentId = wbsSet.UnitProjectId;
unitProjectDetail.Months = months;
unitProjectDetail.StartDate = startDate;
unitProjectDetail.EndDate = endDate;
unitProjectDetail.ThisPlanValue = changeThisPlanValue;
unitProjectDetail.ThisRealCost = changeThisRealCost;
unitProjectDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(unitProjectDetail);
}
//更新专业
Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(wbsSet.CnProfessionId, months, startDate);
if (cnProfessionDetail != null)
{
cnProfessionDetail.ThisPlanValue += changeThisPlanValue;
cnProfessionDetail.ThisRealCost += changeThisRealCost;
cnProfessionDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(cnProfessionDetail);
}
else
{
cnProfessionDetail = new Model.WBS_CostControlParentDetail();
cnProfessionDetail.CostControlParentDetailId = SQLHelper.GetNewID();
cnProfessionDetail.ParentId = wbsSet.CnProfessionId;
cnProfessionDetail.Months = months;
cnProfessionDetail.StartDate = startDate;
cnProfessionDetail.EndDate = endDate;
cnProfessionDetail.ThisPlanValue = changeThisPlanValue;
cnProfessionDetail.ThisRealCost = changeThisRealCost;
cnProfessionDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(cnProfessionDetail);
}
//更新装置
UpdateWeekInstallationDetail(wbsSet.InstallationId, months, startDate, endDate, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
}
Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(this.trWBS.SelectedNodeID, months);
if (parentDetail != null) //如果工作项节点存在,则计算计划值差异值
{
changeThisPlanValue = changeThisPlanValue - (parentDetail.ThisPlanValue ?? 0);
}
//更新树节点
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
//更新工作包、工作项
UpdateWbsSetDetail(this.trWBS.SelectedNodeID, months, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//更新分部
Model.WBS_CostControlParentDetail unitProjectDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.UnitProjectId, months);
if (unitProjectDetail != null)
{
unitProjectDetail.ThisPlanValue += changeThisPlanValue;
unitProjectDetail.ThisRealCost += changeThisRealCost;
unitProjectDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(unitProjectDetail);
}
else
{
unitProjectDetail = new Model.WBS_CostControlParentDetail();
unitProjectDetail.CostControlParentDetailId = SQLHelper.GetNewID();
unitProjectDetail.ParentId = wbsSet.UnitProjectId;
unitProjectDetail.Months = months;
unitProjectDetail.ThisPlanValue = changeThisPlanValue;
unitProjectDetail.ThisRealCost = changeThisRealCost;
unitProjectDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(unitProjectDetail);
}
//更新专业
Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.CnProfessionId, months);
if (cnProfessionDetail != null)
{
cnProfessionDetail.ThisPlanValue += changeThisPlanValue;
cnProfessionDetail.ThisRealCost += changeThisRealCost;
cnProfessionDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(cnProfessionDetail);
}
else
{
cnProfessionDetail = new Model.WBS_CostControlParentDetail();
cnProfessionDetail.CostControlParentDetailId = SQLHelper.GetNewID();
cnProfessionDetail.ParentId = wbsSet.CnProfessionId;
cnProfessionDetail.Months = months;
cnProfessionDetail.ThisPlanValue = changeThisPlanValue;
cnProfessionDetail.ThisRealCost = changeThisRealCost;
cnProfessionDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(cnProfessionDetail);
}
//更新装置
UpdateInstallationDetail(wbsSet.InstallationId, months, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//}
//else //保存周记录
//{
// string[] strs = this.drpWeek.SelectedValue.Split(',');
// DateTime startDate = Convert.ToDateTime(strs[0]);
// DateTime endDate = Convert.ToDateTime(strs[1]);
// foreach (JObject mergedRow in mergedData)
// {
// oldThisPlanValue = 0;
// oldThisRealCost = 0;
// oldThisPlanCost = 0;
// JObject values = mergedRow.Value<JObject>("values");
// string costControlDetailId = values.Value<string>("CostControlDetailId");
// string costControlId = values.Value<string>("CostControlId");
// string thisNum = values.Value<string>("ThisNum");
// string planPrice = values.Value<string>("PlanPrice");
// Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlDetailId(costControlDetailId);
// Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
// if (costControlDetail != null)
// {
// oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
// oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
// if (!string.IsNullOrEmpty(thisNum))
// {
// costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
// }
// thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
// thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
// thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
// BLL.CostControlDetailService.UpdateCostControlDetail(costControlDetail);
// }
// else
// {
// costControlDetail = new Model.WBS_CostControlDetail();
// costControlDetail.CostControlDetailId = costControlDetailId;
// costControlDetail.CostControlId = costControlId;
// costControlDetail.Months = months;
// costControlDetail.StartDate = startDate;
// costControlDetail.EndDate = endDate;
// if (!string.IsNullOrEmpty(thisNum))
// {
// costControlDetail.ThisNum = Convert.ToDecimal(thisNum);
// }
// thisPlanValue = 0;
// thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
// thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
// BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
// }
// //累加变化值,计算总的变化值
// changeThisRealCost += thisRealCost - oldThisRealCost;
// changeThisPlanCost += thisPlanCost - oldThisPlanCost;
// }
// //累计所有子节点的计划值
// var costControls = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
// foreach (var item in costControls)
// {
// Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonthsWeek(item.CostControlId, months, startDate);
// if (costControlDetail != null)
// {
// changeThisPlanValue += (costControlDetail.PlanNum ?? 0) * (item.PlanPrice ?? 0);
// }
// }
// Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(this.trWBS.SelectedNodeID, months, startDate);
// if (parentDetail != null) //如果工作项节点存在,则计算计划值差异值
// {
// changeThisPlanValue = changeThisPlanValue - (parentDetail.ThisPlanValue ?? 0);
// }
// //更新树节点
// Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
// //更新工作包、工作项
// UpdateWeekWbsSetDetail(this.trWBS.SelectedNodeID, months, startDate, endDate, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
// //更新分部
// Model.WBS_CostControlParentDetail unitProjectDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(wbsSet.UnitProjectId, months, startDate);
// if (unitProjectDetail != null)
// {
// unitProjectDetail.ThisPlanValue += changeThisPlanValue;
// unitProjectDetail.ThisRealCost += changeThisRealCost;
// unitProjectDetail.ThisPlanCost += changeThisPlanCost;
// BLL.CostControlParentDetailService.UpdateCostControlParentDetail(unitProjectDetail);
// }
// else
// {
// unitProjectDetail = new Model.WBS_CostControlParentDetail();
// unitProjectDetail.CostControlParentDetailId = SQLHelper.GetNewID();
// unitProjectDetail.ParentId = wbsSet.UnitProjectId;
// unitProjectDetail.Months = months;
// unitProjectDetail.StartDate = startDate;
// unitProjectDetail.EndDate = endDate;
// unitProjectDetail.ThisPlanValue = changeThisPlanValue;
// unitProjectDetail.ThisRealCost = changeThisRealCost;
// unitProjectDetail.ThisPlanCost = changeThisPlanCost;
// BLL.CostControlParentDetailService.AddCostControlParentDetail(unitProjectDetail);
// }
// //更新专业
// Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(wbsSet.CnProfessionId, months, startDate);
// if (cnProfessionDetail != null)
// {
// cnProfessionDetail.ThisPlanValue += changeThisPlanValue;
// cnProfessionDetail.ThisRealCost += changeThisRealCost;
// cnProfessionDetail.ThisPlanCost += changeThisPlanCost;
// BLL.CostControlParentDetailService.UpdateCostControlParentDetail(cnProfessionDetail);
// }
// else
// {
// cnProfessionDetail = new Model.WBS_CostControlParentDetail();
// cnProfessionDetail.CostControlParentDetailId = SQLHelper.GetNewID();
// cnProfessionDetail.ParentId = wbsSet.CnProfessionId;
// cnProfessionDetail.Months = months;
// cnProfessionDetail.StartDate = startDate;
// cnProfessionDetail.EndDate = endDate;
// cnProfessionDetail.ThisPlanValue = changeThisPlanValue;
// cnProfessionDetail.ThisRealCost = changeThisRealCost;
// cnProfessionDetail.ThisPlanCost = changeThisPlanCost;
// BLL.CostControlParentDetailService.AddCostControlParentDetail(cnProfessionDetail);
// }
// //更新装置
// UpdateWeekInstallationDetail(wbsSet.InstallationId, months, startDate, endDate, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//}
//BindGrid();
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
}
@@ -798,87 +843,84 @@ namespace FineUIPro.Web.JDGL.WBS
// codes.Add(item.CostControlCode);
//}
//var list = BLL.CostControlService.GetCostControlsByCostControlCodes(codes, this.trWBS.SelectedNodeID);
var list = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
var list = BLL.CostControlService.GetSelectedCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
if (list.Count > 0)
{
List<Model.View_WBS_CostControlDetail> details = new List<Model.View_WBS_CostControlDetail>();
if (this.drpWeek.SelectedValue == BLL.Const._Null) //月份记录
//if (this.drpWeek.SelectedValue == BLL.Const._Null) //月份记录
//{
this.Grid1.Columns[4].HeaderText = "本月计划完成量";
this.Grid1.Columns[7].HeaderText = "本月完成量";
foreach (var item in list)
{
this.Grid1.Columns[4].HeaderText = "本月计划完成量";
this.Grid1.Columns[7].HeaderText = "本月完成量";
foreach (var item in list)
Model.View_WBS_CostControlDetail detail = BLL.CostControlDetailService.GetViewCostControlDetailByCostControlIdAndMonth(item.CostControlId, months);
if (detail == null)
{
if (item.TotalNum != null)
{
Model.View_WBS_CostControlDetail detail = BLL.CostControlDetailService.GetViewCostControlDetailByCostControlIdAndMonth(item.CostControlId, months);
if (detail == null)
{
detail = new Model.View_WBS_CostControlDetail();
detail.CostControlDetailId = SQLHelper.GetNewID();
detail.CostControlId = item.CostControlId;
detail.CostControlCode = item.CostControlCode;
detail.CostControlName = item.CostControlName;
detail.TotalNum = item.TotalNum;
detail.Unit = item.Unit;
detail.PlanNum = null;
detail.RealPrice = item.RealPrice;
detail.PlanPrice = item.PlanPrice;
}
if (detail.ThisNum == 0)
{
detail.ThisNum = null;
}
details.Add(detail);
}
detail = new Model.View_WBS_CostControlDetail();
detail.CostControlDetailId = SQLHelper.GetNewID();
detail.CostControlId = item.CostControlId;
detail.CostControlCode = item.CostControlCode;
detail.CostControlName = item.CostControlName;
detail.TotalNum = item.TotalNum;
detail.Unit = item.Unit;
detail.PlanNum = null;
detail.RealPrice = item.RealPrice;
detail.PlanPrice = item.PlanPrice;
}
}
else //周记录
{
this.Grid1.Columns[4].HeaderText = "本周计划完成量";
this.Grid1.Columns[7].HeaderText = "本周完成量";
foreach (var item in list)
if (detail.ThisNum == 0)
{
if (item.TotalNum != null)
{
DateTime startDate = Convert.ToDateTime(this.drpWeek.SelectedValue.Split(',')[0]);
Model.View_WBS_CostControlDetail detail = BLL.CostControlDetailService.GetViewCostControlDetailByCostControlIdAndMonthWeek(item.CostControlId, months, startDate);
if (detail == null)
{
detail = new Model.View_WBS_CostControlDetail();
detail.CostControlDetailId = SQLHelper.GetNewID();
detail.CostControlId = item.CostControlId;
detail.CostControlCode = item.CostControlCode;
detail.CostControlName = item.CostControlName;
detail.TotalNum = item.TotalNum;
detail.Unit = item.Unit;
detail.PlanNum = null;
detail.RealPrice = item.RealPrice;
detail.PlanPrice = item.PlanPrice;
}
else
{
Model.WBS_CostControlDetail oldDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlDetailId(detail.CostControlDetailId);
if (oldDetail.PlanNum != null)
{
detail.PlanNum = Convert.ToDouble(oldDetail.PlanNum);
}
else
{
detail.PlanNum = null;
}
if (oldDetail.ThisNum != null)
{
detail.ThisNum = Convert.ToDouble(oldDetail.ThisNum);
}
else
{
detail.ThisNum = null;
}
}
details.Add(detail);
}
detail.ThisNum = null;
}
details.Add(detail);
}
//}
//else //周记录
//{
// this.Grid1.Columns[4].HeaderText = "本周计划完成量";
// this.Grid1.Columns[7].HeaderText = "本周完成量";
// foreach (var item in list)
// {
// if (item.TotalNum != null)
// {
// DateTime startDate = Convert.ToDateTime(this.drpWeek.SelectedValue.Split(',')[0]);
// Model.View_WBS_CostControlDetail detail = BLL.CostControlDetailService.GetViewCostControlDetailByCostControlIdAndMonthWeek(item.CostControlId, months, startDate);
// if (detail == null)
// {
// detail = new Model.View_WBS_CostControlDetail();
// detail.CostControlDetailId = SQLHelper.GetNewID();
// detail.CostControlId = item.CostControlId;
// detail.CostControlCode = item.CostControlCode;
// detail.CostControlName = item.CostControlName;
// detail.TotalNum = item.TotalNum;
// detail.Unit = item.Unit;
// detail.PlanNum = null;
// detail.RealPrice = item.RealPrice;
// detail.PlanPrice = item.PlanPrice;
// }
// else
// {
// Model.WBS_CostControlDetail oldDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlDetailId(detail.CostControlDetailId);
// if (oldDetail.PlanNum != null)
// {
// detail.PlanNum = Convert.ToDouble(oldDetail.PlanNum);
// }
// else
// {
// detail.PlanNum = null;
// }
// if (oldDetail.ThisNum != null)
// {
// detail.ThisNum = Convert.ToDouble(oldDetail.ThisNum);
// }
// else
// {
// detail.ThisNum = null;
// }
// }
// details.Add(detail);
// }
// }
//}
Grid1.DataSource = details;
Grid1.DataBind();
}
@@ -908,7 +950,7 @@ namespace FineUIPro.Web.JDGL.WBS
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
this.btnMenuEdit.Hidden = false;
}
}
}
@@ -930,8 +972,8 @@ namespace FineUIPro.Web.JDGL.WBS
{
if (BLL.CostControlDetailService.IsExitWeekCostControlDetailByCostControlIdAndMonth(item.CostControlId, months))
{
BLL.CostControlDetailService.InitWeekPlanList(this.drpWeek, item.CostControlId, months, true);
this.drpWeek.SelectedValue = BLL.Const._Null;
//BLL.CostControlDetailService.InitWeekPlanList(this.drpWeek, item.CostControlId, months, true);
//this.drpWeek.SelectedValue = BLL.Const._Null;
break;
}
}
@@ -950,7 +992,7 @@ namespace FineUIPro.Web.JDGL.WBS
protected void txtMonths_TextChanged(object sender, EventArgs e)
{
BindGrid();
InitWeek();
//InitWeek();
}
#endregion