Link Operations Definitions Together Into a Route 3.0
Overview
Often process steps are joined in a consistent route through possible processes. Operation Definitions can be joined to form such routes to match operational practice.
Frequently a Bill of Process is defined or required in an application. Routes provides the ISA-95 instantiation of a Bill of Process.
Applies to
This feature applies to Track and Trace module.
Version
This feature is available in all versions.
Scripting
The following python code snippet joins the "Mix Nuts" operation to the "Package Nuts" operation.
Trigger Property Creation Example
|
#Example to link two operation definition together
od1 = system.mes.loadMESObject('Mix Nuts', 'OperationsDefinition')
od2 = system.mes.loadMESObject('Package Nuts', 'OperationsDefinition')
trigProp = od2.createComplexProperty('TriggerOperBegin', 'Trigger')
trigProp.setPrecedingRefType(od1.getMESObjectType().getName())
trigProp.setPrecedingRefUUID(od1.getUUID())
trigProp.setMode('At Operation End')
trigProp.setDefault(True)
objList = system.mes.object.list.createList()
objList.add(od1)
objList.add(od2)
system.mes.saveMESObjects(objList)
|
Larger Example of Route Building Script
|
##Suggest this script is utilized while looping through a list of Operations:
opName = 'Operation Name'
nextOpName = None
rate = 100.0
someCounter = 1
## Load the Base Operation Definition and Segment
baseOpDef = system.mes.loadMESObject(opName, 'OperationsDefinition')
baseOpSeg = system.mes.loadMESObject(opName, 'OperationsSegment')
## Derive an Operation Definition for use in the Route from the Base Operation Definition
list = system.mes.deriveOperation(baseDef)
## Get the objects from the MES Object List Derived and Assign Names
newName = '%s_%s_%s' % (routeName, someCounter, opName)
newOpDef = list.get(0)
newOpDef.setPropertyValue('Name', newName)
newOpSeg = list.get(1)
newOpSeg.setPropertyValue('Name', newName)
## Suggest adding custom properties and possibly rework step if appropriate.
## Set the Material Out Lot Equipment Reference to the Equipment reference for the next operation.
if nextOpName is not None:
nextOpSeg = system.mes.loadMESObject(nextOpName, 'OperationsSegment')
nextOpSegEq = nextOp.getEquipment()
matProp = newOpSeg.getComplexProperty('Material', 'Material Out')
matProp.setEquipmentRefType(nextOpSegEq.getMESObjectType().getName())
matProp.setEquipmentRefUUID(nextOpSegEq.getUUID())
## Set the appropriate production rate
matProp = newOp.getComplexProperty('Material', 'Material Out')
matProp.setRatePeriod('Hour')
matProp.setRate(float(rate))
## Assign the Trigger Property when route building with multiple operation definitions
#tripProp = newOpDef.createComplexProperty('TriggerOperBegin', 'Begin Trigger')
#tripProp.setMode('At Operation End')
#tripProp.setAuto(False)
#tripProp.setDefault(True)
#tripProp.setPrecedingRefType('OperationsDefinition')
#tripProp.setPrecedingRefUUID(preOp)
## Save MES Objects to manifest changes
system.mes.saveMESObject(newOpDef)
system.mes.saveMESObject(newOpSeg)
print 'Process Successful'
|