feat(wms): 优化批次分配逻辑
- 新增死锁检测功能,判断任务执行顺序是否会产生死锁 - 如果存在死锁,使用拓扑排序找出可行的批次分配方案 - 如果不存在死锁,按 processId 合并任务生成批次组 - 优化了代码结构,提高了可读性和可维护性
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.klp.domain.vo.BatchGroupVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -119,8 +121,8 @@ public class WmsBatchController extends BaseController {
|
||||
.collect(java.util.stream.Collectors.groupingBy(BatchGroupVo::getProcessId));
|
||||
|
||||
// 合并相同processId的批次组
|
||||
List<BatchGroupVo> mergedBatches = new java.util.ArrayList<>();
|
||||
java.util.concurrent.atomic.AtomicInteger groupCounter = new java.util.concurrent.atomic.AtomicInteger(1);
|
||||
List<BatchGroupVo> mergedBatches = new ArrayList<>();
|
||||
AtomicInteger groupCounter = new AtomicInteger(1);
|
||||
|
||||
groupedByProcessId.forEach((processId, groups) -> {
|
||||
// 创建一个新的合并后的批次组
|
||||
|
||||
Reference in New Issue
Block a user