diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 6015c8d9..f0d72f5d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -263,9 +263,12 @@ namespace Tnb.WarehouseMgr .Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) && !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)) .ToList(); + preTasks = preTasks.Where(it => !agvElevatorTasks.Select(x=>x.endlocation_code).Contains(it.endlocation_code)).ToList(); + IEnumerable firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault()); agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code)); - preTasks = preTasks.Where(it => !it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase)).Concat(agvElevatorTasks).ToList(); + preTasks = preTasks.Concat(agvElevatorTasks).ToList(); + List ids = preTasks.Select(x => x.id).Distinct().ToList(); List? preTaskCodes = await db.Queryable().Where(it => ids.Contains(it.bill_id)).ToListAsync();