MES Work Order

Sepasoft MES Module Suite

MES Work Order

An instance of the MES Work Order object is created whenever a new work order is created using the MES Work Order Table component and also by the system.mes.workorder.createMESWorkOrder() scripting function. This object can then be used to adjust any of the parameters such as required quantity, due date and status. The actual quantity produced against a work order and remaining quantity are calculated based on the sum of quantities from operations associated with the work order ref UUID.  Please note that these calculations can change based on the operations referencing the work order.  The Work Order object has a method called "updateQuantities()" described below, which retrieves the latest values associated with the work order.  This is part of the full object load, but is not part of loading the object from a link.

The MES Work Order object is derived from the MESAbstractObject and inherits all of its exposed properties, methods and events as well as adds the ones documented in this section.



Object Creation

The following scripting functions create an MES Work Order:

Python
#Get a material link for the work order material
matLink = system.mes.getMESObjectLinkByName('MaterialDef', 'Soda')
   
#Create the work order
wo = system.mes.workorder.createMESWorkOrder('A34', matLink)
  
#Set some production related properties
wo.setWorkOrderQuantity(1000.0)
 
#Set the due date
wo.setDueDate(system.date.addDays(system.date.now(), 7))
 
#Save the object
system.mes.saveMESObject(wo)

Use

The following scripting functions and components use this object.

Object Properties

Inherits properties from AbstractMESObject.

Property values can be accessed and changed for an object by using the getPropertyValue() and setPropertyValue() method.

These properties are accessible through the MES Work Order Table component and with the provided object functions, but not directly as obj.properties.

Name
Scripting Name
Permissions
Description
Material Reference
MaterialRef
Read/Write
Material Definition assigned to the Work Order object.
Material Reference UUID
MaterialRefUUID
Read/Write
UUID of the Material Definition assigned to the Work Order object.
Material Reference Type
MaterialRefType
Read/Write
Type of the Material Definition assigned to the Work Order object.
Work Order Target Quantity
WorkOrderQuantity
Read/Write
Target quantity assigned to the Work Order object.
Work Order Actual Quantity
WorkOrderActualQuantity
Read Only
Actual quantity corresponding to the Work Order object.
Work Order Scheduled Quantity
WorkOrderScheduledQuantity
Read Only
Quantity scheduled for the Work Order object.
Work Order Remaining Quantity
WorkOrderRemainingQuantity
Read Only
Quantity of material remaining for the work order.
Work Order Closed Date
WorkOrderClosedDate
Read/Write
Closed date assigned to the Work Order object.
Work Order Due Date
WorkOrderDueDate
Read/Write
Due date assigned to the Work Order object.
Work Order Closed
WorkOrderClosed
Read/Write
The boolean assigned to closed property of the Work Order object.

Object Functions

This object provides the following functions:


getActiveOperationsResponses()

Syntax


getActiveOperationsResponses()

  • Parameters

None

  • Returns

MESList<MESObjectLink>  Returns actively running Operations Responses that are associated with a work order.

  • Scope

All

getActualMaterialLots(beginDate, endDate, lotUseType) 

Gets the Material Lots related to this Work Order, filtered by begin and end dates and Lot Use Type.


Syntax


getActualMaterialLots(beginDate, endDate, lotUseType)

  • Parameters

Date beginDate - Date (inclusive) when the Operations Request for this Work Order was executed. Pass in 'None' to use the default date [1 Jan, 1970 00:00:00].

Date endDate - Date (inclusive) when the Operations Request for this Work Order finished executing. Pass in 'None' to use the default date [1 Jan, 2200 00:00:00].

String lotUseType - The lot's use-type. Valid uses are: 'In', 'Out', 'Consumable', and 'By-product'.

  • Returns

MESList<MESObjectLinkmatLotLinks - A list of MESObjectLinks that each have a reference to an Material Lot object.

  • Scope

All

getActualPersonnel(beginDate, endDate)

Gets the Personnel related to this Work Order, filtered by begin and end dates.


Syntax


getActualPersonnel(beginDate, endDate)

  • Parameters

Date beginDate - Date (inclusive) when the Operations Request for this Work Order was executed. Pass in 'None' to use the default date [1 Jan, 1970 00:00:00].

Date endDate - Date (inclusive) when the Operations Request for this Work Order finished executing. Pass in 'None' to use the default date [1 Jan, 2200 00:00:00].

  • Returns

MESList<MESObjectLinkpersonLinks - A list of MESObjectLinks that each have a reference to a personnel object.

  • Scope

All

getActualQuantity()

Gets the actual work order quantity.


Syntax

getActualQuantity()

  • Parameters

 None

  • Returns

Double quantity - The work order quantity.

  • Scope

All

 

getActualSupplementalEquipment(beginDate, endDate)

Gets the Supplemental Equipment related to this Work Order, filtered by begin and end dates.


Syntax

getActualSupplementalEquipment(beginDate, endDate)

  • Parameters

Date beginDate - Date (inclusive) when the Operations Request for this Work Order was executed. Pass in 'None' to use the default date [1 Jan, 1970 00:00:00].

Date endDate - Date (inclusive) when the Operations Request for this Work Order finished executing. Pass in 'None' to use the default date [1 Jan, 2200 00:00:00].

  • Returns

MESList<MESObjectLink> supEqpLinks - A list of MESObjectLinks that each have a reference to a supplemental equipment object.

  • Scope

All

getClosedDate()

Gets the closed date for the work order.


Syntax


getClosedDate()

  • Parameters

 None

  • Returns

Date closedDate - Closed date for the work order.

  • Scope

All


Code Example
Python
woObj = system.mes.workorder.getMESWorkOrder('A34')
                        
closedDate = woObj.getClosedDate()
                        
print closedDate

getDueDate()

Gets the due date for the work order.


Syntax

getDueDate()

  • Parameters

 None

  • Returns

Date dueDate - Due date for the work order.

  • Scope

All


Code Example
Python
woObj = system.mes.workorder.getMESWorkOrder('A34')
                        
endDate = woObj.getDueDate()
                        
print endDate


getMaterialRef()

Gets the material definition object corresponding to the work order.


Syntax

getMaterialRef()

  • Parameters

 None

  • Returns

MESObjectLink mesMaterialDef - Material definition object corresponding to the work order.

  • Scope

All

getMaterialRefName()

Gets the name of the material reference object.


Syntax

getMaterialRefName()

  • Parameters

 None

  • Returns

String materialRefName - Name of the material reference object.

  • Scope

All

getMaterialRefType()

Gets the type of the material reference object.


Syntax


getMaterialRefType()

  • Parameters

 None

  • Returns

String materialRefType - Type of the material reference object.

  • Scope

All

getMaterialRefUUID()

Gets the UUID of the material reference object.


Syntax


getMaterialRefUUID()

  • Parameters

 None

  • Returns

String materialRefUUID - Unique identifier that represent the material reference object.

  • Scope

All

getOperationsRequests()

Gets the Operations Requests related to this Work Order.


Syntax

getOperationsRequests()

  • Parameters

 None

  • Returns

MESList<MESObjectLink> opsReqLinks - A list of MESObjectLinks that each have a reference to an MESOperationsRequest object.

  • Scope

All

 getOperationsRequests(beginDate, endDate)

Gets the Operations Requests related to this Work Order, filtered by begin and end dates.


Syntax

getOperationsRequests(beginDate, endDate)

  • Parameters

Date beginDate - Date (inclusive) when the Operations Request for this Work Order was executed. Pass in 'None' to use the default date [1 Jan, 1970 00:00:00].

Date endDate - Date (inclusive) when the Operations Request for this Work Order finished executing. Pass in 'None' to use the default date [1 Jan, 2200 00:00:00].

  • Returns

MESList<MESObjectLink> opsReqLinks - A list of MESObjectLinks that each have a reference to an MESOperationsRequest object.

  • Scope

All

 getOperationsResponses()

Gets the Operations Responses related to this Work Order.


Syntax

getOperationsResponses()

  • Parameters

 None

  • Returns

MESList<MESObjectLink> opsRspLinks - A list of MESObjectLinks that each have a reference to an MESOperationsRequest object.

  • Scope

All

 

getOperationsResponses(beginDate, endDate)

Gets the Operations Responses related to this Work Order, filtered by begin and end dates.


Syntax


getOperationsRequests(beginDate, endDate)

  • Parameters

Date beginDate - Date (inclusive) when the Operations Request for this Work Order was executed. Pass in 'None' to use the default date [1 Jan, 1970 00:00:00].

Date endDate - Date (inclusive) when the Operations Request for this Work Order finished executing. Pass in 'None' to use the default date [1 Jan, 2200 00:00:00].

  • Returns

MESList<MESObjectLink> opsRspLinks - A list of MESObjectLinks that each have a reference to an MESOperationsRequest object.

  • Scope

All

 

getRemainingQuantity()

Gets the remaining quantity of the work order.


Syntax


getRemainingQuantity()

  • Parameters

 None

  • Returns

double qty - Remaining quantity for the work order.

  • Scope

All

 

getScheduledQuantity()

Gets the scheduled quantity of the work order.


Syntax

getScheduledQuantity()

  • Parameters

 None

  • Returns

double quantity - The scheduled quantity of work order.

  • Scope

All

getWorkOrderQuantity()

Gets the quantity assigned for the work order.


Syntax

getWorkOrderQuantity()

  • Parameters

 None

  • Returns

double quantity - The quantity assigned for work order.

  • Scope

All

 isClosed()

Checks whether the work order is closed.


Syntax


isClosed()

  • Parameters

 None

  • Returns

boolean True if it is a closed work order and False otherwise.

  • Scope

All

setClosed(closed)

Sets the work order to closed.


Syntax

setClosed(closed)

  • Parameters

boolean closed  - Set to True to set work order to close and False otherwise.

  • Returns

Nothing

  • Scope

All

 

setClosedDate(closedDate)

Sets the closed date for the work order.


Syntax

setClosedDate(closedDate)

  • Parameters

 Date closedDate - Closed date for the work order.

  • Returns

None

  • Scope

All


Code Example
Python
# closes a work order, and sets the closed date to yesterday at the current time
                            
workOrder = system.mes.workorder.getMESWorkOrder("My Work Order")
                            
workOrder.setClosed(True)
                            
closedDate = system.date.addDays(system.date.now(), -1)
                            
workOrder.setClosedDate(closedDate)
                            
system.mes.saveMESObject(workOrder)

 setDueDate(dueDate)

Sets the due date for the work order.


Syntax

setDueDate(dueDate)

  • Parameters

 Date dueDate - Due date to set for the work order.

  • Returns

Nothing

  • Scope

All

 

setMaterialRef(mesMaterialDef)

 Sets the material definition as a reference for the work order.

Syntax

setMaterialRef(mesMaterialDef)

  • Parameters

MESMaterialDef mesMaterialDef - Material definition to set as the reference for the work order.

  • Returns

 Nothing

  • Scope

All

setMaterialRef(materialLink)

Sets the material reference for the work order.

Syntax

setMaterialRef(materialLink)

  • Parameters

MESObjectLink materialLink- Material reference to set for the work order.

  • Returns

 Nothing

  • Scope

All

 setWorkOrderQuantity(quantity)

Sets the quantity for the work order.


Syntax

setWorkOrderQuantity(quantity)

  • Parameters

 double quantity - Quantity to set for the work order.

  • Returns

Nothing

  • Scope

All

 

updateQuantities()

This method queries the system and updates all of the quantities (work order quantity, actual quantity, scheduled quantity, remaining quantity) for the work order object.


Syntax

updateQuantities()

  • Parameters

 None

  • Returns

Nothing

  • Scope

All


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