diff --git a/servo/src/main/java/com/galaxis/rcs/plan/path/PathUtils.java b/servo/src/main/java/com/galaxis/rcs/plan/path/PathUtils.java index be16506..09aaba8 100644 --- a/servo/src/main/java/com/galaxis/rcs/plan/path/PathUtils.java +++ b/servo/src/main/java/com/galaxis/rcs/plan/path/PathUtils.java @@ -1,6 +1,7 @@ package com.galaxis.rcs.plan.path; import com.galaxis.rcs.common.enums.LCCDirection; +import com.galaxis.rcs.plan.PlanTaskSequence; import java.util.*; @@ -150,8 +151,12 @@ public class PathUtils { /** * 转换货位方向到AGV所需方向 */ - public static LCCDirection convertStoreDirection(LCCDirection storeDirection) { + public static LCCDirection convertStoreDirection(PlanTaskSequence plan, LCCDirection storeDirection) { // 转换规则: 货位在路径点的方位 -> AGV所需方向 + if (plan.getAgv().t.toLowerCase().startsWith("fm") || plan.getAgv().t.toLowerCase().startsWith("fit")) { + // if qianfu AGV + return storeDirection; + } return switch (storeDirection) { case UP -> LCCDirection.RIGHT; // 货位在上方 → 车头向右 case DOWN -> LCCDirection.LEFT; // 货位在下方 → 车头向左 diff --git a/servo/src/main/java/com/galaxis/rcs/plan/path/PtrPathPlanner.java b/servo/src/main/java/com/galaxis/rcs/plan/path/PtrPathPlanner.java index 3f7b784..e66f127 100644 --- a/servo/src/main/java/com/galaxis/rcs/plan/path/PtrPathPlanner.java +++ b/servo/src/main/java/com/galaxis/rcs/plan/path/PtrPathPlanner.java @@ -77,7 +77,7 @@ public class PtrPathPlanner { // 取货点 String loadRackId = task.from().rackId(); int pickupBay = task.from().bay(); - List loadNodeDirectionList = findNodeForStore(loadRackId, pickupBay); + List loadNodeDirectionList = findNodeForStore(plan, loadRackId, pickupBay); if (loadNodeDirectionList.isEmpty()) { throw new RuntimeException("Pickup node not found for rackId=" + loadRackId + ", bay=" + pickupBay); } @@ -85,7 +85,7 @@ public class PtrPathPlanner { // 放货点 String unloadRackId = task.to().rackId(); int unloadBay = task.to().bay(); - List unloadNodeDirectionList = findNodeForStore(unloadRackId, unloadBay); + List unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay); if (unloadNodeDirectionList.isEmpty()) { throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay); } @@ -143,7 +143,7 @@ public class PtrPathPlanner { // 放货点 String unloadRackId = task.to().rackId(); int unloadBay = task.to().bay(); - var unloadNodeDirectionList = findNodeForStore(unloadRackId, unloadBay); + var unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay); if (unloadNodeDirectionList.isEmpty()) { throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay); } @@ -190,7 +190,7 @@ public class PtrPathPlanner { // 放货点 String loadRackId = task.to().rackId(); int unloadBay = task.to().bay(); - var loadNodeDirectionList = findNodeForStore(loadRackId, unloadBay); + var loadNodeDirectionList = findNodeForStore(plan, loadRackId, unloadBay); if (loadNodeDirectionList.isEmpty()) { throw new RuntimeException("Drop node not found for rackId=" + loadRackId + ", bay=" + unloadBay); } @@ -230,13 +230,13 @@ public class PtrPathPlanner { plan.addFinish(); } - private List findNodeForStore(String storeId, int bay) { + private List findNodeForStore(PlanTaskSequence plan, String storeId, int bay) { List nodes = this.graph.getNodesForStore(storeId); List results = Lists.newArrayList(); for (Node node : nodes) { for (StoreLink link : node.storeLinks()) { if (link.storeId().equals(storeId) && link.bay() == bay) { - LCCDirection agvDirection = convertStoreDirection(link.direction()); + LCCDirection agvDirection = convertStoreDirection(plan, link.direction()); results.add(new NodeDirection(node, agvDirection)); } }