Skip to main content

system.mes.oee.getAllQualityReasonCodesByLocationHierarchical

Description

Retrieves all OEE Quality Reasons for a specific location, organized as a hierarchical tree structure. This method returns quality reasons with their parent-child relationships intact, allowing for easy navigation of the reason hierarchy.

Permissions

This method requires OEE.READ.GET permission.

Syntax

system.mes.oee.getAllQualityReasonCodesByLocationHierarchical(locationIdOrPath)

Parameters

ParameterTypeNullableDescription
locationIdOrPathStringTrueThe ID or path of the location. If null, returns reasons for all locations.

Returns

A list of JSON objects representing root-level OeeQualityReasonHierarchicalDTO objects, each containing nested children.

NameTypeNullableDescriptionDefault Value
idStringTrueThe id of the Quality Reasonnull
locationIdStringTrueIdentifier of the associated location (inherited from OeeQualityReasonDTO)null
locationPathStringTruePath of the associated location (inherited from OeeQualityReasonDTO)null
parentIdStringTrueIdentifier of the parent quality reason (inherited from OeeQualityReasonDTO)null
codeIntegerFalseUnique fault code associated with this quality reason (inherited from OeeQualityReasonDTO)0
nameStringFalseName of the quality reason (inherited from OeeQualityReasonDTO)null
descriptionStringTrueDescription of the quality reason (inherited from OeeQualityReasonDTO)null
pathStringTruePath representation of the quality reason (inherited from OeeQualityReasonDTO)null
childrenList<OeeQualityReasonHierarchicalDTO>TrueList of child quality reasonsnull
notesStringTrueNotes associated with the Quality Reasonnull
enabledbooleanTrueIndicates whether the Quality Reason is enabledtrue
spare1StringTrueExtra fieldnull
spare2StringTrueExtra fieldnull
spare3StringTrueExtra fieldnull

Code Examples

# Get hierarchical quality reasons for a specific location
location = "Site/Area/Line 1"
hierarchy = system.mes.oee.getAllQualityReasonCodesByLocationHierarchical(location)

def print_hierarchy(reasons, indent=0):
for reason in reasons:
print " " * indent + reason['name']
if reason['children']:
print_hierarchy(reason['children'], indent + 1)

print_hierarchy(hierarchy)