01The problem
One product can carry several units of measure with different rules. The quantity per pack is not consistent, the structure can run five levels deep, and damaged goods still have to be valued down to the smallest unit.
02The approach
Give every product its own unit ladder from a base unit upward, record movement rather than a stored count, and resolve damage down the ladder instead of rounding it to the pack.
An internal application for a staple-goods warehouse: what came in, what went out, what is on its way, and what is actually on the shelf right now.
It is unglamorous software with an exacting core. Stock is only as good as the arithmetic underneath it, and in this warehouse the arithmetic did not want to cooperate.