system.kanoa.lot.addRoute
Description
Adds a new route record to the database.Syntax
addRoute(routeInfo, userId)Parameters:
– routeInfo (dictionary): Dictionary containing route details.
– userId (int): User ID creating the route.
Returns:
– routeId (int): ID of the newly inserted route.
– message (string or None): None if success; error details on failure.
Behavior
The function inserts a new record into the mes.route table with the provided details:– Inserts the route name, description, item and item class references, enabled flag, and user information.
– Automatically sets the created date to the current timestamp.
– Returns the newly created routeId or an error message on failure.
Dictionary
Parameter | Type | Required | Notes |
---|---|---|---|
routeName | string | Yes | Name of the route |
routeDescription | string | No | Description of the route (optional) |
itemId | int | No | ID of the associated item (optional) |
itemClassId | int | No | ID of the associated item class (optional) |
enabled | bool | No | True to enable the route, False to disable it |
Code Examples
# Add a new route linked to an item
routeInfo = {
"routeName": "Assembly Line 3",
"routeDescription": "Primary assembly route for Widget C",
"itemId": 102,
"itemClassId": None,
"enabled": True
}
routeId, msg = system.kanoa.lot.addRoute(routeInfo=routeInfo, userId=123)
print(routeId, msg)
# Add a route linked by item class
routeInfo = {
"routeName": "Final Packaging",
"routeDescription": "Packaging workflow for consumer products",
"itemId": None,
"itemClassId": 205,
"enabled": True
}
routeId, msg = system.kanoa.lot.addRoute(routeInfo, 123)
print(routeId, msg)