system.mes.batch.recipe.getRecipeBOM(masterRecipeLink)

Sepasoft MES Module Suite

system.mes.batch.recipe.getRecipeBOM(masterRecipeLink) 

This script function gets the Bill of Materials (BOM) and user-parameter values from a Master recipe. It is common to include values like mix time or temperature.

Use the jsonEncode function to convert from a python dictionary to a json xml format, see code example below.

Warning

Scripting Function added in MES 3.81.8 RC 1 and later

getRecipeBOM(masterRecipeLink) → Python dictionary

Syntax

getRecipeBOM(masterRecipeLink)

  • Parameters

int masterRecipeLink - A required link of the master recipe to return details for.

  • Returns

 A Python dictionary containing the details of the master batch recipe. 

  • Scope

All

Example Script

Python
recLink = system.mes.batch.recipe.getRecipeLink('Product 1111')
print( system.util.jsonEncode(system.mes.batch.recipe.getRecipeBOM(recLink)))

Example Return

Python
{
    "LogicType": "Procedure",
    "Name": "Equipment Phase Manual",
    "Recipe_Name": "Equipment Phase Manual",
    "Recipe_Quantity": 1.0,
    "Recipe_Scale": 0.0,
    "Recipe_Version": 3,
    "Steps": [
		{
            "Step": "Mix",
            "Phase": "Unit Procedure",
            "Sublogic": {
                "Steps": [
	 	    {
                        "Phase": "Mix_Meat",
                        "Step": "Mix_Meat",
                        "Parameters": [
                            {
                                "DataType": "INTEGER",
                                "Name": "Mix_Time",
                                "Value": 600,
			      "UOM": "Minutes"
                            },
                        ],
                    },
                    {
                        "Phase": "Add Ingredient A",
                        "Step": "Add Protein",
                        "Parameters": [
                            {
                                "DataType": "MATERIAL_LOT_NUM",
                                "Name": "Protein.Lot_No",
                                "Value": ArrayOfLotNumbers[]
                            },
			  {
                                "DataType": "MATERIAL_NAME",
                                "Name": "Protein.Material_Name",
                                "Value": "Chicken"
                            },
			  {
                                "DataType": "MATERIAL_LOT_STATUS",
                                "Name": "Protein.Lot_Status",
                                "Value": "Uncooked"
                            },
                            {
                                "DataType": "MATERIAL_TARGET_QUANTITY",
                                "Name": "Protein.Target_Quantity",
                                "Value": 1000,
			      "UOM": "Lbs"
                            },
			  {
                                "DataType": "MATERIAL_ALTERNATE_GROUP",
                                "Name": "Protein.Alternate_Group",
                                "Value": "Alt 1"
                            },
			  {
                                "DataType": "MATERIAL_ALTERNATE_PRIORITY",
                                "Name": "Protein.Alternate_Priority",
                                "Value": 1
                            },
			  //Other Material_In sub-parameters may be included
			  {
                                "DataType": "MATERIAL_LOT_NUM",
                                "Name": "Alt_Protein.Lot_No",
                                "Value": "Meat7890"
                            },
			  {
                                "DataType": "MATERIAL_NAME",
                                "Name": "Alt_Protein.Material_Name",
                                "Value": "Chicken (Grade 2)"
                            },
			  {
                                "DataType": "MATERIAL_LOT_STATUS",
                                "Name": "Alt_Protein.Lot_Status",
                                "Value": "Uncooked"
                            },
                            {
                                "DataType": "MATERIAL_TARGET_QUANTITY",
                                "Name": "Alt_Protein.Target_Quantity",
                                "Value": 1000,
			      "UOM": "Lbs"
                            },
			  {
                                "DataType": "MATERIAL_ALTERNATE_GROUP",
                                "Name": "Alt_Protein.Alternate_Group",
                                "Value": "Alt 1"
                            },
			  {
                                "DataType": "MATERIAL_ALTERNATE_PRIORITY",
                                "Name": "Alt_Protein.Alternate_Priority",
                                "Value": 2
                            },
			  //Other Material_In sub-parameters may be included
                        ],
                    },
                    {
		       "Phase": "Add Ingredient B",
                        "Step": "Add Flavor",
                        "Parameters": [
			  {
                                "DataType": "MATERIAL_LOT_NUM",
                                "Name": "Flavor.Lot_No",
                                "Value": "Seasoning1234"
                            },
			  {
                                "DataType": "MATERIAL_NAME",
                                "Name": "Flavor.Material_Name",
                                "Value": "Mix Spices"
                            },
			  {
                                "DataType": "MATERIAL_LOT_STATUS",
                                "Name": "Flavor.Lot_Status",
                                "Value": "Good"
                            },
                            {
                                "DataType": "MATERIAL_TARGET_QUANTITY",
                                "Name": "Flavor.Target_Quantity",
                                "Value": 10
			      "UOM": "Lbs"
                            },
			  //Other Material_Out sub-parameters may be included
                        ],
                    },
                ]
            },
        },
        {
            "Step": "Cook",
            "Phase": "Unit Procedure",
            "Sublogic": {
                "Steps": [
                    {
                        "Phase": "Full Cook",
                        "Step": "Cook",
                        "Parameters": [
                            {
                                "DataType": "DOUBLE",
                                "Name": "Cook_Temperature",
                                "Value": 220.0,
			      "UOM": 
                            },
                            {
                                "DataType": "INTEGER",
                                "Name": "Cook_Time",
                                "Value": 120,
			      "UOM": "Minutes"
                            },
                            {
                                "DataType": "MATERIAL_LOT_NUM",
                                "Name": "Raw_In.Lot_No",
                                "Value": "Raw1234"
                            },
			  {
                                "DataType": "MATERIAL_NAME",
                                "Name": "Raw_In.Material_Name",
                                "Value": "Uncooked Chicken"
                            },
			  {
                                "DataType": "MATERIAL_LOT_STATUS",
                                "Name": "Raw_In.Lot_Status",
                                "Value": "Uncooked"
                            },
                            {
                                "DataType": "MATERIAL_TARGET_QUANTITY",
                                "Name": "Raw_In.Target_Quantity",
                                "Value": 1000,
			      "UOM": "Lbs"
                            },
			  //Other Material_In sub-parameters may be included
			  {
                                "DataType": "MATERIAL_LOT_NUM",
                                "Name": "Cooked_Out.Lot_No",
                                "Value": "Cooked1234"
                            },
			  {
                                "DataType": "MATERIAL_NAME",
                                "Name": "Cooked_Out.Material_Name",
                                "Value": "Cooked Chicken"
                            },
			  {
                                "DataType": "MATERIAL_LOT_STATUS",
                                "Name": "Cooked_Out.Lot_Status",
                                "Value": "Cooked"
                            },
                            {
                                "DataType": "MATERIAL_TARGET_QUANTITY",
                                "Name": "Cooked_Out.Target_Quantity",
                                "Value": 975,
			      "UOM": "Lbs"
                            },
			  //Other Material_Out sub-parameters may be included
                        ],
                    },
                ]
            },
        },
    ]
}

Sepasoft MES Module Suite