修改进度录入页面
This commit is contained in:
@@ -169,77 +169,77 @@ namespace FineUIPro.Web.JDGL.WBS
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
//foreach (JObject mergedRow in Grid1.GetModifiedData())
|
||||
string[] ids = this.hdId.Text.Split(',');
|
||||
if (ids.Length > 0)
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
if (this.Grid1.Rows[i].DataKeys[2] != null)
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
Model.WBS_CostControl costControl = oldViewInfos.FirstOrDefault(x => x.CostControlId == this.Grid1.Rows[i].DataKeys[2].ToString());
|
||||
if (costControl != null)
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
if (this.Grid1.Rows[i].DataKeys[2] != null)
|
||||
{
|
||||
decimal oldPlanPrice = costControl.PlanPrice ?? 0;
|
||||
decimal oldRealPrice = costControl.RealPrice ?? 0;
|
||||
string costControlId = costControl.CostControlId;
|
||||
string totalNum = values.Value<string>("TotalNum");
|
||||
string planPrice = values.Value<string>("PlanPrice");
|
||||
string realPrice = values.Value<string>("RealPrice");
|
||||
string planStartDate = values.Value<string>("PlanStartDate");
|
||||
string planEndDate = values.Value<string>("PlanEndDate");
|
||||
string realStartDate = values.Value<string>("RealStartDate");
|
||||
string realEndDate = values.Value<string>("RealEndDate");
|
||||
costControl.TotalNum = Funs.GetNewDecimal(totalNum);
|
||||
costControl.PlanPrice = Funs.GetNewDecimal(planPrice);
|
||||
costControl.RealPrice = Funs.GetNewDecimal(realPrice);
|
||||
costControl.PlanStartDate = Funs.GetNewDateTime(planStartDate);
|
||||
costControl.PlanEndDate = Funs.GetNewDateTime(planEndDate);
|
||||
costControl.RealStartDate = Funs.GetNewDateTime(realStartDate);
|
||||
costControl.RealEndDate = Funs.GetNewDateTime(realEndDate);
|
||||
BLL.CostControlService.UpdateCostControl(costControl);
|
||||
for (int j = 0; j < months.Count; j++)
|
||||
Model.WBS_CostControl costControl = oldViewInfos.FirstOrDefault(x => x.CostControlId == this.Grid1.Rows[i].DataKeys[2].ToString());
|
||||
if (costControl != null && ids.Contains(this.Grid1.Rows[i].DataKeys[2].ToString()))
|
||||
{
|
||||
oldThisPlanValue = 0;
|
||||
oldThisRealCost = 0;
|
||||
oldThisPlanCost = 0;
|
||||
changeThisPlanValue = 0;
|
||||
changeThisRealCost = 0;
|
||||
changeThisPlanCost = 0;
|
||||
string planNum = values.Value<string>(string.Format("{0:yyyy-MM}", months[j]) + "Plan");
|
||||
string thisNum = values.Value<string>(string.Format("{0:yyyy-MM}", months[j]) + "This");
|
||||
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(costControlId, months[j]);
|
||||
if (costControlDetail != null)
|
||||
{
|
||||
oldThisPlanValue = (costControlDetail.PlanNum ?? 0) * oldPlanPrice;
|
||||
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * oldRealPrice;
|
||||
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * oldPlanPrice;
|
||||
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
|
||||
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(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 = SQLHelper.GetNewID();
|
||||
costControlDetail.CostControlId = costControlId;
|
||||
costControlDetail.Months = months[j];
|
||||
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
|
||||
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(thisNum);
|
||||
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
|
||||
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
|
||||
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
|
||||
//BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
|
||||
db.WBS_CostControlDetail.InsertOnSubmit(costControlDetail);
|
||||
}
|
||||
//累加变化值,计算总的变化值
|
||||
changeThisPlanValue += thisPlanValue - oldThisPlanValue;
|
||||
changeThisRealCost += thisRealCost - oldThisRealCost;
|
||||
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
|
||||
if (changeThisPlanValue != 0 || changeThisRealCost != 0 || changeThisPlanCost != 0)
|
||||
decimal oldPlanPrice = costControl.PlanPrice ?? 0;
|
||||
decimal oldRealPrice = costControl.RealPrice ?? 0;
|
||||
string costControlId = costControl.CostControlId;
|
||||
string totalNum = values.Value<string>("TotalNum");
|
||||
string planPrice = values.Value<string>("PlanPrice");
|
||||
string realPrice = values.Value<string>("RealPrice");
|
||||
string planStartDate = values.Value<string>("PlanStartDate");
|
||||
string planEndDate = values.Value<string>("PlanEndDate");
|
||||
string realStartDate = values.Value<string>("RealStartDate");
|
||||
string realEndDate = values.Value<string>("RealEndDate");
|
||||
costControl.TotalNum = Funs.GetNewDecimal(totalNum);
|
||||
costControl.PlanPrice = Funs.GetNewDecimal(planPrice);
|
||||
costControl.RealPrice = Funs.GetNewDecimal(realPrice);
|
||||
costControl.PlanStartDate = Funs.GetNewDateTime(planStartDate);
|
||||
costControl.PlanEndDate = Funs.GetNewDateTime(planEndDate);
|
||||
costControl.RealStartDate = Funs.GetNewDateTime(realStartDate);
|
||||
costControl.RealEndDate = Funs.GetNewDateTime(realEndDate);
|
||||
BLL.CostControlService.UpdateCostControl(costControl);
|
||||
for (int j = 0; j < months.Count; j++)
|
||||
{
|
||||
oldThisPlanValue = 0;
|
||||
oldThisRealCost = 0;
|
||||
oldThisPlanCost = 0;
|
||||
changeThisPlanValue = 0;
|
||||
changeThisRealCost = 0;
|
||||
changeThisPlanCost = 0;
|
||||
string planNum = values.Value<string>(string.Format("{0:yyyy-MM}", months[j]) + "Plan");
|
||||
string thisNum = values.Value<string>(string.Format("{0:yyyy-MM}", months[j]) + "This");
|
||||
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(costControlId, months[j]);
|
||||
if (costControlDetail != null)
|
||||
{
|
||||
oldThisPlanValue = (costControlDetail.PlanNum ?? 0) * oldPlanPrice;
|
||||
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * oldRealPrice;
|
||||
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * oldPlanPrice;
|
||||
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
|
||||
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(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 = SQLHelper.GetNewID();
|
||||
costControlDetail.CostControlId = costControlId;
|
||||
costControlDetail.Months = months[j];
|
||||
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
|
||||
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(thisNum);
|
||||
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
|
||||
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
|
||||
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
|
||||
//BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
|
||||
db.WBS_CostControlDetail.InsertOnSubmit(costControlDetail);
|
||||
}
|
||||
//累加变化值,计算总的变化值
|
||||
changeThisPlanValue += thisPlanValue - oldThisPlanValue;
|
||||
changeThisRealCost += thisRealCost - oldThisRealCost;
|
||||
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
|
||||
//更新工作包、工作项
|
||||
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(costControl.WbsSetId);
|
||||
UpdateWbsSetDetail(db, costControl.WbsSetId, months[j], changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
|
||||
|
||||
Reference in New Issue
Block a user