Skip to main content

system.mes.productionOrder.findProductionOrders

Description

Retrieves Production Orders records based on the specified pagination, sort, and column constraint parameters.

Syntax

system.mes.productionOrder.findProductionOrders(**queryRequest)

Parameters

Using Python keyword arguments, a Query Request can be passed to the findProductionOrders 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<Production Order>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.

Production Order

NameTypeDescription
productNameStringThe name of the material produce to be produced in this production order.
locationNameStringThe name of the location that is associated with this production order.
unitOfMeasureNameStringThe name of the unit of measure that is associated with this production order.
nameStringThe name of the production order.
productIdString (ULID)The ULID of the material produce to be produced.
locationIdString (ULID)The ULID of the location associated with this production order.
statusStringThe status of the production order. (e.g., IDLE, SCHEDULED, RUNNING, PAUSED, STOPPED, CLOSED, CANCELLED).
schedulePriorityStringThe schedule priority of the production order (e.g., LOW, NORMAL, HIGH, URGENT).
quantityDoubleThe total quantity to be produced in this production order.
quantityProducedDoubleThe quantity that has been already produced in this production order.
quantityScheduledDoubleThe quantity that has been scheduled to be produced in this production order.
startDateInstantThe date this production order started.
endDateInstantThe date this production order ended.
dueDateInstantThe date this production order is due.
unitOfMeasureIdString (ULID)The ULID of the unit of measure for this production order.
shiftRecordIdString (ULID)The ULID of the shift the production order started in.
idString (ULID)The ULID of the production order.
notesStringNotes related to the production order.
enabledBooleanIndicates if the production order is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Code Examples

Here is an example of how to use a Query Request to retrieve the first ten production orders created in 2025 sorted by their name.

# 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'] = ['name']
queryRequest['sortDirections'] = ['Ascending']

# Generate the object structure for a filter for the query request
filterRequest = system.mes.query.newFilterRequest()
filterRequest['field'] = 'createdDate'
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 production orders that match the filter
result = system.mes.productionOrder.findProductionOrders(**queryRequest)

# Output the production orders that match the filter.
print(result)