AddProdPostExec(Int32,String,Int32,Double,String,String,Int32,DateTime,DateTime,Int32,String,Nullable<Int32>,String,String,String,String,Nullable<Int32>,Nullable<Int32>,Nullable<Int32>,String,Nullable<Int32>,String,String,String,String,String,DBString,DBString,DBString,DBString,String) Method
- Last UpdatedNov 06, 2025
- 5 minute read
The AddProdPostExec() method enters production data for a given job, shift, production code, lot, and container in the production transaction table (Item_Prod) after the job has run on an entity.
This overload of the method uses the shift start time, hour start time, and entity ID to identify entities specified for the method.
'Declaration
Public Overloads Shared Sub AddProdPostExec( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entId As Integer, _
ByVal qtyProd As Double, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Integer, _
ByVal shiftStart As Date, _
ByVal hourStart As Date, _
ByVal shiftId As Integer, _
ByVal itemId As String, _
ByVal reasCd As Nullable(Of Integer), _
ByVal lotNo As String, _
ByVal rmLotNo As String, _
ByVal subLotNo As String, _
ByVal rmSubLotNo As String, _
ByVal toEntId As Nullable(Of Integer), _
ByVal processed As Nullable(Of Integer), _
ByVal byproduct As Nullable(Of Integer), _
ByVal extRef As String, _
ByVal moveStatus As Nullable(Of Integer), _
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 altNo As String _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entId As Integer
Dim qtyProd As Double
Dim woId As String
Dim operId As String
Dim seqNo As Integer
Dim shiftStart As Date
Dim hourStart As Date
Dim shiftId As Integer
Dim itemId As String
Dim reasCd As Nullable(Of Integer)
Dim lotNo As String
Dim rmLotNo As String
Dim subLotNo As String
Dim rmSubLotNo As String
Dim toEntId As Nullable(Of Integer)
Dim processed As Nullable(Of Integer)
Dim byproduct As Nullable(Of Integer)
Dim extRef As String
Dim moveStatus As Nullable(Of Integer)
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 altNo As String
JobExec.AddProdPostExec(sessionId, userId, entId, qtyProd, woId, operId, seqNo, shiftStart, hourStart, shiftId, itemId, reasCd, lotNo, rmLotNo, subLotNo, rmSubLotNo, toEntId, processed, byproduct, extRef, moveStatus, genealogyId, eventId, segmentRequirementId, segmentResponseId, comments, spare1, spare2, spare3, spare4, altNo)
public static void AddProdPostExec(
int sessionId,
string userId,
int entId,
double qtyProd,
string woId,
string operId,
int seqNo,
DateTime shiftStart,
DateTime hourStart,
int shiftId,
string itemId,
Nullable<int> reasCd,
string lotNo,
string rmLotNo,
string subLotNo,
string rmSubLotNo,
Nullable<int> toEntId,
Nullable<int> processed,
Nullable<int> byproduct,
string extRef,
Nullable<int> moveStatus,
string genealogyId,
string eventId,
string segmentRequirementId,
string segmentResponseId,
string comments,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
string altNo
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- userId
- Required. Holds the ID of the user who is making the change.
- entId
- Required. Holds the ID of the entity.
- qtyProd
- Required. Holds the quantity being produced.
- woId
- Required. Holds the ID of the work order.
- operId
- Required. Holds the ID of the operation.
- seqNo
- Required. Holds the job sequence number.
- shiftStart
- Required. Holds the start of the shift during which production occurred.
- hourStart
- Required. Holds the start of the hour during which production occurred.
- shiftId
- Required. Holds the shift ID.
- itemId
- Optional. Holds the ID of the item being produced.
- reasCd
- Optional. Holds the reason code for the item being produced.
- lotNo
- Optional. Holds the lot number of the item being produced.
- rmLotNo
- Optional. Holds the raw material lot number from which this lot was produced.
- subLotNo
- Optional. Holds the sublot number of the item being produced.
- rmSubLotNo
- Optional. Holds the raw material sublot number from which this lot was produced.
- toEntId
- Optional. Holds the ID of the storage entity for this quantity produced.
- processed
- Optional. Holds a flag that, if set to true, indicates that the quantity was processed.
- byproduct
- Optional. Holds a flag that, if set to true, indicates that a by-product was produced.
- extRef
- Optional. Holds an external reference for this row.
- moveStatus
- Optional. Holds an integer that indicates the move status.
- genealogyId
- Optional. Holds the genealogy ID (for S95).
- eventId
- Optional. Holds the upstream 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.
- spare2
- Optional. Holds the contents of the user-defined spare2 field.
- spare3
- Optional. Holds the contents of the user-defined spare3 field.
- spare4
- Optional. Holds the contents of the user-defined spare4 field.
- altNo
- Optional. Holds the alternative number.
The low number of required parameters for this method are designed to facilitate capturing production data from the I/O system via tags as simply as possible. The shift (shiftStart, hourStart, shiftId) and job input parameters (woId, operId, seqNo) are required parameters as the production data is being entered after the fact.
Whether an existing record in the Item_Prod table is updated or a new record is added is determined as follows:
- If a record already exists for the primary key values supplied (or defaulted), then the quantity provided by this method will be added to the existing record in the Item_Prods table. In this case, the other non-defaulted dependent parameters (fromEntId, etc.) for the entire record (i.e., including previous quantities) will be changed to those specified by this call.
- If a record with the supplied primary key values does not exist, or the Maintain distinct good production records or Maintain distinct reject production records system attribute (attr_id = 362 and 309, respectively) is True, then a new record is created.
Other behaviors of this method include the following:
- If a job has multiple starts during the shift and hour, then the job start time closest to the end of the hour will be used.
- If the specified job is not found to be running during the provided time, an error is returned.
- If any of the lot, container, reason code, or entity values change, then these changes are written to the Job_Bom table and used as the defaults for future transactions where the defaults are to be applied.
- If the update_inv flag is set for this produced item in the Job_Bom table, then the qty_left field in the Item_Inv table will be increased by the produced qty_prod.
- If the backflush flag is set for any of the BOM items in the Job_Bom table for this job, then a consumption transaction 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.