Skip to main content

system.kanoa.inventory.addAssetBomItem(bomInfo, userId)

Adds a new Bill-of-Materials line item to a specific installed asset instance, or updates an existing one when assetBomId is supplied inside bomInfo. An asset BOM entry lets a particular unit's actual composition diverge from (or extend) its model-level BOM. for example recording a non-standard part actually installed at a position, or a position that only exists on this asset. As with model BOM items, partId and modelId are mutually exclusive, so each entry represents either a part or a referenced model at that position, not both.


Parameters

bomInfo Dictionary

- assetBomIdIntegerNot required, pass to update
- assetIdInteger
- enabledBooleanNot required
- modelIdIntegerNot required, mutually exclusive with partId
- notesStringNot required
- parentBomIdIntegerNot required
- partIdIntegerNot required, mutually exclusive with modelId
- positionCodeStringNot required
- positionNameStringNot required
- quantityFloat
- uomIdInteger

userId Integer:Id of the user executing the function


Returns

assetBomId Integer
message String None if success


Example

# Add a part to an asset's BOM
bomInfo = {
'assetId': 7734,
'partId': 8891,
'quantity': 1.0,
'uomId': 1,
'positionCode': 'P1-A',
'positionName': 'Drive Shaft Bearing',
'enabled': True,
'notes': 'Replaced with heavy-duty bearing during last overhaul'
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
assetBomId, message = system.kanoa.inventory.addAssetBomItem(bomInfo, userId)
print assetBomId, message