Skip to main content

system.mes.oee.getStateRecordsGroupedByState

Description

Retrieves OEE state records aggregated by state for a specified location and time range. This is useful for creating summary charts or reports of how time was spent.

Permissions

This method requires the OEE.READ.GET permission.

Syntax

system.mes.oee.getStateRecordsGroupedByState(locationIdOrPath, startDate, endDate)

Parameters

ParameterTypeNullableDescription
locationIdOrPathStringFalseThe location path or ID to analyze.
startDateDateFalseThe start time for the analysis period.
endDateDateFalseThe end time for the analysis period.

Returns

A list of JSON representations of OeeStateRecordsGroupedByStateDTO objects, each representing the aggregated data for a specific OEE state.

Each object has the following properties:

NameTypeNullableDescriptionDefault Value
locationIdStringTrueIdentifier of the associated locationnull
codeIntegerTrueThe integer code associated with the Statenull
nameStringTrueThe name of the state, such as "Downtime", "Running", etc.null
colorStringTrueThe color code for displaying this statenull
durationDoubleTrueThe total aggregated duration of this state in secondsnull
countLongTrueThe number of occurrences of this statenull

Code Examples

from java.util import Date
from java.util.concurrent import TimeUnit

# Get state record summary for the last 24 hours
location = "Enterprise/Site/Area/Line1"
endTime = Date()
startTime = Date(endTime.getTime() - TimeUnit.DAYS.toMillis(1))

groupedStates = system.mes.oee.getStateRecordsGroupedByState(
locationIdOrPath=location,
startDate=startTime,
endDate=endTime
)

for stateGroup in groupedStates:
print "State:", stateGroup['name']
print " Total Duration (hours):", stateGroup['duration'] / 3600.0
print " Occurrence Count:", stateGroup['count']