#
vincentlu
2025-01-21 a079fff1e7bae25a5e29f73709b8e9972216f7ef
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -250,7 +250,7 @@
        try {
            // valid -----------------------------------------------
            Agv agv = agvService.getById(agvId);
            if (!agvService.judgeEnable(agv.getId(), true)) {
            if (!agvService.judgeEnable(agv.getId(), false)) {
                return;
            }
            if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) {
@@ -497,7 +497,6 @@
        if (Cools.isEmpty(agvId, taskType)) { return false; }
        try {
            String agvNo = agvService.getAgvNo(agvId);
            AgvDetail agvDetail = agvDetailService.selectByAgvId(agvId);
            if (!agvService.judgeEnable(agvId)) {
                return false;
            }
@@ -510,6 +509,7 @@
            }
            Date now = new Date();
            AgvDetail agvDetail = agvDetailService.selectMajorByAgvId(agvId);
            Code endCode = null;
            switch (taskType) {
                case TO_CHARGE:
@@ -653,9 +653,9 @@
//            JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class);
            int angleOffsetVal = configService.getVal("mapAngleOffsetVal", Integer.class);
            String agvNo = agvService.getAgvNo(agvId);
            if (!agvService.judgeEnable(agvId)) {
                throw new CoolException("AGV[" + agvNo + "]当前不可用...");
            }
//            if (!agvService.judgeEnable(agvId)) {
//                throw new CoolException("AGV[" + agvNo + "]当前不可用...");
//            }
            AgvModel agvModel = agvModelService.getByAgvId(agvId);
            Double workDirection = agvModel.getWorkDirection();
@@ -989,26 +989,19 @@
                    now    // 工作时间
            ));
//            List<Action> newActionList = new ArrayList<>(actionList);
//            List<Action> optimizeList = actionService.optimizeSort(actionList);
            List<Action> optimizeList = actionSorter.optimizeSort(actionList);
            List<Action> newActionList = new ArrayList<>(optimizeList);
            List<Action> newActionList = actionSorter.optimizeSort(actionList);
            String groupId = String.valueOf(snowflakeIdWorker.nextId()).substring(3);
            // save action
            int i = newActionList.size();
            for (Action action : newActionList) {
                action.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3));
//                action.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3));
                action.setGroupId(groupId);
                action.setPriority(i);
                if (!actionService.save(action)) {
                    throw new BusinessException(action.getName() + "动作保存失败");
                }
                i -= 1;
            }
            if (!actionService.saveBatch(newActionList)) {
                throw new BusinessException("group[" + groupId + "] 动作保存失败");
            }
            // update segment
@@ -1057,9 +1050,9 @@
                action.setStartTime(now);
                action.setIoTime(now);
                action.setUpdateTime(now);
                if (!actionService.updateById(action)) {
                    throw new BusinessException(action.getPriority() + " - " + action.getName() + "动作更新失败");
                }
            }
            if (!actionService.updateBatchById(actionList)) {
                throw new BusinessException("failed to update action batch !!!");
            }
            // task