system.kanoa.inventory.issuePartToWorkOrderEvent(issueInfo, userId)
Issues (deducts) a quantity of a part from inventory and records the consumption against a CMMS work order event.
This is a cross-module operation: workOrderEventId ties the transaction back to a system.kanoa.cmms work order event, inventoryAssetId identifies the bin/location the part is issued from, and assetId identifies the (maintainable) asset the part was used on.
Unless otherwise noted, all fields in issueInfo are required. The operation is attributed to the user identified by userId.
Parameters
issueInfo Dictionary
| - assetId | Integer | Where the part was used |
| - inventoryAssetId | Integer | Where the part came from |
| - notes | String | Not required |
| - partId | Integer | |
| - quantity | Float | |
| - unitCost | Float | Not required |
| - usedBy | Integer | Not required |
| - workOrderEventId | Integer |
userId Integer:Id of the user executing the function
Returns
inventoryTransactionId Integer
message String None if success
Example
issueInfo = {
'assetId': 340,
'inventoryAssetId': 12,
'notes': 'Replaced worn bearing during PM',
'partId': 8891,
'quantity': 2.0,
'unitCost': 14.75,
'usedBy': 205,
'workOrderEventId': 5502,
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
inventoryTransactionId, message = system.kanoa.inventory.issuePartToWorkOrderEvent(issueInfo, userId)
print inventoryTransactionId, message