Functional Weave
Code in Python

inventory.reorder-point@1.0.0

README.md

1,082 bytes · view raw

# inventory.reorder-point

The stock level at which to place a replenishment order:

    reorder point = lead-time demand + safety stock
    lead-time demand = demand x leadTimeDays / demandPeriodDays, rounded up

Demand is given per period (units a week, a month, a year) with the period's
length in days, so a daily rate of 33.3 units (1000 a month) needs no float:
the division happens once, exactly, with `math.round-div`.

**Lead-time demand is rounded up**, never to nearest. 1000 a month over a 7-day
lead time is 233.33 units; ordering at 233 plans to run out a third of a unit
early. Safety stock is already whole units and is added unchanged.

Compare the result with stock on hand **plus stock already on order**, or an
order placed yesterday triggers another today.

Zero lead time or zero demand leaves just the safety stock. Negative values and
a demand period of zero days are errors.

Source: the standard textbook definition, e.g. APICS Dictionary ("order point")
and Silver, Pyke and Thomas, *Inventory and Production Management in Supply
Chains*, 4th ed., ch. 6.