AddConsDirect(Int32,Int32,String,String,String,Double,Int32,Int32,Int32,String,String,String,Nullable<Int32>,Nullable<DateTime>,String,String,Nullable<Int32>,Nullable<Int32>,Nullable<Int32>,Nullable<Double>,String,Nullable<ConsumptionTransType>,String,String,String,String,String,DBString,DBString,DBString,DBString,Int32) Method
- Last UpdatedNov 06, 2025
- 5 minute read
The AddConsDirect() method adds direct consumption and reduces the quantity from the inventory. It can also be used to scrap all inventory for an entity by passing a null for the itemId parameter.
This overload of the method uses the entity ID to identify the entity where this item is being consumed.
'Declaration
Public Overloads Shared Sub AddConsDirect( _
ByVal sessionId As Integer, _
ByVal fromEntId As Integer, _
ByVal itemId As String, _
ByVal lotNo As String, _
ByVal subLotNo As String, _
ByVal qtyCons As Double, _
ByVal reasCd As Integer, _
ByVal gradeCd As Integer, _
ByVal statusCd As Integer, _
ByVal userId As String, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Nullable(Of Integer), _
ByVal shiftStart As Nullable(Of Date), _
ByVal fgLotNo As String, _
ByVal fgSubLotNo As String, _
ByVal itemScrapped As Nullable(Of Integer), _
ByVal entId As Nullable(Of Integer), _
ByVal shiftId As Nullable(Of Integer), _
ByVal qtyConsErp As Nullable(Of Double), _
ByVal extRef As String, _
ByVal transactionType As Nullable(Of ConsumptionTransType), _
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, _
ByRef rowId As Integer _
)
'Usage
Dim sessionId As Integer
Dim fromEntId As Integer
Dim itemId As String
Dim lotNo As String
Dim subLotNo As String
Dim qtyCons As Double
Dim reasCd As Integer
Dim gradeCd As Integer
Dim statusCd As Integer
Dim userId As String
Dim woId As String
Dim operId As String
Dim seqNo As Nullable(Of Integer)
Dim shiftStart As Nullable(Of Date)
Dim fgLotNo As String
Dim fgSubLotNo As String
Dim itemScrapped As Nullable(Of Integer)
Dim entId As Nullable(Of Integer)
Dim shiftId As Nullable(Of Integer)
Dim qtyConsErp As Nullable(Of Double)
Dim extRef As String
Dim transactionType As Nullable(Of ConsumptionTransType)
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 rowId As Integer
JobExec.AddConsDirect(sessionId, fromEntId, itemId, lotNo, subLotNo, qtyCons, reasCd, gradeCd, statusCd, userId, woId, operId, seqNo, shiftStart, fgLotNo, fgSubLotNo, itemScrapped, entId, shiftId, qtyConsErp, extRef, transactionType, genealogyId, upstreamEventId, segmentRequirementId, segmentResponseId, comments, spare1, spare2, spare3, spare4, rowId)
public static void AddConsDirect(
int sessionId,
int fromEntId,
string itemId,
string lotNo,
string subLotNo,
double qtyCons,
int reasCd,
int gradeCd,
int statusCd,
string userId,
string woId,
string operId,
Nullable<int> seqNo,
Nullable<DateTime> shiftStart,
string fgLotNo,
string fgSubLotNo,
Nullable<int> itemScrapped,
Nullable<int> entId,
Nullable<int> shiftId,
Nullable<double> qtyConsErp,
string extRef,
Nullable<ConsumptionTransType> transactionType,
string genealogyId,
string upstreamEventId,
string segmentRequirementId,
string segmentResponseId,
string comments,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
ref int rowId
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- fromEntId
- Required. Holds the ID of the entity where this item is being consumed.
- itemId
Optional. Holds the ID of the item that is being consumed. Passing a null will scrap all inventory for the entity.
- lotNo
- Optional. Holds the lot number for this quantity being consumed.
- subLotNo
- Optional. Holds the sublot number for this quantity being consumed.
- qtyCons
- Required. Holds the quantity to be consumed for this job.
- reasCd
- Optional. Holds the item reason code for this quantity being consumed.
- gradeCd
- Optional. Holds the grade code for the item that is being consumed.
- statusCd
- Optional. Holds the status code for the item that is being consumed.
- userId
- Optional. Holds the ID of the user who is consuming this item.
- woId
- Optional. Holds the ID of the work order to which the quantity is being consumed.
- operId
- Optional. Holds the ID of the operation of this work order.
- seqNo
- Optional. Holds the job sequence number.
- shiftStart
- Optional. Holds the shift start time for this entity.
- fgLotNo
- Optional. Holds the finished goods lot number.
- fgSubLotNo
- Optional. Holds the finished goods sublot number
- itemScrapped
- Optional. Holds a flag that, if set to true, indicates that this item is a scrapped item.
- entId
- Optional. Holds the ID of the entity on which this job is run.
- shiftId
- Optional. Holds the shift ID for this entity.
- qtyConsErp
- Optional. Holds the quantity that is updated to ERP.
- extRef
- Optional. Holds the reference for the external system that is used to track defects.
- transactionType
- Optional. Holds an enumeration that specifies the transaction type. Normal = 0, LotSplit = 1, LotCombination = 2
- 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.
- rowId
Output. Holds the row ID of the record in the Item_Cons table that is added or updated if this call is successful.
If the system attribute for “Maintain distinct consumption records” (attr_id=325) is set to true, a new consumption row in the Item_Cons table is created every time this method is called.
If the above system attribute is turned off and the supplied parameters match those of the values from an existing consumption row, then the supplied quantities are added to the existing consumption row. Otherwise, a new consumption row in the Item_Cons table is created with the supplied values.
Additionally, the quantities are reduced from the inventory based on the supplied values.
For this method to succeed, a valid inventory location must be able to be identified based on the supplied parameters.
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.