Forum: Ruby on Rails Inventory/warehouse management, order picking etc...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
92ce537e2c732b0300d9ea97f6bf3fe3?d=identicon&s=25 Andrew Edwards (Guest)
on 2008-10-15 13:24
(Received via mailing list)

Apologies if this isn't the best fit for this group.

Does anyone know of any rails based warehouse management systems (I
have looked, but with little result)? Including inventory tracking and
order picking?

I'm currently working on such a rails project for our small retail/
wholesale business and am struggling to pin down the model
(specifically inventory tracking, modeling transactions to represent
movements between available, allocated, document shortages etc).

I could really do with either researching a similar project or
speaking to some involved in a similar project.

If there anyone out there with dev experience in this domain type and
who wouldn't mind a short chat drop me a line.

Thanks, Andrew.
36f02ca8773a0bdc3f2d90a932c1b8b3?d=identicon&s=25 (Guest)
on 2008-10-15 17:08
(Received via mailing list)
I've developed a family of inventory related products but don't
understand what you mean by 'order picking'. In my systems the user
would transact items out of a location, thus decrementing the balance
and building a transaction for each occurance.
My application is designed to handle many distinct companies in an
SaaS business model.

On Oct 15, 5:22 am, Andrew Edwards <>
C5b3b9acd960574f2744f1fbb5b5ee66?d=identicon&s=25 Erik (Guest)
on 2008-10-15 17:43
(Received via mailing list)
Where can I see a demo of your app.? :)

On Oct 15, 8:07 am, "" <>
92ce537e2c732b0300d9ea97f6bf3fe3?d=identicon&s=25 Andrew Edwards (Guest)
on 2008-10-15 17:56
(Received via mailing list)

This reply ended up exploding in size, sorry! It details the overall
methods I'm employing, maybe you might spot any paths you've taken or
even rejected.

Thanks for taking the time to reply.

Are any of your products promoted on the web, or do you deal on a more
personal basis with clients?

I think I'm getting in fuss about the actual audit trail of inventory
in terms of cradle to grave. I also need to track by delivery batch so
that I can maintain a FIFO when required. It is possible I'm
overcomplicating by trying to simplify things to a more abstract
concept. I started looking at tracking inventory around double entry
accounting principles.

I have models such as:

class InventoryAccount < ActiveRecord::Base
  belongs_to :product
  belongs_to :storage_location

  has_many :inventory_account_entries
  has_many :transactions, :through => :inventory_account_entries

class InventoryTransaction < ActiveRecord::Base
  before_save :check_transaction_balances
  has_many :inventory_account_entries


  def check_transaction_balances
    # check the account entry amounts have balancing debits and credits

class InventoryAccountEntry < ActiveRecord::Base
  belongs_to :inventory_account
  belongs_to :inventory_transaction

However it becomes complicated as every possible class of product
inventory needs a separate account. For example Product1 would need
account records for:

Product1, Income Account
Product1, Error Account
Product1, At Location 1, Available, From PurchaseOrder1
Product1, At Location 1, Available, From PurchaseOrder2
Product1, At Location 1, Allocated, From PurchaseOrder1
Product1, At Location 1, Allocated, From PurchaseOrder2

That's 6 accounts just for one product, and each time a new batch
arrives it would also create account objects for each location it is
placed in. I was initially worried that this might make it massively
unmanageable after a while but I suppose it is just disk space.
Eventually every batch accounts would migrate towards a zero balance,
after which they never really need to be referenced unless to look up
previous stock movements. Does this sound logical?

I could almost visualise this working but am struggling to keep the
concept when you need to transfer stock to sales/despatch orders.

Roughly, my sales order processing and despatch models are structured
as follows:

class Customer < ActiveRecord::Base
  has_many :sales_orders
  has_many :despatch_orders
  has_many :invoices

class SalesOrder < ActiveRecord::Base
  belongs_to :customer
  has_many :sales_order_lines

class DespatchOrder < ActiveRecord::Base
  belongs_to :customer
  has_many :despatch_order_lines

class Invoice < ActiveRecord::Base
  belongs_to :customer
  has_many :invoice_lines

class PickingBatch < ActiveRecord::Base
  # picking trolley has fixed number of locations and decides the
maximum number of despatch orders per picking batch
  belongs_to :picking_trolley

  has_many :despatch_orders
  has_many :despatch_order_lines, :through => :despatch_orders

  def optimise_picking_order
    # assign a sequence number to each despatch_order_line in such a
    # way that lines from different despatch_orders are interleaved
during picking
    # to achieve an optimal route around the warehouse

Inventory is allocated to the sales_order which then creates a
despatch order. The despatch order is picked and on pick completion
triggers payment collection at which point an invoice (receipt) is
generated. The picked despatch order then generates a despatch note
and is sent for packing before being barcode scanned to confirm
confirm packing and despatch.

I think the sticking point for me is how to integrate stock movements
using the above double entry method with my SOP models (sales_order,
despatch_order etc). In theory each despatch order (or despatch order
line) would need it own account so stock flowed between
inventory_account_entries from the product income account to the
eventual resting place on the despatch_order_line.

Or maybe I should take a completely different approach (read
simpler!), although I do like the elegance of the double entry
accounting model.

Thanks, Andrew.

On Oct 15, 12:22 pm, Andrew Edwards <>
D188e591eac11021329b8821a5f954c7?d=identicon&s=25 Ar Chron (railsdog)
on 2008-10-15 18:21
> If there anyone out there with dev experience in this domain type..

I'm in a different domain but we face similar issues.

   Cusotmers, orders, line items, and products would be the bare bones
I'd think to start bootstrapping an application.
   At the bottom of the application, there would be a products table
with a record for each thing that you sell. Each of those products would
have a physical "on-hand" count of inventory, an allocated count, and
available (just on-hand - allocated). How you manage those numbers
depends on how much you "game" your supply chain.
   When a customer places an order, the "allocated" number would
increase by the units requested, available is just inventory -
allocated. When the order is actually fulfilled (i.e., the item is
physically picked and put in a box, or on a truck, or whatever), the
allocated count drops by x units, and the inventory count drops by x
units as well. On products, you'll probably want to set a lower
threshold for on-hand inventory, to prompt an order from your supplier
(sounds like an after_update filter in Rails).
   "Gaming" your supply chain involves scenarios like "We have 10
widgets on hand today. Customer A, at 9:00am, ordered 7 for delivery
next Wednesday. Physical inventory is still 10, available is only 3.
Customer B, at noon, requests 5 for delivery tomorrow.
   If you don't game your supply chain, you tell Customer B "Sorry, I
only have 3 available, but I can get you 5 in (today + time to receive
widgets from supplier)."
   If you're sure (here's the gaming part) your supplier can get at
least 2 more widgets to you before next Wednesday if you order today, go
ahead and sell and ship the 5 to Customer B today, and place your order
for widgets today.
   Walk-in purchases are just another form of Customer B.

The nice thing about Rails is that you can easily extend an application.
Start small... take note of how your current physical processes work,
model your physical artifacts (product information, an order form, a
customers file) in the database, then hook up the behaviors in the
   Run the app in parallel with your current process to see if your
application accurately reflects reality, tweak and tune and when your
app does everything your need (or can make do with), drop the paper.
This topic is locked and can not be replied to.