From dfd4e472210cd8c312672e75a6c356610e5ba6b4 Mon Sep 17 00:00:00 2001 From: youjie <272855983@qq.com> Date: Mon, 17 Apr 2023 10:19:41 +0800 Subject: [PATCH] 优化库位分配代码, 库位类型由托盘类型匹配 --- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java index f24e52e..c9c62ab 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java @@ -15,6 +15,7 @@ import org.jeecg.modules.wms.api.wcs.entity.WcsTask; import org.jeecg.modules.wms.config.address.service.IAddressService; import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; +import org.jeecg.modules.wms.config.containerType.entity.ContainerType; import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.ILocationService; @@ -124,9 +125,18 @@ public class WcsServiceImpl implements WcsService { if (container == null) { return Result.error("分配库位时,任务托盘为空"); } + String containerTypeCode = container.getContainerTypeCode(); + if (StringUtils.isEmpty(containerTypeCode)) { + return Result.error("分配库位时,任务托盘没有库位类型,托盘号为" + containerCode); + } + ContainerType containerType = containerTypeService.getContainerTypeByCode(containerTypeCode, warehouseCode); + if (containerType == null) { + return Result.error("分配库位时,托盘类型为空,托盘类型值为" + containerTypeCode); + } + String locationTypeCodes = containerType.getLocationType(); // 查询满足条件的库位类型 LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery(); - locationTypeLambdaQueryWrapper.eq(LocationType::getZoneCode, zone.getCode()).eq(LocationType::getWarehouseCode, warehouseCode); + locationTypeLambdaQueryWrapper.in(LocationType::getCode, locationTypeCodes).eq(LocationType::getWarehouseCode, warehouseCode); List<LocationType> locationTypeList = locationTypeService.list(locationTypeLambdaQueryWrapper); if (locationTypeList.size() == 0) { return Result.error("分配库位时,没有找到库位类型"); -- libgit2 0.22.2