Sepasoft MES Module Suite
Operations Response
This object is created behind the scenes anytime a Operations Definition or a Operations Request is selected to begin. It holds some base information about the operation whereas most production information is stored with the Response Segment. It can also be created from script and used to begin segments from script, but it cannot be created from the components provided with the Track & Trace Module. For this reason, there is no component that can be used to change the properties listed for the Operations Response object.
The Operations Response is derived from the AbstractMESObject and inherits all the exposed properties, methods and events for that object.
Object Creation
This object is created at run time when an Operation is executed. The Operations Response is based on a reference object. The two options to base this reference off of are, the Operations Definition and Operations Request.
The following scripting functions can also be used to create or return this type of object.
Script example of getting an instance of a MESOperationsResponse object:
Python |
#Get the currently running operation for specified equipment eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' oper = system.mes.getCurrentOperation(eqPath) |
Python |
#Create new operation for specified equipment eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' oper = system.mes.createOperation('Receive Steel') |
Use
The following scripting functions use this object.
Object Properties
These properties are accessible through the MES Object Editor component and with the provided object functions, but not directly as obj.properties. Property values can be accessed and changed for an object by using the getPropertyValue() and setPropertyValue() method.
Setting Name | Scripting | R/W | 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 Definition will be executed at the interval set in the Update Event Interval. The UpdateProgress event is defined in the Ignition Designer in the MES Events section. |
| Update Event Interval | UpdateEventInterval | Read/Write | This setting defined the frequency (in seconds) to execute the UpdateProgress event. |
| Begin Date Time | BeginDateTime | Read/Write | The date and time the operation started. This setting is set when the operation is started, and it will automatically be set to the date and time of the Ignition server. |
| End Date Time | EndDateTime | Read/Write | The date and time the operation ended. This setting is set when the operation is ended, and it will automatically be set to the date and time of the Ignition server. |
| Operation Reference Type | OperationRefType | Read/Write | This setting is automatically set and should not be changed. It will either be set to Operations Definition or Operations Request depending on how the operation was started. If the operation was scheduled prior to being run, then it will equal Operations Request, otherwise it will equal Operations Definition. |
| Operation Reference UUID | OperationRefUUID | Read/Write | This setting is automatically set and should not be changed. It refers to the UUID of the Operations Definition or Operations Request, depending on how the operation was started. If the operation was scheduled prior to being run, then it will equal the UUID of the Operations Request it is based on, otherwise it will equal the UUID of the Operations Definition it is based on. |
This object inherits the AbstractMESObject properties.
Object Functions
This object provides the following functions:
- abort()
- begin()
- createSegment(segmentName)
- createSegment(segmentName, autoAssignOptions)
- end()
- getActiveSegment(segmentName)
- getActiveSegmentName()
- getActiveSegmentNames()
- getActualMaterialLots(lotUseCase)
- getActualPersonnel()
- getActualSupplementalEquipment()
- getAvailableSegmentNames()
- getEquipmentLink()
- getProductionCount()
- getResponseSegments()
- getWorkOrderLink()
- setEquipmentLink(equipmentLink)
- setWorkOrderLink(woLink)
abort()
Abort the operation. This will do an abrupt abort of all segments currently running under the operation before aborting the operation.
|
This helper function should NOT be used in normal operations because the tracking data will not be validated or in many cases accurately recorded in the database. |
abort()
- Parameters
None
- Returns
Nothing
- Scope
All
Python |
#Get the MES object link of Unload Station 1 eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Get the current operation running at the equipment path oper = system.mes.getCurrentOperation(eqPath) #Abort the operation oper.abort() |
begin()
Begin the operation which will allow segments to begin. Multiple operations can be running at an equipment item at a time, and multiple segments can run under an operation.
begin()
- Parameters
None
- Returns
MESOperationsResponse operResponse - The operation response object is returned.
- Scope
All
Python |
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Get a new operation to be run at the specified equipment path oper = system.mes.createOperation('Receive Steel', eqPath) #Begin the operation oper = oper.begin() |
createSegment(segmentName)
Create a new segment to run under the operation. After calling this script function, the segment will not be running until required resources and custom properties are assigned begin is called. Operations can contain one or more segments and the name of the segment to create is passed in the segmentName parameter.
createSegment(segmentName)
- Parameters
String segmentName - The name of the segment to create.
- Returns
A new MESResponseSegment object that can be used to assign resources and custom properties.
- Scope
All
Python |
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Create and begin a new operation at the specified equipment path oper = system.mes.createOperation('Receive Steel', eqPath) oper = oper.begin() #Create new segment seg = oper.createSegment('Inspect Steel') #Assign material resources.... #Assign personnel resources.... #Assign supplemental resources.... #Assign custom properties.... #Begin segment seg = seg.begin() |
createSegment(segmentName, autoAssignOptions)
Create a new segment to run under the operation. After calling this script function, the segment will not be running until required resources and custom properties are assigned begin is called. Operations can contain one or more segments and the name of the segment to create is passed in the segmentName parameter.
createSegment(segmentName, autoAssignOptions)
- Parameters
String segmentName - The name of the segment to create.
Boolean autoAssignOptions - If true, automatically assign material, lot and person options. Otherwise, they have to be set prior to beginning the segment.
- Returns
A new MESResponseSegment object that can be used to assign resources and custom properties.
- Scope
All
Python |
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Create and begin a new operation at the specified equipment path oper = system.mes.createOperation('Receive Steel', eqPath) oper = oper.begin() #Create new segment seg = oper.createSegment('Inspect Steel', True) #Assign material resources.... #Assign personnel resources.... #Assign supplemental resources.... #Assign custom properties.... #Begin segment seg = seg.begin() |
end()
End the operation. Before an operation can be ended all segments must be ended first.
end()
- Parameters
None
- Returns
MESOperationsResponse seg - The ended segment is returned.
- Scope
All
Python |
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Get the currently running operation running at the specified equipment path oper = system.mes.getCurrentOperation(eqPath) #End the operation oper = oper.end() |
getActiveSegment(segmentName)
Get the active segment MES object from a operation by the name of the segment. Because more than one segment can be running under an operation, the segmentName parameter specifies which one to return.
getActiveSegment(segmentName)
- Parameters
String segmentName - The name of the segment.
- Returns
The MESResponseSegment object that can be updated to reflect lot, material, personnel, supplemental equipment or custom properties changes.
- Scope
All
Python |
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Get the current operation being run at the equipment oper = system.mes.getCurrentOperation(eqPath) #Get the Inspect Steel segment running under the operation seg = oper.getActiveSegment('Inspect Steel') #End the segment seg.end() |
getActiveSegmentName()
Return the name of currently active segment for the operation. If there are no active segments or more than one active segment, then an exception will be thrown.
getActiveSegmentName()
- Parameters
None
- Returns
The name of the currently active segment.
- Scope
All
Python |
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Get the current operation being run at the equipment oper = system.mes.getCurrentOperation(eqPath) #Get the active segment running under the operation segName = oper.getActiveSegmentName() seg = oper.getActiveSegment(segName) #End the segment seg.end() |
getActiveSegmentNames()
Return names of all active segments for an operation. Operations can be running multiple segments at any time and this script function is used to get the names of them.
getActiveSegmentNames()
- Parameters
None
- Returns
An array of the names of all active segments for the operation.
- Scope
All
Python |
#Get the operation currently being run at Unload Station 1 eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' oper = system.mes.getCurrentOperation(eqPath) operName = oper.getName() #Get the names of active segments for the operation if oper == None: print 'No active segments found for "%s"' % eqPath else: try: segNames = oper.getActiveSegmentNames() for name in segNames: print name except: print 'There are no active segments for "%s "' % operName |
Python |
Unload Steel Inspect Steel |
getActualMaterialLots(lotUseCase)
Gets the Material Lots related to this Operations Response.
getActualMaterialLots(lotUseCase)
- Parameters
String lotUseCase - The lot's use-type. Valid uses are: 'In', 'Out', 'Consumable', 'By-product', and '(Unknown)'.
- Returns
MESList<MESObjectLink> matLotLinks - A list of MESObjectLinks that each have a reference to an MESMaterialLot object.
- Scope
All
getActualPersonnel()
Gets the Personnel related to this Operations Response.
getActualPersonnel()
- Parameters
None
- Returns
MESList<MESObjectLink> personLinks - A list of MESObjectLinks that each have a reference to a person object.
- Scope
All
getActualSupplementalEquipment()
Gets the Supplemental Equipment related to this Operations Response.
getActualSupplementalEquipment()
- Parameters
None
- Returns
MESList<MESObjectLink> supEqpLinks - A list of MESObjectLinks that each have a reference to a supplemental equipment object.
- Scope
All
getAvailableSegmentNames()
Return a list of all available segments that can be run for the operation. Both currently running and not running segments will be returned.
getAvailableSegmentNames()
- Parameters
None
- Returns
An array of the names of all available segments for the operation.
Unload SteelInspect SteelStore in Inventory |
getEquipmentLink()
Return a link to the equipment MES object associated with the operation.
getEquipmentLink()
- Parameters
None
- Returns
MES Object Link object containing details of the equipment that is associated with the operation.
- Scope
All
Python |
#Get the operation currently being run at Unload Station 1 eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' oper = system.mes.getCurrentOperation(eqPath) #Get the MES object link of where the operation is running eqLink = oper.getEquipmentLink() #Print the UUID and the type of equipment print eqLink.getMESObjectUUID() print eqLink.getMESObjectType() #Get the full MES object for the equipment eqObj = eqLink.getMESObject() print eqObj.getName() |
508ebebc-8f19-4521-b018-a3e177028981Response LineUnload Station 1 |
getProductionCount()
Return the production count for the operations response. The Track Production By setting must be set to a valid material reference.
getProductionCount()
- Parameters
None
- Returns
Double - Returns the production count as a double (Float8).
- Scope
All
Python |
#Get the production count for the operation currently being run at Unload Station 1 eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' oper = system.mes.getCurrentOperation(eqPath) prodCount = oper.getProductionCount() print prodCount |
430.0 |
getResponseSegments()
Gets the Response Segments related to this Operations Response.
getResponseSegments()
- Parameters
None
- Returns
MESList<MESObjectLink> rspSegLinks - A list of MESObjectLinks that each have a reference to an MESResponseSegment object.
- Scope
All
getWorkOrderLink()
Return a link to the work order MES object associated with the operation.
getWorkOrderLink()
- Parameters
None
- Returns
MESObjectLink object containing details of the work order that is associated with the operation.
- Scope
All
Python |
eqPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1' oper = system.mes.getCurrentOperation(eqPath) #Get work order link print oper.getWorkOrderLink() |
(type: Work Order, uuid: 2e906f1e-1736-4e02-8586-6b7e4e7e17fc) |
setEquipmentLink(equipmentLink)
Set the equipment that the operation is associated with by the link to the equipment.
|
Using this method is not the preferred method of assigning the equipment of where an operation is to run. Instead, use the system.mes.createOperation script function that will set the equipment based on the equipment path. |
setEquipmentLink(equipmentLink)
- Parameters
A MES Object Link object containing details of the equipment to associate with the operation.
- Returns
Nothing
- Scope
All
Example of unpreferred method:
Python |
#Get the MES object link of Unload Station 1 eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' eqLink = system.mes.getMESObjectLinkByEquipmentPath(eqPath) #Create a new operation from a operation definition object operDef = system.mes.loadMESObject('Receive Steel', 'OperationsDefinition') oper = system.mes.createOperation(operDef) #Set the equipment where the new operation is to run. oper.setEquipmentLink(eqLink) |
Python |
#Get the MES object link of Unload Station 1 eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1' #Create a new operation using the equipment path oper = system.mes.createOperation('Receive Steel', eqPath) |
setWorkOrderLink(woLink)
Sets a link to the work order MES object associated with the operation.
setWorkOrderLink(woLink)
- Parameters
MESObjectLink woLink - The object link containing details of the work order that is associated with the operation.
- Returns
Nothing
- Scope
All
Python |
eqPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1' #Get current operation oper = system.mes.getCurrentOperation(eqPath) #Get the work order link woLink=system.mes.getMESObjectLinkByName('WorkOrder', 'New Work Order') #Set the work order link oper.setWorkOrderLink(woLink) ##Save the MES Objectsystem.mes.saveMESObject(oper) |
This object inherits the AbstractMESObject functions.
Object Events
Objects have events associated with them that allow for custom scripts to be added whenever the event occurs. Refer to MES Object Events for more information.
This object inherits the AbstractMESObject events.
Sepasoft MES Module Suite