From 63d1ef3bbf39960506cd050da016ad8316a53a2e Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Mon, 13 Nov 2023 18:32:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E7=94=B5=E6=A2=AF=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E9=A2=84Agv=E4=BB=BB=E5=8A=A1=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4Agv=E4=BB=BB=E5=8A=A1=E4=BF=9D=E8=AF=81?= =?UTF-8?q?=E7=94=B5=E6=A2=AF=E4=BB=BB=E5=8A=A1=E5=85=88=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 523819c6..a9691665 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -252,7 +252,7 @@ namespace Tnb.WarehouseMgr //获取所有未下发的预任务申请 List preTasks = await db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id) .InnerJoin((a, b, c) => a.area_id == c.id) - .InnerJoin((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0" ) + .InnerJoin((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 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().ToList(); - preTasks = preTasks.Concat(agvElevatorTasks).ToList(); + agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty().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 ids = preTasks.Select(x => x.id).Distinct().ToList(); @@ -1025,7 +1035,7 @@ namespace Tnb.WarehouseMgr /// /// [NonAction] - public async Task> PathAlgorithmsEle(string pStartId, string pEndId,int ele) + public async Task> PathAlgorithmsEle(string pStartId, string pEndId, int ele) { List roads = await _db.Queryable().Where(it => it.status == 1).ToListAsync(); List 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)