Skip to main content

system.mes.trackandtrace.getLotTraceGraph

Description

Retrieves adjacent nodes and edges of the trace graph for the given InventoryLot ID in the specified direction. Only a single level of adjacency is returned, meaning that the function will return only the nodes and edges that are directly connected to the root node.

This function is used by the trace graph component to visualize the flow of materials. Nodes represent inventory lots, and edges represent the InventoryLotRecords that connect them.

Permissions

This scripting function has no client permission restrictions.

Syntax

system.mes.trackandtrace.getLotTraceGraph(rootNodeId, direction)

Parameters

ParameterTypeDescription
rootNodeIdString (ULID)The ID of the root inventory lot
directionStringThe direction of the trace graph to be retrieved. Can be either INPUT or OUTPUT

Returns

A trace graph object with the following properties:

Trace Graph

PropertyTypeDescription
nodesList of nodesList of nodes in the track and trace graph that are adjacent to the root node in the requested direction.
edgesList of edgesList of edges in the track and trace graph that connect the nodes in the requested direction.
rootNodeIdStringThe inventory lot ID that was given as an argument in the original request
directionStringThe direction that was given as an argument in the original request

Node

PropertyTypeDescription
idString (ULID)The ID of the node, which is the inventory lot ID
dataObjectThe data object contains several properties listed below

Node data

PropertyTypeDescription
lotNameStringThe name of the inventory lot
materialNameStringThe name of the material associated with this inventory lot
materialClassNameStringThe name of the material class of the material associated with this inventory lot
materialDescriptionStringThe description of the material associated with this inventory lot
quantityDoubleThe total quantity of inventory processed from the starting node to this one
uomStringThe unit of measure symbol for the quantity

Edge

PropertyTypeDescription
idString (ULID)Unique identifier of the InventoryLotRecord for the edge.
sourceString (ULID)The source InventoryLot ID from which this edge originates.
targetString (ULID)The target InventoryLot ID to which this edge points.
animatedBooleanWhether the edge is animated in the track and trace graph.

Code Example

inventoryLotId = "01JZJZ1FSE-WAW6VBVG-4506XP0C"
traceGraph = system.mes.trackandtrace.getLotTraceGraph(inventoryLotId, "OUTPUT")
print(traceGraph)

Example Output

{
"direction": "OUTPUT",
"rootNodeId": "01JZJZ1FSE-WAW6VBVG-4506XP0C",
"nodes": [
{
"id": "01JRGMQQQR-FNYB310E-QATAWA9X",
"data": {
"lotName": "Lot-01JZJZ",
"materialName": "cherry",
"materialClassName": "BLEND",
"materialDescription": null,
"quantity": 100.0,
"uom": "kg"
}
}
],
"edges": [
{
"id": "01JZKBA80K-JYT9EC63-BZRVNE6H",
"source": "01JZJZ1FSE-WAW6VBVG-4506XP0C",
"target": "01JRGMQQQR-FNYB310E-QATAWA9X",
"animated": true
}
]
}