af5e14557af94409a0d2e3f2dca1eed1b99a895a..97e0bddd5a8b54ba0007af1f70d3e910a4dd81c0
1 天以前 yy
测试修馥版
97e0bd 对比 | 目录
2 天以前 skyouc
1
5da24c 对比 | 目录
1个文件已修改
34 ■■■■■ 已修改文件
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -765,7 +765,6 @@
            boolean first = true;
            for (Segment segment : segmentList) {
                // 分段所属的Task
                Task task = taskService.getById(segment.getTaskId());
                TaskPosDto.PosType posType = Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()));
@@ -785,22 +784,17 @@
                    // 走行路径节点
//                    List<String> pathList = mapService.checkoutPath(agv.getUuid(), lastCode, code);
                    List<String> pathListPart = pathList.subList(pathList.indexOf(lastCode.getData()), pathList.indexOf(code.getData()) + 1);
                    for (int i = 0; i < pathListPart.size(); i++) {
                        if (i == 0) {
                            continue;
                        }
                        String next = pathListPart.get(i);
                        Code nextCode = codeService.getCacheByData(next);
                        Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
                        // 第一步:如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true
                        boolean reverse = false;
                        if (nextDirection.equals((workDirection + 180) % 360)) {
                            if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                            // if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                            if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && locTurnCodes.contains(lastCode.getData()))) {
                                reverse = false;
                                lastDirection = nextDirection;
                            } else {
@@ -827,8 +821,7 @@
                                    nextDirection = lastDirection;
                                    reverse = true;
                                } else {
                                    if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                    // if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                    if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                        // turn
                                        reverse = false;
                                        actionList.add(new Action(
@@ -854,7 +847,7 @@
                                                180);
                                    } else {
                                        Double turnDirection = nextDirection;
                                        if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                        if (turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050") || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                            turnDirection = 180.0;
                                            reverse = false;
                                        }
@@ -879,14 +872,12 @@
                                                lastCode.getData(),
                                                lastCode.getCornerBool(),
                                                nextDirection,
                                                lastDirection);
                                                nextDirection);
                                    }
                                    lastDirection = nextDirection;
                                }
                            } else {
                                // if (isStation && lastCode.getData().equals("00000050")) {
                                if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                // if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && lastCode.getData().equals("00000080"))) {
                                if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                                    // turn
                                    reverse = false;
                                    actionList.add(new Action(
@@ -974,11 +965,16 @@
                if (first) {
                    if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) {
                        Double turnDirection = workDirection;
                        Code nextCode = codeService.getCacheByData(lastCode.getData());
//                        Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
                        // if (isStation && turnCodes.contains(lastCode.getData())) {
                        if ((turnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000050")) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                        // if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(lastCode.getData()))) {
                        Code nextCode = null;
                        //添加判断是否存在下一个地码
                        int index = pathList.indexOf(lastCode.getData());
                        if (index != -1 && index + 1 < pathList.size()) {
                            String nextCodeData = pathList.get(index + 1);
                            nextCode = codeService.getCacheByData(nextCodeData);
                        } else {
                            nextCode = codeService.getCacheByData(lastCode.getData());
                        }
                        if ((isStation && turnCodes.contains(lastCode.getData())) || (isLoc && locTurnCodes.contains(nextCode.getData()) && lastCode.getData().equals("00000080"))) {
                            turnDirection = workDirection + 180.0;
                        }
                        if (lastCode.getCornerBool()) {