Commit dfd4e472210cd8c312672e75a6c356610e5ba6b4
1 parent
522ea145
优化库位分配代码, 库位类型由托盘类型匹配
Showing
1 changed file
with
11 additions
and
1 deletions
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; | @@ -15,6 +15,7 @@ import org.jeecg.modules.wms.api.wcs.entity.WcsTask; | ||
15 | import org.jeecg.modules.wms.config.address.service.IAddressService; | 15 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
16 | import org.jeecg.modules.wms.config.container.entity.Container; | 16 | import org.jeecg.modules.wms.config.container.entity.Container; |
17 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 17 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
18 | +import org.jeecg.modules.wms.config.containerType.entity.ContainerType; | ||
18 | import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; | 19 | import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; |
19 | import org.jeecg.modules.wms.config.location.entity.Location; | 20 | import org.jeecg.modules.wms.config.location.entity.Location; |
20 | import org.jeecg.modules.wms.config.location.service.ILocationService; | 21 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
@@ -124,9 +125,18 @@ public class WcsServiceImpl implements WcsService { | @@ -124,9 +125,18 @@ public class WcsServiceImpl implements WcsService { | ||
124 | if (container == null) { | 125 | if (container == null) { |
125 | return Result.error("分配库位时,任务托盘为空"); | 126 | return Result.error("分配库位时,任务托盘为空"); |
126 | } | 127 | } |
128 | + String containerTypeCode = container.getContainerTypeCode(); | ||
129 | + if (StringUtils.isEmpty(containerTypeCode)) { | ||
130 | + return Result.error("分配库位时,任务托盘没有库位类型,托盘号为" + containerCode); | ||
131 | + } | ||
132 | + ContainerType containerType = containerTypeService.getContainerTypeByCode(containerTypeCode, warehouseCode); | ||
133 | + if (containerType == null) { | ||
134 | + return Result.error("分配库位时,托盘类型为空,托盘类型值为" + containerTypeCode); | ||
135 | + } | ||
136 | + String locationTypeCodes = containerType.getLocationType(); | ||
127 | // 查询满足条件的库位类型 | 137 | // 查询满足条件的库位类型 |
128 | LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery(); | 138 | LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery(); |
129 | - locationTypeLambdaQueryWrapper.eq(LocationType::getZoneCode, zone.getCode()).eq(LocationType::getWarehouseCode, warehouseCode); | 139 | + locationTypeLambdaQueryWrapper.in(LocationType::getCode, locationTypeCodes).eq(LocationType::getWarehouseCode, warehouseCode); |
130 | List<LocationType> locationTypeList = locationTypeService.list(locationTypeLambdaQueryWrapper); | 140 | List<LocationType> locationTypeList = locationTypeService.list(locationTypeLambdaQueryWrapper); |
131 | if (locationTypeList.size() == 0) { | 141 | if (locationTypeList.size() == 0) { |
132 | return Result.error("分配库位时,没有找到库位类型"); | 142 | return Result.error("分配库位时,没有找到库位类型"); |