Commit 23461ec561ad52396c0036bd7a930cb656c20f6d

Authored by puff
1 parent a0a8a88d

bugfix:库位分配同步问题修复

src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... ... @@ -222,13 +222,15 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
222 222 // return AjaxResult.error("物料不存在!!!");
223 223 // materialAreaCode = material.getMaterialAreaCode();
224 224 // }
  225 +
225 226 boolean passLimit = true;
226 227 if (taskType == QuantityConstant.TASK_TYPE_WHOLERECEIPT || taskType == QuantityConstant.TASK_TYPE_EMPTYRECEIPT
227 228 || taskType == QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT) {
228 229 passLimit = false;
229 230 }
230 231  
231   - locationCode = getNearestLocation("");
  232 + // TODO inputOrOutPutMaterialcode
  233 + locationCode = getNearestLocation(high,"",warehouseCode,"");
232 234 if(StrUtil.isBlank(locationCode)){
233 235 locationCode = locationAllocationService.allocation(allocationRule,
234 236 locationTypeCodeList, high, area, roadWays, warehouseCode, containerCode, materialAreaCode);
... ... @@ -328,7 +330,17 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
328 330  
329 331 private final static String INVENTORY_RANKING_KEY = "INVENTORY_RANKING";
330 332  
331   - private String getNearestLocation(String inputOrOutPutMaterialcode){
  333 + /**
  334 + * 统计物料出入库的频率,将常用的物料优先分配离出入口近的库区A
  335 + * @param high 高度
  336 + * @param materialAreaCode
  337 + * @param warehouseCode
  338 + * @param inputOrOutPutMaterialcode
  339 + * @return
  340 + */
  341 + private String getNearestLocation(int high,String materialAreaCode,
  342 + String warehouseCode,
  343 + String inputOrOutPutMaterialcode){
332 344 Map<String, InventoryRankVO> inventoryRankMap =
333 345 inventoryTransactionService.getMaterialDetailByKey(INVENTORY_RANKING_KEY);
334 346 InventoryRankVO inputMaterialCode = inventoryRankMap.get(inputOrOutPutMaterialcode);
... ... @@ -337,7 +349,13 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService
337 349 // 获取常用库区
338 350 List<Location> locationList = locationService
339 351 .list(new LambdaQueryWrapper<Location>()
340   - .eq(Location::getZoneCode, "A"));
  352 + .eq(Location::getZoneCode, "A")
  353 + .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY)
  354 + .eq(Location::getHigh, high)
  355 + .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode)
  356 + .eq(Location::getWarehouseCode, warehouseCode)
  357 + .orderByAsc(Location::getILayer).last(" limit 20"));
  358 +
341 359 if(CollectionUtil.isNotEmpty(locationList)){
342 360 LinkedList<Location> locationLinkedList = new LinkedList<>(locationList);
343 361 locationLinkedList.sort(Comparator.comparingInt(Location::getId));
... ...