Back to Home

Warehouse management system using CQRS and Event Sourcing. Statement of requirements

magento · magento 2 · event sourcing · event-sourcing · warehouse management · catalog inventory · cqrs

Warehouse management system using CQRS and Event Sourcing. Statement of requirements

    image

    The Omnichannel concept has recently become popular when, in order to improve the quality of customer service, various sales channels are integrated into one. And no matter how and where the sale is made, it makes sense for the seller to combine all the sales channels in order to fulfill the order. In practice, this means that no matter the client came to you offline, made an order on the site, in a mobile application or in telephone mode, you should use all available means to complete it. And for you, as a seller, each individual channel should not be a big difference. Presentation of omni channel on the example of Frankfurt airport (English).

    To integrate the above, it is very important for the seller to be able to integrate inventory levels. Because the retail infrastructure can be quite complex and combine external warehouses, shops, stores with the possibility of ordering goods to the store (store pick-up), dropshipping (a trading scheme in which you sell products of the supplier company, which itself sends them to the buyer from Your name, and you only accept money from the buyer).


    image

    Since we are developing a framework, and not a specific solution with turnkey integration for a specific business, the set of requirements for us turned out to be quite wide.
    Key requirements include:
    • The inventory management system should not be a bottleneck during checkout when an order is placed. Those. there should be no synchronous checks of the relevance of the availability of products at each warehouse, and potential blockages accompanying them.
    • The system must support asynchronous order processing, in which the creation of the order itself will not be an operation that changes the state of the system. And the team will only be registered, which will need to be processed subsequently. Thus, a time-critical operation of placing an order will take place very quickly and without any locks. Such an implementation can be seen, for example, at Amazon, when after successful placement of the order and payment, the buyer may receive a letter in time notifying that the system cannot complete the order, because there are not enough goods in the warehouse and it returns the money. On the one hand, this can worsen the customer’s experience, but for sellers with large warehouses who make hundreds of thousands of sales per day, this risk is justified in order to speed up the process of placing an order.
    • The system should provide various algorithms for the delivery of goods from several warehouses to the end user. For example, in the simplest case, it can be priority delivery, where each of the delivery sources is indicated by priority, and the system will go by this priority trying to take the maximum of goods to fulfill orders from each warehouse. More elemental algorithms involve determining the minimum shipping cost (Minimal Shipping Cost) separately for the client and seller.
    • The inventory management system should provide the value of a certain aggregate flow for a particular product within the current context, at the front end for buyers. And this value is taken into account when selling a product or when evaluating whether we have run out of stock or not yet. This is necessary in order not to count stocks for each product in runtime, especially on such critical pages as the old page of the product category, this can take enough time and slow down productivity.
    • The system should support a reservation mechanism when a seller can reserve a sale, for example, for his wholesale customer, which must be completed on time. After that, the reserved products cannot be sold through other sales channels to other customers.
    • The system should provide a mechanism for controlling the load of warehouses and other physical places of goods placement. To be able to plan and organize the logistics and delivery of goods when stocks need to be replenished.
    • To support the previous paragraph, a special set of conditions for the product must also be introduced in order to solve such problems: the goods are sold, but have not yet been shipped from the warehouse, respectively, still occupies a place in the warehouse, and we cannot import new goods into this warehouse. Also, goods that have been returned by the buyer may not always immediately return to stock. Sometimes a product is returned due to a malfunction or a defect, respectively, such a product should be processed separately.
    • Dropshipping Support
    • The system should provide the flexible ability to map physical warehouses to sales channels. About this item separately


    Mapping physical warehouses and vaults to sales channels


    image

    This diagram shows the various mapping options for physical warehouses where goods are located on sales channels. Sales channels mean ways of delivering goods to the market and their subsequent sale. For example, in terms of Magento, this can be a Website, but with the advent of B2B, a separate sales channel can be a wholesale client for which you have a separate discount, and which can be traded separately with you. In this case, the sales channel will be the Customer Group. Also a good example of a sales channel is a country or region.

    As you can see in this diagram, physical warehouses are combined into a virtual aggregation, which in turn is assigned to a specific sales channel. At the same time, one physical warehouse can serve more than 1 sales channel, and stock from more than one warehouse can be combined within the sales channel. This allows you to achieve maximum flexibility, as well as, if necessary, introduce new sales channels and match existing stocks to them.

    Magento MSI (Multi Source Inventory)


    This article is the first article in the series “Warehouse Management System Using CQRS and Event Sourcing” in which the collection of requirements, design and development of a warehouse management system will be considered using the example of Magento 2.

    An open project where development is being carried out and where community engineers are involved, and also where it is possible to get acquainted with the current state of the project and the documentation, is available at the link - github.com/magento-engcom/magento2/projects

    Read Next