Skip to main content

system.mes.oee.savePerformanceReason

Description

Creates or updates an OEE Performance Reason record in the system. To create a new performance reason, first generate a new object with system.mes.oee.newPerformanceReason.

Permissions

This method requires the OEE.WRITE.SAVE permission.

Syntax

system.mes.oee.savePerformanceReason(**reasonData)

Parameters

An unpacked dictionary of OeePerformanceReasonDTO fields.

ParameterTypeNullableDescriptionDefault Value
idStringTrueThe id of the Performance Reasonnull
locationIdStringTrueIdentifier of the associated location where this performance reason appliesnull
locationPathStringTruePath of the associated location where this performance reason appliesnull
parentIdStringTrueIdentifier of the parent performance reason, if applicablenull
codeIntegerFalseUnique fault code associated with this performance reason0
nameStringFalseName of the performance reasonnull
descriptionStringTrueDescription of the performance reasonnull
pathStringTruePath representation of the performance reason within a hierarchical structurenull
notesStringTrueNotes associated with the Performance Reasonnull
enabledbooleanTrueIndicates whether the Performance Reason is enabledtrue
spare1StringTrueExtra field 1null
spare2StringTrueExtra field 2null
spare3StringTrueExtra field 3null

Returns

A JSON representation of the saved OeePerformanceReasonDTO object.

Code Examples

# Create a new performance reason object
newReason = system.mes.oee.newPerformanceReason()

# Set attributes for the new reason
newReason['locationId'] = '01JCH3ENEB-SV2X8B3W-NFY8WZNK'
newReason['name'] = 'Slow Conveyor'
newReason['enabled'] = True

# Save the new performance reason
savedReason = system.mes.oee.savePerformanceReason(**newReason)

print "Saved Performance Reason with ID:", savedReason['id']

# To update an existing reason, include its ID
# updatedReasonData = system.mes.oee.getPerformanceReason(savedReason['id'])
# updatedReasonData['name'] = 'Slow Conveyor'
# system.mes.oee.savePerformanceReason(**updatedReasonData)