Back to Feed
article 3m read

A few missing units kept turning into a whole case in the reorder planner

One code path in my ordering system ignored the vendor's minimum-order setting and rounded every small shortage up to a full case. It now holds those lines for review with the real need still visible, still buys when a busy shelf is empty, and finally counts the back room.

Article DepthPractice

Flow

How one row gets its order

  1. 1Count all the stock

    Package total first, then every room, then zero.

  2. 2Empty and selling a case?

    Yes: round up to a case no matter the setting.

  3. 3Under a case and under the minimum?

    With a review setting: order zero and record why.

  4. 4Otherwise

    Round up to full cases, same as before.

  5. 5Write down the math

    Inputs, demand, each decision and the final numbers on the row.

Whole cases kept being suggested by the reorder planner to cover a gap of a few units. If a store was a little short on something that only comes by the case, the planner rounded the order up to a full case, every time.

That's fine when the gap is close to a case. It's a waste when the gap is tiny, because most of the case is extra. For a slow seller, that extra sits in the back for a long time.

The odd part is that the vendor settings already had a fix. Each vendor has a minimum, set as part of a case, and a rule for what to do below it: round up, let it through, or send it to a person. One path in my code used that rule. The main path, for vendors who only sell full cases, skipped it.

Now the main path checks it too. The minimum is a share of the case, never less than one unit. If the need is under a full case and under that minimum, and the vendor is set to review, the planner orders zero and writes down why. Vendors set to round up still round up.

There's one exception, and you want it. If the shelf is empty and demand is at least a full case, the planner rounds up anyway. It does that on a copy of the vendor settings, so other rows aren't affected. The bar is empty, not low.

Next, make zero mean one thing. A zero row could mean "no need" or "need, but we held off." So a held row keeps its original demand number, sets every order field to zero, switches its action to no-reorder, and gets its own label. That way the totals and the lines agree. The test uses a made-up product with a big case and a small gap, and checks all of that, down to a report total of zero.

Later that day I gave each row a plain record of its own math: inputs, demand, the decision at each step, what the case rule did, and the final numbers. When my sales tool says buy and the ordering system says no, I read that record.

Last, check the stock number under all of this. My inventory feed only counted the sales floor, not the back room. Too little stock on hand means too much need, and case rounding makes that worse. Now it uses the total for the package, then the sum of every room, then zero. In the test, the count jumped about twentyfold once the back room was in.

Keep reading

Pick up a connected idea or branch into a nearby one.

5 paths forward