Commit 4ce8c79abd62b96e764a14dcffe6eccaa76981fe

Authored by 谭毅彬
1 parent c40a570d

多库区分配巷道,修正未筛选库区参数BUG

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationService.java
... ... @@ -34,9 +34,10 @@ public interface LocationAllocationService {
34 34 * 排除巷道,如果这个巷道分配了超过2个库位,那么就不往这边分库位了,避免堵死的情况
35 35 * @param roadWays
36 36 * @param warehouseCode
  37 + * @param warehouseCode2
37 38 * @return
38 39 */
39   - List<Integer> removeRoadWaysByPreLocations(List<Integer> roadWays, String warehouseCode);
  40 + List<Integer> removeRoadWaysByPreLocations(List<Integer> roadWays, String zoneCode, String warehouseCode);
40 41  
41 42 /**
42 43 * 获取巷道,根据入库物料均分原则,选取物料最少的巷道
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
... ... @@ -28,6 +28,7 @@ import org.jeecg.utils.StringUtils;
28 28 import org.jeecg.utils.constant.QuantityConstant;
29 29 import org.springframework.stereotype.Service;
30 30 import org.springframework.transaction.annotation.Transactional;
  31 +import org.springframework.util.CollectionUtils;
31 32  
32 33 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
33 34 import com.baomidou.mybatisplus.core.metadata.IPage;
... ... @@ -237,16 +238,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
237 238 @Override
238 239 @Transactional(rollbackFor = Exception.class)
239 240 public Integer getRoadWay(List<Integer> roadWays, String materialCode, String zoneCode, String warehouseCode) {
240   - if (StringUtils.isEmpty(roadWays)) {
  241 + if (CollectionUtils.isEmpty(roadWays)) {
241 242 throw new JeecgBootException("分配库位错误,没有巷道");
242 243 }
243 244 int roadWay = roadWays.get(0);
244 245 if (roadWays.size() == 1) {
245 246 return roadWay;
246 247 }
247   -
248   - roadWays = locationAllocationService.removeRoadWaysByPreLocations(roadWays, warehouseCode);
249   - if (StringUtils.isEmpty(roadWays)) {
  248 + roadWays = locationAllocationService.removeRoadWaysByPreLocations(roadWays, zoneCode, warehouseCode);
  249 + if (CollectionUtils.isEmpty(roadWays)) {
250 250 return roadWay;
251 251 }
252 252 // 获取巷道,选取空闲库位最多作为巷道
... ... @@ -288,7 +288,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
288 288  
289 289 @Override
290 290 @Transactional(rollbackFor = Exception.class)
291   - public List<Integer> removeRoadWaysByPreLocations(List<Integer> roadWays, String warehouseCode) {
  291 + public List<Integer> removeRoadWaysByPreLocations(List<Integer> roadWays, String zoneCode, String warehouseCode) {
292 292 String value = parameterConfigurationService.getValueByCode(QuantityConstant.MAX_ROADWAY_RECEIPT);
293 293 // 同巷道分配的库位大于等于2时,这个巷道就不能再分了
294 294 int maxRoadReceipt = 2;
... ... @@ -296,8 +296,8 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
296 296 maxRoadReceipt = Integer.parseInt(value);
297 297 }
298 298 LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
299   - taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED).ne(TaskHeader::getToLocationCode,
300   - QuantityConstant.EMPTY_STRING);
  299 + taskHeaderLambdaQueryWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED).eq(TaskHeader::getZoneCode, zoneCode)
  300 + .ne(TaskHeader::getToLocationCode, QuantityConstant.EMPTY_STRING);
301 301 List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper);
302 302 if (taskHeaderList.size() != 0) {
303 303 List<Integer> roadWayList = taskHeaderList.stream().map(TaskHeader::getRoadWay).collect(toList());
... ... @@ -321,14 +321,14 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
321 321 }
322 322 Collections.shuffle(roadWays);// 打乱巷道排序
323 323 int roadWay = roadWays.get(0);
324   - if (roadWays.size() == 1) {
325   - return roadWay;
326   - }
  324 +// if (roadWays.size() == 1) {
  325 +// return roadWay;
  326 +// }
  327 +// roadWays = locationAllocationService.removeRoadWaysByPreLocations(roadWays, zoneCode, warehouseCode);
  328 +// if (roadWays.size() == 0) {
  329 +// return roadWay;
  330 +// }
327 331 int min = Integer.MAX_VALUE;
328   - roadWays = locationAllocationService.removeRoadWaysByPreLocations(roadWays, warehouseCode);
329   - if (roadWays.size() == 0) {
330   - return roadWay;
331   - }
332 332 List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByMaterialCodeAndZoneCode(materialCode, zoneCode, warehouseCode);
333 333 if (inventoryDetailList.size() != 0) {
334 334 List<Integer> roadWayList = inventoryDetailList.stream().map(InventoryDetail::getRoadWay).collect(toList());
... ...