Skip to main content

find-oee-state-records

et---- sidebar_position: 51 title: "findOeeStateRecords" description: "Retrieves OEE state records based on the specified pagination, sort, and column constraint parameters."

system.mes.oee.findOeeStateRecords

Description

Retrieves OEE State Records based on the specified pagination, sort, and column constraint parameters.

Permissions

This method requires the OEE.READ.GET permission.

Syntax

system.mes.oee.findOeeStateRecords(**queryRequest)

Parameters

Using Python keyword arguments, a Query Request can be passed to the findOeeStateRecords function without specifying each parameter individually. Please refer to the Query Request documentation for a list of parameters.

ParameterTypeNullableDescription
queryRequestQuery RequestFalseA Query Request with the desired pagination, sorting, and filtering parameters.

Returns

Returns a Query Result object with the following properties:

NameTypeDescription
contentList<OeeStateRecord>The list of all records found that meet the specified criteria
totalPagesIntegerIf pagination is used, this is the number of total pages of records in the database for the specified page size.
totalElementsLongIf pagination is used, this is the number of records in the database that meet the specified criteria.
pageSizeIntegerIf pagination is used, this is the specified page size.
pageIndexIntegerIf pagination is used, this is the specified page index.
hasContentBooleanTrue if any records were found that meet the specified criteria.
isFirstBooleanIf pagination is used, this is true if the first page was returned.
isLastBooleanIf pagination is used, this is true if the last page was returned.
hasNextBooleanIf pagination is used, this is true if there is a page of content available after this one.
hasPreviousBooleanIf pagination is used, this is true if there is a page of content available before this one.

Each OeeStateRecordDTO in content 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 state 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

Here is an example of how to use a Query Request to retrieve the first ten OEE state records created in 2025, sorted by start date.

# Generate the object structure for a new query request
queryRequest = system.mes.query.newQueryRequest()

# Set the basic attributes of the query request
queryRequest['pageSize'] = 10
queryRequest['pageIndex'] = 0

queryRequest['sortFields'] = ['startDate']
queryRequest['sortDirections'] = ['Ascending']

# Generate the object structure for a filter for the query request
filterRequest = system.mes.query.newFilterRequest()
filterRequest['field'] = 'startDate'
filterRequest['condition'] = 'between'
filterRequest['minDateValue'] = '2025-01-01T00:00:00Z' # OR system.date.getDate(2025, 0, 1)
filterRequest['maxDateValue'] = '2026-01-01T00:00:00Z' # OR system.date.getDate(2026, 0, 1)

filters = [filterRequest]

queryRequest['filters'] = filters

# Retrieve the OEE state records that match the filter
result = system.mes.oee.findOeeStateRecords(**queryRequest)

# Output the OEE state records that match the filter
print(result)