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
| - assetBomId | Integer | Not required, pass to update |
| - assetId | Integer | |
| - enabled | Boolean | Not required |
| - modelId | Integer | Not required, mutually exclusive with partId |
| - notes | String | Not required |
| - parentBomId | Integer | Not required |
| - partId | Integer | Not required, mutually exclusive with modelId |
| - positionCode | String | Not required |
| - positionName | String | Not required |
| - quantity | Float | |
| - uomId | Integer |
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