#
vincentlu
2025-12-31 4937f052ec2c91b3fdcbb669aef7991912cde98e
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -246,33 +246,36 @@
            }
            List<Long> taskIds = taskList.stream().map(Task::getId).distinct().collect(Collectors.toList());
            for (Task task : taskList) {
                String agvNo = allocateService.execute(task, new AllocateSupport() {
                    @Override
                    public void success(Task task, String agvNo) {
                        if (Cools.isEmpty(agvNo)) {
                            return;
            for (Task t : taskList) {
                String resultAgvNo = allocateService.execute(t
                        // inbound
                        , (task, agvNo) -> {
                        }
                        task.setAgvId(agvService.getAgvId(agvNo));
                        task.setTaskSts(TaskStsType.WAITING.val());
                        task.setIoTime(now);
                        task.setUpdateTime(now);
                        if (!taskService.updateById(task)) {
                            throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update");
                        }
                    }
                });
                if (Cools.isEmpty(agvNo)) {
//                    log.warn("Task[{}] has an issue, because it failed to check out agv which is idle...", task.getSeqNum());
                    continue;
                }
                task.setAgvId(agvService.getAgvId(agvNo));
                task.setTaskSts(TaskStsType.WAITING.val());
                task.setIoTime(now);
                task.setUpdateTime(now);
                if (!taskService.updateById(task)) {
                    throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update");
                }
                        // normal
                        , (task, agvNo) -> {
                            if (Cools.isEmpty(agvNo)) {
                                return;
                            }
                            task.setAgvId(agvService.getAgvId(agvNo));
                            task.setTaskSts(TaskStsType.WAITING.val());
                            task.setIoTime(now);
                            task.setUpdateTime(now);
                            if (!taskService.updateById(task)) {
                                throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update");
                            }
                        });
//                if (Cools.isEmpty(agvNo)) {
////                    log.warn("Task[{}] has an issue, because it failed to check out agv which is idle...", task.getSeqNum());
//                    continue;
//                }
//                task.setAgvId(agvService.getAgvId(agvNo));
//                task.setTaskSts(TaskStsType.WAITING.val());
//                task.setIoTime(now);
//                task.setUpdateTime(now);
//                if (!taskService.updateById(task)) {
//                    throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update");
//                }
            }
        } catch (Exception e) {
            log.error("mainService.infuseAgvForTask", e);