PrepareProductionAttributes(Int32,Nullable<DateTime>,Int32,String,String,String,String,String,String,String,Nullable<Double>,Nullable<Int32>,Nullable<Double>,Nullable<Double>,String,Nullable<Double>,Nullable<Boolean>,Nullable<Boolean>,String,String,String) Method
- Last UpdatedMar 17, 2026
- 5 minute read
The PrepareProductionAttributes() method passes a set of values for all production attributes and creates the required entity, item class, item, work order, and thus the job in the database to support logging utilization events against these attributes. For this method, the entity is specified by its ID.
This overload of the method includes the eventTime input parameter.
'Declaration
Public Overloads Shared Sub PrepareProductionAttributes( _
ByVal sessionId As Integer, _
ByVal eventTime As Nullable(Of Date), _
ByVal entId As Integer, _
ByVal itemId As String, _
ByVal itemClassId As String, _
ByVal itemUOM As String, _
ByVal woId As String, _
ByVal moId As String, _
ByVal productionScheduleId As String, _
ByVal operId As String, _
ByVal targetProdRate As Nullable(Of Double), _
ByVal unitOfMeasure As Nullable(Of Integer), _
ByVal batchSize As Nullable(Of Double), _
ByVal startQuantity As Nullable(Of Double), _
ByVal userId As String, _
ByVal reqdQuantity As Nullable(Of Double), _
ByVal updateInventory As Nullable(Of Boolean), _
ByVal invUniqueByJob As Nullable(Of Boolean), _
ByVal processId As String, _
ByVal bomVerId As String, _
ByRef warningMessages As String _
)
'Usage
Dim sessionId As Integer
Dim eventTime As Nullable(Of Date)
Dim entId As Integer
Dim itemId As String
Dim itemClassId As String
Dim itemUOM As String
Dim woId As String
Dim moId As String
Dim productionScheduleId As String
Dim operId As String
Dim targetProdRate As Nullable(Of Double)
Dim unitOfMeasure As Nullable(Of Integer)
Dim batchSize As Nullable(Of Double)
Dim startQuantity As Nullable(Of Double)
Dim userId As String
Dim reqdQuantity As Nullable(Of Double)
Dim updateInventory As Nullable(Of Boolean)
Dim invUniqueByJob As Nullable(Of Boolean)
Dim processId As String
Dim bomVerId As String
Dim warningMessages As String
Ent.PrepareProductionAttributes(sessionId, eventTime, entId, itemId, itemClassId, itemUOM, woId, moId, productionScheduleId, operId, targetProdRate, unitOfMeasure, batchSize, startQuantity, userId, reqdQuantity, updateInventory, invUniqueByJob, processId, bomVerId, warningMessages)
public static void PrepareProductionAttributes(
int sessionId,
Nullable<DateTime> eventTime,
int entId,
string itemId,
string itemClassId,
string itemUOM,
string woId,
string moId,
string productionScheduleId,
string operId,
Nullable<double> targetProdRate,
Nullable<int> unitOfMeasure,
Nullable<double> batchSize,
Nullable<double> startQuantity,
string userId,
Nullable<double> reqdQuantity,
Nullable<bool> updateInventory,
Nullable<bool> invUniqueByJob,
string processId,
string bomVerId,
out string warningMessages
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- eventTime
- Holds the event time.
- entId
- Required. Holds the ID of the entity where the job is intended to run.
- itemId
- Required. Holds the ID of the item for this data entry job.
- itemClassId
- Required. Holds the ID of the item class for this data entry job.
- itemUOM
- Required. Holds the unit of measurement for this item.
- woId
- Required. Holds the ID of the work order for this data entry job.
- moId
- Required.Holds the Id of the manufacturing order
- productionScheduleId
- Required.Holds the ID of the production schedule
- operId
- Required. Holds the ID of the operation for this data entry job.
- targetProdRate
- Optional. Holds the target production rate for this data entry job.
- unitOfMeasure
- Required. Holds an enumeration value that identifies the unit of measurement for the target production rate.
- batchSize
- Optional. Holds the batch size for this data entry job.
- startQuantity
- Optional. Holds the starting quantity for this data entry job.
- userId
- Required. Holds the ID of the user associated with this entity.
- reqdQuantity
- Optional. Holds the quantity that is required. If not using this parameter, set it to null.
- updateInventory
- Optional.Holds the update inventory flag
- invUniqueByJob
- Optional.Holds the inventory unique by job flag
- processId
- Optional.Holds the process ID
- bomVerId
- Optional.Holds the BOM version ID
- warningMessages
- Output. Holds a warning message returned by the Middleware after executing this method.
The Middleware first creates the item UOM, item class, and then the item, if they are supplied and they do not exist in the database already.
The Middleware also creates a new data entry job if any production attribute other than the operator has changed on the entity. Creation of the data entry job will also create a new work order if the work order provided (or the default) has changed from the work order currently active on the entity. Any work order created will be associated with the given item, and a newly created item will be associated with the given item class.
The target production rate, UOM, and batch size will be set to the given values when creating the active entity job, if those values are provided in the call from the object (non-blank values).
It is important to note that passing a new item ID to the method with a work order ID that already exists does not alter the item associated with the existing work order. A new job will be created using the new item and the existing work order ID, but the work order record itself will still be associated with the original item.
The default value from the system attribute is used correspondingly if the supplied item, item class, item UOM, work order, or operation contains a blank or null value. If an operator (user_id) is supplied (non-blank value), then the Middleware will attempt to associate the operator with the entity by creating a labor usage record. If the operator does not exist already in the database, then no association will be made and the Middleware will not attempt to create a new user. A warning will be returned to the object. Note that this situation will not impact creation of an item, item class, work order, or data entry job.
In some cases, the Middleware call can return an error or warning to the object. The possible warning and error conditions include the following:
- Failed Creation — The attempt to create one of the database records fails (item, item class, work order, job). Specifics of the failure will be returned.
- Operator does not Exists — The supplied operator (user_id) does not already exist in the database. No change to the entity’s association with a user will be made.
- Operator cannot be Associated with Entity — Attempting to associate the given operator with the given entity has failed. Specifics of the failure will be provided.
- Item already in an Item Class – Changing the item class without changing the item ID will cause a warning since an item ID can only be contained within one item class. The item class will not be altered in this case.
Note that standard errors returned by the Middleware because of database connection failure, non-existent session, etc., can also occur.