Stock balances and inventory
Table of contents
Introduction
The inventory describes which articles are in stock. There are several different functions for retrieving the inventory data from the API:
- GetInventoryByQuery - Returns the inventory information for a selection of articles, summarized per article.
- GetInventoryPerWarehouse - Returns the inventory information for all articles, summarized per article and warehouse. This function is only of interest if the goods owner keeps items in several different warehouses.
- GetInventoryItems - Returns detailed stock information, not summarized per article. This function can be used, for instance, if you want to know exactly which serial numbers or batches are in stock.
Note that these functions also return the basic article data (such as weight, dimensions and description) for each article. There is no separate function for getting the basic article data. Thus, in order to get the article registry, GetInventoryByQuery should be used.
Sellable number of items
When you call GetInventoryByQuery, the response will contain a field called SellableNumberOfItems. This is the number of items which can still be sold. If you create an order for an item, then the sellable number of items will be decreased accordingly.
If the article is a kit article (that is, an article which is defined in terms of other articles), then SellableNumberOfItems will be the minimum of the sellable number of items of each sub-article.
If you are integrating with a web shop and wish to display the remaining quantity which can be sold, then SellableNumberOfItems is the field to use.
This value may be negative.
Physical stock balance
When you call GetInventoryByQuery, the response will contain a field called NumberOfItemsDecimal. This is the number of items which are physically present in the warehouse.
This value will always be greater than or equal to 0.
Advanced topics
We believe that most integrations will never need anything other than SellableNumberOfItems or NumberOfItemsDecimal (described above). But if you are interested in the advanced details of how Ongoing WMS handles stock balances, we have described them below.
The different quantities in GetInventoryByQuery
When you call GetInventoryByQuery, the response will contain several different quantities for each article:
NumberOfItemsDecimal
NumberOfItemsDecimal is the total, physical stock stored in the warehouse.
NumberOfBookedItemsDecimal
NumberOfBookedItemsDecimal is the number of items which have been ordered but which have not yet been picked.
AllocatedNumberOfItems
AllocatedNumberOfItems is the number of items which have been allocated to orders but have not yet been picked. Some warehouses use this two-step process of first allocating goods, and then picking them. Other warehouses use a one-step process (directly picking the goods), in which case AllocatedNumberOfItems will always be 0.
NumberOfLockedItems
NumberOfLockedItems counts article items where either:
- the article item is allocated (the allocated quantity can also be accessed via AllocatedNumberOfItems),
- the article item is in a warehouse location which has been locked,
- the article item is subject to stock-taking activities, or
- the article item is locked by the warehouse workers for other reasons (e.g. the item could be of unknown condition and is under investigation).
LockedForSaleNumberOfItems
LockedForSaleNumberOfItems counts article items where either:
- the article item is allocated (the allocated quantity can also be accessed via AllocatedNumberOfItems),
- the article item has been specifically locked for sale.
ToReceiveNumberOfItems
ToReceiveNumberOfItems has no relationship to the rest of the values. It describes how large a quantity of goods is expected to arrive in the warehouse, that is, how large a quantity exists on a purchase order but is not yet received.
PickedToBeCollectedNumberOfItems
PickedToBeCollectedNumberOfItems is the number of items which have been picked by the warehouse, and which are on orders whose statuses are strictly below "Collected" (< 500). That is to say, this is the number of items which have been picked by the warehouse but where the warehouse does not yet consider the orders to be completely done. This field is generally only used by ERP integrations when running the daily stock comparison.
ReceivedToBeFinishedNumberOfItems
ReceivedToBeFinishedNumberOfItems is the number of items which have been received and which are on inorders whose statuses are strictly below "Received" (< 500). That is to say, this is the number of items which have been received by the warehouse but where the warehouse does not yet consider the inorders to be completely done. This field is generally only used by ERP integrations when running the daily stock comparison.
SellableNumberOfItems
This is the number of items which can still be sold. If you create an order for an item, then the sellable number of items will be decreased accordingly.
If the article is a kit article, then its SellableNumberOfItems will be the minimum of the SellableNumberOfItemss of all the sub-articles.
Venn diagram illustration
The following Venn diagram illustrates the relation between the different quantities.
Stock balance formulas
ERP daily comparison formula
In integrations with ERP systems, it is common to run a daily comparison between the stock balances in Ongoing WMS and the stock balances in the ERP. In this case, neither the physical stock balance nor the sellable balance is of interest.
What is required here is a formula which takes into account the fact that:
- Items may have been picked in Ongoing WMS, but the ERP does not yet know about them because the warehouse has not yet finalized the order, and
- Items may have been received in Ongoing WMS, but the ERP does not yet know about them because the warehouse has not yet finalized the inorder.
ERP-stock-balance = NumberOfitems + (1) - (2)
To compute (1), make a call to GetOrdersByQuery and specificy OrderStatusTo = 449 and OrderSpecialFilters.HasPickedArticleItem = true. Then group the returned order lines by article and sum the PickedNumberOfItems for each order line.
To compute (2), make a call to GetInOrdersByQuery and specificy OrderStatusTo = 399 and InOrderSpecialFilters.HasReceivedArticleItem = true. Then group the returned purchsae order lines by article and sum the ReceivedNumberOfItems for each order line.
The difference between GetInventoryByQuery and GetInventoryItems
The fundamental difference between GetInventoryByQuery and GetInventoryItems is that:
- GetInventoryByQuery will summarize the various quantities per article.
- GetInventoryItems will simply give you the raw data, without any summarization.
- Which serial numbers are in stock?
- Which batches are in stock, and how many of each?
- What is the article item status ("Blocked", "Quarantine", "Investigation", etc) of each item?
- Which warehouse locations are used for my goods?
As an example, let us say that you have an article called A1 with the following items in stock:
- 5 pieces with batch number B1.
- 10 pieces with batch number B2.
- The first InventoryItem will have Batch = B1 and NumberOfItems = 5.
- The second InventoryItem will have Batch = B2 and NumberOfItems = 10.