Skip to main content

system.mes.oee.saveMode

Description

Creates or updates an OEE Mode in the system. To create a new mode, first generate a new object with system.mes.oee.newOeeMode.

Permissions

This method requires the OEE.WRITE.SAVE permission.

Syntax

system.mes.oee.saveMode(**modeData)

Parameters

An unpacked dictionary of OeeModeDTO fields.

ParameterTypeNullableDescriptionDefault Value
idStringTrueThe id of the OEE Modenull
locationIdStringFalseIdentifier of the associated locationnull
locationPathStringTruePath to the associated locationnull
codeIntegerFalseInteger value representing the modenull
nameStringFalseName of the modenull
calculationTypeOeeModeCalculationTypeFalseSpecifies how this mode should be factored into OEE calculationsSCHEDULED_PRODUCTION
expectedDurationSourceOeeModeExpectedDurationSourceFalseDefines the source used to determine the expected duration of a scheduled downtime eventSTATIC
expectedDurationExpressionStringTrueIgnition expression to dynamically calculate the expected duration of the mode in secondsnull
expectedDurationDoubleTrueExpected duration of the mode in seconds0.0
colorStringFalseHex color code representing the mode visually"#000000"
notesStringTrueNotes associated with the OEE Modenull
enabledbooleanTrueIndicates whether the OEE Mode is enabledtrue
spare1StringTrueExtra field 1null
spare2StringTrueExtra field 2null
spare3StringTrueExtra field 3null

Returns

A JSON representation of the saved OeeModeDTO object.

Code Examples

# Create a new OEE mode object
newMode = system.mes.oee.newOeeMode()

# Set attributes for the new mode
newMode['locationId'] = '01JCH3ENEB-SV2X8B3W-NFY8WZNK'
newMode['name'] = 'Production'
newMode['calculationType'] = 'SCHEDULED_PRODUCTION'
newMode['enabled'] = True

# Save the new mode
savedMode = system.mes.oee.saveMode(**newMode)

print "Saved OEE Mode with ID:", savedMode['id']

# To update an existing mode, include its ID
# updatedModeData = system.mes.oee.getMode(savedMode['id'])
# updatedModeData['name'] = 'Full Production'
# system.mes.oee.saveMode(**updatedModeData)