How to calculate reorder quantity based on current stock, lead time and 30-day velocity

28 Views Asked by At

I'm running into an issue with my code where I can't seem to accurately calculate the reorder quantity of my inventory and need some help brainstorming possible solutions. I'm taking data from a CSV spreadsheet that includes the current stock, the product ID (ASIN), lead time and 30-day velocity represented as a ratio (say 1.5 is one and a half units per day average)

Here is the part of my code I'm running into trouble with:

reorder_quantities = {}
total_velocity = 0
csv_data.each do |row|
  asin = row['ASIN']
  current_stock = row['On Hand']
  velocity = row['Last 30 Days'].to_f
  min_stock = 10
  total_velocity += velocity
  reorder_quantities[asin] = { velocity: velocity, safety_stock: min_stock}
end

reorder_quantities.each do |asin, data|
  velocity_ratio = data[:velocity].to_f / total_velocity
  reorder_quantity = (data[:safety_stock] + data[:velocity]) * velocity_ratio
  reorder_quantities[asin][:reorder_quantity] = reorder_quantity.round(2)
end

  reorder_quantities.each do |asin, data|
    puts "Product: #{asin}, Reorder Quantity: #{data[:reorder_quantity]}"
  end

historically I've just eyeballed the amount needed by looking at the current stock and and considering the sales velocity. For example, if the current stock is 25 and the 30-day velocity is 1.14, I would just assume that I need to order about 40 more units of that product. If the velocity is 0.5 and the stock is 40, I'd say about 20 units.

I wanted to get different takes on this because my method of calculating is resulting in ridiculously high (or low) reorder quantities and I'm just not 100% sure how to calculate this in a consistent way. I've also tried calculating this by multiplying current stock * sales velocity * lead time and then subtracting the current stock, but again I'm getting really high quantities that don't align with how much I normally would order. Any pointers would be much appreciated.

0

There are 0 best solutions below