system.mes.oee.rebuildCalculationRecords
Description
Deletes existing pre-computed OEE calculation records in the specified range and regenerates them
from raw data. This is useful for correcting stale data or backfilling historical periods after
raw record corrections. If an OeeCalculationConfig exists for the location and period type,
its latestCalculationTimestamp is updated to the end date of the last generated record.
Permissions
This method requires the OEE.WRITE.SAVE permission.
Syntax
system.mes.oee.rebuildCalculationRecords(locationIdOrPath, periodType, startDate, endDate)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
locationIdOrPath | String | False | Location ID (ULID) or path. |
periodType | String | False | Period granularity: "HOUR", "DAY", "WEEK", "MONTH", or "SHIFT". |
startDate | Date | False | Start of the rebuild range (inclusive). |
endDate | Date | False | End of the rebuild range (inclusive). |
Returns
A JSON ApiResponse object indicating success or failure.
| Name | Type | Description |
|---|---|---|
success | Boolean | True if the records were rebuilt successfully. |
message | String | A message describing the result. |
error | String | Error details if the operation failed, otherwise null. |
Code Examples
import system.date
from java.util import Date
# Rebuild daily records for the past 7 days
location = "Enterprise/Site/Line1"
endDate = system.date.midnight(Date())
startDate = system.date.addDays(endDate, -7)
result = system.mes.oee.rebuildCalculationRecords(location, "DAY", startDate, endDate)
if result['success']:
print "Records rebuilt successfully"
else:
print "Error:", result['error']