This commit is contained in:
qianjiawei
2023-06-27 14:27:59 +08:00
parent 35275f723c
commit 97def64135

View File

@@ -77,8 +77,8 @@ namespace Tnb.ProductionMgr
} }
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id) var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim()) .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
.WhereIF(start, a => startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date) // .WhereIF(start, a => a.estimated_start_date != null&& startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date)
.WhereIF(end, a => endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date) // .WhereIF(end, a => a.estimated_end_date != null && endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date)
.WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!)) .WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!))
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled") .Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
.Select((a, b, c) => new PrdMoTask .Select((a, b, c) => new PrdMoTask
@@ -96,6 +96,10 @@ namespace Tnb.ProductionMgr
}) })
.ToPagedListAsync(input.currentPage, input.pageSize); .ToPagedListAsync(input.currentPage, input.pageSize);
if (start)
items.list= items.list.Where(a => startTimes[0] <= a.plan_start_date && startTimes[1] >= a.plan_start_date).ToList();
if (end)
items.list= items.list.Where(a => endTimes[0] <= a.plan_end_date && endTimes[1] >= a.plan_end_date).ToList();
_db.ThenMapper(items.list, it => _db.ThenMapper(items.list, it =>
{ {
it.mo_task_status = it.mo_task_status.IsNotEmptyOrNull() && dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : ""; it.mo_task_status = it.mo_task_status.IsNotEmptyOrNull() && dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : "";
@@ -124,20 +128,24 @@ namespace Tnb.ProductionMgr
var treeList = trees.ToTree(); var treeList = trees.ToTree();
if (!string.IsNullOrEmpty(input.process)) if (!string.IsNullOrEmpty(input.process))
{ {
List< PackReportTreeOutput > removelist = new List< PackReportTreeOutput >();
foreach (var item in treeList) foreach (var item in treeList)
{ {
bool flag = false; bool flag = false;
if (item.process_id != null && item.process_id.Contains(input.process)) if (item.process_id != null && item.process_id.Contains(input.process))
flag = true; flag = true;
if (item.children != null) if (item.children != null&& item.children.Count>0)
{ {
List<PackReportTreeOutput> childs = (List<PackReportTreeOutput>)(Object)item.children; var childs = item.children.Adapt<List<PackReportTreeOutput>>();
if (childs.Where(p => p.process_id.Contains(input.process)).Any()) if (childs.Where(p => p.process_id.Contains(input.process)).Any())
flag = true; flag = true;
} }
if (!flag) if (!flag)
treeList.Remove(item); removelist.Add(item);
} }
removelist.ForEach(p => treeList.Remove(p));
} }
SqlSugarPagedList<PackReportTreeOutput> pagedList = new() SqlSugarPagedList<PackReportTreeOutput> pagedList = new()
{ {