0915-gaofei

This commit is contained in:
gaofei
2021-09-15 14:50:52 +08:00
parent 176d79aa61
commit c330245a88
51 changed files with 20672 additions and 1060 deletions
+409 -181
View File
@@ -24,6 +24,7 @@ namespace FineUIPro.Web.JDGL.WBS
GetButtonPower();
InitTreeMenu();
this.txtMonths.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
Funs.FineUIPleaseSelect(this.drpWeek);
}
}
@@ -283,74 +284,6 @@ namespace FineUIPro.Web.JDGL.WBS
}
#endregion
protected void trWBS_NodeCheck(object sender, FineUIPro.TreeCheckEventArgs e)
{
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(e.NodeID);
if (wbsSet != null)
{
wbsSet.IsSelected = e.Checked;
wbsSet.IsApprove = e.Checked;
BLL.WbsSetService.UpdateWbsSet(wbsSet);
Model.Wbs_WbsSet pWbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(wbsSet.SuperWbsSetId);
if (pWbsSet != null)
{
pWbsSet.IsSelected = e.Checked;
pWbsSet.IsApprove = e.Checked;
BLL.WbsSetService.UpdateWbsSet(pWbsSet);
Model.Wbs_WbsSet ppWbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(pWbsSet.SuperWbsSetId);
if (ppWbsSet != null)
{
ppWbsSet.IsSelected = e.Checked;
ppWbsSet.IsApprove = e.Checked;
BLL.WbsSetService.UpdateWbsSet(ppWbsSet);
Model.Wbs_WbsSet pppWbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(ppWbsSet.SuperWbsSetId);
if (pppWbsSet != null)
{
pppWbsSet.IsSelected = e.Checked;
pppWbsSet.IsApprove = e.Checked;
BLL.WbsSetService.UpdateWbsSet(pppWbsSet);
}
}
}
Model.Wbs_UnitProject unitProject = BLL.UnitProjectService.GetUnitProjectByUnitProjectId(wbsSet.UnitProjectId);
if (unitProject != null)
{
unitProject.IsSelected = e.Checked;
unitProject.IsApprove = e.Checked;
BLL.UnitProjectService.UpdateUnitProject(unitProject);
}
Model.WBS_CnProfession cnProfession = BLL.CnProfessionService.GetCnProfessionByCnProfessionId(wbsSet.CnProfessionId);
if (cnProfession != null)
{
cnProfession.IsSelected = e.Checked;
cnProfession.IsApprove = e.Checked;
BLL.CnProfessionService.UpdateCnProfession(cnProfession);
}
}
//if (e.Checked)
//{
// CheckAllParentNodes(e.Node);
// CheckAllChildNodes(e.Node);
// this.UpdateSelect(e.Node, true);
//}
//else
//{
// if (auditText == string.Empty)
// {
// trWBS.UncheckAllNodes(e.Node.Nodes);
// this.UpdateSelect(e.Node, false);
// }
// else
// {
// auditText = auditText.Substring(0, auditText.Length - 1);
// e.Node.Checked = true;
// ShowNotify("权重已有设置审核项:'" + auditText + "',不能取消设置!", MessageBoxIcon.Success);
// }
//}
BindGrid();
}
#region Tree点击事件
/// <summary>
/// Tree点击事件
@@ -359,6 +292,9 @@ namespace FineUIPro.Web.JDGL.WBS
/// <param name="e"></param>
protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
{
InitWeek();
this.Grid1.Columns[4].HeaderText = "本月计划完成量";
this.Grid1.Columns[7].HeaderText = "本月完成量";
BindGrid();
}
#endregion
@@ -380,116 +316,235 @@ namespace FineUIPro.Web.JDGL.WBS
if (Grid1.Rows.Count > 0)
{
decimal changeThisPlanValue = 0, changeThisRealCost = 0, changeThisPlanCost = 0, //当月总变化完成成本、完成预算
oldThisPlanValue = 0, oldThisRealCost = 0, oldThisPlanCost = 0,
thisPlanValue = 0, thisRealCost = 0, thisPlanCost = 0;
oldThisPlanValue = 0, oldThisRealCost = 0, oldThisPlanCost = 0,
thisPlanValue = 0, thisRealCost = 0, thisPlanCost = 0;
JArray mergedData = Grid1.GetMergedData();
foreach (JObject mergedRow in mergedData)
if (this.drpWeek.SelectedValue == BLL.Const._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)
foreach (JObject mergedRow in mergedData)
{
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
if (!string.IsNullOrEmpty(thisNum))
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)
{
costControlDetail.ThisNum = Convert.ToDecimal(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);
}
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;
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);
}
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);
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);
}
//累加变化值,计算总的变化值
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)
//更新专业
Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.CnProfessionId, months);
if (cnProfessionDetail != null)
{
changeThisPlanValue += (costControlDetail.PlanNum ?? 0) * (item.PlanPrice ?? 0);
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);
}
Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(this.trWBS.SelectedNodeID, months);
if (parentDetail != null) //如果工作项节点存在,则计算计划值差异值
else //保存周记录
{
changeThisPlanValue = changeThisPlanValue - (parentDetail.ThisPlanValue ?? 0);
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);
}
//更新树节点
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);
BindGrid();
//BindGrid();
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
}
else
@@ -501,7 +556,7 @@ namespace FineUIPro.Web.JDGL.WBS
#region
/// <summary>
/// 更新工作包、工作项
/// 更新工作包、工作项
/// </summary>
/// <param name="years"></param>
/// <param name="months"></param>
@@ -537,11 +592,51 @@ namespace FineUIPro.Web.JDGL.WBS
}
}
}
/// <summary>
/// 更新周工作包、工作项
/// </summary>
/// <param name="years"></param>
/// <param name="months"></param>
/// <param name="planValue"></param>
/// <param name="parentId"></param>
private void UpdateWeekWbsSetDetail(string wbsSetId, DateTime months, DateTime startDate, DateTime endDate, decimal changeThisPlanValue, decimal changeThisRealCost, decimal changeThisPlanCost)
{
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(wbsSetId);
if (wbsSet != null)
{
Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonthsWeek(wbsSetId, months, startDate);
if (parentDetail != null)
{
parentDetail.ThisPlanValue += changeThisPlanValue;
parentDetail.ThisRealCost += changeThisRealCost;
parentDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(parentDetail);
}
else
{
parentDetail = new Model.WBS_CostControlParentDetail();
parentDetail.CostControlParentDetailId = SQLHelper.GetNewID();
parentDetail.ParentId = wbsSetId;
parentDetail.Months = months;
parentDetail.StartDate = startDate;
parentDetail.EndDate = endDate;
parentDetail.ThisPlanValue = changeThisPlanValue;
parentDetail.ThisRealCost = changeThisRealCost;
parentDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(parentDetail);
}
if (wbsSet.SuperWbsSetId != null) //还存在上级节点,需要继续循环
{
UpdateWeekWbsSetDetail(wbsSet.SuperWbsSetId, months, startDate, endDate, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
}
}
}
#endregion
#region
/// <summary>
/// 更新装置
/// 更新装置
/// </summary>
/// <param name="years"></param>
/// <param name="months"></param>
@@ -577,6 +672,46 @@ namespace FineUIPro.Web.JDGL.WBS
}
}
}
/// <summary>
/// 更新周装置
/// </summary>
/// <param name="years"></param>
/// <param name="months"></param>
/// <param name="planValue"></param>
/// <param name="parentId"></param>
private void UpdateWeekInstallationDetail(string installationId, DateTime months, DateTime startDate, DateTime endDate, decimal changeThisPlanValue, decimal changeThisRealCost, decimal changeThisPlanCost)
{
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(installationId);
if (installation != null)
{
Model.WBS_CostControlParentDetail parentDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(installationId, months);
if (parentDetail != null)
{
parentDetail.ThisPlanValue += changeThisPlanValue;
parentDetail.ThisRealCost += changeThisRealCost;
parentDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(parentDetail);
}
else
{
parentDetail = new Model.WBS_CostControlParentDetail();
parentDetail.CostControlParentDetailId = SQLHelper.GetNewID();
parentDetail.ParentId = installationId;
parentDetail.Months = months;
parentDetail.StartDate = startDate;
parentDetail.EndDate = endDate;
parentDetail.ThisPlanValue = changeThisPlanValue;
parentDetail.ThisRealCost = changeThisRealCost;
parentDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(parentDetail);
}
if (installation.SuperInstallationId != null) //还存在上级节点,需要继续循环
{
UpdateWeekInstallationDetail(installation.SuperInstallationId, months, startDate, endDate, changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
}
}
}
#endregion
#region
@@ -636,24 +771,29 @@ namespace FineUIPro.Web.JDGL.WBS
if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
{
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01");
var codeList = BLL.WbsSetMatchCostControlService.GetWbsSetMatchCostControls(this.trWBS.SelectedNodeID);
Model.Wbs_WbsSet wbeSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
if (codeList.Count > 0) //存在费控对应关系项
//var codeList = BLL.WbsSetMatchCostControlService.GetWbsSetMatchCostControls(this.trWBS.SelectedNodeID);
//Model.Wbs_WbsSet wbeSet = BLL.WbsSetService.GetWbsSetByWbsSetId(this.trWBS.SelectedNodeID);
//if (codeList.Count > 0) //存在费控对应关系项
//{
//List<string> codes = new List<string>();
//foreach (var item in codeList)
//{
// codes.Add(item.CostControlCode);
//}
//var list = BLL.CostControlService.GetCostControlsByCostControlCodes(codes, this.trWBS.SelectedNodeID);
var list = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
if (list.Count > 0)
{
List<string> codes = new List<string>();
foreach (var item in codeList)
List<Model.View_WBS_CostControlDetail> details = new List<Model.View_WBS_CostControlDetail>();
if (this.drpWeek.SelectedValue == BLL.Const._Null) //月份记录
{
codes.Add(item.CostControlCode);
}
var list = BLL.CostControlService.GetCostControlsByCostControlCodes(codes, this.trWBS.SelectedNodeID);
if (list.Count > 0)
{
List<Model.View_WBS_CostControlDetail> details = new List<Model.View_WBS_CostControlDetail>();
this.Grid1.Columns[4].HeaderText = "本月计划完成量";
this.Grid1.Columns[7].HeaderText = "本月完成量";
foreach (var item in list)
{
if (item.TotalNum != null)
{
Model.View_WBS_CostControlDetail detail = BLL.CostControlDetailService.GetViewCostControlDetailByCostControlIdYearMonth(item.CostControlId, months);
Model.View_WBS_CostControlDetail detail = BLL.CostControlDetailService.GetViewCostControlDetailByCostControlIdAndMonth(item.CostControlId, months);
if (detail == null)
{
detail = new Model.View_WBS_CostControlDetail();
@@ -667,12 +807,68 @@ namespace FineUIPro.Web.JDGL.WBS
detail.RealPrice = item.RealPrice;
detail.PlanPrice = item.PlanPrice;
}
if (detail.ThisNum == 0)
{
detail.ThisNum = null;
}
details.Add(detail);
}
}
Grid1.DataSource = details;
Grid1.DataBind();
}
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();
}
else
{
Grid1.DataSource = null;
Grid1.DataBind();
}
}
}
@@ -701,6 +897,33 @@ namespace FineUIPro.Web.JDGL.WBS
}
#endregion
#region
protected void InitWeek()
{
if (!string.IsNullOrEmpty(this.txtMonths.Text.Trim()))
{
DateTime months = Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01");
string costControlId = string.Empty;
var list = BLL.CostControlService.GetCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
if (list.Count > 0)
{
foreach (var item in list)
{
if (item.TotalNum != null)
{
if (BLL.CostControlDetailService.IsExitWeekCostControlDetailByCostControlIdAndMonth(item.CostControlId, months))
{
BLL.CostControlDetailService.InitWeekPlanList(this.drpWeek, item.CostControlId, months, true);
this.drpWeek.SelectedValue = BLL.Const._Null;
break;
}
}
}
}
}
}
#endregion
#region
/// <summary>
/// 月份选择事件
@@ -709,9 +932,14 @@ namespace FineUIPro.Web.JDGL.WBS
/// <param name="e"></param>
protected void txtMonths_TextChanged(object sender, EventArgs e)
{
//InitTreeMenu();
BindGrid();
InitWeek();
}
#endregion
protected void drpWeek_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
}
}