# README

## Overview

The Manufacturing module manages production planning and execution from recipe and process definition through order release, shop-floor progress tracking, completion, and cost capture. It owns the master and transactional records that explain what should be produced, how it should be produced, where capacity exists to produce it, what work is in progress, what quantities were consumed or completed, and how actual manufacturing results differ from the plan.

Manufacturing sits between upstream demand or supply signals and downstream stock or finance execution. It references items from item-management, company and site context from organization, units and currencies from primitives, and coordinates with inventory for component issue, finished-goods receipt, and scrap posting. That coordination includes named cross-module contracts such as `ManufacturingReceiptHandoff`, `ManufacturingScrapHandoff`, `InventoryIssueOutcomeEvent`, and `ManufacturingCostSettlementAcknowledgment`, which let inventory and downstream accounting remain the owners of stock movement, valuation, and settlement while manufacturing remains the owner of production intent and variance analysis. It may prepare cost and account-reference data for downstream accounting, but journal posting and ledger ownership remain outside the module.

## Key Features

- **[Bill of Material Management](docs/feature/bill-of-material-management.md)**: Define versioned multi-level bills of material for finished goods and subassemblies, including component quantities, scrap assumptions, effectivity, and default selection rules used by production orders
- **[Routing and Work Center Definition](docs/feature/routing-and-work-center-definition.md)**: Define routings as ordered manufacturing steps and configure work centers with capacity, calendars, standard times, and cost rates used for planning and execution
- **[Production Order Lifecycle](docs/feature/production-order-lifecycle.md)**: Create, schedule, release, reschedule, cancel, complete, technically complete, and close production orders with BOM and routing snapshots plus progress visibility from planned order through settled closeout
- **[Work Order Execution](docs/feature/work-order-execution.md)**: Execute operation-level work orders with start, pause, report, complete, material issue or backflush, scrap capture, and finished or intermediate receipt handoff to inventory
- **[Manufacturing Cost and Variance](docs/feature/manufacturing-cost-and-variance.md)**: Capture planned versus actual component, labor, machine, and overhead cost at production-order level and classify manufacturing variances for downstream accounting consumption

## Module Scope

### In Scope

- Bill of material ownership, including component lines, versioning, effectivity windows, multi-level subassembly references, and `bomType` semantics for `MANUFACTURE`, `PHANTOM`, and `KIT`
- Routing ownership, including ordered operations, standard setup or run times, operation instructions, and work-center assignment
- Work center master data, including company or site scope, availability calendar, capacity assumptions, and standard cost rates
- Production order planning and control, including creation, scheduling, BOM or routing selection, release, cancellation, completion, technical completion, and closeout
- Work order execution at operation level, including start, pause, resume, quantity reporting, time capture, scrap reporting, and exception notes
- Material requirement handoff to inventory for reservation, issue, backflush, finished-goods receipt, intermediate receipt, and scrap posting
- Planned-versus-actual manufacturing cost rollup using component issue values from inventory plus labor or machine rates from work centers, with explicit variance categories and downstream account references
- Production status, progress, and auditability scoped by company and site

### Out of Scope

- Forecasting, MRP netting, replenishment proposals, and automated procurement planning
- Advanced finite-capacity optimization, drag-and-drop scheduling boards, and AI or rules-based sequencing
- Quality inspection plans, nonconformance, CAPA, rework loops, and regulated electronic batch record workflows
- Subcontracting, outside processing, contract manufacturing, and supplier-operated work centers
- Co-products, by-products, and joint-production costing
- Detailed operator kiosk UX, barcode device workflows, PLC or IoT machine integration, and MES hardware connectivity
- Storage-location ownership, stock balances, and inventory valuation logic
- Journal entry posting, WIP settlement, period close, and general-ledger balance ownership
- Preventive maintenance, OEE analytics, and HR or payroll-driven labor management

### Scope Decision Rationale

Manufacturing is scoped to the **production definition and execution layer**: product recipe, process steps, capacity context, production order control, and operation-level reporting. These concepts depend on one another and change together, so they belong in one module rather than being split prematurely across planning, execution, and costing.

Inventory remains the owner of **physical stock state**. Manufacturing decides that materials should be issued, scrap should be recorded, or finished goods should be received, but inventory owns the resulting stock movement, storage-location state, and valuation basis. Manufacturing can request issue execution, but actual material cost becomes manufacturing-visible only when inventory returns the named `InventoryIssueOutcomeEvent` after inventory-owned valuation is complete. This keeps manufacturing focused on production intent and progress rather than stock-tracking internals.

Sales and purchase remain the owners of **commercial demand and supply commitments**. Manufacturing can consume sales demand, open supply status, or manual planner input when creating production orders, but it must not own customer orders, purchase orders, or supplier receipts. That separation preserves clean module boundaries and allows manufacturing to serve both make-to-stock and make-to-order flows without duplicating commercial logic.

Financial-accounting remains the owner of **financial posting and settlement**. Manufacturing can capture planned and actual production cost, classify variances into price, usage, rate, efficiency, scrap, and yield categories, and reference WIP or variance accounts from coa-management, but posting journal entries and enforcing period-close rules belong to downstream financial-accounting workflows. This keeps cost insight in manufacturing without pulling ledger behavior into the shop-floor domain.

## Module Dependencies

- [item-management](../item-management/README.md) — Finished goods, subassemblies, raw materials, and consumables are referenced as Items or SKUs
- [organization](../organization/README.md) — Company and Site scope for BOM defaults, work centers, and production execution context
- [primitives](../primitives/README.md) — Unit-of-measure conversions for component and output quantities plus currency references for costing
- [inventory](../inventory/README.md) — Downstream execution of component issue, backflush, finished-goods receipt, intermediate receipt, scrap, and actual material cost sourcing through `InventoryIssueOutcomeEvent`
- [user-management](../user-management/README.md) — Permissions for create, release, reschedule, start, complete, technically complete, cancel, close, and cost-review actions
- [coa-management](../coa-management/README.md) — WIP, absorption, material price, material usage, labor rate, labor efficiency, machine rate, machine efficiency, scrap, and yield account references for downstream cost posting
- [sales](../sales/README.md) — Optional demand signal source for make-to-order or priority-driven production planning
- [purchase](../purchase/README.md) — Optional material availability and ETA signal source for release decisions and shortage visibility
- [product-management](../product-management/README.md) — Optional product or variant metadata source when aligning commercial catalog structure to manufacturing definitions
