Commit dfd4e472210cd8c312672e75a6c356610e5ba6b4

Authored by 肖超群
1 parent 522ea145

优化库位分配代码, 库位类型由托盘类型匹配

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 15 import org.jeecg.modules.wms.config.address.service.IAddressService;
16 16 import org.jeecg.modules.wms.config.container.entity.Container;
17 17 import org.jeecg.modules.wms.config.container.service.IContainerService;
  18 +import org.jeecg.modules.wms.config.containerType.entity.ContainerType;
18 19 import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService;
19 20 import org.jeecg.modules.wms.config.location.entity.Location;
20 21 import org.jeecg.modules.wms.config.location.service.ILocationService;
... ... @@ -124,9 +125,18 @@ public class WcsServiceImpl implements WcsService {
124 125 if (container == null) {
125 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 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 140 List<LocationType> locationTypeList = locationTypeService.list(locationTypeLambdaQueryWrapper);
131 141 if (locationTypeList.size() == 0) {
132 142 return Result.error("分配库位时,没有找到库位类型");
... ...