#
luxiaotao1123
2 天以前 788c049b641607b4288f76b57dd73230bf882177
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -936,7 +936,6 @@
                if (!lastCode.getData().equals(code.getData())) {
                    // 走行路径节点
//                    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++) {
@@ -979,7 +978,7 @@
                                        null,    // 动作号
                                        null,    // 优先级
                                        ActionTypeType.TurnCorner.desc,    // 名称
                                        (double) mapService.spinDirection(lastCode).val,     // 属性值
                                        (double) MapService.calcSpinDirection(lastCode, lastDirection, nextLaneDir).val,     // 属性值
                                        lastCode.getData(),    // 地面码
                                        String.valueOf(nextLaneDir),   // 动作参数
                                        ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -988,30 +987,25 @@
                                        now    // 工作时间
                                ));
                                lastDirection = nextLaneDir;
                                if (nextDirection.equals(oppNextLaneDir)) {
                                    reverse = true;
                                }
                            } else {
                                if (nextDirection.equals(oppNextLaneDir)) {
                                    nextDirection = nextLaneDir;
                                    reverse = true;
                                }
                            }
                            nextDirection = nextLaneDir;
                        } else if (null != lastLaneDir) {
                            final double oppLastLaneDir = (lastLaneDir + 180) % 360;
                            if (nextDirection.equals(oppLastLaneDir)) {
                            if (nextDirection.equals(oppNextLaneDir)) {
                                reverse = true;
                            }
                            nextDirection = lastLaneDir;
                            nextDirection = nextLaneDir; // 防止 第一个动作一定是 turn 出问题
                        } else if (null != lastLaneDir) { // turn 环形直角不应该存在于lane中
                            final double oppLastLaneDir = (lastLaneDir + 180) % 360;
                            if (!lastDirection.equals(nextDirection)) {
                            if (!lastDirection.equals(lastLaneDir)) {
                                if (!lastCode.getCornerBool()) {
                                    throw new CoolException(agvNo + "号小车离开巷道需调整方向为 " + nextDirection + "°,请推至转弯点手动调整");
                                }
                            }
                            if (nextDirection.equals(oppLastLaneDir)) {
                                reverse = true;
                            }
                            nextDirection = lastLaneDir; // 防止 第一个动作一定是 turn 出问题
                        } else {
                            // 如果下一个方向正好是作业方向的相反方向,则重置下一个方向为作业方向,标记 reverse = true
@@ -1051,7 +1045,7 @@
                                                null,    // 动作号
                                                null,    // 优先级
                                                ActionTypeType.TurnCorner.desc,    // 名称
                                                (double) mapService.spinDirection(lastCode).val,     // 属性值
                                                (double) MapService.calcSpinDirection(lastCode, lastDirection, nextDirection).val,     // 属性值
                                                lastCode.getData(),    // 地面码
                                                String.valueOf(nextDirection),   // 动作参数
                                                ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -1076,7 +1070,7 @@
                                    null,    // 动作号
                                    null,    // 优先级
                                    ActionTypeType.TurnCorner.desc,    // 名称
                                    (double) mapService.spinDirection(lastCode).val,    // 属性值
                                    (double) MapService.calcSpinDirection(lastCode, lastDirection, nextDirection).val,    // 属性值
                                    lastCode.getData(),    // 地面码
                                    String.valueOf(nextDirection),   // 动作参数
                                    ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -1143,7 +1137,7 @@
                                null,    // 动作号
                                null,    // 优先级
                                ActionTypeType.TurnCorner.desc,    // 名称
                                (double) mapService.spinDirection(lastCode).val,    // 属性值
                                (double) MapService.calcSpinDirection(lastCode, lastDirection, firstTurnDir).val,    // 属性值
                                lastCode.getData(),    // 地面码
                                String.valueOf(firstTurnDir),   // 动作参数
                                ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -1269,7 +1263,7 @@
                                    null,    // 动作号
                                    null,    // 优先级
                                    ActionTypeType.TurnCorner.desc,    // 名称
                                    (double) mapService.spinDirection(lastCode).val,   // 属性值
                                    (double) MapService.calcSpinDirection(lastCode, lastDirection, oriStaWorkDirection).val,   // 属性值
                                    lastCode.getData(),    // 地面码
                                    String.valueOf(oriStaWorkDirection),   // 动作参数
                                    ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -1333,7 +1327,7 @@
                                    null,    // 动作号
                                    null,    // 优先级
                                    ActionTypeType.TurnCorner.desc,    // 名称
                                    (double) mapService.spinDirection(lastCode).val,    // 属性值
                                    (double) MapService.calcSpinDirection(lastCode, lastDirection, destStaWorkDirection).val,    // 属性值
                                    lastCode.getData(),    // 地面码
                                    String.valueOf(destStaWorkDirection),   // 动作参数
                                    ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -1392,7 +1386,7 @@
                                    null,    // 动作号
                                    null,    // 优先级
                                    ActionTypeType.TurnCorner.desc,    // 名称
                                    (double) mapService.spinDirection(lastCode).val,    // 属性值
                                    (double) MapService.calcSpinDirection(lastCode, lastDirection, chargeDirection).val,    // 属性值
                                    lastCode.getData(),    // 地面码
                                    String.valueOf(chargeDirection),   // 动作参数
                                    ActionTypeType.TurnCorner.val(),    // 动作类型
@@ -1874,6 +1868,7 @@
                                    staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.OUT);
                                    break;
                                }
                                log.info("Agv [{}] 取放货成功", protocol.getAgvNo()); // todo
                                success = true;
                                break;
                            case DEST_STA:
@@ -1889,6 +1884,7 @@
                                    staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.IN);
                                    break;
                                }
                                log.info("Agv [{}] 取放货成功", protocol.getAgvNo()); // todo
                                success = true;
                                break;
                            default:
@@ -1905,8 +1901,8 @@
            AGV_06_DOWN agv_06_down = new AGV_06_DOWN();
            agv_06_down.setSerialNo(agv_06_up.getSerialNo());
            agv_06_down.setActionCode(agv_06_up.getActionCode());
            //agv_06_down.setResult(success ? 1 : 0);
            agv_06_down.setResult(1);
            agv_06_down.setResult(success ? 1 : 0);
            //agv_06_down.setResult(0);
            redis.push(RedisConstant.AGV_PATH_DOWN_FLAG, AgvProtocol.build(protocol.getAgvNo()).setMessageBody(agv_06_down));
        }