When the inventory management comes out of the warehouse, it decreases gradually corresponding to the earliest single remaining quantity in the warehouse.

problem description

there is a fixed number of incoming and outgoing orders when leaving the warehouse, and you need to subtract the remaining quantity of the entry orders when you complete them. Because the quantity is uncertain, the earliest completed purchase orders are not certain, which is troublesome.

the environmental background of the problems and what methods you have tried

calculate the total inbound amount of all incoming orders, sort by time and calculate a column of the cumulative sum of the remaining total. Compare the column of this cumulative sum with this outgoing order, and the amount of storage is reduced if the column is less than the outgoing order. But the result is not negative (that is, all less than 0 are 0), and then update this value to the surplus of each order.

what result do you expect? What is the error message actually seen?

accurate inventory leftover

Nov.09,2021

analyze by manual operation:

:=
:
:
    1 x
    2 x0
    3if x0 >= x
         = x0 - x
        x = 0
       else 
         = 0
        x = x - x0
         2
Is that what

means?

Menu