|
|
|
@ -9,6 +9,7 @@ import com.yvan.logisticsModel.StaticItem; |
|
|
|
import org.clever.core.Conv; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static com.galaxis.rcs.plan.path.PathUtils.convertStoreDirection; |
|
|
|
|
|
|
|
@ -77,7 +78,7 @@ public class PtrPathPlanner { |
|
|
|
// 取货点
|
|
|
|
String loadRackId = task.from().rackId(); |
|
|
|
int pickupBay = task.from().bay(); |
|
|
|
List<NodeDirection> loadNodeDirectionList = findNodeForStore(plan, loadRackId, pickupBay); |
|
|
|
List<NodeDirection> loadNodeDirectionList = findNodeForStore(plan, loadRackId, pickupBay, startNodeId, startDirection); |
|
|
|
if (loadNodeDirectionList.isEmpty()) { |
|
|
|
throw new RuntimeException("Pickup node not found for rackId=" + loadRackId + ", bay=" + pickupBay); |
|
|
|
} |
|
|
|
@ -85,7 +86,7 @@ public class PtrPathPlanner { |
|
|
|
// 放货点
|
|
|
|
String unloadRackId = task.to().rackId(); |
|
|
|
int unloadBay = task.to().bay(); |
|
|
|
List<NodeDirection> unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay); |
|
|
|
List<NodeDirection> unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay, null, null); |
|
|
|
if (unloadNodeDirectionList.isEmpty()) { |
|
|
|
throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay); |
|
|
|
} |
|
|
|
@ -143,7 +144,7 @@ public class PtrPathPlanner { |
|
|
|
// 放货点
|
|
|
|
String unloadRackId = task.to().rackId(); |
|
|
|
int unloadBay = task.to().bay(); |
|
|
|
var unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay); |
|
|
|
var unloadNodeDirectionList = findNodeForStore(plan, unloadRackId, unloadBay, startNodeId, startDirection); |
|
|
|
if (unloadNodeDirectionList.isEmpty()) { |
|
|
|
throw new RuntimeException("Drop node not found for rackId=" + unloadRackId + ", bay=" + unloadBay); |
|
|
|
} |
|
|
|
@ -190,7 +191,7 @@ public class PtrPathPlanner { |
|
|
|
// 放货点
|
|
|
|
String loadRackId = task.to().rackId(); |
|
|
|
int unloadBay = task.to().bay(); |
|
|
|
var loadNodeDirectionList = findNodeForStore(plan, loadRackId, unloadBay); |
|
|
|
var loadNodeDirectionList = findNodeForStore(plan, loadRackId, unloadBay, startNodeId, startDirection); |
|
|
|
if (loadNodeDirectionList.isEmpty()) { |
|
|
|
throw new RuntimeException("Drop node not found for rackId=" + loadRackId + ", bay=" + unloadBay); |
|
|
|
} |
|
|
|
@ -230,9 +231,10 @@ public class PtrPathPlanner { |
|
|
|
plan.addFinish(); |
|
|
|
} |
|
|
|
|
|
|
|
private List<NodeDirection> findNodeForStore(PlanTaskSequence plan, String storeId, int bay) { |
|
|
|
private List<NodeDirection> findNodeForStore(PlanTaskSequence plan, String storeId, int bay, String startNodeId, LCCDirection startDirection) { |
|
|
|
List<Node> nodes = this.graph.getNodesForStore(storeId); |
|
|
|
List<NodeDirection> results = Lists.newArrayList(); |
|
|
|
|
|
|
|
for (Node node : nodes) { |
|
|
|
for (StoreLink link : node.storeLinks()) { |
|
|
|
if (link.storeId().equals(storeId) && link.bay() == bay) { |
|
|
|
@ -241,6 +243,24 @@ public class PtrPathPlanner { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 就地取货逻辑,当前车所在的位置,就是能取货的位置,就不要再跑去别的地方取货了;
|
|
|
|
// 如果 startNodeId 和 startDirection 有值,并且 results 结果中包含 startNodeId/startDirection ,那么只保留 startNodeId/startDirection 的结果
|
|
|
|
if (startNodeId != null && startDirection != null) { |
|
|
|
boolean matchSelfOnly = false; |
|
|
|
for (NodeDirection nd : results) { |
|
|
|
if (nd.node().id().equals(startNodeId) && nd.direction() == startDirection) { |
|
|
|
matchSelfOnly = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (matchSelfOnly) { |
|
|
|
return results.stream().filter(nd -> nd.node().id().equals(startNodeId) && nd.direction() == startDirection) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return results; |
|
|
|
} |
|
|
|
|
|
|
|
|