An e-commerce inventory multi-strategy allocation system and method based on directed acyclic graph

By constructing a directed acyclic graph model and a multi-strategy allocation algorithm, the problems of liquidity and response lag in multi-platform e-commerce inventory allocation are solved, realizing intelligent and efficient inventory allocation and synchronization, and improving the real-time response and resource utilization efficiency of e-commerce inventory management.

CN123180902APending Publication Date: 2026-11-27江苏虫洞电商科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611565358.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-10
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies suffer from problems such as loss of inventory liquidity, resource mismatch, delayed response, rigid strategies, and time-consuming calculations in multi-platform e-commerce inventory allocation, making it impossible to achieve intelligent, efficient, and real-time inventory allocation.

Method used

A multi-strategy inventory allocation method based on directed acyclic graphs (DAGs) is adopted. By constructing a DAG model and combining the Kahn algorithm and multi-strategy allocation algorithm, intelligent inventory allocation and synchronization are achieved. It supports weighted strategies and indicator strategies, and uses Redis distributed locks and task state machines to improve system reliability.

Benefits of technology

It enables multi-level, dynamic, and intelligent allocation of inventory resources, improves the real-time response speed and intelligence level of allocation decisions, enhances inventory liquidity and resource utilization, and reduces the cost of human intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180902A_ABST
    Figure CN123180902A_ABST
Patent Text Reader

Abstract

The application discloses an e-commerce inventory multi-strategy distribution system and method based on a directed acyclic graph, relates to the technical field of computer internet, and receives an inventory distribution request and creates a task; a directed acyclic graph structure of a virtual warehouse is constructed; physical inventory data is acquired; unshipped order deduction and SKU dimension reservation are performed to obtain distributable inventory; after topological sorting of the directed acyclic graph, multi-strategy distribution is performed layer by layer, wherein an index strategy adopts a multi-index fusion algorithm, and intelligent distribution is realized through minimum correction, smooth scaling, comprehensive weight normalization and balance adjustment; an inventory update task is dispatched and synchronized to each e-commerce platform. The system comprises a task management module, an inventory distribution task management module and an inventory update task management module, and aims to solve the problems of poor liquidity, rigid strategy, delayed response and inability to consider multi-objective optimization in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer and internet technology, specifically to an e-commerce inventory multi-strategy allocation system and method based on directed acyclic graphs. Background Technology

[0002] Currently, in business practices supporting multi-platform sales systems, the same physical inventory needs to be allocated in real time to a massive number of sales links across multiple e-commerce platforms in order to maximize the utilization of inventory resources and optimize overall business value.

[0003] E-commerce inventory allocation technology focuses on how to intelligently, efficiently, and in real-time distribute limited salable inventory to different sales channels while meeting business rules. This process not only needs to consider the traffic characteristics of each link, but also needs to take into account multiple objectives such as profit contribution, strategic priority, and conversion efficiency, making it far more complex than traditional single-channel inventory management scenarios.

[0004] Existing technologies suffer from systemic flaws in addressing these challenges: Manual static allocation relies on operational experience to solidify quotas, leading to loss of inventory liquidity, severe resource misallocation, and delayed response; simple pooling-based preemptive allocation, while improving flexibility, suffers from a "first-come, first-served" mechanism that allows high-traffic links to monopolize inventory, neglecting the supply guarantee of low-traffic, high-value channels; fixed-rule quota allocation avoids disorderly competition, but rigid rules and frequent parameter adjustments make it difficult to adapt to real-time market changes and achieve optimal returns; while offline optimization schemes based on linear programming and other models possess a degree of intelligence, they are limited by computational time, failing to meet the responsiveness requirements of e-commerce scenarios, and local decisions can easily harm overall efficiency. Therefore, existing methods have significant shortcomings in four dimensions: inventory liquidity, strategy capacity, intelligent decision-making level, and real-time response performance. A novel inventory allocation mechanism that combines structural flexibility, strategy diversity, computational efficiency, and execution reliability is urgently needed. Summary of the Invention

[0005] The purpose of this invention is to provide an e-commerce inventory multi-strategy allocation system and method based on directed acyclic graphs to solve the problems raised in the prior art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a multi-strategy allocation method for e-commerce inventory based on a directed acyclic graph, the method comprising: Step S1: Receive inventory allocation request and create task: Receive external trigger signal, create inventory allocation task containing task ID, SKU identifier, trigger type and task status, add task to Redis sorted set as task queue according to creation time, and ensure that allocation tasks of the same SKU are executed in order, where SKU represents stock keeping unit. Step S2: Construct a directed acyclic graph structure: Read the DAG template configuration corresponding to the SKU, instantiate virtual warehouse nodes, each node contains node ID, node name, node attributes, parent node ID list, child node ID list, inventory allocation strategy configuration and inventory reservation strategy configuration, construct directed edge relationships between virtual warehouses to form a DAG, and automatically query all sales links corresponding to the SKU to create leaf virtual warehouse nodes and add them to the DAG; Step S3: Obtain physical inventory data: Parse the attributes of the source inventory in the DAG root node, call the warehouse management system interface to query the available inventory details, summarize the inventory according to the root node attributes, and fill the results into the original inventory field of the root node virtual warehouse. Step S4: Perform inventory reservation and deduction: Query the unshipped orders corresponding to the SKU, deduct the quantity of unshipped orders from the available inventory of the root node virtual warehouse to obtain the deducted inventory, and then reserve a specified quantity from the deducted inventory according to the SKU-dimensional reservation strategy to obtain the final allocable inventory. Step S5 performs topological sorting and allocation on the DAG: The Kahn algorithm is used to calculate the in-degree of each node. The root node with an in-degree of 0 is added to the node queue. The nodes in the node queue are processed in turn, and their inventory reservation strategy and allocation strategy are executed. The in-degree of the child node is decremented by 1. If the in-degree of the child node becomes 0, it is added to the node queue. The process continues until the node queue is empty, thus completing the acyclic detection and sorting. Step S6 applies a multi-strategy allocation algorithm to calculate the allocation result: Based on the configured weight strategy or indicator strategy, calculate the inventory allocation amount from the parent virtual warehouse to the child virtual warehouse. The indicator strategy uses an indicator fusion allocation algorithm to preprocess, smooth, scale, calculate the ratio, normalize the comprehensive weight, and adjust the inventory allocation for business indicators such as sales volume, conversion rate, and profit margin, ensuring that the total allocation amount equals the allocable inventory. Step S7 generates and schedules inventory update tasks: Traverse the leaf nodes of the DAG, compare the original inventory with the target inventory, and divide the leaf nodes into three categories: inventory increase, decrease, or no change. Prioritize creating and executing update tasks for nodes with inventory decrease and no change. After all of them succeed, create update tasks for nodes with inventory increase. Step S8: Synchronize inventory to e-commerce platforms: Use the adapter pattern to implement a unified inventory update interface for each e-commerce platform, call the platform API to synchronize the allocated inventory to the front-end products, and verify the update results and record logs.

[0007] Furthermore, in step S1, the task queue adopts the first-in-first-out principle. The task state machine defines the task allocation state transition path as pending allocation → pending update → allocation completed. In case of an exception, it enters the allocation failure or retry state. The update task state machine is defined as pending inventory query → pending update → checking → update completed. In case of an exception, it enters the update failure or retry state.

[0008] Furthermore, in step S2, the virtual warehouse nodes are divided into three types: the root node warehouse is used to specify the calculation rules for obtaining source inventory and to summarize physical inventory from the warehouse management system; the intermediate node warehouse is bound to business dimensions such as platform and store for intermediate layer allocation; and the leaf node warehouse is bound to sales links to update the final allocated inventory to the sales links.

[0009] Furthermore, in step S3, the inventory details returned by the warehouse management system include warehouse ID, region, and sales team ID. The system performs dimensional aggregation of inventory based on the bound entity ID of the root node virtual warehouse, for example, aggregating the available inventory quantity of all relevant warehouses by sales team ID.

[0010] Furthermore, the deduction of unshipped orders in step S4 is only performed at the root node, using formula I. available =I original -Qo, where I available For available inventory after deduction, I original For the original inventory, Qo represents the total quantity of all unshipped orders; SKU-level reservations are also only executed at the root node, using formula I. reservedsku =min(R config ,I available ), I allocatable =I available –I reserved,sku , where R config For the configured reserved quantity, I allocatable This is the final allocatable inventory.

[0011] Furthermore, in step S5, the Kahn algorithm performs loop detection simultaneously during the topology sorting process. If the number of processed nodes is not equal to the total number of nodes, it determines that there is a loop in the DAG and terminates the allocation task directly, ensuring the logical correctness of the allocation process.

[0012] Furthermore, in step S6, the weight allocation strategy configures a weight value for each sub-virtual warehouse, allocates inventory according to the weight ratio, and distributes the remainder to each sub-warehouse in descending order of weight. The indicator fusion allocation algorithm of the indicator allocation strategy first applies a minimum value correction I'i,j=max(Ii,j,Mj) to the j-th indicator, where Ii,j is the j-th indicator value of the i-th virtual warehouse node object, and Mj is the minimum value threshold of the j-th indicator. Then, non-positive indicators are offset by I''i,j=I'i,j-min. k (I'k,j)+ε, where ε is a preset positive coefficient, preferably 10. -10 min k (I'k,j) represents finding the minimum correction value for all virtual warehouse node objects under the j-th metric for the i-th virtual warehouse node object.

[0013] Furthermore, in step S6, the data span smoothing scaling step of the index fusion allocation algorithm calculates the data span Sj=maxi(I''i,j) / mini(I''i,j) of the j-th index. When Sj is less than the span threshold Tj and the smoothing scaling coefficient βj is greater than or equal to 0, the transformation I'''i,j=(I''i,j) is applied. βj Otherwise, keep I'''i,j=I''i,j, where βj is used to reduce the difference in indicators within a predetermined interval and to amplify the difference when it is greater than 1.

[0014] Furthermore, in step S6, the inventory allocation calculation step of the indicator fusion allocation algorithm first compares the normalized weight W'i with the allocable inventory I. allocatable The product of the products is rounded up to obtain the initial allocation amount Ai. Then, the difference Δ between the total and the allocable inventory is calculated. If Δ is greater than 0, the allocation amount is reduced by 1 in descending order. If Δ is less than 0, the allocation amount is increased by 1 in ascending order until Δ equals 0.

[0015] Furthermore, in step S7, for leaf nodes with unchanged inventory, the corresponding update task is set to update complete immediately after creation, without needing to call the platform API; for nodes with reduced inventory, the system prioritizes executing their update tasks to release physical inventory, ensuring that the total inventory of each sales link does not exceed the total physical inventory of the physical warehouse under any state.

[0016] Furthermore, in step S8, the adapter pattern encapsulates the inventory update logic for different e-commerce platforms such as Temu, Shein, and TikTokShop, providing a unified interface method to the outside world. This allows new e-commerce platforms to implement only new adapters without modifying the core allocation logic, thus improving the scalability of the system.

[0017] Furthermore, the e-commerce inventory multi-strategy allocation method also includes a task retry mechanism, which configures a maximum number of retries for task allocation and update. If a task fails and is a retryable exception, the retry count is increased and the task is re-added to the task queue. If the maximum number of retries is exceeded, it is marked as a final failure, so as to improve the system's fault tolerance in the face of network fluctuations or temporary failures.

[0018] Furthermore, the multi-strategy allocation method for e-commerce inventory also includes a distributed lock mechanism. When processing the allocation task of the same SKU, Redis distributed locks are used to ensure that the same task is processed by only one service instance in a distributed environment. The lock expiration time can be configured to avoid deadlock, thereby ensuring the consistency of inventory data.

[0019] A multi-strategy inventory allocation system for e-commerce based on directed acyclic graphs; The system includes: a task management module, an inventory allocation task management module, and an inventory update task management module; The task management module is used to receive inventory allocation requests, create inventory allocation tasks and inventory update tasks, add tasks to the task queue, and manage the status transition and retry mechanism of tasks. The inventory allocation task management module is used to allocate physical warehouse inventory to various sales links; The inventory update task management module is used to update the inventory allocated to each sales link to each e-commerce platform.

[0020] The task management module includes: a task triggering and scheduling submodule and a task status management submodule; The task triggering and scheduling submodule is used to receive inventory allocation requests, create inventory allocation tasks and inventory update tasks, and add the tasks to the task queue; the task status management submodule is used to allocate tasks and update task status transitions and retry mechanisms. The task triggering and scheduling submodule is the system's entry point, responsible for receiving inventory allocation requests and initiating the allocation process. Its working principle is as follows: it receives external triggers, including scheduled tasks and manual triggers, and creates inventory allocation tasks. Each task contains the following key information: task ID, SKU identifier, trigger type, and task status. Tasks to be processed are sorted by creation time and added to a Redis Sorted Set as the task queue. The task queue follows a first-in, first-out (FIFO) principle, prioritizing the execution of the earliest created allocation tasks. Multiple allocation tasks can be executed in parallel, but to ensure consistency between available inventory and connected inventory, allocation tasks for the same SKU must be executed sequentially.

[0021] The task status management submodule is used to manage the status transition of task allocation and update, and to implement task retries and exception handling. Its working principle is as follows: the task allocation state machine has a status transition path of: pending allocation → pending update → allocation completed; in case of exception: allocation failure or retry. Update task state machine: The state transition path for updating task status is: Inventory to be queried → Pending update → Checking → Update complete; In case of an error: Update fails or retry; Retry mechanisms include: Configure the maximum number of retries. If a task fails and it is a retryable exception, increment the retry count and add it back to the task queue. If the maximum number of retries is exceeded, mark it as a final failure. Distributed locks: Use Redis distributed locks to prevent the same task from being processed concurrently by multiple threads.

[0022] The inventory allocation task management module includes: a directed acyclic graph construction submodule, a virtual warehouse management submodule, an inventory data acquisition submodule, an inventory reservation and deduction submodule, an allocation algorithm submodule, and a topology sorting and execution submodule; The DAG construction submodule is used to build a directed acyclic graph (DAG) structure for virtual warehouses for each SKU based on a pre-configured DAG template. Its working principle is as follows: It reads the DAG template configuration corresponding to the SKU, which defines the hierarchical structure, parent-child relationships, and strategy configurations of the virtual warehouses; it constructs directed edge relationships between virtual warehouses to form a DAG structure; and it automatically completes leaf nodes by querying all sales links corresponding to the SKU, creating leaf virtual warehouse nodes for each sales link, and matching the corresponding DAG nodes based on the attributes of the leaf nodes, adding the leaf nodes to the DAG. The working principle of the DAG construction submodule also includes instantiating virtual repository nodes based on the template content; Each virtual warehouse node includes: node ID, node name, node attributes such as bound entity type, bound entity ID, platform, store ID, etc., parent node ID list (parentIds), child node ID list (childIds), inventory allocation strategy configuration: how to allocate the current node's inventory to child nodes, and inventory reservation strategy configuration: reserve some inventory in the current node and not allocate it to child nodes.

[0023] The virtual warehouse management submodule manages the hierarchical relationship, attribute information, and inventory status of virtual warehouses. It is the core data carrier of the DAG structure. Its working principle is as follows: virtual warehouses are divided into three types: root node warehouse, intermediate node warehouse, and leaf node warehouse. The root node warehouse is used to obtain the calculation rules of the source inventory. It can specify a fixed value or use a pre-defined calculation rule to summarize the physical inventory obtained from WMS. The intermediate node warehouse is used to bind business dimensions such as platform and store for intermediate layer allocation. The leaf node warehouse binds to sales links and updates the finally allocated inventory to the sales links.

[0024] Each virtual warehouse node maintains the following inventory status: original inventory, available inventory, and sub-warehouse allocated inventory. Original inventory represents the initial inventory quantity, available inventory represents the allocable inventory or remaining inventory after deducting reservations and deductions, and sub-warehouse allocated inventory represents the inventory mapping allocated to each sub-warehouse. The virtual warehouse attributes of the virtual warehouse node include: using a key-value pair structure to store business dimension information, which is used for strategy matching, virtual warehouse matching, and indicator matching, etc. The inventory strategies for virtual warehouses include: strategies for allocating inventory to child nodes, strategies for secondary inventory adjustments, and strategies for reserving inventory dimensions within the virtual warehouse.

[0025] The inventory data acquisition submodule is used to obtain available inventory to be allocated and retrieve physical inventory data from the WMS (Warehouse Management System) as the basic data source for allocation. Its working principle is as follows: parse the attributes of the source inventory obtained from the root node of the DAG to form query conditions, call the WMS interface to query available inventory, and the WMS returns inventory detail data of each warehouse and each area. Then, according to the attributes in the root node, the inventory returned by the WMS side is summarized, and the summarized inventory data is filled into the original inventory field of the virtual warehouse at the root node.

[0026] The inventory reservation and deduction submodule is used to reserve and deduct the inventory of the virtual warehouse before the allocation is executed to ensure the correct execution of business rules. Its working principle includes deduction of unshipped orders and SKU-level reservation. For the root node, query the unshipped orders corresponding to the SKU, and according to the configured deduction strategy (e.g., which part of the inventory should be deducted from the virtual warehouse), deduct the deducted inventory from the available inventory of the root node virtual warehouse as the allocatable inventory. According to the configured reservation strategy (e.g., reservation by priority or by quantity), reserve a certain amount of reserved inventory from the available inventory, which will not participate in the allocation to support specific business scenarios.

[0027] The multi-strategy allocation algorithm submodule is used to calculate the inventory allocation result from the parent virtual warehouse to the child virtual warehouse according to the configured allocation strategy, including weight strategy or indicator strategy. Among them, the working principle of the weight allocation strategy includes: configuring a weight value for each child virtual warehouse, allocating inventory proportionally according to the weight ratio, and sequentially allocating the remainder R to each child warehouse in descending order of weight, ensuring that the total allocated quantity equals the allocatable inventory. The working principle of the indicator allocation strategy includes: performing intelligent allocation based on multi-dimensional business indicators, such as sales volume, conversion rate, profit margin, etc., and adopting an indicator fusion algorithm to comprehensively consider multiple business objectives. The indicator fusion allocation algorithm specifically includes: Step 1: Indicator data preprocessing: Apply minimum value correction to each indicator: I'i,j=max(Ii,j,Mj) where Ii,j represents the value of the j-th indicator of the i-th object, and Mj represents the minimum threshold of the j-th indicator. Offset processing is performed on non-positive value indicators: I''i,j=I'i,j-mink(I'k,j)+ε where ε is a very small constant to ensure all values are positive, with an initial value of 10 -10 ; Step 2: Data span smoothing scaling: Calculate the data span of the indicator: Sj=maxi(I''i,j) / mini(I''i,j); Apply smoothing scaling transformation according to the interval configured for the span: when Sj<Tj and βj≥0: I'''i,j=(I''i,j) βjWhen βj=-1 or Sj≥Tj: I'''i,j=I''i,j where Tj is the span threshold and βj is the smoothing scaling factor. When the value is between 0 and 1, the difference is reduced; when the value is greater than 1, the difference is amplified. Step 3: Calculate the indicator ratio: Calculate the sum of each indicator: , where n represents the total number of objects; Calculate the proportion of each object on each indicator: Pi,j = I'''i,j / Tj; Step 4: Calculate the overall weight: For each object, calculate the weighted composite score: , where αj is the weight coefficient of the j-th indicator, and m is the total number of indicators; Normalized weights: , Step 5: Inventory Allocation Calculation: Preliminary allocation (rounded up): Ai = ceil(W'i × I) allocatable ); Adjust the allocation to ensure the sum equals the allocatable inventory: If Δ>0, decrease by 1 in descending order of inventory; if Δ<0, increase by 1 in ascending order of inventory until Δ=0.

[0028] The topology sorting and execution submodule is used to sort the DAG topology to ensure that the allocation strategy of each virtual warehouse is executed in the correct order and to avoid circular dependencies. Its working principle is as follows: (1) Use Kahn algorithm to sort the topology; (2) Loop detection: check if there is a loop in the DAG. If there is, the allocation will fail directly; (3) Execution order guarantee: the allocation of the parent node is completed before the child node to ensure that the inventory flows from top to bottom. The topological sorting using the Kahn algorithm includes: calculating the in-degree of each node, adding nodes with an in-degree of 0 (the root node) to the queue, processing the nodes in the queue sequentially, and repeating the processing of the nodes in the queue until the queue is empty. The processing of nodes in the queue includes: executing the node's inventory reservation strategy, executing the node's inventory allocation strategy, decrementing the in-degree of all child nodes of the node by 1, and adding child nodes to the queue if their in-degree becomes 0.

[0029] The inventory update task management module includes: an inventory update task scheduling submodule and an execution update task submodule; The inventory update task scheduling submodule is used to create update tasks for each leaf node based on the allocation results, and monitor the execution status of update tasks to schedule them, completing the final step of inventory allocation: updating the inventory allocated to each leaf node to the sales link. Its working principle is as follows: traversing the leaf nodes of the DAG, such as the virtual warehouse of the sales link, first checking the inventory minus the original inventory of each sales link, comparing the original inventory with the target inventory, the leaf nodes can be divided into three categories: virtual warehouse nodes with increased inventory, virtual warehouse nodes with decreased inventory, and virtual warehouse nodes with unchanged inventory. Update tasks are first created for nodes with decreased and unchanged inventory. For nodes with unchanged inventory, after creating the inventory update task, the update task simply sets the task status to success. For nodes with decreased inventory, the update logic is executed. After all update tasks corresponding to nodes with decreased inventory have been successfully executed, update tasks are then created for virtual warehouse nodes with increased inventory. These update tasks are added to the update task queue, awaiting further processing.

[0030] The update task submodule is used to synchronize the allocated inventory to various e-commerce platforms and update the available inventory of front-end products. Its working principle is as follows: it adopts the adapter pattern to implement a unified inventory update interface for each platform, calls the platform API to update the inventory, verifies the update results, and records the update log.

[0031] In summary, this system models the hierarchical structure of inventory allocation using a Directed Acyclic Graph (DAG), forming multi-level allocation paths from physical inventory (root node) to sales links (leaf nodes). The system employs topological sorting to ensure the correctness of the allocation order, utilizes multi-strategy algorithms for intelligent allocation, and supports business rules such as inventory reservation and deduction. The entire process is automated, supporting task retries and exception handling, and ultimately synchronizes the allocation results to various e-commerce platforms, achieving dynamic, intelligent, and efficient inventory allocation.

[0032] Compared with the prior art, the beneficial effects of the present invention are: 1. By constructing a directed acyclic graph model, this invention achieves a multi-level, structured allocation path from physical inventory to multi-platform sales links. During each allocation task execution, the system can acquire the latest business indicator data in real time and dynamically calculate the optimal allocation scheme through a multi-indicator fusion allocation algorithm, effectively avoiding allocation imbalances caused by drastic data fluctuations. Compared to traditional methods relying on fixed rules or offline calculations, this invention significantly improves the real-time response speed and intelligence level of allocation decisions, enabling rapid response to market changes and achieving globally optimal allocation of inventory resources.

[0033] 2. Supports two core strategies: weight allocation and indicator allocation, and manages all strategy parameters through configuration-driven methods. The directed acyclic graph structure is highly flexible and can easily adapt to different business organizational structures, such as sales teams, platforms, and stores, through configuration templates. This design solves the problems of rigid strategies and difficult parameter tuning in traditional manual static allocation and fixed rule allocation modes, enabling the system to support complex, multi-objective business strategies and meet the ever-changing operational needs of cross-border e-commerce.

[0034] 3. A highly reliable execution framework was built using technologies such as task state machines, configurable retry mechanisms, and Redis distributed locks. A clear task state machine facilitates end-to-end tracking and anomaly localization; the retry mechanism effectively handles occasional failures such as network jitter and temporary unavailability of third-party platform APIs, improving the final success rate of tasks; and the distributed lock fundamentally eliminates the problem of inventory overselling or data inconsistency caused by concurrent processing of the same SKU in a distributed deployment environment. These three technologies work together to ensure the stability, reliability, and strong data consistency of inventory allocation and synchronization processes in complex, high-concurrency e-commerce environments.

[0035] 4. Through an automated and intelligent allocation process, inventory is dynamically allocated to high-value channels based on the real-time performance of each link, while a reservation mechanism ensures supply for strategic new products or specific scenarios. Furthermore, the intelligent scheduling strategy for inventory update tasks maximizes the release of physical inventory and accelerates inventory turnover while ensuring data consistency. Overall, this method significantly improves inventory liquidity and resource utilization while reducing human intervention costs. Attached Figure Description

[0036] Figure 1 This is a schematic diagram of an embodiment of an e-commerce inventory multi-strategy allocation system based on a directed acyclic graph according to the present invention; Figure 2 This is a schematic diagram illustrating the inventory reservation and deduction process of an e-commerce inventory multi-strategy allocation method based on a directed acyclic graph according to the present invention. Detailed Implementation

[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0038] Example: Figures 1-2 As shown, the present invention provides a technical solution: an e-commerce inventory multi-strategy allocation system and method based on a directed acyclic graph. Example

[0039] This embodiment primarily describes the inventory allocation process based on a weighted allocation strategy. The weighted allocation strategy is suitable when business personnel can explicitly specify the priority of each sales link. By configuring a weight value for each link, the system allocates inventory according to the weight ratio. This embodiment completes the allocation from physical inventory to sales links through steps such as constructing a DAG structure, obtaining physical inventory, performing reservation deductions, topology sorting, and weighted allocation.

[0040] Step 1: Receive the assignment request and create the task; The system receives external trigger signals, which can be triggered by a scheduled task, manually, or through an event-driven mechanism. In this embodiment, the SKU is set to "SKU-001" and assigned via a scheduled task.

[0041] Create an inventory allocation task object containing the following key information: field names and detailed descriptions. Field names include: task_id, sku, trigger_type, status, retry_times, retry_times, start_time, and status_time. task_id: Task ID, generated using a distributed ID generator; sku: Product SKU identifier; trigger_type: Trigger type: JOB (scheduled task), MANUAL (manual), EVENT (event); status: Task status: PENDING_ALLOCATION (pending assignment); retry_times: Number of retries, initialized to 0; start_time: Task creation time; status_time: Current status time.

[0042] Add tasks to a Redis sorted set as a task queue, and use the task creation time as a score to ensure that tasks are executed in chronological order.

[0043] Step 2: Construct the DAG structure; Read the DAG template configuration corresponding to the SKU. In this embodiment, the DAG template corresponding to SKU-001 contains the following virtual warehouse nodes as shown in Table 1: DAG Template Virtual Warehouse Node Definitions; Table 1:

[0044] Based on the template content, instantiate virtual repository nodes. Each node contains the following information: fields include: id, name, attributes, parentIds, childIds, originalInventory, availableInventory, and childInventory; id: Virtual warehouse node ID, automatically generated by the system; name: Node name; attributes: Node attributes; parentIds: List of parent node IDs; childIds: List of child node IDs; originalInventory: Original inventory; availableInventory: Available inventory; childInventory: Inventory mapping assigned to child warehouses.

[0045] Automatic leaf node completion: Query the corresponding sales link based on node attributes. In this embodiment, the sales link should be queried based on the store and product SKU. Sales team 1001 has two stores (Shop001, Shop002), with a total of 3 sales links; sales team 1002 has one store (Shop003), with a total of 1 sales link. Create a leaf virtual warehouse node for each link. An example of a leaf node is shown in Table 2: Leaf Node Examples. Table 2:

[0046] Step 3: Obtain physical inventory data; The WMS interface is called to query available inventory. In this embodiment, the inventory of SKU-001 under sales teams 1001 and 1002 is queried, and the returned inventory details are shown in Table 3: Inventory Details Returned by WMS; Table 3:

[0047] Inventory is aggregated by sales team, and the calculation results are as follows: Total available inventory for Sales Team 1001: I 1001 =50+30+20=100; Total available inventory for Sales Team 1002: I 1002 =40; Populate the aggregated inventory data into the root node virtual warehouse: Sales Team Warehouse 1001 (Bound Entity ID=1001): originalInventory=100, availableInventory=100; Sales Team Warehouse 1002 (Bound Entity ID=1002): originalInventory=40, availableInventory=40; Step 4: Perform inventory reservation and deduction; (1) Deductions for orders not yet shipped; Check the unshipped orders for SKU-001 under each sales team.

[0048] In this embodiment: Sales team 1001 has 10 unshipped orders. Sales team 1002 has no outstanding orders. Use the formula: Iavailable=Ioriginal–Qo; After deduction: Sales Team Warehouse 1001: Available Inventory = 100 - 10 = 90; Sales Team Warehouse 1002: available Inventory = 40 - 0 = 40; (2) SKU dimension reservation In this embodiment, the SKU dimension reservation quantity is configured to be 5, using the formula: I reserved,sku =min(R config ,I available )=min(5,90)=5I allocatable =I available –I reserved,sku =90-5=85; The available inventory for sales team warehouse 1001 has been updated to 85.

[0049] Step 5: Topological Sort Kahn's algorithm is used for topological sorting, and the in-degree of each node is calculated: Sales Team 1001 Warehouse: In-degree = 0; Sales Team 1002 Warehouse: In-degree = 0; Platform A warehouse: in-degree = 1; Platform B warehouse: in-degree = 1; Store A1 warehouse: in-degree = 1; Store A2 warehouse: in-degree = 1; Store B1 warehouse: in-degree = 1; Leaf node: in-degree = 1; Add the node with an in-degree of 0 (the root node) to the queue: Sales Team 1001 Warehouse, Sales Team 100 Warehouse; Process the nodes in the queue sequentially to generate an ordered list: Sales Team Warehouse 1001 → Platform Warehouse A → Store Warehouse A1, Store Warehouse A2 → Leaf Node; Sales Team Warehouse 1002 → Platform Warehouse B → Store Warehouse B1 → Leaf Node; Loop detection: If the number of processed nodes equals the total number of nodes, there are no loops, and the sorting is successful.

[0050] Step 6: Execute the weight-based allocation strategy sequentially; Based on the topological sorting results, the allocation strategy for each virtual warehouse is executed sequentially.

[0051] (1) Allocation of sales team from warehouse 1001 to platform warehouse A; The sales team's warehouse 1001 has an allocable inventory of 85, with platform warehouse A as its sub-node. Since there is only one sub-node, allocation is done directly: Platform A Warehouse: originalInventory=0+85=85, availableInventory=0+85=85; (2) Allocation of Platform Warehouse A to Store Warehouse A1 and Store Warehouse A2; In this embodiment, platform A warehouse is configured with a proportional reservation strategy, with a reservation ratio of 10%:I reserved,vw =I available ×R ratio =85 × 0.1 = 8.5 ≈ 9 (rounded up) vw,allocatable =I available –I reserved,vw =85-9=76; The available inventory in warehouse A on platform has been updated to 76.

[0052] The available inventory in platform warehouse A is 76 (after deducting the reserved inventory), and the sub-nodes are store warehouse A1 and store warehouse A2.

[0053] Configuration weights: Store A1 warehouse: weight = 3, Store A2 warehouse: weight = 2; Using the weighting formula: ; calculate: Total weight: totalWeight = 3 + 2 = 5; Store A1 warehouse allocation: A1 = floor(3 / 5 × 76) = floor(45.6) = 45; Store A2 warehouse allocation: A2 = floor(2 / 5 × 76) = floor(30.4) = 30; Remainder: R = 76 - (45 + 30) = 1; Remainder Adjustment: Allocate the remainder 1 to store A1, which has a higher weight. Final allocation for store A1 warehouse: 45 + 1 = 46; Final allocation for store A2 warehouse: 30; Update inventory: Store A1 Warehouse: originalInventory=0+46=46, availableInventory=0+46=46; Store A2 warehouse: originalInventory=0+30=30, availableInventory=0+30=30; (3) Allocation of store A1 warehouse → link A1-1 and link A1-2; The allocable inventory in store A1 warehouse is 46, and the child nodes are link A1-1 and link A1-2.

[0054] Configure weights: Link A1-1: weight = 2, Link A1-2: weight = 1; calculate: Total weight: totalWeight = 2 + 1 = 3; Link A1-1 allocation: A1 = floor(2 / 3 × 46) = floor(30.67) = 30; Link A1-2 allocation: A2 = floor(1 / 3 × 46) = floor(15.33) = 15; Remainder: R = 46 - (30 + 15) = 1; Remainder Adjustment: Allocate the remainder 1 to the link A1-1 with the higher weight. The final allocation for link A1-1 is: 30 + 1 = 31; Link A1-2 final allocation: 15; (4) Allocation of store A2 warehouse → link A2-1; The allocatable inventory in store A2 warehouse is 30, and its child node is link A2-1. Since there is only one child node, allocate directly: Link A2-1: originalInventory=0+30=30, availableInventory=0+30=30; (5) Allocation of Sales Team Warehouse 1002 → Platform Warehouse B → Store Warehouse B1 → Link B1-1 Following the same method, the 40 items of inventory in sales team warehouse 1002 were ultimately allocated to link B1-1.

[0055] Step 7: Generate an inventory update task; Traverse the leaf nodes of the DAG to generate inventory update tasks. The results of the update tasks are shown in Table 4. Table 4:

[0056] Step 8: Update the target inventory to the third-party platform; First, the system queries the original inventory of the link corresponding to each update task. To ensure that the total inventory on the link is less than the physical inventory in the physical warehouse at any given state, the system will process all update tasks with decreased inventory first. Only after all update tasks have been updated to UPDATE_SUCCESS will the system process update tasks with increased inventory. For update tasks with unchanged inventory, the state will directly cycle to UPDATE_SUCCESS.

[0057] Select the platform adapter and call the platform API to update the inventory.

[0058] In this embodiment: Links A1-1, A1-2, and A2-1 belong to the Temu platform and are updated by calling the Temu-API; Link B1-1 belongs to the Shein platform and updates by calling the Shein-API; Step 9: Update the inventory allocation task status; The task management module updates the assigned task status to ALLOCATION_SUCCESS and records the assignment result; Aggregate and update status results: Sales Team 1001: Physical Inventory: 100, After Deduction: 90, After Reservation: 85, Final Allocation Result: Link A1-1: 31, Link A1-2: 15, Link A2-1: 30, Virtual Warehouse Reservation at Intermediate Nodes: 9; Sales Team 1002: Physical Inventory: 40, After Deduction: 40, After Reservation: 40, Final Allocation Result: Link B1-1: 40.

[0059] Example 2; This embodiment primarily describes the inventory allocation process based on an indicator allocation strategy. The indicator allocation strategy is suitable for situations requiring intelligent allocation that comprehensively considers multiple business indicators (such as sales volume, conversion rate, profit margin, etc.). This embodiment achieves multi-objective optimized allocation through a multi-indicator fusion algorithm.

[0060] Steps 1-4: Same as in Example 1; Steps 1-4 are the same as in Example 1, including receiving allocation requests, constructing a DAG structure, obtaining physical inventory data, and performing inventory reservation and deduction. In this example, the SKU is set to "SKU-002", the physical inventory of sales team 1001 is 200, and the allocatable inventory after deduction and reservation is 180.

[0061] Step 5: Topological sorting; Similar to Example 1, the DAG is topologically sorted to generate an ordered list of nodes.

[0062] Step 6: Execute the allocation strategy based on indicators in sequence; In this embodiment, platform warehouse A needs to allocate inventory to store warehouses A1 and A2, using an indicator allocation strategy.

[0063] Step 6.1: Query indicator data; Query the business indicator data of each store from the indicator data table, as shown in Table 5, Store Business Indicator Data; Table 5:

[0064] Step 6.2: Preprocessing of indicator data; Minimum threshold for configuration metrics: Minimum sales volume: M1=100, minimum conversion rate: M2=1.0, minimum profit margin: M3=10.0; Strategic value mapping: High = 3, Medium = 2, Low = 1; Apply minimum value correction: Store A1: Sales = max(500, 100) = 500, Conversion Rate = max(3.5, 1.0) = 3.5, Profit Margin = max(25, 10) = 25, Strategic Value = 3; Store A2: Sales = max(300, 100) = 300, Conversion Rate = max(4.2, 1.0) = 4.2, Profit Margin = max(30, 10) = 30, Strategic Value = 2; Non-positive value offset processing: In this embodiment, all values ​​are positive, so no offset is required. I''1,1=500,I''1,2=3.5,I''1,3=25,I''1,4=3,I''2,1=300,I''2,2=4.2,I''2,3=30,I''2,4=2.

[0065] Step 6.3: Smoothly scale the data span; Calculate the data span for each indicator: Sales volume range: S1 = 500 / 300 = 1.67; Conversion rate range: S2 = 4.2 / 3.5 = 1.2. Profit margin range: S3 = 30 / 25 = 1.2; Strategic value range: S4 = 3 / 2 = 1.5. Configure span threshold and smooth scaling factor: Sales volume: T1=10, α1=0.8, when the span is less than 10, apply scaling; Conversion rate: T2=5, α2=0.9; Profit margin: T3=5, α3=0.9; Strategic value: T4=3, α4=1.0. Since all spans are smaller than the corresponding thresholds, a smooth scaling transformation is applied: Shop A1: Sales = 500 0.8 =190.55, conversion rate=3.5 0.9 =3.15, Profit Margin = 25 0.9 =19.34, Strategic Value=3 1 =3; Shop A2: Sales = 300 0.8 =138.17, conversion rate=4.2 0.9 =3.88, Profit Margin = 30 0.9 =23.23, Strategic Value=2 1 =2.

[0066] Step 6.4: Calculate the indicator ratio; Calculate the sum of each indicator: Total sales: T1 = 190.55 + 138.17 = 328.72; Total conversion rate: T2 = 3.15 + 3.88 = 7.03. Total profit margin: T3 = 19.34 + 23.23 = 42.57; Total strategic value: T4 = 3 + 2 = 5. Calculate the proportion of each object in each indicator: Shop A1: P1,1=190.55 / 328.72=0.580,P1,2=3.15 / 7.03=0.448,P1,3=19.34 / 42.57=0.454,P1,4=3 / 5=0.6; Shop A2: P2,1=138.17 / 328.72=0.420,P2,2=3.88 / 7.03=0.552,P2,3=23.23 / 42.57=0.546,P2,4=2 / 5=0.4.

[0067] Step 6.5: Calculate the overall weight; Configure the weighting coefficients for each indicator: Sales volume weight: α1=0.3, Conversion rate weight: α2=0.2, Profit margin weight: α3=0.3, Strategic value weight: α4=0.2; Calculate the weighted composite score: Shop A1: W1 = 0.3 × 0.580 + 0.2 × 0.448 + 0.3 × 0.454 + 0.2 × 0.6 = 0.174 + 0.090 + 0.136 + 0.12 = 0.520; Shop A2: W2 = 0.3 × 0.420 + 0.2 × 0.552 + 0.3 × 0.546 + 0.2 × 0.4 = 0.126 + 0.110 + 0.164 + 0.08 = 0.480; Normalized weights: Total weights: 0.520 + 0.480 = 1.000; Shop A1: W'1=0.520 / 1.000=0.520, Shop A2: W'2=0.480 / 1.000=0.480.

[0068] Step 6.6: Inventory allocation calculation; The available inventory in warehouse A of platform A is 180, which will be allocated as follows: Round up the initial allocation: Shop A1: A1 = ceil(0.520 × 180) = ceil(93.6) = 94; Shop A2: A2 = ceil(0.480 × 180) = ceil(86.4) = 87; Total: 94 + 87 = 181; Adjust allocation: Difference: Δ = 181 - 180 = 1. Since Δ > 0, decrease by 1 for each inventory level from largest to smallest. Store A1 has the largest inventory, so subtract 1: 94-1=93; Final allocation results: Store A1: 93, Store A2: 87.

[0069] The final allocation results are shown in Table 6: a comparison of the indicator allocation results; Table 6:

[0070] Steps 7-9 are the same as in Example 1, including generating an inventory update task, synchronizing it to a third-party platform, and updating the task status.

[0071] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A multi-strategy allocation method for e-commerce inventory based on directed acyclic graphs, characterized in that: The methods include: Obtain inventory allocation requests and create inventory allocation tasks containing task ID, inventory unit identifier, trigger type and task status. Add tasks to the task queue according to creation time. Allocation tasks for the same inventory unit in the task queue are executed sequentially using the first-in-first-out rule. Read the directed acyclic graph template configuration corresponding to the inventory unit, instantiate virtual warehouse nodes, construct directed edge relationships between virtual warehouses to form a directed acyclic graph, and create leaf virtual warehouse nodes according to all sales links corresponding to the inventory unit and add them to the directed acyclic graph. Parse the root node in the directed acyclic graph, obtain the attributes of the source inventory corresponding to the root node, call the warehouse management system interface to query the remaining inventory details, summarize the inventory according to the root node attributes, and fill the original inventory field of the virtual warehouse of the root node with the results. Query the unshipped orders corresponding to the inventory unit, deduct the number of unshipped orders from the remaining inventory of the root node virtual warehouse to obtain the deducted inventory, and then reserve a specified quantity from the deducted inventory to obtain the allocable inventory; The directed acyclic graph is topologically sorted, the root node is added to the node queue, the root node in the node queue is processed in turn, and the inventory reservation strategy and inventory allocation strategy are executed until the acyclic detection and sorting of the node queue are processed. The inventory allocation strategy is configured with either a weighted strategy or an indicator strategy to calculate the inventory allocation from the parent virtual warehouse to the child virtual warehouse. The weighted strategy allocates inventory according to a preset weight ratio, calculates the allocation quantity according to the weight value and processes the remainder for adjustment. The indicator strategy uses an indicator fusion allocation algorithm to extract the data features of business indicators to obtain a comprehensive weight, and adjusts the inventory allocation according to the normalized comprehensive weight. Traverse the leaf nodes of the directed acyclic graph, compare the original inventory with the allocated inventory, and divide the leaf nodes into three categories: inventory increase, decrease, or no change. Create update tasks for leaf nodes with decreased or unchanged inventory and execute them. After all tasks are successful, create update tasks for leaf nodes with increased inventory.

2. The e-commerce inventory multi-strategy allocation method based on directed acyclic graphs according to claim 1, characterized in that: Methods for constructing directed acyclic graphs (DAGs) using a directed acyclic graph template configuration include: The instantiated virtual warehouse node includes: dividing the virtual warehouse node into a root node warehouse, intermediate node warehouses and leaf node warehouses, wherein the root node warehouse is used to specify the calculation rules for obtaining source inventory and to aggregate physical inventory from the warehouse management system, the intermediate node warehouse is bound to the platform or store business dimension, and the leaf node warehouse is bound to the sales link. Each virtual warehouse node's information includes node ID, node name, node attributes, a list of parent node IDs, a list of child node IDs, inventory allocation strategy configuration, and inventory reservation strategy configuration.

3. The e-commerce inventory multi-strategy allocation method based on directed acyclic graphs according to claim 1, characterized in that: The execution method of the task queue includes: The task queue adopts a first-in-first-out (FIFO) rule. The task status is divided into task allocation status and task update status. The status transition path for task allocation status is: pending allocation, pending update, and allocation completed. In case of an error, it enters the allocation failure or retry status. The status transition path for task update status is: pending inventory query, pending update, checking, and update completed. In case of an error, it enters the update failure or retry status.

4. The e-commerce inventory multi-strategy allocation method based on a directed acyclic graph according to claim 2, characterized in that: Inventory reservation and allocation strategies include: The inventory reservation strategy includes: reserving virtual warehouse inventory before inventory allocation, the reservation process including deduction of unshipped orders and reservation at the inventory unit level; The inventory allocation strategy includes a weighted strategy or an indicator strategy: the weighted strategy allocates inventory according to weight ratios, calculates the allocation quantity according to the weight value and handles the remainder adjustment; the indicator strategy generates the allocation result through an indicator fusion algorithm, which includes: data preprocessing, smooth scaling, ratio calculation and weight fusion.

5. The e-commerce inventory multi-strategy allocation method based on directed acyclic graphs according to claim 1, characterized in that: Methods for performing acyclic detection and sorting on a node queue include: Initialize the node queue: Traverse all nodes in the directed acyclic graph, count the in-degree of each node, and add nodes with an in-degree of 0 to the node queue as the starting point for topological sorting. Perform topological sorting: retrieve the first node from the node queue and execute the inventory reservation and inventory allocation strategies; Decrement the in-degree of all child nodes of the first node by 1. If the in-degree of a child node becomes 0, add it to the node queue. Repeat until the queue is empty or all nodes have been processed. Loop detection: If the final number of nodes processed is equal to the total number of nodes in the directed acyclic graph, then there are no loops; otherwise, the allocation fails.

6. The e-commerce inventory multi-strategy allocation method based on a directed acyclic graph according to claim 4, characterized in that: The methods for implementing the weighting and indicator strategies include: The methods for implementing the weighting strategy include: minimum value correction, offset processing, data span smoothing and scaling, ratio calculation and comprehensive weight normalization of sales, conversion rate, profit margin and strategic value business indicators to generate inventory allocation results; The method for implementing the indicator strategy includes generating allocation results through the steps of data preprocessing, smooth scaling, ratio calculation and weight fusion using an indicator fusion algorithm.

7. A multi-strategy e-commerce inventory allocation system based on a directed acyclic graph, used to execute the multi-strategy e-commerce inventory allocation method based on a directed acyclic graph as described in claim 1, characterized in that: The system includes: Task management module, inventory allocation task management module, and inventory update task management module; The task management module is used to receive inventory allocation requests, create inventory allocation tasks and inventory update tasks, add tasks to the task queue, and manage the status transition and retry mechanism of tasks. The inventory allocation task management module is used to allocate physical warehouse inventory to various sales links; The inventory update task management module is used to update the inventory allocated to each sales link to each e-commerce platform.

8. The e-commerce inventory multi-strategy allocation system based on a directed acyclic graph according to claim 7, characterized in that: The task management module includes: a task triggering and scheduling submodule and a task status management submodule; The task triggering and scheduling submodule is used to receive inventory allocation requests, create inventory allocation tasks and inventory update tasks, and add the tasks to the task queue; the task status management submodule is used to allocate tasks and update the status transition and retry mechanism of tasks.

9. The e-commerce inventory multi-strategy allocation system based on a directed acyclic graph according to claim 7, characterized in that: The inventory allocation task management module includes: a directed acyclic graph construction submodule, a virtual warehouse management submodule, an inventory data acquisition submodule, an inventory reservation and deduction submodule, an allocation algorithm submodule, and a topology sorting and execution submodule; The Directed Acyclic Graph (DAG) construction submodule is used to construct the DAG structure of the virtual repository based on the configured DAG template. The virtual warehouse management submodule is used to manage the hierarchical relationship, attribute information, and inventory of virtual warehouses; The inventory data acquisition submodule is used to obtain actual inventory data from the warehouse management system; The inventory reservation and deduction submodule is used to execute inventory reservation and inventory deduction strategies; The allocation algorithm submodule is used to calculate inventory allocation results based on weight or indicator strategies; The topology sorting and execution submodule is used to perform topology sorting on the directed acyclic graph and execute the inventory allocation strategies of each virtual warehouse in sequence.

10. The e-commerce inventory multi-strategy allocation system based on a directed acyclic graph according to claim 7, characterized in that: The inventory update task management module includes: an inventory update task scheduling submodule and an execution update task submodule; The inventory update task scheduling submodule is used to generate inventory update tasks for each sales link based on the allocation results; The "Execute Update Task" submodule is used to synchronize the allocated inventory to various e-commerce platforms.