| | |
| | | String currentDirection = currentCode.getDirection(); |
| | | String nextDirection = nextCode.getDirection(); |
| | | |
| | | if (!currentDirection.equals(nextDirection)) { |
| | | stayTime += config.getTurnTime(currentDirection, nextDirection); |
| | | if (currentDirection != null && nextDirection != null) { |
| | | if (!currentDirection.equals(nextDirection)) { |
| | | stayTime += config.getTurnTime(currentDirection, nextDirection); |
| | | } |
| | | } else { |
| | | if (pathIndex == agv.getCurrentPathIndex()) { |
| | | System.out.println("AGV " + agv.getAgvId() + |
| | | " 的剩余路径中direction字段为null"); |
| | | } |
| | | stayTime += 0.5; |
| | | } |
| | | } |
| | | |
| | |
| | | stayTime += 2.0; // 放货需要2秒 |
| | | break; |
| | | case "3": // 充电 |
| | | stayTime += 10.0; // 充电停靠需要10秒 |
| | | stayTime += 100.0; // 充电停靠 |
| | | break; |
| | | default: |
| | | stayTime += 1.0; // 其他动作需要1秒 |
| | |
| | | connectedPath.setAgvId(agv.getAgvId()); |
| | | connectedPath.setCodeList(remainingCodes); |
| | | |
| | | // 生成新的段落ID |
| | | String segId = agv.getAgvId() + "_CONNECTED_" + System.currentTimeMillis(); |
| | | if (newPath != null && newPath.getSegId() != null) { |
| | | segId = newPath.getSegId() + "_EXTENDED"; |
| | | // 使用剩余路径的原始segId |
| | | String segId = remainingPath.getSegId(); |
| | | |
| | | if (segId != null && !segId.trim().isEmpty()) { |
| | | // 如果有新路径连接,在原segId基础上添加扩展标记 |
| | | if (newPath != null && newPath.getCodeList() != null && !newPath.getCodeList().isEmpty()) { |
| | | // 检查是否已经有扩展标记,避免重复添加 |
| | | if (!segId.endsWith("_EXTENDED")) { |
| | | segId = segId + "_EXTENDED"; |
| | | } |
| | | } |
| | | } else { |
| | | // 如果原始路径没有segId,根据情况生成 |
| | | if (newPath != null && newPath.getSegId() != null && !newPath.getSegId().trim().isEmpty()) { |
| | | segId = newPath.getSegId() + "_EXTENDED"; |
| | | } else { |
| | | segId = agv.getAgvId() + "_CONNECTED_" + System.currentTimeMillis(); |
| | | } |
| | | } |
| | | |
| | | connectedPath.setSegId(segId); |
| | | |
| | | return connectedPath; |