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

### Query Definitions

- [getRouting](../queries/GetRouting.md) - Retrieve one routing revision with ordered operations.
- [listRoutingsByItem](../queries/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.
