Skip to main content

system.mes.oee.saveQualityReason

Description

Creates or updates an OEE Quality Reason record in the system. To create a new quality reason, first generate a new object with system.mes.oee.newQualityReason.

Permissions

This method requires the OEE.WRITE.SAVE permission.

Syntax

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

Parameters

An unpacked dictionary of OeeQualityReasonDTO fields.

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

Returns

A JSON representation of the saved OeeQualityReasonDTO object.

Code Examples

# Create a new quality reason object
newReason = system.mes.oee.newQualityReason()

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

# Save the new quality reason
savedReason = system.mes.oee.saveQualityReason(**newReason)

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

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