Here is my approach to balancing stockouts against excess inventory for staple (steady-selling) items where the main issue is volume and randomness in the demand stream. Also accounts for item margins. https://github.com/raagnew/Optimal-Retail-Inventory-Turnover
Theyhave a warehouse with thousands of products stored. When a client purchases a product A the clerck at the checkout uses the product barcode and with this removes the number of units of A purchases form shelves and in storage
When the A product reaches a certain limit, automatically a new order is placed for supply
This limit is computed as a function of several issues such as idle capital held in storage by tha total numbe rof units of A, replenish time from the supplier, maintena nce, etc. There is a very-well known and simple formula, easily found in Internet.
Of course, the supermarket can correct any data at any time.
In this way the supermatket maintain a suitable inventory to satisfy demand, frees storage space, and works with the minimum storage cost
Based on my experience with automotive industries. Knowing the market share of business and product demand in the market can control the surplus production and inventory control efficiently. The cost effective tools like Enterprises Resource Planning (ERP) systems integrated with Radio Frequency Identification (RFID) or IoT devices are automated to track the products.