# Validate Units ## Overview This feature enables the material interlocking through ValidateUnits event, we will validate the production history and status of a production unit, and its readiness for processing. ## How To Configure ### Relevant Artifacts The table below describes the properties for this entity type: | Name | Type | Is Mandatory | Data Type | Description | | :-------------------- | :--------- | :----------: | :-------- | :----------------------------------------------- | | IoTMetadataDefinition | SmartTable | Yes | | Metadata configuration for equipment integration | ### IoTMetadataDefinition Resource Level Configuration At the **Resource** level, there are several configuration we can make to set our connection with the AMQP broker and with the Equipment. | Resource | Resource Type | Area | Name | Value | Description | | ---------------------- | ------------- | ---- | ------------------------ | ------------- | --------------------------------------------------------- | | *MES IPC-CFX Resource* | | | useIPCCFXToValidateUnits | ValidateUnits | Enable use of ValidateUnits event for material validation | | *MES IPC-CFX Resource* | | | useRecipeValidation | true | Enable Recipe validation for material validation | ### Debuging For debuging purposes, it's convenient to bypass the interlocking process and alway return a `Passed` value. For this we can use the key `useBypassValidation` with one of the following values: | Key Value | Description | | :--------------- | :------------------------------------------ | | 0 | All boards in the Panel passed | | N | All boards are passed except the Position N | | key not existing | Interlocking process as usual | ### How It Works The equipment sends a **CFX.InformationSystem.UnitValidation.ValidateUnitsRequest** Event from IPC-CFX standard. In the Event message, we will receive the validations we need to perform and the material identifier. !!! note "Currently Supported Validations" - UnitRouteValidation - UnitStatusValidation - UniTraceValidation Automation Controller will parse the event message and call MES service `api/IoTIPCCFX/ValidateUnits` that will handle the verification process and return a validation result. ??? Example "CFX ValidateUnitsRequest Example" ```JSON { "Validations": [ "UnitRouteValidation", "UnitStatusValidation" ], "PrimaryIdentifier": "MaterialName", "Units": [ { "UnitIdentifier": "MaterialName1", "PositionNumber": 1, "PositionName": "CIRCUIT1", "X": 50.45, "Y": 80.66, "Rotation": 0.0, "FlipX": false, "FlipY": false }, { "UnitIdentifier": "MaterialName2", "PositionNumber": 2, "PositionName": "CIRCUIT2", "X": 70.45, "Y": 80.66, "Rotation": 90.0, "FlipX": false, "FlipY": false } ] } ``` If `useRecipeValidation` is enabled, the system will: - Retrieve the current **Material Recipe**. - Validate it against the **Resource** or **Lane Recipe**, depending on the configuration. - If the resource is set as **Multi Lane** and the validation request targets a specific lane, the check will be performed against the corresponding **Lane Recipe**. - If the recipes don't match the **PrimaryResult** object of the response will be set with **Result** Failed and **Message** "Invalid Recipe. Expected ${expectedRecipeName} but current is ${currentRecipe}"; A `CFX.InformationSystem.UnitValidation.ValidateUnitsResponse` will be sent to the same request Id with the results of all the validation. ??? Example "CFX ValidateUnitsResponse Example" ```JSON { "Result": { "Result": "Success", "ResultCode": 0, "Message": null }, "PrimaryResult": { "UniqueIdentifier": "CARRIER5566", "PositionNumber": 0, "Result": "Passed", "FailureCode": 0, "Message": "OK" }, "ValidationResults": [ { "UniqueIdentifier": "CARRIER5566", "PositionNumber": 1, "Result": "Passed", "FailureCode": 0, "Message": "OK" }, { "UniqueIdentifier": "CARRIER5566", "PositionNumber": 2, "Result": "Passed", "FailureCode": 0, "Message": "OK" } ] } ```