# Automatic Defect Creation and Inspection Data Collection ## Overview This feature enables Automatic MES Data Collection by parsing equipment events. !!! note "Currently supported events:" - UnitsInspected - UnitsTested ## 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 | | SMTConventionContext | SmartTable | Yes | - | SmartTable to get custom convention Product | | SMTMapBoardIDContext | SmartTable | Yes | - | SmartTable to resolve and allow mapping of board | ### IoTMetadataDefinition Resource Level Configuration At the **Resource** level, there are several configuration we can make to set this feature. | Resource | Resource Type | Area | Name | Value | Description | | ---------------------- | ------------- | ---- | ---------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------- | | *MES IPC-CFX Resource* | | | materialUpdateFromPanelPosition | true | If true, the service api/IoTIPCCFX/LoadUnitIdentifiers will be called for these messages | | *MES IPC-CFX Resource* | | | useIPCCFXToInspect | Supported Event Name | Event used to remove the Transaction ID/Primary Identifier pair from Queue. | | *MES IPC-CFX Resource* | | | useInspectionToMaterialDataCollection | true | Enable Data Collection. If set we must also define the DEE name. | | *MES IPC-CFX Resource* | | | useInspectionToMaterialDataCollection_DEE | | Name of the DEE to be called to handle data collection. | | *MES IPC-CFX Resource* | | | useInspectionToMaterialDataCollection_useAsync | true | Enable async Data Collection. | | *MES IPC-CFX Resource* | | | useInspectionToMaterialDefects | true | Enable creation of defects using received data. | | *MES IPC-CFX Resource* | | | usePanelPositionToMaterialDefects | true | Enable use of Panel Position for Material Identification. | | *MES IPC-CFX Resource* | | | materialDefectsNotificationTemplate | Template Name | If set with notification template name, we will trigger a notification in case of Error during defect creation. | | *MES IPC-CFX Resource* | | | removeTransactionIDonMessage | Supported Event Name | Event used to remove the Transaction ID/Primary Identifier pair from Queue. | ### How It Works This feature relies on the SmartTable `IoTMetadataDefinition` to determine the behavior of inspection and defect tracking operations for the current MES Resource instance. #### Inspection Operation - Checks if the **Inspection** operation is enabled for the current MES Resource. - If the configuration `useIPCCFXToInspect` is defined, the system will use the specified **IPC-CFX message type** to enable inspection. **CFX.Production.UnitsInspected** or **CFX.Production.UnitsTested** Event from IPC-CFX standard. In the Event message we will retrieve TransactionId and InspectedUnits|TestedUnits object. With the TransactionId we will be able to retrieve from persistency the PrimaryIdentifier, which will identify MES Material. !!! note "TransactionId PrimaryIdentifier Persistency Handling" When `removeTransactionIDonMessage` is set to **UnitsInspected**, the value pair *TransactionId - PrimaryIdentifier* will be removed from persistency Queue after retrieving the information. If the key `materialUpdateFromPanelPosition` is set we will use the MES service `api/IoTIPCCFX/LoadUnitIdentifiers` who will update the UnitIdentifier properties according to MES Panel Position. ??? note "LoadUnitIdentifiers service signature" The input object **LoadUnitIdentifiersInput** contains the following information: | Name | Type | Description | | :------------- | :-------------- | :------------------------------------------------------------ | | PrimaryId | String | Material Name | | Type | String | Load type (UnitsInspected|UnitsTested) | | InspectedUnits | InspectedUnit[] | Array of CFX InspectedUnit Object with UnitIdentifier updated | | TestedUnit | TestedUnit[] | Array of CFX TestedUnit Object | The output object **LoadUnitIdentifiersOutput** contains the following information: | Name | Type | Description | | :------------- | :-------------- | :------------------------------------------------------------ | | InspectedUnits | InspectedUnit[] | Array of CFX InspectedUnit Object with UnitIdentifier updated | | TestedUnit | TestedUnit[] | Array of CFX TestedUnit Object with UnitIdentifier updated | If `useIPCCFXToInspect` is set to one of the supported events the Controller will call MES service `api/IoTIPCCFX/TestUnitsInspected` which will handle the MES PassFail Data Collection. ??? note "TestUnitsInspected service signature" **Pre Conditions:** Configs: /IoT/IPC-CFX/ParameterUnitsInspected/PassValue is set. /IoT/IPC-CFX/ParameterUnitsInspected/FailValue is set. /IoT/IPC-CFX/ParameterUnitsInspected/Parameter is set. /IoT/IPC-CFX/ParameterUnitsInspected/PerformDCSubMaterials is set. The input object **TestUnitsInspectedInput** contains the following information: | Name | Type | Description | | :---------------------- | :------------------------- | :--------------------------------------- | | Operation | String | Current Resource name | | OverallResults | Dictionary | Overall Results : Panel Results | | PanelBoardResults | PanelBoardResults | Panel Results | | PerformToParentWhenPass | Bool | Perform UnitInspected to Parent Material | The output object **TestUnitsInspectedOutput** contains the following information: | Name | Type | Description | | :--- | :--- | :---------- | | | | | ??? Example "CFX UnitsInspected Example" ```JSON { "TransactionId": "493bdbe0-9c32-4ed1-b7bf-b25372386b99", "InspectionMethod": "SPI", "SamplingInformation": { "SamplingMethod": "NoSampling", "LotSize": null, "SampleSize": null }, "Inspector": { "OperatorIdentifier": "BADGE489499", "ActorType": "Human", "LastName": "Smith", "FirstName": "Joseph", "LoginName": "joseph.smith@abcdrepairs.com" }, "InspectedUnits": [ { "UnitIdentifier": "PANEL34543535", "UnitPositionNumber": 1, "OverallResult": "Passed", "Inspections": [ { "UniqueIdentifier": "09b88135-019d-44f0-b28d-1de766851fd1", "InspectionName": "INSPECT_PASTE_DEPOSITIONS", "InspectionStartTime": null, "InspectionEndTime": null, "TestProcedure": null, "Comments": null, "Result": "Passed", "Error": null, "DefectsFound": [], "Symptoms": null, "Measurements": [ { "$type": "CFX.Structures.SolderPasteInspection.SolderPasteMeasurement, CFX", "X": 5.62, "EX": 5.6, "Y": 8.29, "EY": 8.3, "Z": 5.01, "EZ": 5.0, "DX": 0.02, "DY": 0.03, "Vol": 5.11, "EVol": 5.1, "Image": null, "UniqueIdentifier": "9367a252-cd8b-4198-bd75-100a0ace2249", "MeasurementName": "R1.1", "TimeRecorded": null, "Sequence": 0, "Result": "Passed", "CRDs": "R1.1" }, { "$type": "CFX.Structures.SolderPasteInspection.SolderPasteMeasurement, CFX", "X": 5.62, "EX": 5.6, "Y": 8.29, "EY": 8.3, "Z": 5.01, "EZ": 5.0, "DX": 0.02, "DY": 0.03, "Vol": 5.11, "EVol": 5.1, "Image": null, "UniqueIdentifier": "db0d3ac0-b6b8-40c2-8dd4-2ca426d3373a", "MeasurementName": "R1.2", "TimeRecorded": null, "Sequence": 0, "Result": "Passed", "CRDs": "R1.1" } ] } ] }, { "UnitIdentifier": "PANEL34543535", "UnitPositionNumber": 2, "OverallResult": "Failed", "Inspections": [ { "UniqueIdentifier": "6ae0a4c5-119c-4381-8d9d-eb193345445f", "InspectionName": "INSPECT_PASTE_DEPOSITIONS", "InspectionStartTime": null, "InspectionEndTime": null, "TestProcedure": null, "Comments": null, "Result": "Passed", "Error": null, "DefectsFound": [], "Symptoms": null, "Measurements": [ { "$type": "CFX.Structures.SolderPasteInspection.SolderPasteMeasurement, CFX", "X": 5.62, "EX": 5.6, "Y": 8.29, "EY": 8.3, "Z": 5.01, "EZ": 5.0, "DX": 0.02, "DY": 0.03, "Vol": 5.11, "EVol": 5.1, "Image": null, "UniqueIdentifier": "276b031b-69aa-47de-a087-bf4f1471ff0a", "MeasurementName": "R1.1", "TimeRecorded": null, "Sequence": 0, "Result": "Passed", "CRDs": "R1.1" }, { "$type": "CFX.Structures.SolderPasteInspection.SolderPasteMeasurement, CFX", "X": 5.62, "EX": 5.6, "Y": 8.29, "EY": 8.3, "Z": 5.01, "EZ": 5.0, "DX": 0.02, "DY": 0.03, "Vol": 5.11, "EVol": 5.1, "Image": null, "UniqueIdentifier": "49e5f6cf-dd27-4ad7-aa77-469e1da576df", "MeasurementName": "R1.2", "TimeRecorded": null, "Sequence": 0, "Result": "Passed", "CRDs": "R1.1" } ] } ] } ] } ``` ??? Example "CFX UnitsInspected Example" ```JSON { "TransactionId": "1b3524e0-fd4f-4bd8-93a7-992d12bdb418", "TestMethod": "Automated", "Tester": { "OperatorIdentifier": "BADGE489499", "ActorType": "Human", "LastName": "Smith", "FirstName": "Joseph", "LoginName": "joseph.smith@abcdrepairs.com" }, "SamplingInformation": { "SamplingMethod": "NoSampling", "LotSize": null, "SampleSize": null }, "TestedUnits": [ { "UnitIdentifier": "UNIT123456789", "UnitPositionNumber": 1, "OverallResult": "Passed", "Tests": [ { "UniqueIdentifier": "5de9b7e9-9c7c-4e88-9d40-07c7618248a2", "TestName": "HOT_TEST", "TestStartTime": "2018-10-03T16:02:33.2831984-04:00", "TestEndTime": "2018-10-03T16:03:05.2842009-04:00", "TestConditions": [ { "$type": "CFX.Structures.Temperature, CFX", "StartTime": null, "EndTime": null, "MeanValue": 45.2, "MedianValue": 0.0, "MaxValue": 45.8, "MinValue": 44.9 }, { "$type": "CFX.Structures.Humidity, CFX", "StartTime": null, "EndTime": null, "MeanValue": 85.5, "MedianValue": 0.0, "MaxValue": 85.7, "MinValue": 85.4 } ], "TestProcedure": null, "Comments": null, "Result": "Passed", "Error": null, "SymptomsFound": [], "DefectsFound": [], "Measurements": [] }, { "UniqueIdentifier": "c2668251-aaba-4ceb-a584-55e8b10f0de1", "TestName": "COLD_TEST", "TestStartTime": "2018-10-03T16:02:33.2842009-04:00", "TestEndTime": "2018-10-03T16:03:05.2842009-04:00", "TestConditions": [ { "$type": "CFX.Structures.Temperature, CFX", "StartTime": null, "EndTime": null, "MeanValue": -6.5, "MedianValue": 0.0, "MaxValue": -6.4, "MinValue": -6.7 }, { "$type": "CFX.Structures.Humidity, CFX", "StartTime": null, "EndTime": null, "MeanValue": 22.5, "MedianValue": 0.0, "MaxValue": 22.7, "MinValue": 22.4 } ], "TestProcedure": null, "Comments": null, "Result": "Passed", "Error": null, "SymptomsFound": [], "DefectsFound": [], "Measurements": [] } ] } ] } ``` #### Material Defect Operation - Checks if the **Material Defect** operation is enabled for the current MES Resource. - If the configuration `useInspectionToMaterialDefects` is defined, the system will automatically open material defects received in the IPC-CFX message. - If set Controller will call MES service `api/IoTUtilities/CreateDefects` who will handle the creation of defects in MES. ??? note "CreateDefects service signature" The input object **CreateDefectsInput** contains the following information: | Name | Type | Description | | :--------------- | :-------------- | :-------------------------------------------------------- | | ResourceName | String | Current Resource name | | UsePanelPosition | Resource | Enable the use of Panel position to identify MES Material | | InspectedUnits | InspectedUnit[] | Array of CFX InspectedUnit Object | | TestedUnit | TestedUnit[] | Array of CFX TestedUnit Object | The output object **CreateDefectsOutput** contains the following information: | Name | Type | Description | | :------------- | :----------- | :-------------------- | | DefectsResults | List | List of defects names | #### Track-Out Operation - If the configuration `useIPCCFXToTrackOut` is defined for either `UnitsInspected` or `UnitsTested` IPC-CFX messages, the system will perform a **Track-Out** operation after inspection. - At the end of the process we can use these events to Track the material Out of the Resource. [Check this for more information.](trackout.md)