Skip to main content

system.kanoa.lot.addRoute

Requires kanoaOPS license

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

ParameterTypeRequiredNotes
routeNamestringYesName of the route
routeDescriptionstringNoDescription of the route (optional)
itemIdintNoID of the associated item (optional)
itemClassIdintNoID of the associated item class (optional)
enabledboolNoTrue 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)