Skip to main content

system.kanoa.lot.updateRoute

Requires kanoaOPS license

Description

Updates an existing route record in the database.

Syntax

updateRoute(routeInfo, userId)

Parameters:

– routeInfo (dictionary): Dictionary containing route details to update.
– userId (int): User ID performing the update.

Returns:

– recordsModified (int): Number of records updated.
– message (string): None if success; error details if an exception occurs.

Behavior

The function updates an existing route record in the mes.route table using the provided routeInfo.

– Updates the route name, description, item and item class associations, enabled status, and audit fields.
– Sets the changedDate field to the current timestamp.
– Returns the number of updated records (typically 1) or an error message if unsuccessful.

Dictionary

ParameterTypeRequiredNotes
routeIdintYesID of the route to update
routeNamestringNoName 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

# Update an existing route with a new description
routeInfo = {
"routeId": 12,
"routeName": "Assembly Line 3",
"routeDescription": "Updated assembly flow for Widget C",
"itemId": 102,
"itemClassId": None,
"enabled": True
}
recordsModified, msg = system.kanoa.lot.updateRoute(routeInfo=routeInfo, userId=123)
print(recordsModified, msg)

# Disable a specific route
routeInfo = {
"routeId": 15,
"routeName": "Packaging Route",
"routeDescription": "Temporarily disabled for maintenance",
"itemId": 205,
"itemClassId": None,
"enabled": False
}
recordsModified, msg = system.kanoa.lot.updateRoute(routeInfo, 123)
print(recordsModified, msg)