Skip to main content

system.kanoa.lot.addRouteStep

Requires kanoaOPS license

Description

Adds a new step to an existing route.

Syntax

addRouteStep(routeStepInfo, userId)

Parameters:

– routeStepInfo (dictionary): Dictionary containing route step details.
– userId (int): User ID performing the insert.

Returns:

– routeStepId (int): ID of the newly created route step.
– message (string): None if success; error details if an exception occurs.

Behavior

The function inserts a new record into the mes.routeStep table, linking it to an existing route and operation.

– Creates a new step with the specified step number, operation, and description.
– Automatically sets audit fields (createdBy and createdDate).
– Returns the new routeStepId upon success or an error message if the insert fails.

Dictionary

ParameterTypeRequiredNotes
routeIdintYesID of the route the step belongs to
stepNumintYesSequential step number in the route
lotOperationIdintYesID of the linked lot operation
stepDescriptionstringNoDescription or notes for the route step (optional)
enabledboolNoTrue to enable the step, False to disable it

Code Examples

# Add a new route step
routeStepInfo = {
"routeId": 101,
"stepNum": 3,
"lotOperationId": 55,
"stepDescription": "Inspection before packaging",
"enabled": True
}
routeStepId, msg = system.kanoa.lot.addRouteStep(routeStepInfo=routeStepInfo, userId=123)
print(routeStepId, msg)

# Add a disabled route step
routeStepInfo = {
"routeId": 101,
"stepNum": 4,
"lotOperationId": 56,
"stepDescription": "Final assembly",
"enabled": False
}
routeStepId, msg = system.kanoa.lot.addRouteStep(routeStepInfo, 123)
print(routeStepId, msg)