Orders, suppliers and partnerships
Formulation and production are only part of the picture. Materials have to be sourced, ordered, received, and costed before they ever reach a batch. This post covers how Plan.Make.Trace models the commercial side of that process.
What we built
Three connected domain areas: companies and partnerships, orders, and the receipt and costing mechanics that bring inventory into the system when goods arrive.
A company is an external organisation. A partnership is the business relationship between the account and that company: supplier, stockist, or another type. An order is a commercial transaction between two parties, linked to the partnership that governs it. Receiving a line on an order creates the physical inventory items and calculates what those units actually cost.
The problem it solves
The manufacturing process needs more than purchasing. Materials come in through purchases, but finished products eventually move out through sales and other transactions. Rather than build purchasing as the architectural centre and bolt other transaction types alongside it later, the order domain models any commercial transaction and the order type defines what kind it is. The structure works the same whether the transaction is inbound or outbound.
Separating company from partnership solves a real usability problem too. A company can be both a supplier and a stockist, with different contacts for each relationship. Those concerns belong on the partnership, not on the company record. You need to speak to a supplier: the partnership tells you who that is. Staff can also rate partnerships, giving the wider team useful context about their experience with each partner. All of these records support comments for additional context that does not fit neatly into a field.
The challenge
The landed cost problem is the most interesting part: knowing what inventory actually cost once shipping, tax, discounts, and other order-level charges are accounted for. Those costs cannot stay on the order header. They need to flow through receiving into the physical inventory units the order produced, so that when a batch draws from stock, the cost of what it consumed is accurate.
The allocator distributes order-level costs across lines by category, preserves any allocations the user has edited by hand, and assigns the remainder deterministically so that per-unit costs always reconcile exactly with the transaction totals. That reconciliation requirement is what makes the problem specific: the numbers have to add up in both directions.
What makes this different
Order, order item, and partnership all carry full state lifecycle through Dawnshard's existing state graph infrastructure. Lifecycle rules, transition guards, and cancellation cascades are expressed in the graph rather than scattered across service logic. No Dawnshard core changes were needed to support any of it.
The same applies to RBAC, field-level access, and audit. These are substantial commercial domains with real access control requirements, and they inherit all of that from the existing infrastructure. The domain code focuses on the things specific to orders and partnerships.
What this unlocks
A soap maker can record their supplier relationships, raise purchase orders, and receive goods into inventory with costs that carry through from the order. That chain of custody from supplier through order through physical stock is the foundation for tracing materials through the manufacturing process.
It also means the business side of manufacturing is part of the same connected system as the production side, rather than being managed separately and reconciled by hand.
What's next
The next post covers inventory and materials: how Plan.Make.Trace tracks physical stock and connects what was received to what gets consumed in production.
Liked this post? Tap the heart to let us know.
Get early access
Be the first to hear about early access, roadmap updates, and exclusive early adopter pricing.
Join the early access list