AddProdAsync(Int32,Nullable<DateTime>,String,String,String,Double,Nullable<Int32>,String,String,String,String,String,Nullable<Int32>,String,Nullable<Boolean>,String,String,String,String,String,DBString,DBString,DBString,DBString,String,String,Int32) Method
- Last UpdatedNov 06, 2025
- 7 minute read
The AddProdAsync() method adds production to the job running on the specified job position (default is 0).
This overload of the method uses the entity name and entity site name to identify entities specified for the method.
'Declaration
Public Overloads Shared Sub AddProdAsync( _
ByVal sessionId As Integer, _
ByVal eventTime As Nullable(Of Date), _
ByVal userId As String, _
ByVal entName As String, _
ByVal siteName As String, _
ByVal qtyProd As Double, _
ByVal reasCd As Nullable(Of Integer), _
ByVal lotNo As String, _
ByVal subLotNo As String, _
ByVal toEntName As String, _
ByVal toSiteName As String, _
ByVal itemId As String, _
ByVal byproductBomPos As Nullable(Of Integer), _
ByVal extRef As String, _
ByVal applyScalingFactor As Nullable(Of Boolean), _
ByVal genealogyId As String, _
ByVal eventId As String, _
ByVal segmentRequirementId As String, _
ByVal segmentResponseId As String, _
ByVal comments As String, _
ByVal spare1 As DBString, _
ByVal spare2 As DBString, _
ByVal spare3 As DBString, _
ByVal spare4 As DBString, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Integer _
)
'Usage
Dim sessionId As Integer
Dim eventTime As Nullable(Of Date)
Dim userId As String
Dim entName As String
Dim siteName As String
Dim qtyProd As Double
Dim reasCd As Nullable(Of Integer)
Dim lotNo As String
Dim subLotNo As String
Dim toEntName As String
Dim toSiteName As String
Dim itemId As String
Dim byproductBomPos As Nullable(Of Integer)
Dim extRef As String
Dim applyScalingFactor As Nullable(Of Boolean)
Dim genealogyId As String
Dim eventId As String
Dim segmentRequirementId As String
Dim segmentResponseId As String
Dim comments As String
Dim spare1 As DBString
Dim spare2 As DBString
Dim spare3 As DBString
Dim spare4 As DBString
Dim woId As String
Dim operId As String
Dim seqNo As Integer
JobExec.AddProdAsync(sessionId, eventTime, userId, entName, siteName, qtyProd, reasCd, lotNo, subLotNo, toEntName, toSiteName, itemId, byproductBomPos, extRef, applyScalingFactor, genealogyId, eventId, segmentRequirementId, segmentResponseId, comments, spare1, spare2, spare3, spare4, woId, operId, seqNo)
public static void AddProdAsync(
int sessionId,
Nullable<DateTime> eventTime,
string userId,
string entName,
string siteName,
double qtyProd,
Nullable<int> reasCd,
string lotNo,
string subLotNo,
string toEntName,
string toSiteName,
string itemId,
Nullable<int> byproductBomPos,
string extRef,
Nullable<bool> applyScalingFactor,
string genealogyId,
string eventId,
string segmentRequirementId,
string segmentResponseId,
string comments,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
string woId,
string operId,
int seqNo
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- eventTime
- Optional. Holds the event time.
- userId
- Required. Holds the ID of the user who is making the change.
- entName
- Required. Holds the name of the entity.
- siteName
- Required. Holds the site name of the entity.
- qtyProd
- Required. Holds the quantity being produced.
- reasCd
- Optional. Holds the reason code for item being produced (production code or reject reason). Default is the last used reas_cd on this entity.
- lotNo
- Optional. Holds the lot number of the item being produced. Default islast used lot_no on this entity.
- subLotNo
- Optional. Holds the sublot number of the item being produced.
- toEntName
- Optional. Holds the name of the storage entity for this quantity produced. Default is the last used storage entity used by this entity.
- toSiteName
- Optional. Holds the site name of the storage entity for this quantity produced. Default is the last used storage entity used by this entity.
- itemId
- Optional. Holds the iD of the item being produced. Default is the last produced item on this entity.
- byproductBomPos
- Optional. Hold the BOM position if this item is a by-product (e.g., -1, -2, -3, etc.). Default is null (i.e., item is not a by-product).
- extRef
- Optional. Holds an external reference for this row. Default is null.
- applyScalingFactor
- Optional. Holds the scaling factor. Default is 0 (no scaling factor).
- genealogyId
- Optional. Holds the genealogy ID (for S95).
- eventId
- Optional. Holds the event ID (for S95).
- segmentRequirementId
- Optional. Holds the segment requirement ID (for S95).
- segmentResponseId
- Optional. Holds the segment response ID (for S95).
- comments
- Optional. Holds comments about the production that is being added.
- spare1
- Optional. Holds the contents of the user-defined spare1 field. Default is null.
- spare2
- Optional. Holds the contents of the user-defined spare2 field. Default is null.
- spare3
- Optional. Holds the contents of the user-defined spare3 field. Default is null.
- spare4
- Optional. Holds the contents of the user-defined spare4 field. Default is null.
- woId
- Required. Holds the ID of the work order.
- operId
- Required. Holds the ID of the operation.
- seqNo
- Required. Holds the job sequence number.
For the method to succeed, there must be a job running on the specified entity on the specified job position or job position 0 if no job position is specified. Use the AddProdPostExec() method to enter production after a job has finished running on an entity.
The current shift and job details default to the current values for the entity and job position.
If any of the lot, reason code, or entity values are specified, then these values are used for this transaction in place of the default ones stored in the Job_Bom table. These changes are NOT saved to the Job_Bom table to be used as the defaults for future transactions. If you wish to change the defaults, then use the SetCurLotData() method.
The low number of required parameters are designed to facilitate capturing production data from the I/O system via tags as simply as possible.
If a row already exists for the primary key values supplied (or defaulted), then this quantity will be added to the existing row, unless the “maintain distinct reject production” system attribute (attr_id = 309) or the “maintain distinct good production” system attribute (attr_id = 362) are set to true. In this case, the other specified dependent fields (to_ent_id, ext_ref, spare values, etc.) are also updated for this row (i.e., Including previous quantities). For any optional parameters that are not specified, the existing values are left unchanged.
If the “maintain distinct reject production” system attribute is set to true and the production reason is a reject reason, then a new row is created every time this method is called. If the “maintain distinct good production” system attribute is set to true and the production reason is a good reason, then a new row is created every time this method is called.
If a positive amount of good production is being added, it also checks to see whether there are now enough good products available to ready the next job(s) downstream if its state is currently NEW. This means finding each next job downstream via the Job_Route table, and getting its job_bom records excluding those for by-products (i.e., get those that have a bom_pos greater than or equal to zero). For every item with a non-zero reqd_start_val, a check is made of the Item_Prod table for the jobs feeding this one, to see whether they have produced enough for this work order to meet this requirement. If all requirements are met, the job’s state is changed to READY.
In deciding whether there has been sufficient production, if reqd_start_val_is_pct is true, the effective required quantity for a particular bom_pos is found by multiplying reqd_start_val by qty_per_parent_item and multiplying the result by the job’s qty_at_start. If reqd_start_val_is_pct is false, the effective required quantity is the reqd_start_val. All requirements for a given item_id are then totaled across all bom_pos values. The production to count against this item’s requirement is found by adding up all production for any job feeding the downstream one (which will include the job for which production was initially entered), and multiplying it by job_route.input_pct (expressed as a fraction), which is the portion of the upstream job’s production that goes to the downstream job. Then the resulting effective production is added for all jobs producing the same item, and compared to each item requirement. If all item productions are equal to or greater than all item requirements, the job’s state is changed to 2 (READY). If the update_inv flag is set for this produced item, then the qty_left value in the Item_Inv table will be increased by the produced qty_prod.
If a negative amount of good production is added, a check must be made to see whether there are still enough good products available to ready the next job(s) downstream if its state is currently other than NEW or CANCELLED. This check need only consider the material produced in the current job. As with the check to ready a job, this will mean finding each next job downstream via the Job_Route table, and getting its job_bom records for this item, then checking the Item_Prod table for the jobs feeding this one, to see whether they have produced enough for this work order to meet this requirement. If this requirement is no longer met, the downstream job’s state is changed back to NEW if it is currently READY. Otherwise, a warning is returned saying that because the job was already started it could not be un-readied.If the backflush flag is set for any of the BOM items for this job, then consumption transactions will be generated to consume the materials at standard rates. Similarly, if the update_inv flag is set for any of these BOM items, then inventory adjustment transactions will also be applied automatically.
Observe the following input parameter rules:
- Required non-DB* parameters: Must pass a value. Cannot be empty or null.
-
Optional non-DB* parameters: Either enter a value or pass a null. If passing a null and a default value has been defined, the default value will be used for the parameter.
-
Required DB* parameters: Must pass a value. To enter an empty value for the parameter, pass DB*.null (e.g., DBInt.null).
-
Optional DB* parameters: To enter no value for the parameter, pass DB*.null (e.g., DBInt.null). To use the default value for the parameter if one has been defined for the object being added, pass a null.