system.mes.oee.calculateOeeByCalendarPeriod
Description
Calculates OEE (Overall Equipment Effectiveness) metrics broken down by time intervals for a specific location within
a date range. Unlike calculateOeeByTimeInterval, the time intervals are snapped
to natural time boundaries such as hourly or daily periods. This allows for efficient use of the pre-computed records
cache, which can be configured using saveCalculationConfig.
Returns one OeeResultsDTO per calendar-aligned bucket for the given location, period type, bucket size, and
date range. Each result spans exactly one bucket aligned to a calendar boundary — for example,
periodType="HOUR" produces whole-hour results (01:00-02:00, 02:00-03:00, etc.) and periodType="DAY" produces
midnight-to-midnight results.
periodsPerBucket controls how many calendar periods form one bucket. With the default of 1, each
result covers one period (one hour, one day, etc.). However, with periodsPerBucket=4 and
periodType="HOUR" for example, each result covers a 4-hour window anchored to the day boundary
(00:00–04:00, 04:00–08:00, and so on).
The returned buckets always cover complete calendar periods. For example, hourly results with
startDate=10:45 and endDate=11:15 return two buckets: 10:00–11:00 and 11:00–12:00.
For each bucket, the method tries the pre-computed record cache at the requested periodType first.
On a miss it steps down through smaller granularities (MONTH → WEEK → DAY → HOUR) until a cached
record is found. If no cached record exists at any granularity, the bucket falls back to a raw
calculation.
Permissions
This method requires the OEE.READ.GET permission.
Syntax
system.mes.oee.calculateOeeByCalendarPeriod(locationIdOrPath, periodType, startDate, periodsPerBucket=1, endDate=None, unitOfMeasureName=None)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
locationIdOrPath | String | False | Location ID (ULID) or path. |
periodType | String | False | Period granularity: "HOUR", "DAY", "WEEK", or "MONTH". |
startDate | Date | False | Start of the query range. Snapped to the nearest calendar boundary if not already aligned. |
periodsPerBucket | Integer | True | Number of base periods per bucket. For example, periodType="HOUR" with periodsPerBucket=4 produces 4-hour buckets anchored to the day. Defaults to 1. |
endDate | Date | True | End of the query range (inclusive). Defaults to now if omitted. |
unitOfMeasureName | String | True | Unit of measure name for production counts. Uses the location OEE configuration default if omitted. |