Add Operation Information Panel To Trace Graph
Track and Track Graph
The Trace Graph provides a high-level view of all materials produced and consumed over the lifecycle of a given material lot.
Material Lots are displayed as inputs and outputs of each operation. There may be a desired to show additional information about a given operation.
This topic demonstrates how to display additional information about a given operation using the Perspective Trace Graph.
Components:
Resource:
Import the zip file in the designer for the completed example screen.
Example:

In this example, we use the Node Clicked right-click event to trigger an embedded view on the left to display information about a given operation:

Script for nodeClicked event:
|
def runAction(self, event): if event.getType() == 'ResponseSegment': self.getSibling("emb_opInfo").props.params.responseSegUUID = event.getUUID() else: self.getSibling("emb_opInfo").props.params.responseSegUUID = ''
|
Here we are pushing the response segment UUID to the embedded view. The view contains script to populate itself based on the segment data.
In the embedded view, we have a Markdown component which will display the data in a friendly manner.
On the View parameter responseSegUUID value change, we retrieve the uuid, load the object, and load desired data about the operation.

|
def valueChanged(self, previousValue, currentValue, origin, missedEvents): respSegUUID = currentValue.value markup = '' if len(respSegUUID) > 0: seg = system.mes.loadMESObject(respSegUUID) markup = '# **' + seg.getName() + '** ' markup += '**Started:** ' +str(seg.getPropertyValue('BeginDateTime')) +'
' markup += '**Ended:** ' +str(seg.getPropertyValue('EndDateTime')) +'
' operationUUID = seg.getPropertyValue('OperationsResponseRefUUID') opResponse = system.mes.loadMESObject(operationUUID) eqLink = opResponse.getEquipmentLink() markup += '## Processing Equipment ' markup += '**Type**: '+ str(eqLink.getMESObjectType()) + ' ' markup += '**Name**: '+ eqLink.getName() +' ' complexProps = seg.getComplexPropertyCount('ResponseMaterial') props = {} uiList = [] for i in range(complexProps): prop = seg.getComplexProperty('ResponseMaterial',i) propName = prop.getName() if prop.hasSegmentRefUUID(): lotName = prop.getMaterialLot().getName() matName = prop.getMaterialRef().getName() location = prop.getEquipmentRef().getName() quantity = prop.getQuantity() begin = prop.getBeginDateTime() end = prop.getEndDateTime() use = prop.getUse() lotSequence = prop.getLotRefSequence() eqPath = eqLink.getMESObject().getEquipmentPath() customProps = [] lot = system.mes.loadMaterialLot(lotName, lotSequence, eqPath, False) for cp in lot.getAllCustomProperties(): customProps.append(cp.getName() + ':' + str(cp.getValue())) sublots = [] for lot in lot.getChildCollection(): sublots.append(system.mes.getMESObjectLink(lot).getName()) finalProp = {use: { 'propName' : propName, 'lotName' : lotName, 'matName' : matName, 'location' : location, 'quantity' : quantity, 'begin' : begin, 'end': end, 'customProps': customProps, 'sublots':sublots } } else: finalProp = {'unused':{'propName':propName}} if props.has_key(finalProp.keys()[0]): props[finalProp.keys()[0]].append(finalProp[finalProp.keys()[0]]) else: props.update({finalProp.keys()[0]:[finalProp[finalProp.keys()[0]]]}) useOrder = ['In','Out','Consumable','By-Product'] for use in useOrder: first = True for key, values in props.items(): if key == use: for matProp in values: if first == True: markup += '## **Material - ' + key + '** ' else: markup += ' ' markup += '|' + matProp['propName'] + ':|| ' markup += '|--|--| ' markup += '|Lot No:|' + matProp['lotName'] + '| ' markup += '|Material|' + matProp['matName'] + '| ' markup += '|Location|' + matProp['location'] + '| ' markup += '|Quantity|' + str(matProp['quantity']) + '| ' markup += '|Begin Date Time|' + str(matProp['begin']) + '| ' markup += '|End Date Time|' + str(matProp['end']) + '| ' if matProp['customProps']: for cp in matProp['customProps']: markup += '|' + cp.split(':')[0] + '|' + cp.split(':')[1] + '| ' first = False if matProp['sublots']: for sublot in matProp['sublots']: markup += '| |'+ sublot + '| '
self.getChild("root").getChild("Markdown").props.source = markup |
Related