Skip to main content

system.kanoa.tooling.savePositions(toolingAssetId, positions, userId)

Replaces a tool's positions, matched by positionNumber: existing numbers are updated, new ones added, missing ones removed. Refused while the tool is mounted (use setPositionBlocked or setPositionRetired), for a removed position with mount history (retire it instead), and for a pocket that holds a tool and would stop being a pocket. Positions need the tool's hasPositions on, and a pocket needs holdsInserts on; an empty list is always allowed.


Parameters​

toolingAssetId Integer: The tool

positions List: List of dicts

- positionNumberIntegerRequired, unique on the tool
- positionTypeString'cavity', 'out', 'station', 'nest', 'pick' or 'pocket'. A pocket holds another tool
- nameString
- itemIdIntegerOptional. Set it only on a family tool: the position then counts only for that item. With no item, the position makes whatever item is running
- outputQtyIntegerParts per cycle from this position. Must be 0 for a pocket, which also can't have an itemId. Defaults to 0
- isBlockedBoolean
- blockReasonString'ratio', 'quality' or 'other'. Out of service for now: still counts toward the standard rate
- isRetiredBooleanOut of service for good: leaves the standard rate. A retired position isn't blocked

userId Integer: The user making the change


Returns​

(positionCount, message)


Example​

toolingAssetId = 1
positions = {'positionNumber': 1, 'positionType': 'cavity', 'name': 'name', 'itemId': 1, 'outputQty': 1}
userId = 5
positionCount, message = system.kanoa.tooling.savePositions(toolingAssetId, positions, userId)