--- alias: meddev-feature-protocolinstanceproductionorder render_macros: false --- # Protocol Instance Production Order Association ## Overview Each Protocol Instance already carries context information, such as Product, Step, Facility, Flow and Resource. This feature adds the **Production Order (PO)** to that context, so that Protocol Instances can be traced, and later filtered, by the Production Order they relate to. ### Concept The association between a Protocol Instance and a Production Order is created **when the Protocol Instance is opened** and follows the same logic as the remaining context entities: - If the Materials selected belong to the same Production Order, the Protocol Instance is associated with that Production Order automatically. - If the Materials belong to different Production Orders, or at least one Material has no Production Order, no association is made. - A Protocol Instance can also be opened by selecting only a Production Order, without any Material. Once created, the association is **read-only**. Changes to the Materials of the Protocol Instance do not affect it, and it cannot be changed manually. --- ## Opening a Protocol Instance with a Production Order In the **Open Protocol Instance** wizard, the **Context** step includes an optional **PO** selector, beneath **Resource**. Any existing Production Order can be selected. ![Protocol Production Order Context Open Protocol Wizard](features.images/protocol_production_order_context_open_protocol_wizard.png) The Production Order associated with the Protocol Instance is resolved as follows: | Materials selected | Production Order selected | Result | |---|---|---| | All from the same PO (for example, 1234) | None, or the same PO (1234) | Associated with PO 1234. No warning. | | All from the same PO (for example, 1234) | A different PO (for example, 5678) | Associated with PO 1234. PO 5678 is ignored and a warning explains that PO 1234 was associated because all the selected Materials belong to it. | | From different POs, or at least one Material without PO | None | No association. No PO warning. | | From different POs, or at least one Material without PO | A PO | No association. The selected PO is ignored and a warning explains why no association was made. | | None | A PO (for example, 1234) | Associated with PO 1234. No warning. | | None | None | No association. | !!! note When Materials are selected, the Production Order of the Materials takes precedence over the Production Order selected in the wizard. --- ## Viewing the associated Production Order The associated Production Order is displayed in the **Context** sidebar of the Protocol Instance, beneath **Resource**: - It is a read-only field, displayed as a link to the Production Order. - If the Protocol Instance has no associated Production Order, the field is hidden. ![Protocol Production Order Context Sidebar](features.images/protocol_production_order_context_sidebar.png) --- ## Execution Behavior ### Changes to the Materials The Production Order association reflects the context at the moment the Protocol Instance was opened. Adding, removing or replacing the Materials of a Protocol Instance afterwards: - does **not** change the Production Order association, and - does **not** create an association if there was none when the Protocol Instance was opened. ### Manual changes are not allowed It is not possible to manually add, update or remove the Production Order relation of a Protocol Instance, either from the **Protocol Instance** page or from the **Production Order** page. MES rejects the change and shows an error. The existing context remains unchanged. !!! note Other changes to the Protocol Instance or to the Production Order are not affected by this validation. --- ## Using the Production Order context The Production Order association can be used to filter Protocol Instances in the Protocol Instances page. For more information, see [Protocol Instances Page: Context Filters](protocolinstancefilters.md). ---