修改托盘库库位选择逻辑,改为从中间的43,44列向两边扩散,先左后右
This commit is contained in:
parent
6b19b888c6
commit
7f00983377
|
|
@ -1,4 +1,4 @@
|
|||
package com.wms_main.service.business.serviceImpl;
|
||||
package com.wms_main.service.business.serviceImpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
|
|
@ -101,7 +101,7 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
* @return 申请到的库位,null表示无库位可用
|
||||
*/
|
||||
@Override
|
||||
public TAppLocation requestOneLocation(TAppLocation locationFilter, String requestVehicleId) {
|
||||
public TAppLocation requestOneLocation(TAppLocation locationFilter, String requestVehicleId) {
|
||||
// 目标库位
|
||||
TAppLocation targetLocation = null;
|
||||
// 设备号优先级序列
|
||||
|
|
@ -148,10 +148,11 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
}
|
||||
}
|
||||
return filterResult;
|
||||
}).sorted(Comparator.comparingInt(TAppLocation::getLRow)
|
||||
.thenComparingInt(TAppLocation::getLCol)
|
||||
.thenComparingInt(TAppLocation::getLLayer))
|
||||
.toList();
|
||||
}).collect(Collectors.toList());
|
||||
int maxCol = locationList.stream().mapToInt(TAppLocation::getLCol).max().orElse(86);
|
||||
candidateLocationList.sort(Comparator.comparingInt(TAppLocation::getLRow)
|
||||
.thenComparingInt(loc -> computeColOrder(loc.getLCol(), maxCol))
|
||||
.thenComparingInt(TAppLocation::getLLayer));
|
||||
|
||||
// 若指定了 subArea,则基于上述排序优先同 subArea 的库位
|
||||
if (locationFilter != null && StringUtils.isNotEmpty(locationFilter.getSubArea())) {
|
||||
|
|
@ -349,6 +350,17 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 列排序权重:以列数中点为中心(86列 => 中点在43/44之间),
|
||||
* 先靠近中点的列优先,等距时优先左侧(43)再右侧(44)。
|
||||
* 计算采用整数运算:distance2 = |col*2 - (maxCol + 1)|。
|
||||
*/
|
||||
private int computeColOrder(int col, int maxCol) {
|
||||
int centerTimes2 = maxCol + 1; // 偶数列的两个中心之和(如86=>87)
|
||||
int distance2 = Math.abs(col * 2 - centerTimes2); // 与中心的“距离”×2
|
||||
int side = (col <= centerTimes2 / 2) ? 0 : 1; // 左侧优先(43 再 44)
|
||||
return distance2 * 2 + side; // 组合为稳定的权重
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到最空闲的那台设备
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user