system.kanoa.lot.updateRoute
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
Parameter | Type | Required | Notes |
---|---|---|---|
routeId | int | Yes | ID of the route to update |
routeName | string | No | 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
# 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)