Operations Request

Sepasoft MES Module Suite

MES Operations Request Object

The Operations Request object is a central component in the MES ecosystem, serving as the primary data structure for orchestrating manufacturing operations. Its core purpose is to hold critical information for a specific operation, encapsulating details related to the equipment where the work will be performed, the associated work order, and the operation's schedule. As a derived object, the Operations Request is built upon the MESAbstractObject and consequently inherits all of its exposed properties, methods, and events, providing a consistent and extensible foundation for developers.

Usage in Core MES Functions

The Operations Request object is a key input for several critical system functions that manage and execute production runs. Its importance is established by its consumption in the following scripting functions:

Understanding how to correctly instantiate and configure this object is the first practical step for developers seeking to programmatically manage MES schedules and operations.

Object Instantiation and Configuration

Correctly creating and configuring an Operations Request object is fundamental to scheduling and executing work within the MES. This process involves using dedicated system functions to generate the object and then programmatically setting its attributes to align with specific production requirements.

Core Creation Functions

The following scripting functions are used to generate an Operations Request object as part of a larger scheduling workflow:

Practical Example: Script Analysis

The following script demonstrates a complete workflow for creating a schedule, configuring the resulting Operations Request object, and persisting it to the system.

Python
eqPath = "[global]\Nuts Unlimited\Site\Area\Mixing Line 1"
woName = "WO-0001"
matName = "Mixed Nuts"
opDef = 'Mix Nuts'

startDate = system.date.getDate(2017, 10, 11)
startDate = system.date.setTime(startDate, 14, 0, 0)

woObj = system.mes.workorder.getMESWorkOrder(woName)
qty = woObj.getRemainingQuantity()

schedule = system.mes.createSchedule(opDef)
scheduleList = system.mes.scheduleOperations(schedule, startDate, True, 'Active')

for ndx in range(scheduleList.size()):
    obj = scheduleList.get(ndx)
    objTypeName = obj.getMESObjectType().getName()
    
    #Sort the schedule items in the list by their object type.
    if objTypeName == 'OperationsSchedule':
        #Set the schedule production count on the Operations Schedule object (top level)
        obj.setScheduleProductionCount(qty)
    elif objTypeName == 'OperationsRequest':
        #Set the reference to the Work Order on the Operations Request
        obj.setWorkOrderRefUUID(woObj.getUUID())
    elif objTypeName == 'RequestSegment' and (obj.getComplexPropertyCount('ResponseMaterial') > 0):
        #Set the Material Qty on the Production Request Segment
        if obj.getAvailableMaterialOptions('Material Out').size() > 0:
            obj.setMaterial('Material Out', matName, eqPath, qty)

print 'set work order scheduled qty', obj
system.mes.saveSchedule(scheduleList)

The script's logic can be broken down into the following key stages:

Step

Code Snippet

Purpose

Initialization

eqPath = "..."

woName = "..."

startDate = ...

Defines constant values and parameters for the operation, such as the target equipment path, work order name, and the desired start date.

Data Retrieval

woObj = system.mes.workorder.getMESWorkOrder(woName)

qty = woObj.getRemainingQuantity()

Fetches the existing MES work order object and determines the remaining quantity to be produced. This value will be used to configure the schedule.

Schedule Creation

schedule = system.mes.createSchedule(opDef)

scheduleList = system.mes.scheduleOperations(...)

Creates a new schedule based on an operation definition (opDef) and then populates it, generating the necessary child objects, including the OperationsRequest.

Object Configuration

for ndx in range(scheduleList.size()):

...if objTypeName == ...

elif objTypeName == ...

Iterates through the heterogeneous list of objects returned by system.mes.scheduleOperations. The if/elif block is a critical triage process that identifies each object by its type (OperationsSchedule, OperationsRequest, RequestSegment) and configures it correctly, ensuring a valid and complete schedule is constructed.

Persistence

system.mes.saveSchedule(scheduleList)

Commits the fully configured schedule and its associated objects, including the Operations Request, to the MES database, making it active in the system.

Once an Operations Request object is created and saved, its runtime behavior is further refined through its properties.

Object Properties

An Operations Request object's properties control its specific runtime behavior, including progress tracking and event firing. These properties are not accessed directly using dot notation (e.g., obj.property). Instead, they must be managed programmatically using the getPropertyValue() and setPropertyValue() methods inherited from the parent MESAbstractObject.

Property Reference

The following table details the properties available on the Operations Request object.

Property

Access Key

Permissions

Functional Description

Enable.Update.Event

EnableUpdateEvent

Read/Write

When this setting is set to true, the UpdateProgress event for the Response Segments associated with this Operations Request will be executed at the specified interval. The UpdateProgress event is defined in the Ignition Designer in the MES Events section.

Update.Event.Interval

UpdateEventInterval

Read/Write

Defines the frequency in seconds at which the UpdateProgress event will execute.

Track Progress By

TrackProgressBy

Read/Write

Determines how production is tracked: by time (default) or by material. The option to track by material will only be available if material has been defined and a rate has been specified in the associated process segment.

Is Execute Ready

IsExecuteReady

Read/Write

Returns true only when there is a response segment to act upon. An Operations Definition will not be ready for production unless all its segments are completely setup. This property will be false if there is any error when validating the Operations Definition object.

While properties define an object's state and behavior, its functions provide the primary interface for real-time interaction and data manipulation.

Object Functions (API Reference)

This section provides the core Application Programming Interface (API) for the Operations Request object. The functions detailed below are the primary tools for developers to programmatically read data from and write data to the object instance.

Accessor Functions (Getters)

Accessor functions (or "getters") are used to retrieve state information and data from the object without modifying it. They provide a read-only interface to the object's attributes.

getBeginDateTime()

  • Description: Returns the currently-scheduled begin (start) DateTime, taking into account automatic delays by the system. This DateTime changes minute by minute if the current time causes the schedule to be pushed out.

  • Syntax: getBeginDateTime()

  • Parameters: None

  • Returns: Date value - The currently-scheduled begin DateTime.

getEndDateTime()

  • Description: Returns the currently-scheduled end DateTime, taking into account automatic delays by the system. This DateTime changes minute by minute if the current time causes the schedule to be pushed out.

  • Syntax: getEndDateTime()

  • Parameters: None

  • Returns: Date value - The currently-scheduled end DateTime.

getEnableUpdateEvent()

  • Description: Checks whether the update event is enabled or not and returns the corresponding boolean.

  • Syntax: isEnableUpdateEvent()

  • Parameters: None

  • Returns: Boolean value - True if the update event is enabled, False otherwise.

getEquipmentLink()

  • Description: Get the MES Object Link corresponding to the equipment object.

  • Syntax: getEquipmentLink()

  • Parameters: None

  • Returns: MES Object Link eqLink - The link corresponding to the equipment object.

getEquipmentRefType()

  • Description: Get reference for the equipment type.

  • Syntax: getEquipmentRefType()

  • Parameters: None

  • Returns: String refType - The reference for the equipment type.

getEquipmentRefUUID()

  • Description: Get the unique identifier for equipment reference.

  • Syntax: getEquipmentRefUUID()

  • Parameters: None

  • Returns: String - The unique identifier for the equipment reference.

getOperationLink()

  • Description: Get the MES Object Link corresponding to the operation object.

  • Syntax: getOperationLink()

  • Parameters: None

  • Returns: MES Object Link opLink - The link corresponding to the operation object.

getOperationRefType()

  • Description: Get reference for the operation type.

  • Syntax: getOperationRefType()

  • Parameters: None

  • Returns: String refType - The reference for the operation type.

getOperationRefUUID()

  • Description: Get the unique identifier for operation reference.

  • Syntax: getOperationRefUUID()

  • Parameters: None

  • Returns: String value - The unique identifier for the operation reference.

getOperationsResponse()

  • Description: Gets the Operations Responses related to this Operations Request.

  • Syntax: getOperationsResponse()

  • Parameters: None

  • Returns: MESObjectLink opsRspLink - A link that references an MESOperationsResponse object.

getOriginalBeginDateTime()

  • Description: Returns the DateTime that the operation was originally scheduled to begin. This value does not change, regardless of later changes to the schedule.

  • Syntax: getOriginalBeginDateTime()

  • Parameters: None

  • Returns: Date value - The original scheduled start DateTime.

getOriginalEndDateTime()

  • Description: Returns the DateTime that the operation was originally scheduled to end. This value does not change, regardless of later changes to the schedule.

  • Syntax: getOriginalEndDateTime()

  • Parameters: None

  • Returns: Date value - The original scheduled end DateTime.

getRequestSegments()

  • Description: Gets the Request Segments related to this Operations Request.

  • Syntax: getRequestSegments()

  • Parameters: None

  • Returns: MESList reqSegLinks - A list of MESObjectLinks that each reference an MESRequestSegment object.

getScheduledBeginDateTime()

  • Description: Returns the begin (start) DateTime most recently scheduled by the user (e.g., via script or drag-and-drop). This value does not change when the system pushes the schedule out automatically.

  • Syntax: getScheduledBeginDateTime()

  • Parameters: None

  • Returns: Date value - The most recent user-scheduled start DateTime.

getScheduledEndDateTime()

  • Description: Returns the end DateTime most recently scheduled by the user. This value does not change when the system pushes the schedule out automatically.

  • Syntax: getScheduledEndDateTime()

  • Parameters: None

  • Returns: Date value - The most recent user-scheduled end DateTime.

getScheduleLink()

  • Description: Get the MES Object Link corresponding to the OperationsSchedule object.

  • Syntax: getScheduleLink()

  • Parameters: None

  • Returns: MES Object Link scheduleLink - The MES Object Link corresponding to the OperationsSchedule object.

getScheduleRefUUID()

  • Description: Get the unique identifier for schedule reference.

  • Syntax: getScheduleRefUUID()

  • Parameters: None

  • Returns: String - The unique identifier for the schedule reference.

getSegmentScheduleState()

  • Description: Get the schedule state of the segment.

  • Syntax: getSegmentScheduleState()

  • Parameters: None

  • Returns: String value - The schedule state of the segment.

getTrackProgressBy()

  • Description: Get the value for the Track Progress By property.

  • Syntax: getTrackProgressBy()

  • Parameters: None

  • Returns: String value - The value for the Track Progress By property.

getUpdateEventInterval()

  • Description: Get the interval between two update events.

  • Syntax: getUpdateEventInterval()

  • Parameters: None

  • Returns: Integer value - The interval value in seconds.

getWorkOrderLink()

  • Description: Get the MES Object Link corresponding to the MES Work Order object.

  • Syntax: getWorkOrderLink()

  • Parameters: None

  • Returns: MES Object Link workLink - The link corresponding to the MES Work Order object.

getWorkOrderRefUUID()

  • Description: Get the unique identifier for work order reference.

  • Syntax: getWorkOrderRefUUID()

  • Parameters: None

  • Returns: String value - The unique identifier for the work order reference.

Mutator Functions (Setters)

Mutator functions (or "setters") are used to modify the state and data of the object. They provide a write-only interface to the object's attributes.

Important Advisory Users should avoid setting date/time properties directly on this object. Direct modification via functions like setBeginDateTime() does not account for the start times of the underlying Request Segments, which can lead to an invalid schedule state. Instead, use the system.mes.scheduleOperations function to manage the begin and end parameters for an operation, as it correctly handles all related schedule factors.

setBeginDateTime(value)

  • Description: Set (adjust) the scheduled begin (start) DateTime of the Operations Request.

  • Syntax: setBeginDateTime(value)

  • Parameters: Date value - The begin DateTime to schedule the operation.

  • Returns: None

setEndDateTime(value)

  • Description: Set (adjust) the scheduled end DateTime of the Operations Request.

  • Syntax: setEndDateTime(value)

  • Parameters: Date value - The end DateTime to schedule the operation.

  • Returns: None

setEnableUpdateEvent(value)

  • Description: Enables or disables the update event by setting to True or False respectively.

  • Syntax: setEnableUpdateEvent(value)

  • Parameters: Boolean value - Set to True to enable the event, False to disable.

  • Returns: Nothing

setEquipmentLink(eqLink)

  • Description: Set the MES Object Link corresponding to the equipment object.

  • Syntax: setEquipmentLink(eqLink)

  • Parameters: MES Object Link equipLink - The link corresponding to the equipment object.

  • Returns: Nothing

setEquipmentRefType(refType)

  • Description: Set the reference for the equipment type.

  • Syntax: setEquipmentRefType(refType)

  • Parameters: String refType - The reference for the equipment type.

  • Returns: Nothing

setEquipmentRefUUID(value)

  • Description: Set the unique identifier for the equipment reference.

  • Syntax: setEquipmentRefUUID(value)

  • Parameters: String value - The unique identifier for the equipment reference.

  • Returns: Nothing

setOperationLink(opLink)

  • Description: Set the MES Object Link corresponding to the operation object.

  • Syntax: setOperationLink(opLink)

  • Parameters: MES Object Link opLink - The link corresponding to the operation object.

  • Returns: Nothing

setOperationRefType(refType)

  • Description: Set the reference for the operation type.

  • Syntax: setOperationRefType(refType)

  • Parameters: String refType - The reference for the operation type.

  • Returns: Nothing

setOperationRefUUID(value)

  • Description: Set the unique identifier for the operation reference.

  • Syntax: setOperationRefUUID(value)

  • Parameters: String value - The unique identifier for the operation reference.

  • Returns: Nothing

setOriginalBeginDateTime(value)

  • Description: Set (adjust) original begin date and time of the operation.

  • Syntax: setOriginalBeginDateTime(value)

  • Parameters: Date value - The original begin date and time of the operation.

  • Returns: Nothing

setOriginalEndDateTime(value)

  • Description: Set (adjust) original date and time for ending the operation before it is updated.

  • Syntax: setOriginalEndDateTime(value)

  • Parameters: Date value - The original date and time for ending the operation before it is updated.

  • Returns: Nothing

setScheduledBeginDateTime(date)

  • Description: Set (adjust) the scheduled begin date and time of the operation.

  • Syntax: setScheduledBeginDateTime(date)

  • Parameters: Date value - The scheduled begin date and time of the operation.

  • Returns: Nothing

setScheduledEndDateTime(date)

  • Description: Set (adjust) the scheduled end date and time of the operation.

  • Syntax: setScheduledEndDateTime(date)

  • Parameters: Date value - The scheduled end date and time of the operation.

  • Returns: Nothing

setScheduleLink(scheduleLink)

  • Description: Set the MES Object Link for the corresponding OperationsSchedule object.

  • Syntax: setScheduleLink(scheduleLink)

  • Parameters: MES Object Link scheduleLink - The link to the OperationsSchedule object.

  • Returns: Nothing

setScheduleRefUUID(value)

  • Description: Set the unique identifier for the schedule reference.

  • Syntax: setScheduleRefUUID(value)

  • Parameters: String value - The unique identifier to set as the schedule reference.

  • Returns: Nothing

setSegmentScheduleState(value)

  • Description: Set the schedule state of the segment.

  • Syntax: setSegmentScheduleState(value)

  • Parameters: String value - The schedule state of the segment.

  • Returns: Nothing

setUpdateEventInterval(value)

  • Description: Set the interval between two update events.

  • Syntax: setUpdateEventInterval(value)

  • Parameters: Integer value - The interval in seconds.

  • Returns: Nothing

setWorkOrderLink(woLink)

  • Description: Set the MES Object Link corresponding to the MES Work Order object.

  • Syntax: setWorkOrderLink(woLink)

  • Parameters: MES Object Link woLink - The link to the MES Work Order object.

  • Returns: Nothing

setWorkOrderRefUUID(value)

  • Description: Set the unique identifier for the work order reference.

  • Syntax: setWorkOrderRefUUID(value)

  • Parameters: String value - The unique identifier to set for the work order reference.

  • Returns: Nothing

Beyond direct function calls, developers can also inject custom logic into key lifecycle moments using the object's event model.

--------------------------------------------------------------------------------

Object Events

Object events provide powerful hooks that allow developers to execute custom scripts at critical moments in the Operations Request lifecycle. These events can be used to add validation, logging, or other custom logic before an operation starts, after it is scheduled, or when it is first created.

Event Handling Pattern

When implementing a custom script for an event, you have the option to either replace the system's default logic entirely or to augment it. If you wish to execute your custom code and then still allow the system's standard behavior to proceed, you must call the event.runDefaultHandler() function within your script. If this function is omitted, only your custom script will run.

Available Events

  • BeforeAutoStart This event is fired before the automatic start of a scheduled Operations Request.

  • BeginSchedule This event is fired before the requested operation is scheduled.

  • EndSchedule This event is fired after the requested operation has been scheduled.

  • New This event is fired when a new instance of an Operations Request object is created.

  • ScheduleDelay This event is fired to provide notification that an operation is delayed.

Sepasoft MES Module Suite