修改施工日志

This commit is contained in:
2023-09-22 14:09:58 +08:00
parent 1cacd53725
commit 764455acd9
38 changed files with 3031 additions and 718 deletions
+33 -8
View File
@@ -788,7 +788,21 @@ namespace BLL
IQueryable<Model.WBS_WorkPackage> workPackages = from x in db.WBS_WorkPackage where x.ProjectId == projectId select x;
IQueryable<Model.WBS_UnitWork> unitWorks = from x in db.WBS_UnitWork where x.ProjectId == projectId select x;
IQueryable<Model.View_WBS_WorkPackageDetail> getDetails = from x in db.View_WBS_WorkPackageDetail where x.ProjectId == projectId select x;
//获取符合时间范围的所有项
List<Model.View_WBS> getWBSs = (from x in db.View_WBS where x.ProjectId == projectId select x).ToList();
List<Model.View_WBS> list = getWBSs.Where(x => x.PlanEndDate > startTime && x.PlanEndDate <= endTime).ToList();
List<Model.View_WBS> newLists = new List<Model.View_WBS>();
foreach (var item in list)
{
var supItem = getWBSs.FirstOrDefault(x => x.Id == item.SupId);
if (supItem != null)
{
newLists.Add(item);
newLists.Add(supItem);
AddSupItem(supItem, getWBSs, newLists);
}
}
List<string> ids = newLists.Select(x => x.Id).ToList();
List<Model.View_WBS> WBSList = new List<Model.View_WBS>();
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
@@ -844,11 +858,11 @@ namespace BLL
newList.Add(item);
if (string.IsNullOrEmpty(IsOut))
{
AddDetail2(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime);
AddDetail2(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime, ids);
}
else
{
AddDetail2(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime);
AddDetail2(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime, ids);
}
a++;
}
@@ -990,29 +1004,40 @@ namespace BLL
}
}
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime)
private static void AddSupItem(Model.View_WBS item, List<Model.View_WBS> getWBSs, List<Model.View_WBS> newLists)
{
var items = oldList.Where(x => x.SupId == id && x.PlanEndDate > startTime && x.PlanEndDate <= endTime).OrderBy(x => x.Code);
var supItem = getWBSs.FirstOrDefault(x => x.Id == item.SupId);
if (supItem != null)
{
newLists.Add(item);
newLists.Add(supItem);
AddSupItem(supItem, getWBSs, newLists);
}
}
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime,List<string> ids)
{
var items = oldList.Where(x => x.SupId == id && ((x.PlanEndDate > startTime && x.PlanEndDate <= endTime) || ids.Contains(x.Id))).OrderBy(x => x.Code);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail2(newList, oldList, item.Id, item.Code, startTime, endTime);
AddDetail2(newList, oldList, item.Id, item.Code, startTime, endTime, ids);
b++;
}
}
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix, DateTime startTime, DateTime endTime)
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix, DateTime startTime, DateTime endTime, List<string> ids)
{
var items = oldList.Where(x => x.SupId == id && x.PlanEndDate > startTime && x.PlanEndDate <= endTime).OrderBy(x => x.Code);
var items = oldList.Where(x => x.SupId == id && ((x.PlanEndDate > startTime && x.PlanEndDate <= endTime) || ids.Contains(x.Id))).OrderBy(x => x.Code);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail2(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime);
AddDetail2(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime, ids);
b++;
}
}