system.mes.trackandtrace.collapseLotTraceGraph
Description
Collapses the children or parents of the given node in the track and trace graph. Every node reachable from
nodeId in the requested direction is removed from the caller's graph, along with the edges that touched
them. Any node that is left with no edges is dropped as well, except the node that was collapsed, which is
always kept.
This is the inverse of expandLotTraceGraph, and is used by the trace graph component to fold a branch away again.
Permissions
This method requires the TRACK_AND_TRACE.READ.GET permission.
Syntax
system.mes.trackandtrace.collapseLotTraceGraph(**collapseRequest)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
nodeId | String (ULID) | False | The ID of the inventory lot node to collapse the graph from |
direction | String | False | The direction of the graph collapse. Can be either INPUT or OUTPUT |
existingNodes | List of nodes | False | The nodes already present in the caller's graph, as returned by a previous trace graph call |
existingEdges | List of edges | False | The edges already present in the caller's graph, as returned by a previous trace graph call |
Returns
A trace graph object with the same shape as the one returned by
getLotTraceGraph: nodes, edges, rootNodeId and direction.
The nodes and edges are the caller's graph with the collapsed branch removed, and rootNodeId is the
nodeId that was collapsed.
Code Example
# Collapse a branch that was previously expanded
collapseRequest = {
"nodeId": "01JRGMQQQR-FNYB310E-QATAWA9X",
"direction": "OUTPUT",
"existingNodes": expandedGraph["nodes"],
"existingEdges": expandedGraph["edges"]
}
collapsedGraph = system.mes.trackandtrace.collapseLotTraceGraph(**collapseRequest)
print("%d nodes after collapsing" % len(collapsedGraph["nodes"]))