Skip to main content

system.mes.productionOrder.newBillOfMaterialsItem

Generates an empty non-persisted Production Order Bill of Materials object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveBillOfMaterials method in order to persist the record.

Syntax

system.mes.productionOrder.newBillOfMaterialsItem()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

Returns a JSON representation of the newly created bill of materials object. The following is a list of keys and default values:

KeyDefault Value
productIdnull
productionOrderIdnull
materialNamenull
materialIdnull
quantityPerProducedUnitnull
quantityOrdernull
unitOfMeasureIdnull
unitOfMeasureNamenull
position0
materialGroupnull
materialTypePRODUCT
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new bill of materials object with no initial arguments
new_bill_of_materials = system.mes.productionOrder.newBillOfMaterialsItem()

# Set basic attributes for the new bill of materials
new_bill_of_materials['quantityOrder'] = 1000.0
new_bill_of_materials['materialGroup'] = 'CAN'
new_bill_of_materials['unitOfMeasureId'] = '01JCH3EPVP-1MNNDJTS-37Z75NGB'
new_bill_of_materials['materialId'] = '01JCH3ENGW-82KJDZDR-JHGYCXQN'
new_bill_of_materials['quantityPerProducedUnit'] = 10.0
# (You can continue setting other properties as needed here)

# Save the new bill of materials to the system
saved_bill_of_materials = system.mes.productionOrder.saveBillOfMaterialsItem(**new_bill_of_materials)

# Output the JSON representation of the saved bill of materials
print(saved_bill_of_materials)