# RoutingOperation

## Description

RoutingOperation defines one ordered step within a Routing. It owns the sequence number, work-center assignment, standard setup and run time assumptions, optional operation description, and operator instructions that production-order release later snapshots into executable work orders.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createRouting](../command/CreateRouting.md) - Create draft routings including initial ordered operations.
- [updateRouting](../command/UpdateRouting.md) - Revise operation sequence, times, and work-center assignments while the routing is draft.
- [activateRouting](../command/ActivateRouting.md) - Validate ordered operations and make the routing eligible for production-order release.
- [deactivateRouting](../command/DeactivateRouting.md) - Retire the routing revision without mutating operations already snapshotted onto released orders.

### Query Definitions

- [getRouting](../query/GetRouting.md) - Retrieve one routing revision with ordered operations.
- [listRoutingsByItem](../query/ListRoutingsByItem.md) - List routing revisions and operations for one parent item and scope.

### Models

- RoutingOperation

### Invariants

- Every RoutingOperation belongs to exactly one Routing.
- `sequenceNumber` must be unique within its parent Routing.
- `standardSetupTime` and `standardRunTime` must be zero or greater.
- Each operation must reference an active work center valid for the same company and effective scope.
- An active Routing must not reference an inactive work center through any of its operations.

### Relationships

- **Belongs To Routing**: each operation is subordinate to one [Routing](./Routing.md).
- **References WorkCenter**: `workCenterId` points to the [WorkCenter](./WorkCenter.md) where the step executes.
