From 5682b1ca1b1b016f79667e82866e05683f3dff26 Mon Sep 17 00:00:00 2001 From: cbs <18617195505@163.com> Date: Thu, 3 Jul 2025 10:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E4=BD=8D=E5=B1=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapnode/strategy/HouseLocationStrategyImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/handler/mapnode/strategy/HouseLocationStrategyImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/handler/mapnode/strategy/HouseLocationStrategyImpl.java index 8da0c0629..8cd262fc0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/handler/mapnode/strategy/HouseLocationStrategyImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/handler/mapnode/strategy/HouseLocationStrategyImpl.java @@ -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) { @@ -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); } } }