库位层数

This commit is contained in:
cbs 2025-07-03 10:39:11 +08:00
parent 55712a77a5
commit 5682b1ca1b

View File

@ -57,11 +57,14 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
// -- 筛选出 库位编号不为空 - 并且第最后一组数据 最大的值 - 如果没有则为0
int max = wareHouseLocationDOS.stream().map(WareHouseLocationDO::getLocationNo).filter(StrUtil::isNotEmpty)
.mapToInt(s -> Integer.parseInt(s.substring(s.length() - 1))).max().orElse(1);
boolean isNew = wareHouseLocationDOS.stream().allMatch(v -> ObjectUtil.isEmpty(v.getLocationNo()));
if (!isNew) {
max = max + 1;
}
Long locationNumber = null;
if (ObjectUtil.isNotEmpty(item.getLocationNumber())) {
locationNumber = item.getLocationNumber();
}
int locationStorey = 1;
for (WareHouseLocationDO wareHouseLocationDO : wareHouseLocationDOS) {
wareHouseLocationDO.setLocationX(item.getLocationX());
wareHouseLocationDO.setLocationY(item.getLocationY());
@ -70,12 +73,11 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
if (wareHouseLocationDO.getId() == null) {
wareHouseLocationDO.setId(getId());
}
if (1 == locationStorey) {
if (1 == max) {
wareHouseLocationDO.setLocationTrayHeight(new BigDecimal("0"));
}
wareHouseLocationDO.setLocationStorey(locationStorey);
locationStorey ++;
if (StrUtil.isEmpty(wareHouseLocationDO.getLocationNo())) {
wareHouseLocationDO.setLocationStorey(max);
// -- 生成库位编号 -
String locationNo = String.format(KW_NO_FORMAT, positionMapId, RandomUtil.randomNumbers(4), max++);
wareHouseLocationDO.setLocationNo(locationNo);
@ -104,6 +106,7 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
/**
* 校验要删除的库位是否有处理中的任务
*
* @param list
*/
public void checkLocationHaveDoingTask(List<List<WareHouseLocationDO>> list) {
@ -122,7 +125,7 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
}
String join = StringUtils.join(locationNos, ",");
throw exception0(HOUSE_LOCATION_HAVE_TASK.getCode(), "以下库位存在处理中的任务:"+join,join);
throw exception0(HOUSE_LOCATION_HAVE_TASK.getCode(), "以下库位存在处理中的任务:" + join, join);
}
}
}