Skip to main content

system.mes.oee.setQualityReasonForWasteRecord

Description

Sets a quality reason for a specific OEE waste record, with optional notes.

Permissions

This method requires the OEE.WRITE.SAVE permission.

Syntax

system.mes.oee.setQualityReasonForWasteRecord(oeeWasteRecordId, qualityReasonId=None, notes=None)

Parameters

ParameterTypeNullableDescription
oeeWasteRecordIdStringFalseThe ID of the OEE waste record to update.
qualityReasonIdStringTrueThe ID of the quality reason to assign. Set to None to clear.
notesStringTrueOptional notes to add to the waste record.

Returns

A JSON representation of the updated OeeWasteRecordDTO object.

NameTypeNullableDescriptionDefault Value
idStringTrueThe id of the OEE Waste Recordnull
locationIdStringFalseIdentifier of the associated location where this OEE waste record was capturednull
locationPathStringTruePath of the location where this OEE waste record was capturednull
locationNameStringTrueName of the associated locationnull
startDateInstantFalseStart date and time of the OEE waste recordInstant.now()
endDateInstantTrueEnd date and time of the OEE waste recordnull
totalDurationSecDoubleFalseTotal duration of the OEE waste record in seconds0.0
qualityReasonIdStringTrueIdentifier of the associated quality reason, if applicablenull
qualityReasonNameStringTrueName of the associated quality reason. (Name - Code) For display purposes onlynull
qualityReasonPathStringTruePath to the current quality reasonnull
'qualityReasonCode'StringTrueCode of the associated quality reasonnull
wasteCountDoubleFalseTotal number of waste units recorded during this period0.0
'wasteCountUnitOfMeasureId'StringTrueIdentifier of the unit of measure for the waste countnull
'wasteCountUnitOfMeasureName'StringTrueName of the unit of measure for the waste countnull
'wasteCountUnitOfMeasureSymbol'StringTrueSymbol of the unit of measure for the waste countnull
notesStringTrueNotes associated with the OEE Waste Recordnull
enabledbooleanTrueIndicates whether the OEE Waste Record is enabledtrue
spare1StringTrueExtra field 1null
spare2StringTrueExtra field 2null
spare3StringTrueExtra field 3null

Code Examples

# Assume we have a waste record ID and a quality reason ID
wasteRecordId = "someWasteRecordId"
reasonId = "some-quality-reason-id"

# Set the quality reason and add a note
try:
updatedRecord = system.mes.oee.setQualityReasonForWasteRecord(
oeeWasteRecordId=wasteRecordId,
qualityReasonId=reasonId,
notes="Operator confirmed defective units due to packaging fault."
)
print "Successfully updated waste record:", updatedRecord['id']
print "New Reason:", updatedRecord['qualityReasonName']

except Exception as e:
print "Error updating waste record:", str(e)

# To clear a quality reason
# system.mes.oee.setQualityReasonForWasteRecord(wasteRecordId, None, "Reason cleared.")