Units of measure
Buy in cases, hold in eaches, sell in either — with one conversion definition doing the arithmetic.
Inventory → Units of measure.
An item has a base unit — the unit stock is held and costed in. Around it you define related units with a conversion: 1 case = 24 each, 1 pallet = 40 cases.
Then set defaults: a purchasing unit, a stocking unit and a selling unit. A PO in cases receives 24 eaches per case; an invoice in eaches relieves the right quantity; the valuation stays in the base unit throughout.
Why not just do the maths yourself: because a mis-keyed conversion on a receipt is a costing error that survives every subsequent transaction. Defining it once means it can only be wrong once.
Conversions must be exact — a unit that does not divide evenly into the base is rejected rather than rounded.