Skip to main content

system.mes.oee.getStateRecordsFiltered

Description

Retrieves a filtered list of OEE state records for a specified location and time range, allowing for filtering by event type and minimum duration.

Permissions

This method requires the OEE.READ.GET permission.

Syntax

system.mes.oee.getStateRecordsFiltered(locationPath, startDate, endDate, eventTypes=None, microstopThreshold=None, microstopThresholdTimeUnits='SECONDS', modeCodes=None)

Parameters

ParameterTypeNullableDescription
locationPathStringFalseThe location path to query.
startDateDateFalseThe start of the time range.
endDateDateFalseThe end of the time range.
availabilityReasonPathStringTrueThe path to a availability reason to filter by.
eventTypesString[]TrueA list of event types to include (e.g., DOWNTIME, RUNNING).
microstopThresholdIntegerTrueA duration to filter out records shorter than this value.
microstopThresholdTimeUnitsStringTrueThe time units for microstopThreshold (e.g., SECONDS, MINUTES).
modeCodesInteger[]TrueInteger codes for OEE modes.

Returns

A list of JSON representations of OeeStateRecordDTO objects, each representing a recorded OEE state event.

Each object has the following properties:

NameTypeNullableDescriptionDefault Value
idStringTrueThe id of the OEE State Recordnull
codeIntegerFalseInteger state numbernull
locationIdStringFalseIdentifier of the associated location where this state record was recordednull
locationNameStringTrueName of the associated locationnull
locationPathStringTruePath of the location where this state record was recordednull
nameStringFalseName of the recorded statenull
calculationTypeOeeStateCalculationTypeFalseSpecifies how this state contributes to OEE calculationsDOWNTIME
colorStringFalseHex color code representing the state visually"#000000"
statusStatusFalseStatus of the OEE record (e.g., running, faulted, canceled, complete)UNKNOWN
startDateInstantFalseStart date and time of the state recordInstant.now()
endDateInstantTrueEnd date and time of the state recordnull
durationDoubleFalseDuration of the state record in seconds0.0
availabilityReasonIdStringTrueIdentifier of the associated availability reason, if applicablenull
availabilityReasonStringTrueTitle of the availability reason. (Name - Code) For display purposes onlynull
availabilityReasonPathStringTruePath to the current availability reasonnull
interruptionLocationIdStringTrueLocation id that caused the blocked/starved state on the machinenull
interruptionLocationNameStringTrueName of the interruption location that caused the blocked/starved statenull
interruptionLocationPathStringTrueLocation path that caused the blocked/starved state on the machinenull
acknowledgedBooleanFalseBoolean indicating whether the state record has been acknowledgedfalse
acknowledgedByStringTrueAcknowledged By. This is the user who acknowledged the state recordnull
acknowledgedDateInstantTrueAcknowledged Date. This is the date when the state record was acknowledgednull
modeRecordIdStringTrueIdentifier of the associated mode recordnull
rootCauseStateRecordIdStringTrueIdentifier of the root cause state record, if applicablenull
primaryAlarmRecordIdStringTrueIdentifier of the associated OEE Alarm Record, if applicablenull
primaryAlarmNameStringTruePrimary alarm name, if applicablenull
primaryAlarmDisplayPathStringTruePrimary alarm display path, if applicablenull
primaryAlarmLabelStringTruePrimary alarm display name, if applicablenull
notesStringTrueNotes associated with the OEE State Recordnull
enabledbooleanTrueIndicates whether the OEE State Record is enabledtrue
spare1StringTrueExtra field 1null
spare2StringTrueExtra field 2null
spare3StringTrueExtra field 3null

Code Examples

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

# Get all "Fault" state records longer than 5 minutes from the last day
location = "Enterprise/Site/Area/Line1"
endTime = Date()
startTime = Date(endTime.getTime() - TimeUnit.DAYS.toMillis(1))

filteredRecords = system.mes.oee.getStateRecordsFiltered(
locationPath=location,
startDate=startTime,
endDate=endTime,
eventTypes=["Downtime"], # Filter for downtime-related states
microstopThreshold=5,
microstopThresholdTimeUnits='MINUTES'
)

for record in filteredRecords:
print "State:", record['name'], "Duration (min):", record['duration'] / 60.0