修改进度模块
This commit is contained in:
@@ -73,6 +73,9 @@ namespace BLL
|
||||
newWorkPackage.RealEndDate = WorkPackage.RealEndDate;
|
||||
newWorkPackage.Unit = WorkPackage.Unit;
|
||||
newWorkPackage.IsMileStone = WorkPackage.IsMileStone;
|
||||
newWorkPackage.PlanCost = WorkPackage.PlanCost;
|
||||
newWorkPackage.JDWeights = WorkPackage.JDWeights;
|
||||
newWorkPackage.PreWorkCode = WorkPackage.PreWorkCode;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
@@ -266,6 +269,8 @@ namespace BLL
|
||||
table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime)));
|
||||
table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime)));
|
||||
table.Columns.Add(new DataColumn("IsMileStone", typeof(bool)));
|
||||
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
|
||||
if (getWBSs.Count() > 0)
|
||||
{
|
||||
List<Model.View_WBS> newList = new List<Model.View_WBS>();
|
||||
@@ -293,9 +298,9 @@ namespace BLL
|
||||
var workPackage = workPackages.FirstOrDefault(x => x.WorkPackageId == item.Id);
|
||||
if (workPackage != null)
|
||||
{
|
||||
if (workPackage.Weights != null)
|
||||
if (workPackage.JDWeights != null)
|
||||
{
|
||||
row[6] = decimal.Round(Convert.ToDecimal(workPackage.Weights), 2);
|
||||
row[6] = decimal.Round(Convert.ToDecimal(workPackage.JDWeights), 2);
|
||||
}
|
||||
row[7] = workPackage.Unit;
|
||||
if (workPackage.PlanProjectQuantity != null)
|
||||
@@ -326,6 +331,11 @@ namespace BLL
|
||||
{
|
||||
row[14] = workPackage.IsMileStone;
|
||||
}
|
||||
if (workPackage.PlanCost != null)
|
||||
{
|
||||
row[15] = decimal.Round(Convert.ToDecimal(workPackage.PlanCost), 2);
|
||||
}
|
||||
row[16] = workPackage.PreWorkCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,6 +344,10 @@ namespace BLL
|
||||
var unitWork = unitWorks.FirstOrDefault(x => x.UnitWorkId == item.Id);
|
||||
if (unitWork != null)
|
||||
{
|
||||
if (unitWork.JDWeights != null)
|
||||
{
|
||||
row[6] = decimal.Round(Convert.ToDecimal(unitWork.JDWeights), 2);
|
||||
}
|
||||
if (unitWork.PlanStartDate != null)
|
||||
{
|
||||
row[10] = unitWork.PlanStartDate;
|
||||
@@ -350,6 +364,10 @@ namespace BLL
|
||||
{
|
||||
row[13] = unitWork.RealEndDate;
|
||||
}
|
||||
if (unitWork.PlanCost != null)
|
||||
{
|
||||
row[15] = decimal.Round(Convert.ToDecimal(unitWork.PlanCost), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
@@ -368,5 +386,151 @@ namespace BLL
|
||||
AddDetail(newList, oldList, item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
#region 更新工作包、工作项
|
||||
/// <summary>
|
||||
/// 更新月工作包、工作项
|
||||
/// </summary>
|
||||
/// <param name="years"></param>
|
||||
/// <param name="months"></param>
|
||||
/// <param name="planValue"></param>
|
||||
/// <param name="parentId"></param>
|
||||
public static void UpdateWorkPackages(Model.SGGLDB db, Model.WBS_WorkPackage workPackage, DateTime? planStartDate, DateTime? planEndDate, DateTime? realStartDate, DateTime? realEndDate)
|
||||
{
|
||||
if (workPackage != null)
|
||||
{
|
||||
Model.WBS_WorkPackage parentWorkPackage = BLL.WorkPackageService.GetWorkPackageByWorkPackageId(workPackage.SuperWorkPackageId);
|
||||
if (parentWorkPackage != null)
|
||||
{
|
||||
if (planStartDate != null)
|
||||
{
|
||||
if (parentWorkPackage.PlanStartDate == null)
|
||||
{
|
||||
parentWorkPackage.PlanStartDate = planStartDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parentWorkPackage.PlanStartDate > planStartDate)
|
||||
{
|
||||
parentWorkPackage.PlanStartDate = planStartDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (planEndDate != null)
|
||||
{
|
||||
if (parentWorkPackage.PlanEndDate == null)
|
||||
{
|
||||
parentWorkPackage.PlanEndDate = planEndDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parentWorkPackage.PlanEndDate < planEndDate)
|
||||
{
|
||||
parentWorkPackage.PlanEndDate = planEndDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (realStartDate != null)
|
||||
{
|
||||
if (parentWorkPackage.RealStartDate == null)
|
||||
{
|
||||
parentWorkPackage.RealStartDate = realStartDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parentWorkPackage.RealStartDate > realStartDate)
|
||||
{
|
||||
parentWorkPackage.RealStartDate = realStartDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (realEndDate != null)
|
||||
{
|
||||
if (parentWorkPackage.RealEndDate == null)
|
||||
{
|
||||
parentWorkPackage.RealEndDate = realEndDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parentWorkPackage.RealEndDate < realEndDate)
|
||||
{
|
||||
parentWorkPackage.RealEndDate = realEndDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateWorkPackages(db, parentWorkPackage, planStartDate, planEndDate, realStartDate, realEndDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 更新分部分项工程实际完成时间
|
||||
/// </summary>
|
||||
/// <param name="WorkPackage"></param>
|
||||
public static void UpdateWorkPackageRealEndDate(string workPackageId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var controlItemAndCycles = from x in db.WBS_ControlItemAndCycle where x.WorkPackageId == workPackageId && x.IsApprove == true select x;
|
||||
var spotCheckDetails = from x in db.Check_SpotCheckDetail where x.IsOK == true select x;
|
||||
bool b = true;
|
||||
if (controlItemAndCycles.Count() > 0)
|
||||
{
|
||||
foreach (var c in controlItemAndCycles)
|
||||
{
|
||||
if (c.CheckNum != null && c.CheckNum != 0) //检查次数为0表示一直检查
|
||||
{
|
||||
var okSpotCheckDetails = spotCheckDetails.Where(x => x.ControlItemAndCycleId == c.ControlItemAndCycleId);
|
||||
if (okSpotCheckDetails.Count() != c.CheckNum)
|
||||
{
|
||||
b = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
b = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (b)
|
||||
{
|
||||
var LastEndControlItemAndCycle = controlItemAndCycles.OrderByDescending(x => x.RealEndDate).FirstOrDefault();
|
||||
if (LastEndControlItemAndCycle != null)
|
||||
{
|
||||
var workPackage = db.WBS_WorkPackage.FirstOrDefault(x => x.WorkPackageId == LastEndControlItemAndCycle.WorkPackageId);
|
||||
if (workPackage != null)
|
||||
{
|
||||
workPackage.RealEndDate = LastEndControlItemAndCycle.RealEndDate;
|
||||
UpdateWorkPackages(db, workPackage, null, null, null, workPackage.RealEndDate);
|
||||
db.SubmitChanges();
|
||||
var unitWork = db.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == workPackage.UnitWorkId);
|
||||
//获取是否存在其他未完成的分部分项
|
||||
var notEndOthenWorkPackage = db.WBS_WorkPackage.FirstOrDefault(x => x.UnitWorkId == unitWork.UnitWorkId && x.IsApprove == true && x.RealEndDate == null);
|
||||
if (notEndOthenWorkPackage == null)
|
||||
{
|
||||
if (workPackage.RealEndDate != null)
|
||||
{
|
||||
if (unitWork.RealEndDate == null)
|
||||
{
|
||||
unitWork.RealEndDate = workPackage.RealEndDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unitWork.RealEndDate < workPackage.RealEndDate)
|
||||
{
|
||||
unitWork.RealEndDate = workPackage.RealEndDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user