#
vincentlu
2026-01-05 472fb990c1c6216f6f375eb65ba957aaf75b3a00
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -899,6 +899,8 @@
            AgvModel agvModel = agvModelService.getByAgvId(agvId);
            Double workDirection = agvModel.getWorkDirection();
            boolean backupAction = null != agvModel.getBackupAction() && agvModel.getBackupActionBool();
            boolean needUndocking = null != agvModel.getNeedUndocking() && agvModel.getNeedUndockingBool();
            AgvSpeedType agvSpeedType = AgvSpeedType.query(agvModel.getTravelSpeed());
            assert agvSpeedType != null;
@@ -1063,7 +1065,6 @@
                AgvDirectionType agvDirectionType;
                Double staWorkDirection;
                AgvBackpackType backpackType = AgvBackpackType.query(segment.getBackpack());
                // todo agvModel backpackAction ?
                switch (Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))) {
                    case ORI_LOC:
                        assert backpackType != null;
@@ -1090,7 +1091,8 @@
                                agvId,    // AGV
                                now    // 工作时间
                        ));
                        // 暂存点放货
                        // 背篓放货
                        if (backupAction) {
                        actionList.add(new Action(
                                null,    // 编号
                                task.getBusId(),    // 总线
@@ -1106,6 +1108,7 @@
                                agvId,    // AGV
                                now    // 工作时间
                        ));
                        }
                        break;
                    case DEST_LOC:
                        assert backpackType != null;
@@ -1113,7 +1116,8 @@
                        if (!lastDirection.equals(workDirection)) {
                            throw new CoolException(agvNo + "号小车方向错误,请推至转弯点手动调整");
                        }
                        // 暂存点取货货
                        // 背篓取货
                        if (backupAction) {
                        actionList.add(new Action(
                                null,    // 编号
                                task.getBusId(),    // 总线
@@ -1129,6 +1133,7 @@
                                agvId,    // AGV
                                now    // 工作时间
                        ));
                        }
                        // 货架放货
                        Loc destLoc = locService.getById(task.getDestLoc());
@@ -1194,7 +1199,8 @@
                                agvId,    // AGV
                                now    // 工作时间
                        ));
                        // 暂存点放货
                        // 背篓放货
                        if (backupAction) {
                        assert backpackType != null;
                        actionList.add(new Action(
                                null,    // 编号
@@ -1211,6 +1217,7 @@
                                agvId,    // AGV
                                now    // 工作时间
                        ));
                        }
                        break;
                    case DEST_STA:
                        // 站点放货
@@ -1239,7 +1246,8 @@
                            ));
                            lastDirection = destStaWorkDirection;
                        }
                        // 暂存点取货
                        // 背篓取货
                        if (backupAction) {
                        assert backpackType != null;
                        actionList.add(new Action(
                                null,    // 编号
@@ -1256,6 +1264,7 @@
                                agvId,    // AGV
                                now    // 工作时间
                        ));
                        }
                        // 计算货叉工作方向
                        staWorkDirection = mapService.calculateAgvWorkDirectionByStation(destStaWorkDirection, lastDirection);
                        actionList.add(new Action(
@@ -1362,8 +1371,7 @@
            }
            // 如果充电中,则先断开充电
            // todo agvModel backpackAction ?
            if (agvModel.getNeedUndockingBool() && agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) {
            if (needUndocking && agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) {
                String undockingCode = Cools.isEmpty(actionList) ? lastCode.getData() : actionList.get(0).getCode();
                // undocking charge
                actionList.add(0, new Action(
@@ -1400,8 +1408,6 @@
                    now    // 工作时间
            ));
            // todo asr need optimize sort ?
            List<Action> newActionList = actionSorter.optimizeSort(actionList);
            String groupId = String.valueOf(snowflakeIdWorker.nextId()).substring(3);
            // update segment
@@ -1436,6 +1442,9 @@
//                }
//            }
            // optimize action list, must have backpack
            List<Action> newActionList = backupAction ? actionSorter.optimizeSort(actionList) : actionList;
            // save action
            int i = newActionList.size();
            for (Action action : newActionList) {