Commit d73f651939c3d29a895ff732e4c1cb575283feb5

Authored by 曾湘平
1 parent 9f9b9e75

分配库位巷道为空时,换一个方法获取巷道

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,8 +103,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
103 public String doubleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode, 103 public String doubleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode,
104 String materialCode) { 104 String materialCode) {
105 if (roadWays == null || roadWays.size() < 1) { 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 String value = parameterConfigurationService.getValueByCode(QuantityConstant.DOUBLE_FORK_RESERVE_LOCATION); 108 String value = parameterConfigurationService.getValueByCode(QuantityConstant.DOUBLE_FORK_RESERVE_LOCATION);
110 int reserveNumber = 4; 109 int reserveNumber = 4;
@@ -192,8 +191,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService @@ -192,8 +191,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
192 public String singleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode, 191 public String singleRk(String zoneCode, List<Integer> roadWays, int high, String warehouseCode, List<String> locationTypeCodeList, String materialAreaCode,
193 String materialCode) { 192 String materialCode) {
194 if (roadWays == null || roadWays.size() < 1) { 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 List<Integer> removeRoadWays = new ArrayList<>(); 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&lt;Location&gt; { @@ -27,6 +27,8 @@ public interface ILocationService extends IService&lt;Location&gt; {
27 27
28 List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode); 28 List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode);
29 29
  30 + List<Integer> getRoadWayByZoneCode(String zoneCode, String warehouseCode);
  31 +
30 boolean updateStatus(String locationCode, String status, String warehouseCode); 32 boolean updateStatus(String locationCode, String status, String warehouseCode);
31 33
32 boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode); 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,6 +7,7 @@ import java.util.stream.Collectors;
7 7
8 import javax.annotation.Resource; 8 import javax.annotation.Resource;
9 9
  10 +import cn.hutool.core.collection.CollUtil;
10 import org.apache.commons.collections4.ListUtils; 11 import org.apache.commons.collections4.ListUtils;
11 import org.apache.shiro.util.CollectionUtils; 12 import org.apache.shiro.util.CollectionUtils;
12 import org.jeecg.common.api.vo.Result; 13 import org.jeecg.common.api.vo.Result;
@@ -113,6 +114,18 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i @@ -113,6 +114,18 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
113 } 114 }
114 115
115 @Override 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 @Transactional 129 @Transactional
117 public boolean updateStatus(String locationCode, String status, String warehouseCode) { 130 public boolean updateStatus(String locationCode, String status, String warehouseCode) {
118 LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); 131 LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate();