system.mes.oee.saveCalculationConfig
Description
Creates or updates an OEE Calculation Configuration. If an id is provided and matches an
existing configuration, it is updated; otherwise a new configuration is created.
Permissions
This method requires the OEE.WRITE.SAVE permission.
Syntax
system.mes.oee.saveCalculationConfig(**config)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
id | String | True | ULID of an existing configuration to update. Omit to create new. |
locationId | String | False | ID of the associated location. Required for new configurations. |
locationPath | String | True | Path of the associated location. For display purposes only. |
periodType | String | False | Period granularity: "HOUR", "DAY", "WEEK", "MONTH", or "SHIFT". |
numRowsPerCycle | Integer | True | Maximum records to generate per job cycle. Default 1. |
weekStartDay | String | True | First day of the calendar week for WEEK bucketing. One of "MONDAY" through "SUNDAY". Default "MONDAY" (ISO 8601). Only meaningful for WEEK configurations. |
numDaysDelay | Integer | True | Minimum number of days a period must end before it is pre-computed. The pre-processed row in the rollup table will always be at least this many days behind the current date. This is to allow for a settling period. Default 1, minimum 1. |
latestCalculationTimestamp | String | True | ISO-8601 timestamp. Sets the backfill starting point. |
enabled | Boolean | True | Whether this configuration is active. Default True. |
notes | String | True | Optional notes. |
Returns
A JSON representation of the saved OeeCalculationConfigurationDTO.
| Name | Type | Nullable | Description | Default Value |
|---|---|---|---|---|
id | String | True | The ID of the saved configuration (ULID). | null |
locationId | String | False | Identifier for the associated location. | null |
locationPath | String | True | Path for the associated location (display only). | null |
periodType | String | False | Period granularity: HOUR, DAY, WEEK, MONTH, or SHIFT. | null |
numRowsPerCycle | Integer | False | Maximum records to generate per job cycle. | 1 |
weekStartDay | String | False | First day of the calendar week for WEEK bucketing. | "MONDAY" |
numDaysDelay | Integer | False | Minimum number of days a period must end before it is pre-computed. The pre-processed row in the rollup table will always be at least this many days behind the current date. This is to allow for a settling period. | 1 |
latestCalculationTimestamp | Instant | True | ISO-8601 timestamp of the most recently computed period. | null |
enabled | Boolean | False | Whether this configuration is active. | true |
notes | String | True | Optional notes. | null |
Code Examples
# Create a new hourly calculation config for a line
config = system.mes.oee.saveCalculationConfig(
locationId = "01JCH3ENEB-SV2X8B3W-NFY8WZNK",
periodType = "HOUR",
numRowsPerCycle = 48
)
print "Created config with id:", config['id']
# Update an existing config
config['numRowsPerCycle'] = 24
updated = system.mes.oee.saveCalculationConfig(**config)
print "Updated rows per cycle:", updated['numRowsPerCycle']