修改进度计划编制

This commit is contained in:
2023-09-01 15:12:14 +08:00
parent 14c5600240
commit 06e3944166
7 changed files with 140 additions and 28 deletions
+77 -21
View File
@@ -245,7 +245,7 @@ namespace BLL
/// 获取模拟树表格
/// </summary>
/// <returns></returns>
public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string startTime, string endTime)
public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string startTime, string endTime, string isOK)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
@@ -308,11 +308,11 @@ namespace BLL
newList.Add(item);
if (string.IsNullOrEmpty(IsOut))
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime);
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime, isOK);
}
else
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime);
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime, isOK);
}
a++;
}
@@ -405,7 +405,7 @@ namespace BLL
row[12] = workPackage.RealStartDate;
}
if (workPackage.RealEndDate != null)
{
{
row[13] = workPackage.RealEndDate;
}
if (workPackage.PlanCost != null)
@@ -454,30 +454,86 @@ namespace BLL
}
}
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string startTime, string endTime)
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string startTime, string endTime, string isOK)
{
var items = oldList.Where(x => x.SupId == id && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
if (isOK == "0")
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, startTime, endTime);
b++;
var items = oldList.Where(x => x.SupId == id && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, startTime, endTime, isOK);
b++;
}
}
else if (isOK == "1")
{
var items = oldList.Where(x => x.SupId == id && x.RealEndDate != null && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, startTime, endTime, isOK);
b++;
}
}
else if (isOK == "2")
{
var items = oldList.Where(x => x.SupId == id && x.RealEndDate == null && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, startTime, endTime, isOK);
b++;
}
}
}
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix, string startTime, string endTime)
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix, string startTime, string endTime, string isOK)
{
var items = oldList.Where(x => x.SupId == id && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
if (isOK == "0")
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime);
b++;
var items = oldList.Where(x => x.SupId == id && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime, isOK);
b++;
}
}
else if (isOK == "1")
{
var items = oldList.Where(x => x.SupId == id && x.RealEndDate != null && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime, isOK);
b++;
}
}
else if (isOK == "2")
{
var items = oldList.Where(x => x.SupId == id && x.RealEndDate == null && (x.PlanStartDate <= Funs.GetNewDateTime(startTime) || string.IsNullOrEmpty(startTime)) && (x.PlanEndDate >= Funs.GetNewDateTime(endTime) || string.IsNullOrEmpty(endTime))).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime, isOK);
b++;
}
}
}