yy
8 天以前 afbdf224dcc6f4c5d0f9331e25b99e0621cb6afd
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -34,7 +34,6 @@
import com.zy.acs.manager.manager.entity.*;
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.service.*;
import com.zy.acs.manager.manager.service.impl.LocStsServiceImpl;
import com.zy.acs.manager.manager.service.impl.WebsocketServiceImpl;
import com.zy.acs.manager.manager.utils.ActionSorter;
import com.zy.acs.manager.system.service.ConfigService;
@@ -143,7 +142,6 @@
        }
        Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, true);
        Integer locStaTaskNum = configService.getVal("LOC_STA_TASK_NUM", Integer.class, 2);
        // 保存任务
        for (Task task : taskList) {
@@ -766,10 +764,11 @@
            boolean first = true;
            for (Segment segment : segmentList) {
                // 分段所属的Task
                Task task = taskService.getById(segment.getTaskId());
                TaskPosDto.PosType posType = Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()));
                boolean isStation = posType.equals(TaskPosDto.PosType.ORI_STA) || posType.equals(TaskPosDto.PosType.DEST_STA);
                boolean isLoc = posType.equals(TaskPosDto.PosType.ORI_LOC) || posType.equals(TaskPosDto.PosType.DEST_LOC);
                // 节点条码
                Code code = codeService.getCacheById(segment.getEndNode());
@@ -792,10 +791,8 @@
                        // 第一步:如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true
                        boolean reverse = false;
                        if (nextDirection.equals((workDirection + 180) % 360)) {
                            List<String> list = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054");
                            if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())).equals(TaskPosDto.PosType.ORI_STA)
                                    || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
                                    .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) {
                            List<String> list = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054", "00000080", "00000081", "00000082", "00000083", "00000084");
                            if ((isStation && list.contains("00000050")) || (isLoc && list.contains("00000080"))) {
                                reverse = false;
                                lastDirection = nextDirection;
                            } else {
@@ -822,9 +819,7 @@
                                    nextDirection = lastDirection;
                                    reverse = true;
                                } else {
                                    if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
                                            .equals(TaskPosDto.PosType.ORI_STA) || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
                                            .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) {
                                    if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && lastCode.getData().equals("00000080"))) {
                                        // turn
                                        reverse = false;
                                        actionList.add(new Action(
@@ -842,7 +837,18 @@
                                                agvId,    // AGV
                                                now    // 工作时间
                                        ));
                                        log.info("1TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
                                                posType,
                                                lastCode.getData(),
                                                lastCode.getCornerBool(),
                                                nextDirection,
                                                180);
                                    } else {
                                        List<String> list = Arrays.asList("00000051", "00000052", "00000053", "00000054");
                                        Double turnDirection = nextDirection;
                                        if ((isStation && list.contains("00000050")) || (isLoc && list.contains("00000080"))) {
                                            turnDirection = 180.0;
                                        }
                                        // turn
                                        actionList.add(new Action(
                                                null,    // 编号s
@@ -853,19 +859,23 @@
                                                ActionTypeType.TurnCorner.desc,    // 名称
                                                mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 属性值
                                                lastCode.getData(),    // 地面码
                                                String.valueOf(nextDirection),   // 动作参数
                                                String.valueOf(turnDirection),   // 动作参数
                                                ActionTypeType.TurnCorner.val(),    // 动作类型
                                                actionPrepareSts,    // 动作进度
                                                agvId,    // AGV
                                                now    // 工作时间
                                        ));
                                        log.info("2TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
                                                posType,
                                                lastCode.getData(),
                                                lastCode.getCornerBool(),
                                                nextDirection,
                                                nextDirection);
                                    }
                                    lastDirection = nextDirection;
                                }
                            } else {
                                if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
                                        .equals(TaskPosDto.PosType.ORI_STA) || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
                                        .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) {
                                if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && lastCode.getData().equals("00000080"))) {
                                    // turn
                                    reverse = false;
                                    actionList.add(new Action(
@@ -883,6 +893,12 @@
                                            agvId,    // AGV
                                            now    // 工作时间
                                    ));
                                    log.info("3TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
                                            posType,
                                            lastCode.getData(),
                                            lastCode.getCornerBool(),
                                            nextDirection,
                                            180);
                                }
                            }
                        }
@@ -905,6 +921,12 @@
                                    agvId,    // AGV
                                    now    // 工作时间
                            ));
                            log.info("4TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
                                    posType,
                                    lastCode.getData(),
                                    lastCode.getCornerBool(),
                                    nextDirection,
                                    nextDirection);
                            lastDirection = nextDirection;
                        }
@@ -940,10 +962,8 @@
                if (first) {
                    if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) {
                        Double turnDirection = workDirection;
                        List<String> list = Arrays.asList("00000050","00000051", "00000052", "00000053", "00000054");
                        if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())).equals(TaskPosDto.PosType.ORI_STA)
                                || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
                                .equals(TaskPosDto.PosType.DEST_STA)) && list.contains(lastCode.getData())) {
                        List<String> list = Arrays.asList("00000050","00000051", "00000052", "00000053", "00000054", "00000080", "00000081", "00000082", "00000083", "00000084");
                        if ((isStation && list.contains("00000050")) || (isLoc && list.contains("00000080"))) {
                            turnDirection = workDirection + 180.0;
                        }
                        if (lastCode.getCornerBool()) {
@@ -963,6 +983,12 @@
                                    agvId,    // AGV
                                    now    // 工作时间
                            ));
                            log.info("5TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
                                    posType,
                                    lastCode.getData(),
                                    lastCode.getCornerBool(),
                                    null,
                                    turnDirection);
                            lastDirection = workDirection;
                        }
                    }