Skip to main content

system.mes.productionOrder.swapBillOfMaterialsPositions

Description

Swaps the position values of two Production Order Bill of Materials records within the same production order. This is useful for reordering bill of materials items in a user interface.

Syntax

system.mes.productionOrder.swapBillOfMaterialsPositions(item1Id, item2Id)

Parameters

ParameterTypeDescription
item1IdString (ULID)The ULID of the first bill of materials item to swap positions with.
item2IdString (ULID)The ULID of the second bill of materials item to swap positions with.

Returns

If successful, an ApiResponse Object is returned with the success bool set True. If unsuccessful, an InUseException, IllegalArgumentException or ConstraintViolationException is thrown.

NameTypeDescription
successBooleanIndicates if the position swap was successful.
messageStringThe reason why the swap was successful or unsuccessful.
dataStringThe data associated with the operation.
errorStringThe errors associated with the operation.

Code Examples

# Swap the positions of two bill of materials items
response = system.mes.productionOrder.swapBillOfMaterialsPositions(
'007YKTRY-01JCNH29SS-6HZDTR95',
'007YKTRY-01JCNH29T9-MNMXF65A'
)

# Check if the swap was successful
if response.success:
print("Successfully swapped bill of materials positions")
else:
print("Failed to swap positions: " + response.message)