AddCons(Int32,String,String,String,Int32,Double,Nullable<Int32>,String,String,String,String,String,String,String,String,Nullable<Boolean>,String,String,String,String,String,DBString,DBString,DBString,DBString,Nullable<Int32>,Nullable<Int32>,Int32) Method
- Last UpdatedNov 06, 2025
- 5 minute read
The AddCons() method adds consumption for the specified BOM item for the job running on the current job position.
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 AddCons( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entName As String, _
ByVal siteName As String, _
ByVal bomPos As Integer, _
ByVal qtyCons As Double, _
ByVal reasCd As Nullable(Of Integer), _
ByVal lotNo As String, _
ByVal fgLotNo As String, _
ByVal subLotNo As String, _
ByVal fgSubLotNo As String, _
ByVal fromEntName As String, _
ByVal fromSiteName As String, _
ByVal itemId As String, _
ByVal extRef As String, _
ByVal applyScalingFactor As Nullable(Of Boolean), _
ByVal genealogyId As String, _
ByVal upstreamEventId 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 jobPos As Nullable(Of Integer), _
ByVal altNo As Nullable(Of Integer), _
ByRef rowId As Integer _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entName As String
Dim siteName As String
Dim bomPos As Integer
Dim qtyCons As Double
Dim reasCd As Nullable(Of Integer)
Dim lotNo As String
Dim fgLotNo As String
Dim subLotNo As String
Dim fgSubLotNo As String
Dim fromEntName As String
Dim fromSiteName As String
Dim itemId As String
Dim extRef As String
Dim applyScalingFactor As Nullable(Of Boolean)
Dim genealogyId As String
Dim upstreamEventId 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 jobPos As Nullable(Of Integer)
Dim altNo As Nullable(Of Integer)
Dim rowId As Integer
JobExec.AddCons(sessionId, userId, entName, siteName, bomPos, qtyCons, reasCd, lotNo, fgLotNo, subLotNo, fgSubLotNo, fromEntName, fromSiteName, itemId, extRef, applyScalingFactor, genealogyId, upstreamEventId, segmentRequirementId, segmentResponseId, comments, spare1, spare2, spare3, spare4, jobPos, altNo, rowId)
public static void AddCons(
int sessionId,
string userId,
string entName,
string siteName,
int bomPos,
double qtyCons,
Nullable<int> reasCd,
string lotNo,
string fgLotNo,
string subLotNo,
string fgSubLotNo,
string fromEntName,
string fromSiteName,
string itemId,
string extRef,
Nullable<bool> applyScalingFactor,
string genealogyId,
string upstreamEventId,
string segmentRequirementId,
string segmentResponseId,
string comments,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
Nullable<int> jobPos,
Nullable<int> altNo,
out int rowId
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- userId
- Required. Holds the user ID of the user who is making the change.
- entName
- Required. Holds the name of the entity.
- siteName
- Optional. Holds the site name of the entity.
- bomPos
- Required. Holds the BOM position of the item that is being consumed.
- qtyCons
- Required. Holds the quantity being consumed.
- reasCd
- Optional. Holds the reason code for the item that is being consumed.
- lotNo
- Optional. Holds the the lot number of the item that is being consumed.
- fgLotNo
- Optional. Holds the finished goods lot number of the item that is being consumed.
- subLotNo
- Optional. Holds the sublot number.
- fgSubLotNo
- Optional. Holds the goods sublot number of the item that is being consumed.
- fromEntName
- Optional. Holds the name of the storage entity.
- fromSiteName
- Optional. Holds the site name of the storage entity.
- itemId
- Optional. Holds the ID of the item that is being consumed.
- extRef
- Optional. Holds the external reference of the item that is being consumed.
- applyScalingFactor
- Optional. Holds the scaling factor.
- genealogyId
- Optional. Holds the genealogy ID (for S95).
- upstreamEventId
- 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 consumption 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.
- jobPos
- Optional. Holds an integer that identifies the job exec position.
- altNo
Optional. Holds the alternative number.
- rowId
- Output. The returned row_id of the record that is added or updated if this call is successful.
For the method to succeed, there must be a job running on the specified entity.
Use the AddConsPostExec() method to enter consumption after a job has finished running on an entity.
The current shift and job details default to the current values for the entity. If any of the lot, container, 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. If the current job _bom has a substitution (job_bom.current_subst) that matches a record in Job_Bom_Subst table, then the default values are used from the Job_Bom_Subst table. These changes are NOT saved to the Job_Bom table for this bom_pos to be used as the defaults for future transactions. If you wish to change the defaults, then use the SetCurProdData() method. The same applies if the fg_lot_no field changes.
The low number of required parameters are designed to facilitate capturing consumption 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 consumption records” system parameter (atrr_id = 325) is set to true. In this case, the other specified dependent fields (from_ent_id, ext_ref, spare values, etc.) are also updated for this row (i.e., previous quantities). For any optional parameters that are not specified, the existing values are left unchanged.
If the “maintain distinct consumption records” system parameter is set to true, then a new row is made in the Item_Cons table every time this method is called.
If the update_inv flag is set for this BOM position, then the qty_left field in the Item_Inv table will be reduced by the consumed qty_cons.
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.