Commit d73f651939c3d29a895ff732e4c1cb575283feb5
1 parent
9f9b9e75
分配库位巷道为空时,换一个方法获取巷道
Showing
3 changed files
with
17 additions
and
4 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
... | ... | @@ -103,8 +103,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
103 | 103 | public String doubleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode, |
104 | 104 | String materialCode) { |
105 | 105 | if (roadWays == null || roadWays.size() < 1) { |
106 | - List<Location> locationList = locationService.getLocationListByZoneCode(zoneCode, warehouseCode); | |
107 | - roadWays = locationList.stream().map(Location::getRoadWay).distinct().collect(toList()); | |
106 | + roadWays = locationService.getRoadWayByZoneCode(zoneCode,warehouseCode); | |
108 | 107 | } |
109 | 108 | String value = parameterConfigurationService.getValueByCode(QuantityConstant.DOUBLE_FORK_RESERVE_LOCATION); |
110 | 109 | int reserveNumber = 4; |
... | ... | @@ -192,8 +191,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
192 | 191 | public String singleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode, |
193 | 192 | String materialCode) { |
194 | 193 | if (roadWays == null || roadWays.size() < 1) { |
195 | - List<Location> locationList = locationService.getLocationListByZoneCode(zoneCode, warehouseCode); | |
196 | - roadWays = locationList.stream().map(Location::getRoadWay).distinct().collect(toList()); | |
194 | + roadWays = locationService.getRoadWayByZoneCode(zoneCode,warehouseCode); | |
197 | 195 | } |
198 | 196 | List<Integer> removeRoadWays = new ArrayList<>(); |
199 | 197 | // 寻找可用巷道,空闲的空库位低于设定值,那么这个巷道就不能用来分配库位 |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
... | ... | @@ -27,6 +27,8 @@ public interface ILocationService extends IService<Location> { |
27 | 27 | |
28 | 28 | List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode); |
29 | 29 | |
30 | + List<Integer> getRoadWayByZoneCode(String zoneCode, String warehouseCode); | |
31 | + | |
30 | 32 | boolean updateStatus(String locationCode, String status, String warehouseCode); |
31 | 33 | |
32 | 34 | boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ import java.util.stream.Collectors; |
7 | 7 | |
8 | 8 | import javax.annotation.Resource; |
9 | 9 | |
10 | +import cn.hutool.core.collection.CollUtil; | |
10 | 11 | import org.apache.commons.collections4.ListUtils; |
11 | 12 | import org.apache.shiro.util.CollectionUtils; |
12 | 13 | import org.jeecg.common.api.vo.Result; |
... | ... | @@ -113,6 +114,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
113 | 114 | } |
114 | 115 | |
115 | 116 | @Override |
117 | + public List<Integer> getRoadWayByZoneCode(String zoneCode, String warehouseCode) { | |
118 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
119 | + locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) | |
120 | + .eq(Location::getWarehouseCode, warehouseCode).select(Location::getRoadWay).groupBy(Location::getRoadWay); | |
121 | + List<Location> locationList = locationService.list(locationLambdaQueryWrapper); | |
122 | + if (CollectionUtils.isEmpty(locationList)) { | |
123 | + return CollUtil.newArrayList(); | |
124 | + } | |
125 | + return locationList.stream().map(Location::getRoadWay).collect(Collectors.toList()); | |
126 | + } | |
127 | + | |
128 | + @Override | |
116 | 129 | @Transactional |
117 | 130 | public boolean updateStatus(String locationCode, String status, String warehouseCode) { |
118 | 131 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); |
... | ... |