system.recipe.setPathRecipeValue

Sepasoft MES Module Suite

system.recipe.setPathRecipeValue(itemPath, recipeName, valueName, value, note)

Set production item recipe value.

Syntax

system.recipe.setPathRecipeValue(itemPath, recipeName, valueName, value, note)

  • Parameters

String itemPath - The item path to a production line, cell, cell group or location.

String recipeName - Name of recipe.

String  valueName - Recipe value name to set.

String  value - New value to assign to recipe value.

String  note - Optional note to be stored in the recipe change log.

  • Returns

Nothing

  • Scope

All

Code Examples

Python
#--- setPathRecipeValue(itemPath, recipeName, valueName, value, note) ---
#                        (str)       (str)      (str)    (str) (str)
#
# function system.recipe.setPathRecipeValue() allows you to set the value defined on
# a production Item. You can verify the change using the Recipe Editor. After you do
# a setItemRecipe() the associated tag will be update to this value

#-- Window Code
itemPath = event.source.parent.getComponent('mesosCell').equipmentItemPath
recipe = event.source.parent.getComponent('selRecipeName').selectedRecipeName
valueName = event.source.parent.getComponent('cntPrv').getComponent('tfPrvValueName').text
value = event.source.parent.getComponent('cntPrv').getComponent('tfPrvValue').text
note = event.source.parent.getComponent('cntPrv').getComponent('tfPrvNote').text
if valueName == '' or value == '':
    event.source.parent.getComponent('taOutput').text = 'Please fill in all required fields!'
else:
    try:
        event.source.parent.getComponent('taOutput').text = ''
        event.source.parent.getComponent('taOutput').text += 'itemPath: %s' %itemPath + '
'
        event.source.parent.getComponent('taOutput').text += 'valueName: %s' %valueName + '
'
        event.source.parent.getComponent('taOutput').text += 'value: %s' %value + '
'
        event.source.parent.getComponent('taOutput').text += 'note: %s' %note + '
'
        system.recipe.setPathRecipeValue(itemPath, recipe, valueName, value, note)
    except IOError:
        event.source.parent.getComponent('taOutput').text = 'Attempt to set the recipe value failed!'    

#-- Script Console Code
# itemPath = "Enterprise\New Site\Packaging\packagingLine1\Filler"
# recipe = "Root Beer"
# valueName = "Sugar Percentage"
# value = "17.4"
# note = "17.4% Sugar"
# try:
#     system.recipe.setPathRecipeValue(itemPath, recipe, valueName, value, note)
#     system.gui.messageBox('Root Beer Sugar Percentage updated to 17.4', 'setPathRecipeValue')
# except IOError:
#     system.gui.messageBox('Attempt to set the recipe value failed!', 'setPathRecipeValue')

Output

Code
itemPath: Enterprise\New Site\Packaging\packagingLine1\Filler
valueName: Sugar Percentage
value: 17.7
note: Note for SugarĀ 



Sepasoft MES Module Suite