Sepasoft MES Module Suite
Creating Machine Recipes
The system.recipe namespace provides a set of script functions that can be used to create and modify recipe values.
This sample script shows how to create a recipe and assign values to the recipe items. If this script function is placed in the shared script library under a package called operations and a script library called RecipeManagement it would be executed with the call shared.operations.RecipeManagement.createRecipe(). Script function can have parameters so values such as recipe name and item path may be passed in with the call.
Python |
def createRecipe(): from org.apache.log4j import Logger log = Logger.getLogger('createRecipeScriptLogger') # create the recipe recipeName = 'Manual Recipe 7' parentRecipeName = '' note = 'Manual created recipe' system.recipe.createRecipe(recipeName, parentRecipeName, note) # assign production item to recipe itemPath = 'Your Enterprise\Site 1\Packaging\Line 1' system.recipe.addItemToRecipe(recipeName, itemPath, note) # display current recipe values category = '1' # indicates recipe values were created for the recipe module recipeVals = system.recipe.getRecipeValueList(itemPath, recipeName, category) log.info('Original recipe values') log.info('_____________________________________________________') for ndx in range(recipeVals.size()): recipeItem = recipeVals.get(ndx).getRecipeValue() # get the recipe value item object #recipeItem = recipeVals.get(ndx).getRecipeValue() # if used in gateway scope itemName = recipeItem.getName() itemValue = str(recipeItem.getValue()) #itemSort = recipeItem.getSortOrder() #recipeItem.getMinValue() #recipeItem.getMaxValue() #recipeItem.getAssignedBy() #recipeItem.getSortOrder() #recipeItem.hasDescription() #recipeItem.getDescription() #recipeItem.getFormat() #recipeItem.getUnits() log.info('%s=%s' %(itemName, itemValue)) # assign values to the recipes items valueName = 'IntRecipeTag' value = '346' # always assign as a string, the module will convert to the proper type note = 'value changed' system.recipe.setPathRecipeValue(itemPath, recipeName, valueName, value, note) valueName = 'StringRecipeTag' value = 'Updated string value' note = 'value changed' system.recipe.setPathRecipeValue(itemPath, recipeName, valueName, value, note) # display new values recipeVals = system.recipe.getRecipeValues(itemPath, recipeName, category) log.info('Modified recipe values') log.info('_____________________________________________________') for ndx in range(recipeVals.size()): recipeItem = recipeVals.get(ndx) itemName = recipeItem.getName() itemValue = str(recipeItem.getValue()) log.info('%s=%s' %(itemName, itemValue)) return |
MES Naming Convention
| MES Object | Character that are Not Allowed | Exception |
|---|---|---|
| Production Equipment | . ? ! # % ^ * ~ [ ] { } + = ` \ @ & ( ) < >, | |
| MES Person | . ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | < > | |
| All Other MES Objects | . ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | , | |
Machine Recipe Name | Follows the same convention as All Other MES Objects | Full-stop period . is allowed as of 3.81.10 SP2 |
Sepasoft MES Module Suite