Skip to content

PRD: Stock Locations & Levels

ModuleInventoryPRD IDPRD-STK-001
StatusSupersededFEATSTK
EpicPlane
Date2026-07-13Versionv1.0
Packages@nx/inventoryURDSTK
SurfaceClient · Owner/MgrBO · Ops
OwnerPhát Nguyễn

What stock locations and levels are

A merchant can hold goods in several inventory locations: a main warehouse, a bar counter, a kitchen. Several merchants sit inside one organizer. Locations nest into a tree, and every merchant always has exactly one default location.

A stock item is one item at one location. This is where stock is actually recorded: open a stock item and you see where the goods are, how many are left, and how many of those can still be sold. This PRD builds that foundation for the whole Inventory module.

The four stock numbers

These four numbers are the subject of this PRD, and every other Inventory PRD quotes them from here. Each item at each location carries:

NumberWhat the system calls itMeaning
On-handon-handThe goods physically sitting on the shelf, touchable, countable
ReservedreservedAlready promised to a sale order or a transfer ticket; still on the shelf, but no longer sellable to anyone else
AvailableavailableThe part that can still be sold
IncomingincomingAlready left the source location, not yet arrived here; visible, but not yet sellable

The invariant, true at every moment:

Available = On-hand - Reserved

Why one stock number is not enough

A bubble tea merchant has a bar counter up front and an ingredient store in the back. A retail chain has a main warehouse and many stores. If the system keeps a single "how much is left" number for the whole merchant, the cashier at store A has no idea the goods are sitting at store B, and the person doing a stock count has no idea where to count.

The second problem is the stock number itself. One number cannot answer the question that matters most to a seller: how much can I still sell. Goods on the shelf may already be promised to an order in checkout, or packed into a pending transfer. The seller looks at available, the person doing the count looks at on-hand, and both are right.

One item, from receipt to sale

Coke at the Cold zone. The low-stock threshold on this stock item is 15.

What happensOn-handReservedAvailableIncoming
Receive 10 cans into the Cold zone100100
The cashier taps 3 cans into an order10370
The customer pays, the order completes7070
A transfer ticket sends 5 cans to the Cold zone7075
The Cold zone counts 5 cans and receives them120120
  • Tapping an item into an order does not move on-hand. The goods are still on the shelf; what drops is available.
  • Available ends at 12, below the threshold of 15, so the Stock screen flags a low-stock warning right on this stock item's row.
  • Open "Main warehouse", the parent of the Cold zone, and you read the rolled-up stock of itself plus every zone inside it.

The easiest thing to get wrong

Available is not a column somebody updates by hand

Available = On-hand - Reserved is enforced directly at the database layer. Any write that breaks the equation is rejected at the storage layer.

A new stock write that updates the numbers in the wrong order still cannot leave behind a stock item whose three quantities disagree. The system does not rely on each code path remembering to do the math right.

The consequence: reserving stock for a sale order drops available immediately, on every POS terminal, without moving on-hand by a single unit.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.