IEMSuite
Inventory & stock control7 min read

FIFO vs FEFO allocation

How IEMSuite decides which lot to consume - oldest first (FIFO) or soonest-to-expire first (FEFO) for dated products.

Which lot gets used first?

When a product has stock sitting in more than one lot, something has to decide which lot to draw from. Get that decision wrong on a product with a shelf life and you ship the wrong jar: the one that expires in three weeks stays on the shelf while the fresh one goes out the door, and three weeks later you write it off.

IEMSuite makes the decision for you, every time, using one of two strategies. You do not choose between them in a settings screen. The product decides.

FIFO - First In, First Out

FIFO draws from the oldest received lot first. It is the right default for anything that does not expire: packaging, hardware, components, raw materials with no shelf life. Stock keeps rotating, and you do not end up with a pallet from eighteen months ago in the back of the rack while newer stock gets consumed.

Ordering is by receive date, oldest first.

FEFO - First Expired, First Out

FEFO draws from the lot that expires soonest, no matter when it arrived. A batch received last week that expires next month goes out before a batch received last month that expires next year.

This is the strategy that matters for food, beverage, cosmetics, supplements, and pharmaceuticals. It is also the one that gets skipped when allocation is a human decision made in a hurry, which is why the rule lives in the allocation engine rather than in a procedure someone has to remember.

How IEMSuite picks between them

There is no setting to flip. The rule is:

Product hasStrategy usedSort order

|---|---|---|

No lot with an expiry dateFIFOReceive date, oldest first
At least one lot with an expiry dateFEFOExpiry date, soonest first

Giving a product a shelf life, or receiving a single lot with an expiry date, is enough to switch its rotation. See Creating a product for where shelf life is set and Receiving stock for where expiry dates come in.

A worked example

You need 50 kg of raw sugar for a production batch. You have three lots:

LotQuantityReceivedExpires

|---|---|---|---|

SUG-A20 kg3 March30 September
SUG-B35 kg12 March15 August
SUG-C15 kg1 Aprilnone recorded

Because at least one lot has an expiry date, this product allocates FEFO. The engine takes:

  • 35 kg from SUG-B, because 15 August is the nearest expiry
  • 15 kg from SUG-A, the next nearest, to make up the remaining 15 kg

SUG-C is untouched. Lots with no expiry date sort after dated lots under FEFO, and are ordered among themselves by receive date. That ordering is deliberate: an undated lot has no deadline, so it can wait, while a dated one cannot.

Under FIFO, the same request would have taken 20 kg from SUG-A and 30 kg from SUG-B, purely by arrival order.

Note that the requirement was filled across two lots. Allocation splits automatically; you do not have to find a lot large enough to cover the whole line.

What can never be allocated

Four kinds of stock are excluded before the sort even runs:

  • Expired lots. Any lot whose expiry date is in the past is filtered out of allocation entirely. It stays in your stock records - you still need it for traceability and write-off - but it cannot be picked, by FIFO or FEFO or by hand.
  • Lots awaiting inspection. A lot in PENDING_QC is not available stock. See Creating a QC inspection.
  • Quarantined lots. A failed or conditional inspection puts the lot in QUARANTINE, and allocation refuses it until the non-conformance report is resolved.
  • Rejected lots. Terminal state, never allocatable.

Only lots marked AVAILABLE are candidates. This is enforced in the allocation query itself rather than checked afterwards, so there is no path through the product - order, shipment, production batch - that can consume stock which has not cleared QC.

When there is not enough stock

If the available lots do not cover the full quantity, IEMSuite allocates what exists and leaves the rest short rather than silently rounding down or overselling. You then decide: ship partially now, or wait for the next receipt. Orders can also hold a pending-stock reservation that fills when the stock arrives.

Two orders racing for the same last unit cannot both win. Allocation runs inside a database transaction with a row-level lock on the source lot, so the second one fails the guard and rolls back instead of creating an oversell.

Overriding the suggestion

Automatic does not mean locked. On the shipment screen and on production batch consumption, the pre-selected lots are shown with their quantities, expiry dates, and reservation status, and you can pick different ones. Real reasons to override:

  • A customer contract specifies a lot or a production date
  • The correct lot is behind three pallets and a later one is at the front
  • A lot is being held for a specific order and you would rather not break it up

The override is recorded like any other stock movement, so the audit trail still explains why a lot left the building out of order.

Where allocation happens

  • Order fulfilment, when you create a shipment
  • Production, when a batch consumes raw materials against its recipe
  • Manual consumption, when stock is used outside a batch

The chosen lots are visible on the shipment and on the batch, which is what makes forward and backward traceability work later: given a customer, you can reach the ingredient lots, and given an ingredient lot, you can reach every customer who received it.

FAQ

What is the difference between FIFO and FEFO in one line?

FIFO takes the oldest received lot; FEFO takes the soonest to expire.

Which one should I use?

You do not pick. Products with an expiry date use FEFO, everything else uses FIFO.

What happens to lots with no expiry date on a FEFO product?

They are still usable, but they sort after every dated lot. Dated stock has a deadline; undated stock does not.

Can an expired lot ever ship?

No. Expired lots are excluded from allocation, and they cannot be selected manually either.

Does FEFO work if I do not record expiry dates?

It falls back to receive-date order, which is FIFO by another name. If you sell perishable goods, record the expiry date on every inbound line - that field is what the whole rotation depends on. See Lot and expiry tracking.