预任务执行,如果电梯任务,预Agv任务存在相同目标库位,删除Agv任务保证电梯任务先行
This commit is contained in:
@@ -252,7 +252,7 @@ namespace Tnb.WarehouseMgr
|
||||
//获取所有未下发的预任务申请
|
||||
List<WmsPretaskH> preTasks = await db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
|
||||
.InnerJoin<WmsAreaH>((a, b, c) => a.area_id == c.id)
|
||||
.InnerJoin<BasLocation>((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0" )
|
||||
.InnerJoin<BasLocation>((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0")
|
||||
.Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id))
|
||||
.OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code })
|
||||
.Select((a, b, c, d) => new WmsPretaskH
|
||||
@@ -265,12 +265,22 @@ 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();
|
||||
|
||||
//it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)
|
||||
var elePreTasks = preTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
var normalPreTasks = preTasks.Where(it => !agvElevatorTasks.Concat(elePreTasks).Select(x => x.endlocation_code).Contains(it.endlocation_code)).ToList();
|
||||
|
||||
IEnumerable<WmsPretaskH?> 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)).DistinctBy(x=>x.endlocation_code).ToList();
|
||||
agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty<WmsPretaskH?>().ToList();
|
||||
preTasks = preTasks.Concat(agvElevatorTasks).ToList();
|
||||
agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty<WmsPretaskH>().ToList()!;
|
||||
|
||||
//如果电梯任务,预Agv任务存在相同目标库位,删除Agv任务保证电梯任务先行
|
||||
var equalEndLocPreTasks = elePreTasks.Select(x => x.endlocation_code).Intersect(agvElevatorTasks.Select(x => x.endlocation_code));
|
||||
if (equalEndLocPreTasks.Any())
|
||||
{
|
||||
agvElevatorTasks = agvElevatorTasks.Where(x => !equalEndLocPreTasks.Contains(x.endlocation_code)).ToList();
|
||||
}
|
||||
preTasks = normalPreTasks.Concat(agvElevatorTasks).Concat(elePreTasks).ToList();
|
||||
|
||||
|
||||
List<string> ids = preTasks.Select(x => x.id).Distinct().ToList();
|
||||
@@ -1025,7 +1035,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <param name="ele"></param>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
public async Task<List<WmsPointH>> PathAlgorithmsEle(string pStartId, string pEndId,int ele)
|
||||
public async Task<List<WmsPointH>> PathAlgorithmsEle(string pStartId, string pEndId, int ele)
|
||||
{
|
||||
List<WmsRoad> roads = await _db.Queryable<WmsRoad>().Where(it => it.status == 1).ToListAsync();
|
||||
List<WmsPointH> points = await LocPathCalcAlgorithms(pStartId, pEndId, roads);
|
||||
@@ -1047,7 +1057,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
throw new AppFriendlyException("电梯被禁用或未配置", 500);
|
||||
}
|
||||
if(ele % 2 == 1)
|
||||
if (ele % 2 == 1)
|
||||
{
|
||||
//判断电梯组中各电梯任务数
|
||||
if (curEle == null || sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
|
||||
|
||||
Reference in New Issue
Block a user