#
luxiaotao1123
2024-11-18 18959656f9bf75e40a5802c3befd545ec33621d7
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -254,6 +254,10 @@
            if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) {
                throw new CoolException("AGV[" + agv.getUuid() + "]分配任务失败,已存在执行任务...");
            }
            if (!Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.WAITING.toString()))
                    || !Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.RUNNING.toString()))) {
                throw new CoolException("AGV[" + agv.getUuid() + "] failed to assign,because already has the segment in running...");
            }
            // execute ----------------------------------------------------
            Date now = new Date();
@@ -491,17 +495,19 @@
     * 充电 回待机位任务
     */
    @Transactional(propagation = Propagation.REQUIRES_NEW) // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional
    public boolean buildMinorTask(Agv agv, AgvDetail agvDetail, TaskTypeType taskType, String destination) {
    public boolean buildMinorTask(Agv agv, TaskTypeType taskType, String destination, Jam jam) {
        if (Cools.isEmpty(agv, taskType)) { return false; }
        try {
            if (null == agvDetail) {
                agvDetail = agvDetailService.selectByAgvId(agv.getId());
            }
            AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId());
            if (!agvService.judgeEnable(agv.getId())) {
                return false;
            }
            if (!Cools.isEmpty(taskService.selectInSts(agv.getId(), TaskStsType.ASSIGN, TaskStsType.PROGRESS))) {
                throw new CoolException("AGV[" + agv.getUuid() + "] failed to assign,because already has the task in running...");
            }
            if (!Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.WAITING.toString()))
                    || !Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.RUNNING.toString()))) {
                throw new CoolException("AGV[" + agv.getUuid() + "] failed to assign,because already has the segment in running...");
            }
            Date now = new Date();
@@ -602,6 +608,10 @@
                }
                if (!segmentService.save(next)) {
                    throw new BusinessException("segment failed to save");
                } else {
                    if (null != jam && i == 0) {
                        jam.setAvoSeg(next.getId());
                    }
                }
            }
@@ -621,10 +631,6 @@
                default:
                    break;
            }
//            if (taskType.equals(TaskTypeType.TO_STANDBY)) {
//                redis.setObject(RedisConstant.AGV_TO_STANDBY_FLAG, agv.getUuid(), false);
//            }
            return true;
        } catch (Exception e) {