no message
parent
80b45283b4
commit
2862fdef4f
|
|
@ -427,102 +427,98 @@ public class MlsServiceImpl implements MlsService {
|
|||
if (inventoryListFuture.join().isEmpty()) {
|
||||
throw new RuntimeException("无库存信息!");
|
||||
}
|
||||
List<String> errorMsgList = new ArrayList<>();
|
||||
inventoryListFuture.thenAccept((result) -> {
|
||||
//目标点
|
||||
try {
|
||||
inventoryListFuture.thenAccept((result) -> {
|
||||
//目标点
|
||||
/*Point endPoint = redisObjectUtils.getObjectFromCache("ckjbk", () -> pointService.findByCode(null, BaseStatus.FREE, null, "出库接驳口", null),
|
||||
"系统无此点位!");*/
|
||||
|
||||
List<Inventory> inventoryToUpdate = new ArrayList<>();
|
||||
List<PickDetail> pickDetailToCreate = new ArrayList<>();
|
||||
List<AgvTask> agvTaskToCreate = new ArrayList<>();
|
||||
List<Task> taskToCreate = new ArrayList<>();
|
||||
for (Inventory inv : result) {
|
||||
/* 按顺序获取出库接驳点*/
|
||||
Point endPoint;
|
||||
List<Point> pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.FREE);
|
||||
if (pointList.size() < 1) {
|
||||
errorMsgList.add(inv.getItemKey().getPropC1() + "标签分配无空闲缓存位!");
|
||||
continue;
|
||||
/* 出库接驳口无空闲库位,更新状态重新分配*/
|
||||
List<Inventory> inventoryToUpdate = new ArrayList<>();
|
||||
List<PickDetail> pickDetailToCreate = new ArrayList<>();
|
||||
List<AgvTask> agvTaskToCreate = new ArrayList<>();
|
||||
List<Task> taskToCreate = new ArrayList<>();
|
||||
for (Inventory inv : result) {
|
||||
/* 按顺序获取出库接驳点*/
|
||||
Point endPoint;
|
||||
List<Point> pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.FREE);
|
||||
if (pointList.size() < 1) {
|
||||
throw new RuntimeException("无空闲出库接驳口!");
|
||||
/* 出库接驳口无空闲库位,更新状态重新分配*/
|
||||
/*pointList = pointRepository.findByAreaAndStatus("出库接驳口", BaseStatus.USED);
|
||||
for (Point p : pointList) {
|
||||
p.setStatus(BaseStatus.FREE);
|
||||
pointRepository.save(p);
|
||||
}*/
|
||||
}
|
||||
endPoint = pointList.get(0);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(endPoint);
|
||||
}
|
||||
endPoint = pointList.get(0);
|
||||
endPoint.setStatus(BaseStatus.USED);
|
||||
pointRepository.save(endPoint);
|
||||
|
||||
//根据库存信息生成叫料任务
|
||||
Stock stock = inv.getStock();//容器
|
||||
Point startPoint = inv.getPoint();//起始点位
|
||||
ItemKey itemKey = inv.getItemKey();
|
||||
Item item = inv.getItemKey().getItem();
|
||||
//根据库存信息生成叫料任务
|
||||
Stock stock = inv.getStock();//容器
|
||||
Point startPoint = inv.getPoint();//起始点位
|
||||
ItemKey itemKey = inv.getItemKey();
|
||||
Item item = inv.getItemKey().getItem();
|
||||
|
||||
//更新库存信息
|
||||
inventoryToUpdate.add(updateInventory(inv));
|
||||
//更新库存信息
|
||||
inventoryToUpdate.add(updateInventory(inv));
|
||||
|
||||
//生成出库明细
|
||||
PickDetail pd = createPickDetail(item, inv.getBillCode(), itemKey.getPropC1(), inv.getQuantity(), issueInfo.getTaskNumber());
|
||||
pickDetailToCreate.add(pd);
|
||||
//生成出库明细
|
||||
PickDetail pd = createPickDetail(item, inv.getBillCode(), itemKey.getPropC1(), inv.getQuantity(), issueInfo.getTaskNumber());
|
||||
pickDetailToCreate.add(pd);
|
||||
|
||||
//生成搬运任务
|
||||
AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "PICKER_MOVE");
|
||||
agvTaskToCreate.add(agvTask);
|
||||
//生成搬运任务
|
||||
AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "PICKER_MOVE");
|
||||
agvTaskToCreate.add(agvTask);
|
||||
|
||||
//生成Task
|
||||
Task task = createTask(item, itemKey, pd, inv.getBillCode(), stock, startPoint, endPoint, agvTask, inv);
|
||||
taskToCreate.add(task);
|
||||
}
|
||||
|
||||
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("getIssueInfo-job");
|
||||
|
||||
// 批量更新库存信息
|
||||
CompletableFuture<Void> inventoryFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量更新库存信息
|
||||
if (!inventoryToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(inventoryToUpdate);
|
||||
//生成Task
|
||||
Task task = createTask(item, itemKey, pd, inv.getBillCode(), stock, startPoint, endPoint, agvTask, inv);
|
||||
taskToCreate.add(task);
|
||||
}
|
||||
|
||||
}, executor);
|
||||
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("getIssueInfo-job");
|
||||
|
||||
// 批量更新库存信息
|
||||
CompletableFuture<Void> inventoryFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量更新库存信息
|
||||
if (!inventoryToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(inventoryToUpdate);
|
||||
}
|
||||
|
||||
}, executor);
|
||||
|
||||
|
||||
CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenRunAsync(() -> {
|
||||
//批量生成叫料明细
|
||||
if (!pickDetailToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
||||
}
|
||||
CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenRunAsync(() -> {
|
||||
//批量生成叫料明细
|
||||
if (!pickDetailToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
||||
}
|
||||
|
||||
}, executor);
|
||||
}, executor);
|
||||
|
||||
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenRunAsync(() -> {
|
||||
// 批量生成agv任务
|
||||
if (!agvTaskToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
||||
}
|
||||
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenRunAsync(() -> {
|
||||
// 批量生成agv任务
|
||||
if (!agvTaskToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
||||
}
|
||||
|
||||
}, executor);
|
||||
}, executor);
|
||||
|
||||
CompletableFuture<Void> taskFuture = agvTaskFuture.thenRunAsync(() -> {
|
||||
// 批量生成任务
|
||||
if (!taskToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(taskToCreate);
|
||||
CompletableFuture<Void> taskFuture = agvTaskFuture.thenRunAsync(() -> {
|
||||
// 批量生成任务
|
||||
if (!taskToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(taskToCreate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, executor);
|
||||
taskFuture.join();
|
||||
}, executor);
|
||||
taskFuture.join();
|
||||
|
||||
executor.shutdown();
|
||||
});
|
||||
|
||||
if (!errorMsgList.isEmpty()) {
|
||||
throw new RuntimeException(errorMsgList.toString());
|
||||
executor.shutdown();
|
||||
}).join();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void processInventory(Inventory inv, Point endPoint) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue