Skip to main content

system.mes.oee.saveAvailabilityReason

Description

Creates or updates an OEE Availability Reason record in the system. To create a new availability reason, first generate a new object with system.mes.oee.newAvailabilityReason.

Permissions

This method requires the OEE.WRITE.SAVE permission.

Syntax

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

Parameters

An unpacked dictionary of OeeAvailabilityReasonDTO fields.

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

Returns

A JSON representation of the saved OeeAvailabilityReasonDTO object.

Code Examples

# Create a new availability reason object
newReason = system.mes.oee.newAvailabilityReason()

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

# Save the new availability reason
savedReason = system.mes.oee.saveAvailabilityReason(**newReason)

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

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