Skip to main content

system.mes.oee.saveDowntimeReason

Description

Creates or updates an OEE Downtime Reason record in the system. To create a new downtime reason, first generate a new object with system.mes.oee.newDowntimeReason.

Permissions

This method requires the OEE.WRITE.SAVE permission.

Syntax

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

Parameters

An unpacked dictionary of OeeDowntimeReasonDTO fields.

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

Returns

A JSON representation of the saved OeeDowntimeReasonDTO object.

Code Examples

# Create a new downtime reason object
newReason = system.mes.oee.newDowntimeReason()

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

# Save the new downtime reason
savedReason = system.mes.oee.saveDowntimeReason(**newReason)

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

# To update an existing reason, include its ID
# updatedReasonData = system.mes.oee.getDowntimeReason(savedReason['id'])
# updatedReasonData['name'] = 'Mechanical Jam'
# system.mes.oee.saveDowntimeReason(**updatedReasonData)