修改托盘库库位选择逻辑,改为从中间的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.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
|
@ -148,10 +148,11 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filterResult;
|
return filterResult;
|
||||||
}).sorted(Comparator.comparingInt(TAppLocation::getLRow)
|
}).collect(Collectors.toList());
|
||||||
.thenComparingInt(TAppLocation::getLCol)
|
int maxCol = locationList.stream().mapToInt(TAppLocation::getLCol).max().orElse(86);
|
||||||
.thenComparingInt(TAppLocation::getLLayer))
|
candidateLocationList.sort(Comparator.comparingInt(TAppLocation::getLRow)
|
||||||
.toList();
|
.thenComparingInt(loc -> computeColOrder(loc.getLCol(), maxCol))
|
||||||
|
.thenComparingInt(TAppLocation::getLLayer));
|
||||||
|
|
||||||
// 若指定了 subArea,则基于上述排序优先同 subArea 的库位
|
// 若指定了 subArea,则基于上述排序优先同 subArea 的库位
|
||||||
if (locationFilter != null && StringUtils.isNotEmpty(locationFilter.getSubArea())) {
|
if (locationFilter != null && StringUtils.isNotEmpty(locationFilter.getSubArea())) {
|
||||||
|
|
@ -349,6 +350,17 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
}
|
}
|
||||||
return result;
|
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