Add Method (ItemSubstitute)
- Last UpdatedNov 06, 2025
- 5 minute read
The Add() method adds a new item substitute record to the Item_Subst table.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal origItemId As String, _
ByVal altNo As Integer, _
ByVal pref As Integer, _
ByVal substLevel As Nullable(Of Integer), _
ByVal itemId As String, _
ByVal reqdGradeCd As DBInt, _
ByVal instruction As DBString, _
ByVal qtyPerParentItem As Double, _
ByVal maxQtyPerParentItem As DBDouble, _
ByVal minQtyPerParentItem As DBDouble, _
ByVal updateInv As Nullable(Of Boolean), _
ByVal backflush As Nullable(Of Boolean), _
ByVal defReasCd As DBInt, _
ByVal defLotNo As DBString, _
ByVal defSublotNo As DBString, _
ByVal defStorageEntId As DBInt, _
ByVal defRejectEntId As DBInt, _
ByVal scalingFactor As DBDouble, _
ByVal mustConsumeFromInv As Nullable(Of Boolean), _
ByVal mayChooseAltInvLoc As Nullable(Of Boolean), _
ByVal mayCreateNewLots As Nullable(Of Boolean), _
ByVal mustConsumeFromWip As Nullable(Of Boolean), _
ByVal mustConsumeBeforeProd As Nullable(Of Boolean), _
ByVal constantQty As Nullable(Of Boolean), _
ByVal estTime As DBDouble, _
ByVal spare1 As DBString, _
ByVal spare2 As DBString, _
ByVal spare3 As DBString, _
ByVal spare4 As DBString, _
ByVal lastEditComment As DBString, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim origItemId As String
Dim altNo As Integer
Dim pref As Integer
Dim substLevel As Nullable(Of Integer)
Dim itemId As String
Dim reqdGradeCd As DBInt
Dim instruction As DBString
Dim qtyPerParentItem As Double
Dim maxQtyPerParentItem As DBDouble
Dim minQtyPerParentItem As DBDouble
Dim updateInv As Nullable(Of Boolean)
Dim backflush As Nullable(Of Boolean)
Dim defReasCd As DBInt
Dim defLotNo As DBString
Dim defSublotNo As DBString
Dim defStorageEntId As DBInt
Dim defRejectEntId As DBInt
Dim scalingFactor As DBDouble
Dim mustConsumeFromInv As Nullable(Of Boolean)
Dim mayChooseAltInvLoc As Nullable(Of Boolean)
Dim mayCreateNewLots As Nullable(Of Boolean)
Dim mustConsumeFromWip As Nullable(Of Boolean)
Dim mustConsumeBeforeProd As Nullable(Of Boolean)
Dim constantQty As Nullable(Of Boolean)
Dim estTime As DBDouble
Dim spare1 As DBString
Dim spare2 As DBString
Dim spare3 As DBString
Dim spare4 As DBString
Dim lastEditComment As DBString
Dim lastEditAt As Date
ItemSubstitute.Add(sessionId, origItemId, altNo, pref, substLevel, itemId, reqdGradeCd, instruction, qtyPerParentItem, maxQtyPerParentItem, minQtyPerParentItem, updateInv, backflush, defReasCd, defLotNo, defSublotNo, defStorageEntId, defRejectEntId, scalingFactor, mustConsumeFromInv, mayChooseAltInvLoc, mayCreateNewLots, mustConsumeFromWip, mustConsumeBeforeProd, constantQty, estTime, spare1, spare2, spare3, spare4, lastEditComment, lastEditAt)
public static void Add(
int sessionId,
string origItemId,
int altNo,
int pref,
Nullable<int> substLevel,
string itemId,
DBInt reqdGradeCd,
DBString instruction,
double qtyPerParentItem,
DBDouble maxQtyPerParentItem,
DBDouble minQtyPerParentItem,
Nullable<bool> updateInv,
Nullable<bool> backflush,
DBInt defReasCd,
DBString defLotNo,
DBString defSublotNo,
DBInt defStorageEntId,
DBInt defRejectEntId,
DBDouble scalingFactor,
Nullable<bool> mustConsumeFromInv,
Nullable<bool> mayChooseAltInvLoc,
Nullable<bool> mayCreateNewLots,
Nullable<bool> mustConsumeFromWip,
Nullable<bool> mustConsumeBeforeProd,
Nullable<bool> constantQty,
DBDouble estTime,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
DBString lastEditComment,
out DateTime lastEditAt
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- origItemId
Required. Holds the ID of the item that is being substituted.
- altNo
Optional. Holds an index to this item that is used to identify it as an substitute (alternate) for another item.
- pref
Required. Holds an integer that is used to sort the alternatives for this item from most preferred (lowest number) to least preferred (highest) number.
- substLevel
Optional. Holds the substitution level the user must have to use this substitute. The default is 0.
- itemId
Required. Holds the ID of the substitution item being produced or consumed.
- reqdGradeCd
Optional. Holds the required grade code of the BOM item. Set to null if not used.
- instruction
Optional. Holds the Instruction on how to consume this item. Set to null if not used.
- qtyPerParentItem
Required. Holds the quantity of the item required per unit of the immediate parent item.
- maxQtyPerParentItem
Optional. Holds the maximum acceptable quantity of this BOM component. Set to null if not used.
- minQtyPerParentItem
Optional. Holds the minimum acceptable quantity of this BOM component. Set to null if not used.
- updateInv
Optional. Holds a flag that, if set to true, specifies whether to update inventory table with item consumption. The default is false.
- backflush
Optional. Holds a flag that, if set to true, specifies whether to filter the dataset by backflush consumption. The default is false.
- defReasCd
Optional. Holds the default consumption or production code for the item. If set to null, the value defaults to the one specified for the entity on which the job is run.
- defLotNo
Optional. Holds the default lot number from which to consume. If set to null, defaults to the lot specified for the entity on which the job is run.
- defSublotNo
Optional. Holds the default sublot number from which to consume. If set to null, defaults to the sublot specified for the entity on which the job is run.
- defStorageEntId
Optional. Holds the ID of the entity to get component or put by-product. If set to null, defaults to the entity on which the job runs.
- defRejectEntId
Optional. Holds the ID of the entity for rejected production items. If null, use def_storage_ent_id.
- scalingFactor
Optional. Holds the scaling factor to get correct units from counts if the counts are item dependent.
- mustConsumeFromInv
Optional. Holds a flag that, if set to true, specifies whether consumption must occur from inventory for this item. Default is false.
- mayChooseAltInvLoc
Optional. Holds a flag that, if set to true, specifies whether the user selects alternate inventory locations when consuming or producing this item. The default is true.
- mayCreateNewLots
Optional. Holds a flag that, if set to true, specifies whether the the user create new lots when consuming or producing this item. The default is true.
- mustConsumeFromWip
Optional. Holds a flag that, if set to true, specifies whether the lots consumed during a job must be limited to those lots produced to the Item_Inv table for the same wo_id in an upstream job. The default is false.
- mustConsumeBeforeProd
Optional. Holds a flag that, if set to true, specifies whether to prevent any production transactions until ‘acceptable’ quantities of BOM components have been consumed as specified by the ‘max_qty_per_parent_item’ and ‘min_qty_per_parent_item’ fields. The default is false.
- constantQty
Optional. Holds a flag that, if set to true, specifies whether the quantities consumed of this item are independent of the quantity of the parent item produced. The default is false.
- estTime
Optional. Holds the time it takes to consume or produce this component, per unit of BOM_position 0.
- 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.
- lastEditComment
Optional. Holds comments that describe why this record is being added.
- lastEditAt
Output. Holds the returned date/time when this record was added. The lastEditAt parameter is used by other methods that modify or delete this type of record for optimistic concurrency control.
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.