# Traceability Consumptions ## Overview This functionality enables the use of **TraceabilityData** Event from OIB **Traceability** Extension to collect consumption data in MES. ## 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 | | AssembleMaterialFromConsumptionSummary | Service | No | | Template Service to handle Consumption Operations | To enable TraceabilityData material consumptions functionality we need to configure the extension and any other relevant key as described below: ### IoTMetadataDefinition Area Level Configuration Set the following keys at the **Area** level: | Name | Type | Possible Values | Default Value | Description | | ----------------------------------------- | ------ | ------------------------------------------------------------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | oib_Traceability_disabled | String | `true`
`false` | `true` | This will enable or disable the extension. | | oib_Traceability_enablemode | String | `None`
`OnePerEnterprise`
`OnePerSite`
`OnePerLine` | `None` | How should activate Traceability instance:
`None` - No instance will be used
`OnePerEnterprise` - One Instance for all Lines (Enterprise level)
`OnePerSite` - One Instance for all Lines (Site level)
`OnePerLine` - One Instance per Line | | oib_Traceability_subscriptionnamesuffix | String | | "" | Will be added to the subscription name. | | oib_Traceability_operationmode | String | `Interlocking`, `Notification` or `Both` | Interlocking | How we will interact with the system. | | useCombinedTraceability | String | | | If using "Create one combined Traceability data packet for each board side", then **Station** is not used for Resource Name identification. By Default, we will process the **TraceabilityData** for each **Station**. | | ResourceToAssembleOperationOn_{Line Name} | String | | | Name of the **MES Resource** on which we will do the **Assemble Operation**. | | useDmyIdAsPackagingUID | String | | | If this option is Active we will use `DmyId`, if the value is different from *null*, instead of `PackagingUID` when building our **TraceabilityData** consumptions summary. | | ErrorLabelFailMask | String | | | What value of TraceabilityData property "ErrorLabel" will be considered as a fail. If set, when we receive this key's value in the ErrorLabel property of TraceabilityData we will consider this as a Fail consumption defaulting the Consumption operation to Combine when using CombinedTraceability feature. This code is an integer that will be translated to one or multiple Error Labels by **Bitwise And** operation. | | | | | | | ??? Example | Resource | ResourceType | Area | Name | Value | | -------- | ------------ | ------------------- | ------------------------------------------------- | ---------------- | | | | SMT_Production Line | oib_Traceability_disabled | false | | | | SMT_Production Line | oib_Traceability_enablemode | OnePerLine | | | | SMT_Production Line | OIB_LineNameStationName_Line - TQ & TX2 & SX2_TX2 | SMT_Pick_Place_1 | > Replace with the appropriate values depending on your setup. !!! info "If the equipment is configured to use **CombinedTraceability** the following keys must be set:" - **`useCombinedTraceability`** - **`ResourceToAssembleOperationOn_{Line Name}`** ### IoTMetadataDefinition Resource Level Configuration - `useOIBToTrackIn`: If set with **TraceabilityData**, this event will automatically track in the Material at the MES Resource. - `UseTrackInOperation`: Sets the Track In MES operation. Can be defined as `ComplexDispatchAndTrackIn` or `ComplexTrackIn`. Defaults to `ComplexTrackIn` if not defined. - `useWaitForPreviousTrackout`: Sets a wait time for the previous Track Out event to finish. - `useWaitIfRecipeIsBeingChanged`: Sets a wait time for the recipe change to finish on the current Resource. - `DoPreviousTrackOut`: If defined with any value, the controller logic will attempt to Track Out the previous Material tracked in the Resource before proceeding with the Track In operation for the current Material. - `useOIBToTrackOut`: If set with **TraceabilityData**, this event will automatically track out the Material at the MES Resource. - `UseTrackOutOperation`: Sets the Track Out MES operation. Can be defined as `ComplexTrackOutAndMoveNext` or `ComplexTrackOut`. Defaults to `ComplexTrackOut` if not defined. - `waitForTraceToDoTrackOut`: Sets a wait time for the Traceability data processing before Tracking Out. - `waitForTrackInToDoTrackOut`: Sets a wait time for the Track In operation to conclude before Tracking Out. - `ConsumptionOperation`: For what will we use this **TraceabilityData**, only if `useCombinedTraceability` is not set. - If empty,then we will default to "**Combine**". - `useTraceabilityServiceName`: If set will call the chosen service instead of the SMT service **AssembleMaterialFromConsumptionSummary**. Value must be {Service Type}|{Service URL}. ??? Example | Resource | ResourceType | Area | Name | Value | | ---------------- | ------------ | ---- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | SMT_Pick_Place_1 | | | useOIBToTrackIn | TraceabilityData | | SMT_Pick_Place_1 | | | useOIBToTrackOut | TraceabilityData | | SMT_Pick_Place_1 | | | useTraceabilityServiceName | Cmf.SMT.Orchestration.InputObjects.AssembleMaterialFromConsumptionSummaryInput, Cmf.SMT.Orchestration\|api/SMT/AssembleMaterialFromConsumptionSummary | ## How To Use Traceability informs MES what where the consumables, from which Reels and their location, used during the material processing at each Station. ## Implementation Details During **Equipment Setup**, and according to the defined operation mode, a new *endpoint*, *subscription* or *both* will be created/registered in OIB Central Server. This registration becomes the connection to MES where the **Events** or **Requests** will be sent by the configured Stations. Station TraceabilityData Received: 1. Resolves IoTMetadataDefinition for what tracking operations are configured. 2. Check if any Track In/Out Conditions are enabled. 3. Track In enabled: - Try to Track in Material received into the MES Resource. 4. Consumption Processing. - If `useCombinedTraceability` is set to **True** only one TraceabilityData Event is expected, the Consumption data will be processed and an **Assembly** done in the resource defined in `ResourceToAssembleOperationOn_{Line Name}`. > If `ErrorLabelFailMask` is set and this code is received in TraceabilityData Event we will set the operation as **Combine**. - If `useCombinedTraceability` is set to **False** or not set, we expect a TraceabilityData Event for each configured Station. The Consumption Operation will be the one defined in `ConsumptionOperation`, default is **Combine**. 5. Track Out enabled: - Try to Track out Material received out of the MES Resource.