CreateWOFromProcessQtys Method
- Last UpdatedNov 06, 2025
- 4 minute read
The CreateWOFromProcessQtys() method creates instance data for a work order based on a specified process ID and other work order instance-specific data.
'Declaration
Public Shared Sub CreateWOFromProcessQtys( _
ByVal sessionId As Integer, _
ByVal woId As String, _
ByVal processId As String, _
ByVal itemId As String, _
ByVal reqQty As Double, _
ByVal userId As String, _
ByVal startQty As Nullable(Of Double), _
ByVal initWoState As Nullable(Of Integer), _
ByVal woDesc As String, _
ByVal releaseTime As Nullable(Of Date), _
ByVal reqFinishTime As Nullable(Of Date), _
ByVal woPriority As Nullable(Of Integer), _
ByVal custInfo As String, _
ByVal moId As String, _
ByVal notes As String, _
ByVal bomVerId As String, _
ByVal forFirstOp As Nullable(Of Boolean) _
)
'Usage
Dim sessionId As Integer
Dim woId As String
Dim processId As String
Dim itemId As String
Dim reqQty As Double
Dim userId As String
Dim startQty As Nullable(Of Double)
Dim initWoState As Nullable(Of Integer)
Dim woDesc As String
Dim releaseTime As Nullable(Of Date)
Dim reqFinishTime As Nullable(Of Date)
Dim woPriority As Nullable(Of Integer)
Dim custInfo As String
Dim moId As String
Dim notes As String
Dim bomVerId As String
Dim forFirstOp As Nullable(Of Boolean)
JobExec.CreateWOFromProcessQtys(sessionId, woId, processId, itemId, reqQty, userId, startQty, initWoState, woDesc, releaseTime, reqFinishTime, woPriority, custInfo, moId, notes, bomVerId, forFirstOp)
public static void CreateWOFromProcessQtys(
int sessionId,
string woId,
string processId,
string itemId,
double reqQty,
string userId,
Nullable<double> startQty,
Nullable<int> initWoState,
string woDesc,
Nullable<DateTime> releaseTime,
Nullable<DateTime> reqFinishTime,
Nullable<int> woPriority,
string custInfo,
string moId,
string notes,
string bomVerId,
Nullable<bool> forFirstOp
)
Parameters
- sessionId
- Required. Holds the ID of the session from which the work order is being created.
- woId
- Required. Holds the ID of the work order.
- processId
- Required. Holds the ID of the process from which this work order is being created.
- itemId
- Required. Holds the ID of the item to be made by this work order. (The same process can be used to make multiple items.)
- reqQty
- Required. Holds the quantity of the final item to be made.
- userId
- Required. Holds the ID of the user who is creating this work order.
- startQty
- Optional. Holds the required start quantity. Default is null.
- initWoState
- Optional. Holds the initial state of all jobs for the work order. Default is New (1).
- woDesc
- Optional. Holds the work order description. Default is the work order ID.
- releaseTime
- Optional. Holds the release time of the work order. Default is the current date and time.
- reqFinishTime
- Optional. Holds the required finish time of the work order. Default is the current date and time + 24 hours.
- woPriority
- Optional. Holds the priority of the work order and all its jobs. Default is 1.
- custInfo
- Optional. Holds the customer information field. The default is an empty string.
- moId
- Optional. Holds the ID of the manufacturing order. The default is an empty string.
- notes
- Optional. Holds notes about the work order. The default is an empty string.
- bomVerId
- Optional. Holds the ID of the BOM version.
- forFirstOp
- Optional. Holds a flag that, if set to true, indicates that a quantity has been provided for the first operation.
For the method to succeed, the start quantity must be at least equal to the required quantity and the user must have the “create work order” privilege.
The process is checked out and verified; an exception is generated if the process cannot be verified according to the rules discussed in the VerifyProcess() method. The preferred versions for the BOM and specs version are used unless a version is supplied as an overload. If the forFirstOp flag is true, the final operation start and required quantities are calculated using the CreateWorkOrderFromProcessQtys() method.
The data from tables on the process side are used to create the work order information as follows. The data in the Process table (plus the supplied item, quantity information, initial work order state, priority, customer information, and manufacturing order) are used to create an entry in the Wo table.
- The data in Oper and Oper_Ent_Link are used to create entries in the Job table.
- The data in the Oper_Ent_Route table are used to create entries in the Job_Route table.
- The data in the BOM_Item_Oper_Link table are used to create entries in the Job_Bom table.
- The data in the Step_Grp table are used to create entries in the Job_Step_Grp table.
- The data in the Step table are used to create entries in the Job_Step table.
- The data in the BOM_Item_Oper_Step_Link table are used to create entries in the Job_BOM_Step_Link table.
- The data in the Oper_Step_File are used to create entries in the Job_Step_File table.
- The data in the Oper_Step_Choice files are used to create entries in the Job_Step_Choice table.
- The data in the Oper_Ent_Spec and BOM_Item_Oper_Spec table are used to create entries in the Job_Spec table (note this data must follow the rules specified in the VerifyProcess() method).
Entries will always be made in the Wo, Job, and Job_Route tables. For all the other tables, entries will be made only in the Job tables if data exists in the corresponding Process tables for the supplied process. Step data will not be created for any job corresponding to an entity that appears in the Oper_Step_Ent_Exc table for the specified process.
When creating all the jobs for the entities on the process, the latest start times are calculated using the time zone of the entity that is running the first operation of the process. All downstream entities are assumed to have the same time zone.