# BOM Pre-Check !!! info "From SMT Template version 3.2.0 onwards" ## Overview This feature compares the ASM Recipe component data by comparing it with the material **BOM** existing in MES. ## How it works - Set `UseBomValidation` key in the `IoTMetadataDefinition` table to `True` to activate the Feature. - `UseUpdateRecipeByLane` if set with value **true** we will validate for the Conveyor Lane received in the event. This feature compares the data supplied by **ASM** in **RecipeDetails** object (via SiplacePro.Event.RecipeDetails event) against the material **BOM** existing in MES, for validation purposes. The **RecipeDetails** object is requested by OIB Automation Controller, when a RecipeDownload Event is received or the panel is entering the equipment and no data is stored for this Recipe. After the relevant information is parsed, it is sent as input for the service **ValidatePlacementList** for comparison against the current BOM material. [For more information about ValidatePlacementList check here.](../../../artifacts/services.md#ValidatePlacementList) At ASM RecipeDetails, example below, within the PlacementLists section the **ComponentName** value is mapped to item **Product** in MES BOM and each **ReferenceDesignator** should be added to the corresponding item **Designator**. ??? example "Show Recipe Details Example" ```JSON (...) "Boards": [ { "FullPath": "SMTTemplate\\SMT_Product", "BoardSide": "Top", "PlacementLists": [ { "PlacementListFullPath": "Demo Placement Lists\\Copy of Placement List ASM Simple Product[4868]", "ClusterName": "Cluster 9", "ComponentPlacements": [ { "ReferenceDesignator": "C3", "ComponentName": "0201R", "ComponentFullPath": "Demo Components\\0201R", "ComponentShapeFullPath": "Demo Component Shapes\\98", "OffsetX": 1.0, "OffsetY": 8.0, "Angle": 1.570796326794897, "Level": 0, "Omit": false, "Exclusive": false, "Glue": false, "AlternativeComponents": [] }, { "ReferenceDesignator": "C1", "ComponentName": "0201R", "ComponentFullPath": "Demo Components\\0201R", "ComponentShapeFullPath": "Demo Component Shapes\\98", "OffsetX": 1.0, "OffsetY": 1.0, "Angle": 1.570796326794897, "Level": 0, "Omit": false, "Exclusive": false, "Glue": false, "AlternativeComponents": [] }, { "ReferenceDesignator": "C5", "ComponentName": "SOT23", "ComponentFullPath": "Demo Components\\SOT23", "ComponentShapeFullPath": "Demo Component Shapes\\400", "OffsetX": 4.5, "OffsetY": 4.5, "Angle": 0.0, "Level": 0, "Omit": false, "Exclusive": false, "Glue": false, "AlternativeComponents": [ { "Name": "SMT_Component_3", "FullPath": "Demo Components\\SMT_Component_3" } ] }, { "ReferenceDesignator": "C4", "ComponentName": "0201R", "ComponentFullPath": "Demo Components\\0201R", "ComponentShapeFullPath": "Demo Component Shapes\\98", "OffsetX": 8.0, "OffsetY": 8.0, "Angle": 1.570796326794897, "Level": 0, "Omit": false, "Exclusive": false, "Glue": false, "AlternativeComponents": [] }, { "ReferenceDesignator": "C2", "ComponentName": "0201R", "ComponentFullPath": "Demo Components\\0201R", "ComponentShapeFullPath": "Demo Component Shapes\\98", "OffsetX": 8.0, "OffsetY": 1.0, "Angle": 1.5707963267949, "Level": 0, "Omit": false, "Exclusive": false, "Glue": false, "AlternativeComponents": [] } ] } ] } ] (...) ``` The Automation Controller will parse this event and send a list of **Reference Designators** with the corresponding **Products**, retrieving from PlacementList the main ComponentName property and AlternativeComponents list. ??? example "Placement List" ```JSON PlacementLists: '[ { "ReferenceDesignator": "C3", "ComponentNames": [ "0201R" ] }, { "ReferenceDesignator": "C1", "ComponentNames": [ "0201R" ] }, { "ReferenceDesignator": "C5", "ComponentNames": [ "SOT23", "SMT_Component_3" ] }, { "ReferenceDesignator": "C4", "ComponentNames": [ "0201R" ] }, { "ReferenceDesignator": "C2", "ComponentNames": [ "0201R" ] } ]' ``` ### Persistency Handling After the first successful validation of the BOM, a key named **BomValidated_<Resource Name>_Lane_<Lane number>** will be stored in persistency with the value `true`. This allows subsequent requests to bypass validation until a new recipe is downloaded to the equipment. If you need to trigger a new validation on the next board request event, you can send a message bus message to the Area configured for the OIB Controller. Use the action group `SMT.IoT.Utilities.ResetPreBomValidation` and include the `ResourceName` and `LaneNumber` in the message body. ??? example "Show DEE Example" ```csharp UseReference("", "Cmf.Foundation.Common.Exceptions"); UseReference("Cmf.Foundation.BusinessObjects.dll", "Cmf.Foundation.BusinessObjects"); UseReference("Cmf.Foundation.BusinessOrchestration.dll", ""); UseReference("", "Cmf.Foundation.Common.Exceptions"); UseReference("", "Cmf.Foundation.Common"); UseReference("Cmf.Navigo.BusinessObjects.dll", "Cmf.Navigo.BusinessObjects"); var serviceProvider = (IServiceProvider)Input["ServiceProvider"]; IArea area = serviceProvider.GetService(); area.Name = "SMT_Production Line"; area.Load(); var instance = area.GetAutomationControllerInstance(); if (instance == null) { throw new Exception("Area not connected to any IoT instance"); } else { var args = new { ResourceName = "SMT_Pick_Place_1", LaneNumber = 1 }; instance.Publish("SMT.IoT.Utilities.ResetPreBomValidation", args.ToJsonString()); } ```