Materials cannot be edited or deleted if a current operation is in progress.
This script will check all lines and determine if the material is currently running.
isMaterialRunning
Code |
def isMaterialRunning(materialDefLink):
opSegs = system.mes.oee.getMaterialOperationsSegments(materialDefLink, '*')
for op in opSegs:
opUUID = op.getUUID()
if '_CO' not in op.getName():
eqPath = op.getEquipment().getEquipmentPath()
activeSegs = system.mes.oee.getOEEAllActiveSegments(eqPath)
for seg in activeSegs:
if seg.getMESObject().getPropertyValue('OperationSegmentRefUUID') == opUUID:
return True
return False
materialDefLink = system.mes.getMESObjectLinkByName('MaterialDef','Pilsner')
print materialDefLink
isMaterialRunning(materialDefLink) |
The script could be edited to return specific lines or last run date, etc.