Multi-store inventory management method, system, intelligent terminal and storage medium

Through the coordinated work of Redis database and message queue, the distributed locking mechanism is used to lock and release the inventory quantity, solving the accuracy and consistency of inventory management in multiple store scenarios, ensuring the accuracy and consistency of inventory data.

CN120069762BActive Publication Date: 2025-08-08ZHEJIANG LEMENG INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510525441.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-08
Estimated Expiration
2045-04-25

AI Technical Summary

Technical Problem

In multi-store scenarios, when the existing technology receives a large number of purchase requests in a short period of time, the accuracy and consistency of inventory is difficult to guarantee, resulting in inaccurate error recording and inventory management.

Method used

The Redis database and message queue work together, and the distributed locking mechanism of Redis locks and releases the inventory quantity. The orderly processing of inventory update tasks is achieved through the message queue to ensure the accuracy and consistency of the inventory quantity in the main database.

Benefits of technology

It realizes the accuracy and consistency of inventory quantity when handling multiple user purchase requests, avoids oversold, and ensures user experience and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120069762B_ABST
    Figure CN120069762B_ABST
Patent Text Reader

Abstract

This application relates to a multi-store inventory management method, system, intelligent terminal, and storage medium, and relates to the field of data management. The method includes: in response to obtaining a user purchase request sent by a user terminal, obtaining product information in the user purchase request, the product information including product type and product quantity; obtaining the tradable inventory quantity corresponding to the product type; when the product quantity is not greater than the tradable inventory quantity, updating the inventory quantity in the main database through the Redis database and message queue to obtain an updated inventory quantity; and sending the updated inventory quantity to the user terminal. This application has the effect of improving the accuracy and consistency of inventory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data management, and in particular to a multi-store inventory management method, system, intelligent terminal and storage medium. Background Art

[0002] In recent years, with the digitization of retail and the diversification of consumer scenarios, multi-store operations have become a mainstream choice for brand expansion. Managing inventory in this multi-store environment has become a critical issue that cannot be ignored.

[0003] Related technologies for managing inventory across multiple stores require pre-calculating each store's maximum inventory and recording the remaining inventory in real time. After receiving a customer's purchase request, the system determines the type and quantity of goods purchased based on the request. The store's inventory is then adjusted based on the type and quantity of goods.

[0004] Regarding the related technologies mentioned above, when a large number of purchase requests are received in a short period of time, errors may occur in the recording of the remaining inventory quantity of the store, resulting in a decrease in the accuracy and consistency of the inventory. Summary of the Invention

[0005] In order to improve the accuracy and consistency of inventory, the present application provides a multi-store inventory management method, system, intelligent terminal and storage medium.

[0006] In the first aspect, the present application provides a multi-store inventory management method, which adopts the following technical solutions:

[0007] A multi-store inventory management method, comprising:

[0008] In response to obtaining a user purchase request sent by a user terminal, obtaining product information in the user purchase request, the product information including product type and product quantity;

[0009] Obtain the tradable inventory quantity corresponding to the commodity type;

[0010] When the quantity of the commodity is not greater than the tradable inventory quantity, the inventory quantity in the main database is updated through the Redis database and the message queue to obtain the updated inventory quantity. The Redis cluster is used to adjust the inventory quantity through a distributed lock mechanism;

[0011] The updated inventory quantity is sent to the user terminal.

[0012] By adopting the above technical solution, inventory quantities can be adjusted using a Redis database and message queue. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0013] Optionally, caching the product information in the Redis cluster;

[0014] generating an inventory update task corresponding to the user purchase request;

[0015] Sending the inventory update task to the master database via the message queue, wherein the message queue is used to synchronize the inventory update task with the master database;

[0016] After the main database completes the inventory update task, the updated inventory quantity returned by the main database is received.

[0017] By adopting the above technical solution and leveraging the collaborative work of Redis clusters and message queues, the inventory quantities in the master database can be updated in an orderly manner. Each inventory update task can be accurately executed by the master database, ensuring inventory accuracy and consistency.

[0018] Optionally, when there are at least two user purchase requests, classify the user purchase requests according to the commodity type to obtain a user purchase request combination;

[0019] Counting the total number of purchased commodities in the user purchase request combination according to the quantity of the commodities;

[0020] The inventory update task is obtained according to the total number of purchased commodities and the commodity type.

[0021] By adopting the above technical solution, when multiple user purchase requests are received, the total number of purchased goods and the types of the goods will be counted, an inventory update task will be obtained, and the data in the main database will be updated through the inventory update task to ensure the accuracy and consistency of the inventory.

[0022] Optionally, obtain the total inventory quantity corresponding to the product type;

[0023] According to the total inventory quantity, the tradable inventory quantity is retrieved from a preset quantity mapping table;

[0024] The tradable inventory quantity is sent to the user terminal.

[0025] By adopting the above technical solution, the tradable inventory quantity can be adjusted according to the total inventory quantity to ensure that the sold goods will not exceed the inventory quantity, and the tradable inventory quantity can be provided to users in real time, taking into account both user experience and system stability.

[0026] Optionally, obtaining first geographic information of the user terminal according to the user purchase request;

[0027] Determine a target store based on the user's purchase request, where the target store refers to a store that sells the product type;

[0028] Sending product quantity query information to the store terminal corresponding to the target store;

[0029] Receiving inventory quantity feedback information returned by the store terminal;

[0030] Determining a candidate pickup store terminal from the store terminals according to the inventory quantity feedback information;

[0031] Acquire second geographic information of the candidate store terminal;

[0032] Based on the first geographical location and the second geographical location, a target pickup store terminal is determined from among the candidate pickup store terminals.

[0033] By adopting the above technical solution, the first geographic information of the user terminal and the second geographic information of the candidate store terminal can be used to determine the target pickup store terminal for the user to pick up the goods, which can ensure that the user can get the goods and at the same time ensure the convenience of the customer picking up the goods.

[0034] Optionally, if the candidate store terminal is not determined, obtaining third geographic information of the store terminal;

[0035] Determine a candidate collection store terminal based on the first geographic information and the third geographic information, and obtain the current inventory quantity of the candidate collection terminal;

[0036] Calculating a difference in the quantity of goods according to the current quantity of goods in stock and the purchase request of the user;

[0037] Searching for nearby store terminals located near the candidate collection store terminal based on the geographic information of the candidate collection store terminal;

[0038] Obtaining a target nearby store terminal and a transfer inventory quantity corresponding to the target nearby store terminal based on the commodity quantity difference, the commodity inventory of the nearby store terminal, and a commodity sales forecast plan;

[0039] The master database is updated according to the transferred inventory quantity.

[0040] By adopting the above technical solution, after determining the nearby store terminals located near the candidate collection store terminals, the commodity inventory and commodity sales forecast plan of the nearby store terminals are used to plan the transfer of commodity inventory, so that the commodity inventory of the candidate collection store terminals can meet customer needs and ensure the transfer efficiency of commodities.

[0041] Optionally, storing the inventory quantity feedback information in an inventory message queue;

[0042] Extracting the last inventory quantity record from the inventory message queue;

[0043] Calculating the inventory quantity change difference between the inventory quantity feedback information and the inventory quantity record;

[0044] In a case where the inventory quantity change difference is greater than a preset difference, the inventory update task corresponding to the user purchase request is inserted into the message queue according to the inventory quantity change difference.

[0045] By adopting the above technical solution, the user purchase request in the message queue is adjusted according to the inventory quantity change difference, ensuring that the user purchase request with the inventory quantity change difference greater than the preset difference can receive a faster response.

[0046] In a second aspect, this application provides a multi-store inventory management system that adopts the following technical solutions:

[0047] A multi-store inventory management system, comprising:

[0048] The acquisition module is used to obtain user purchase requests and tradable inventory quantities;

[0049] A memory for storing a program for the multi-store inventory management method;

[0050] The program in the memory can be loaded and executed by the processor to implement the multi-store inventory management method.

[0051] By adopting the above technical solution, inventory quantities can be adjusted using a Redis database and message queue. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0052] In a third aspect, the present application provides a smart terminal that adopts the following technical solution:

[0053] An intelligent terminal includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and execute any one of the above-mentioned methods.

[0054] By adopting the above technical solution, inventory quantities can be adjusted using a Redis database and message queue. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0055] In a fourth aspect, the present application provides a computer storage medium capable of storing corresponding programs, which is characterized by facilitating the improvement of inventory accuracy and consistency, and adopts the following technical solutions:

[0056] A computer-readable storage medium stores a computer program that can be loaded by a processor and execute any of the above-mentioned multi-store inventory management methods.

[0057] By adopting the above technical solution, inventory quantities can be adjusted using a Redis database and message queue. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0058] In summary, this application includes at least one of the following beneficial technical effects:

[0059] 1. Use the Redis database and message queue to adjust inventory quantities. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0060] 2. By leveraging the collaborative work of Redis clusters and message queues, the inventory quantity in the master database can be updated in an orderly manner. Each inventory update task can be accurately executed by the master database, ensuring the accuracy and consistency of the inventory;

[0061] 3. When multiple user purchase requests are received, the total number of purchased items and the types of items will be counted, and an inventory update task will be obtained. The data in the main database will be updated through the inventory update task to ensure the accuracy and consistency of the inventory. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 This is a schematic diagram of the system architecture of a multi-store inventory management method provided in an embodiment of the present application.

[0063] Figure 2This is a schematic diagram of a multi-store inventory management method provided in an embodiment of the present application.

[0064] Figure 3 This is a flowchart of a multi-store inventory management method provided in an embodiment of the present application.

[0065] Figure 4 This is a flowchart of an inventory quantity adjustment method provided in an embodiment of the present application.

[0066] Figure 5 This is a flow chart of a method for displaying tradable inventory quantity provided in an embodiment of the present application.

[0067] Figure 6 This is a flow chart of a method for determining a pickup store provided in an embodiment of the present application.

[0068] Figure 7 This is a flowchart of a method for updating a master database provided in an embodiment of the present application.

[0069] Figure 8 This is a flow chart of a method for queuing up a user's purchase request provided in an embodiment of the present application.

[0070] Figure 9 This is a schematic diagram of a multi-store inventory management system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1 To the attached Figure 9 It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0072] The present application embodiment discloses a schematic diagram of a system architecture of a multi-store inventory management method. Figure 1 The system architecture includes: data layer 11, service layer 12, application layer 13 and user layer 14.

[0073] The data layer 11 includes a master database 111 and a Redis cluster 112. The master database 111 stores inventory data for each store, including product types, inventory quantities, and branch warehouse inventory. Optionally, the master database 111 uses MySQL. The Redis cluster 112 provides a distributed locking mechanism, enabling it to handle high-concurrency requests.

[0074] The service layer 12 includes an inventory synchronization service 23121 and an order verification service 122. The inventory synchronization service 23121 is used to maintain consistency between the master database 111 and the Redis cluster 112 via a message queue 22. The order verification service 122 is used to verify whether the tradable inventory quantity corresponding to the user purchase request 21 meets the required quantity. Optionally, the message queue 22 uses RabbitMQ.

[0075] The application layer 13 includes a front-end interface 131 and a management backend 132. The front-end interface 131 is a user-friendly interface for inventory queries and order placement. It includes both an application (APP) interface and a web interface. Optionally, the front-end interface 131 integrates a dynamic inventory threshold limit function, allowing it to dynamically adjust the tradable inventory quantity based on the total inventory quantity. The management backend 132 is used to adjust inventory allocation, set inventory thresholds, and monitor exception logs.

[0076] User layer 14 includes consumer terminals 141 and store terminals 142. Consumer terminals 141 refer to mobile devices used by consumers. Store terminals 142 refer to devices in merchant stores. For example, consumer terminals 141 allow consumers to view product inventory status in real time. For example, store terminals 142 include POS machines, tablet devices, and other devices installed in merchant stores.

[0077] Further, refer to Figure 2 , the multi-store inventory management method provided by the present application will send the user purchase request 21 to the application layer 13 after obtaining the user purchase request 21, and send the user purchase request 21 to the service layer 12 through the front-end interface 131 and the management backend 132 in the application layer 13. The order verification service 122 in the service layer 12 will determine whether the user purchase request 21 can be executed. If so, it will generate an inventory update task based on the user purchase request 21 and send the inventory update task to the message queue 22. Then, through the inventory synchronization service 23121 in the service layer 12, the inventory update task is sent to the main database 111 and Redis cluster 112 of the data layer 11 to implement the update of inventory data. In the process of updating inventory data, inventory locking and inventory release operations will be performed through the Redis cluster 112 to ensure that the accuracy and consistency of the inventory data are maintained during the update of inventory data.

[0078] The present application embodiment discloses a multi-store inventory management method. Figure 3 , the method comprising:

[0079] Step S301: in response to obtaining a user purchase request sent by a user terminal, obtaining commodity information in the user purchase request, where the commodity information includes commodity type and commodity quantity.

[0080] User terminal refers to the terminal held by the consumer, and user terminal includes any one or more of mobile terminal, desktop computer, and laptop computer.

[0081] The user purchase request is obtained based on the user's purchase behavior. For example, if a user purchases one item A on a mobile phone application, the user purchase request is used to indicate the user's purchase behavior of one item A.

[0082] In some other embodiments, the user purchase request may be sent by a store terminal. In this case, the user purchase request is sent by the store terminal once every preset period. For example, the store terminal collects sales information for the past 10 minutes every 10 minutes and integrates the sales information into the user purchase request.

[0083] Step S302: Obtain the tradable inventory quantity corresponding to the commodity type.

[0084] The tradable inventory quantity refers to the number of commodities available for trading in the inventory corresponding to the commodity type.

[0085] For example, the main database stores inventory data of each store, and the tradable inventory quantity corresponding to the product type can be obtained through the main database.

[0086] In some embodiments, the tradable inventory quantity is determined based on the total inventory quantity of the product category, and the tradable inventory quantity is positively correlated with the total inventory quantity. For example, when the total inventory quantity is 2000, the tradable inventory quantity is 1500; when the total inventory quantity is 3000, the tradable inventory quantity is 2500.

[0087] Step S303: When the quantity of goods is not greater than the tradable inventory quantity, the inventory quantity in the main database is updated through the Redis database and message queue to obtain the updated inventory quantity. The Redis cluster is used to adjust the inventory quantity through the distributed lock mechanism.

[0088] The embodiment of the present application discloses a method for adjusting inventory quantity. Figure 4 The method includes steps S3031 to S3034, the specific contents of which are as follows:

[0089] Step S3031: Generate an inventory update task corresponding to the user's purchase request.

[0090] The inventory update task is used to adjust the inventory quantity in the total database.

[0091] Optionally, if there are at least two user purchase requests, the user purchase requests are classified according to product type to obtain a user purchase request combination. Based on the product quantity, the total number of purchased products in the user purchase request combination is counted. Based on the total number of purchased products and the product type, an inventory update task is obtained.

[0092] The user purchase request combination is used to record the number of product categories. Optionally, the user purchase request classification is performed in real time or at predetermined classification intervals. For example, for one or more user purchase requests obtained, the product categories in each user purchase request are counted and summarized to obtain the user purchase request combination.

[0093] Furthermore, after obtaining the user purchase request combination, the quantity of each commodity type in the user purchase request combination is determined to obtain the total number of purchased commodities.

[0094] Furthermore, the total number of purchased goods and the type of goods are combined to obtain the inventory update task.

[0095] Step S3032: Send the inventory update task to the master database via a message queue. The message queue is used to synchronize the inventory update task with the master database.

[0096] A message queue is an asynchronous communication mechanism used to transfer data between distributed systems or services. For example, if an inventory update task is added to a message queue, the inventory update tasks in the message queue are sorted by the time they entered the message queue. The inventory update tasks in the message queue are then sent to the master database in the order they were sorted. Optionally, the message queue uses a first-in, first-out mechanism.

[0097] Step S3033: Cache the inventory update task in the Redis cluster.

[0098] Redis Cluster features a distributed locking mechanism, a key mechanism for coordinating mutually exclusive access to shared resources across multiple nodes in a distributed system. This mechanism allows only a single inventory update task to lock or unlock the master database at any one time.

[0099] Optionally, after the inventory update task is cached in the Redis cluster, the Redis cluster will lock the data modification operations on the primary database, allowing only the current inventory update task to modify the primary database, and unlock the primary database after the primary database is updated.

[0100] Step S3034: After the master database completes the inventory update task, the updated inventory quantity returned by the master database is received.

[0101] Optionally, after the master database completes the inventory update task, it generates a task completion flag, which indicates that the master database has completed the inventory update task. Based on the task completion flag, the distributed locking mechanism based on the Redis cluster unlocks the master database.

[0102] Furthermore, there is a one-to-one correspondence between the inventory update task and the task completion indicator. In some scenarios, a timestamp can be added to the inventory update task and the task completion indicator. This timestamp is set based on the time of the user's purchase request. If the timestamps on the inventory update task and the task completion indicator are the same, then there is a correspondence between the inventory update task and the task completion indicator.

[0103] Step S304: Send updated inventory quantity to the user terminal.

[0104] Optionally, after the user terminal receives the updated inventory quantity, the user terminal displays the updated inventory quantity.

[0105] In other embodiments, the display mode of the updated inventory quantity is adjusted based on the relationship between the updated inventory quantity and a preset quantity display threshold. The quantity display threshold is a preset empirical value, and technicians can adjust the specific value of the quantity display threshold based on actual needs. For example, if the quantity display threshold is 50, when the updated inventory quantity is greater than 50, the user terminal will display the updated inventory quantity in green; when the updated inventory quantity is less than 50, the user terminal will display the updated inventory quantity in red.

[0106] By adopting the above technical solution, inventory quantities can be adjusted using a Redis database and message queue. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0107] In the following embodiment, in order to prevent the goods from being oversold in a short period of time, it is necessary to limit the tradable inventory quantity to ensure that the total inventory quantity cannot be found. Therefore, the embodiment of the present application discloses a method for displaying the tradable inventory quantity. Figure 5 , the method comprising:

[0108] Step S501: Obtain the total inventory quantity corresponding to the product type.

[0109] Total inventory quantity refers to the sum of merchandise inventory across all stores.

[0110] In some embodiments, an inventory query notification is sent to each store terminal. Current inventory information returned by each store terminal is received, and the current inventory information records the inventory quantity of the store at the current moment. The current inventory information is counted to obtain the total inventory of the goods.

[0111] Step S502: According to the total inventory quantity, the tradable inventory quantity is retrieved from the preset quantity mapping table.

[0112] The preset quantity mapping table records the corresponding relationship between the total inventory quantity and the tradable inventory quantity, wherein the total inventory quantity is greater than the tradable inventory quantity.

[0113] The quantity mapping table can be set by technicians according to needs.

[0114] In some other embodiments, the tradable inventory quantity is obtained in response to an input operation of the tradable inventory quantity. Therefore, the technician can set the tradable inventory quantity by himself, and ensure that the technician can modify the tradable inventory quantity in real time.

[0115] Step S503: Send the tradable inventory quantity to the user terminal.

[0116] Furthermore, the display mode of the updated inventory quantity is adjusted based on the relationship between the tradable inventory quantity and the preset quantity display threshold.

[0117] By adopting the above technical solution, the tradable inventory quantity can be adjusted according to the total inventory quantity to ensure that the sold goods will not exceed the inventory quantity, and the tradable inventory quantity can be provided to users in real time, taking into account both user experience and system stability.

[0118] In some actual scenarios, customers will purchase goods online and choose to pick up the goods at an offline store. At this time, it is necessary to plan which store the user should go to to pick up the goods. Therefore, the embodiment of this application discloses a method for determining the pickup store. Figure 6 , the method comprising:

[0119] Step S601: Acquire first geographic information of a user terminal according to a user purchase request.

[0120] The first geographic information refers to the geographic location corresponding to the user terminal.

[0121] Optionally, when the user terminal generates a user purchase request, the user terminal records its own geographic location, generates first geographic information based on the geographic location, and adds the first geographic information to the user purchase request.

[0122] Optionally, when the user terminal generates a user purchase request, a preset geographic location is obtained. First geographic information is generated based on the geographic location. The first geographic information is added to the user purchase request. The preset geographic location may be a delivery address preset in a shopping app, or a home address or work address pre-stored in the user terminal.

[0123] Step S602: Determine the target store based on the user's purchase request, where the target store refers to a store that sells the same type of goods.

[0124] For example, the product category in the user's purchase request is read. Based on the product category, candidate target stores that have the product category are searched in the master database, and the inventory quantity of the product category in the candidate target stores is obtained. Among the candidate target stores, those with an inventory quantity greater than 0 are selected as target stores.

[0125] Step S603: Send product quantity query information to the store terminal corresponding to the target store.

[0126] In real-world scenarios, the data stored in the master database may differ from the actual data in offline stores. This is because most offline store terminals report their inventory data periodically, rather than in real time. For example, a store terminal may report inventory data every five minutes. Therefore, to ensure data validity, inventory data can be obtained in real time.

[0127] The product quantity query information is used to query the store's inventory data at the current moment. Furthermore, the product quantity query information at least includes the product type in the user's purchase request.

[0128] Step S604: Receive inventory quantity feedback information returned by the store terminal.

[0129] The inventory quantity feedback information includes the inventory data corresponding to the commodity types of the store corresponding to the store terminal at the current moment.

[0130] In some embodiments, after sending inventory quantity feedback information, if the store terminal detects a change in inventory corresponding to the product type within a preset processing time, it generates inventory quantity update information based on the inventory change and sends the inventory quantity update information to the server.

[0131] Step S605: determining a candidate pickup store terminal from the store terminals based on the inventory quantity feedback information.

[0132] Exemplarily, based on the inventory quantity feedback information, a store terminal whose inventory data corresponding to the commodity type is greater than the commodity quantity is determined to obtain a candidate pickup store terminal.

[0133] Step S606: Acquire the second geographic information of the candidate store terminal.

[0134] The second geographic information refers to the geographic location of the store corresponding to the candidate store terminal. In some embodiments, the server pre-stores the geographic information of each store terminal, and selects the geographic information of the candidate store terminal from the stored geographic information to obtain the second geographic information.

[0135] In some embodiments, a geographic information request is sent to the candidate store terminal. After receiving the geographic information request, the store terminal generates second geographic information and sends the second geographic information to the server.

[0136] Step S607: Based on the first geographical location and the second geographical location, determine a target pickup store terminal from the candidate pickup store terminals.

[0137] For example, the spatial distance between the first geographical location and the second geographical location is calculated, and the store terminal at the second geographical location corresponding to the minimum value of the spatial distance is selected as the target pickup store terminal.

[0138] Furthermore, pickup information is generated based on the target pickup store terminal, and the pickup information includes at least one of the geographical location, name, and business hours of the store corresponding to the target pickup store terminal.

[0139] By adopting the above technical solution, the first geographic information of the user terminal and the second geographic information of the candidate store terminal can be used to determine the target pickup store terminal for the user to pick up the goods, which can ensure that the user can get the goods and at the same time ensure the convenience of the customer picking up the goods.

[0140] In the following embodiment, if the product that the customer wants to buy cannot find a suitable candidate store terminal, then the product needs to be transported from other stores or warehouses to a certain store so that the store can provide the product that the customer wants. Therefore, the embodiment of the present application discloses a method for updating the master database. Figure 7 , the method comprising:

[0141] Step S701: If the candidate store terminal is not determined, the third geographic information of the store terminal is obtained.

[0142] The third geographic information includes the geographic information of all store terminals. In some embodiments, the server pre-stores the geographic information of each store terminal, and selects the geographic information of all store terminals to obtain the third geographic information.

[0143] Step S702: Determine a candidate collection store terminal based on the first geographic information and the third geographic information, and obtain the current inventory quantity of the candidate collection terminal.

[0144] For example, the spatial distance between the first and third geographic information is calculated based on the first and third geographic information. The store terminal corresponding to the minimum of these spatial distances is selected as the candidate collection store terminal. The distance threshold is an empirical value, and technicians can adjust the specific value of the distance threshold based on actual needs.

[0145] The current inventory quantity refers to the inventory quantity of the candidate collection store terminal at the current moment.

[0146] Step S703: Calculate the difference in product quantity based on the current product inventory quantity and the user's purchase request.

[0147] Optionally, the difference between the current inventory quantity and the quantity in the user's purchase request is calculated to obtain the item quantity difference. This item quantity difference refers to the difference between the inventory quantity of the store corresponding to the candidate collection store terminal and the quantity in the user's purchase request, that is, the number of items in the store corresponding to the candidate collection store terminal that is needed to meet the customer's demand.

[0148] Step S704: searching for nearby store terminals located near the candidate collection store terminal based on the geographic information of the candidate collection store terminal.

[0149] The distance between the store corresponding to the nearby store terminal and the store corresponding to the candidate collection store terminal is less than a preset distance. The preset distance is an empirical value and can be adjusted by relevant personnel based on actual needs. For example, the preset distance is set to 2 kilometers.

[0150] Step S705: Obtain the target nearby store terminal and the transfer inventory quantity corresponding to the target nearby store terminal according to the commodity quantity difference, the commodity inventory of the nearby store terminal and the commodity sales forecast plan.

[0151] Based on the difference between the merchandise inventory of the nearby store terminals and the merchandise sales forecast plan, the inventory of available merchandise at the nearby store terminals is obtained. The sum of the available merchandise inventory of the nearby store terminals is calculated to obtain the total inventory of the nearby merchandise. If the total inventory of the nearby merchandise is greater than the difference in the number of merchandise, the nearby store terminals are sorted in ascending order based on the distance from the candidate collection store terminals to obtain a sequence of nearby store terminals. Nearby store terminals are selected from the sequence of nearby store terminals in order, and the sum of the available merchandise inventory of the selected nearby store terminals is calculated until the sum of the available merchandise inventory is greater than the difference in the number of merchandise. The target nearby store terminal at this time is obtained, and the merchandise inventory selected from the available merchandise inventory of the target nearby store terminal is used as the transfer inventory quantity.

[0152] Step S706: Update the master database according to the transferred inventory quantity.

[0153] Exemplarily, the quantity of goods in the main database corresponding to the type of goods requested by the user is adjusted according to the transferred inventory quantity.

[0154] By adopting the above technical solution, after determining the nearby store terminals located near the candidate collection store terminals, the commodity inventory and commodity sales forecast plan of the nearby store terminals are used to plan the transfer of commodity inventory, so that the commodity inventory of the candidate collection store terminals can meet customer needs and ensure the transfer efficiency of commodities.

[0155] In the following embodiment, when it is detected that a user purchases a product, the queue order can be adjusted according to the quantity of the product purchased by the user, so that customers who purchase a large quantity of products can purchase the products smoothly. Therefore, the embodiment of the present application discloses a method for jumping the queue of a user's purchase request. Figure 8 , the method comprising:

[0156] Step S801: storing inventory quantity feedback information in an inventory message queue.

[0157] The inventory message queue is used to store inventory quantity feedback information from the store terminal. Furthermore, before the inventory quantity feedback information is stored in the inventory message queue, a timestamp may be added to the inventory quantity feedback information. The timestamp is set according to the time when the user's purchase request was generated.

[0158] Step S802: extract the last inventory quantity record from the inventory message queue.

[0159] The last inventory quantity record refers to the inventory quantity record closest to the current time in the inventory message queue, and the commodity type corresponding to the last inventory quantity record is consistent with the commodity type in the user's purchase request.

[0160] Step S803: Calculate the inventory quantity change difference between the inventory quantity feedback information and the inventory quantity record.

[0161] Exemplarily, the difference between the inventory quantity feedback information and the previous inventory quantity record is calculated to obtain the inventory quantity change difference.

[0162] Step S804: When the inventory quantity change difference is greater than the preset difference, the inventory update task corresponding to the user purchase request is inserted into the message queue according to the inventory quantity change difference.

[0163] The preset difference is a preset empirical value, and technicians can adjust the specific value of the preset difference according to actual needs.

[0164] If the inventory quantity change difference is greater than the preset difference, the message queue position corresponding to the inventory quantity change difference is found from the preset position mapping table. Based on the message queue position, the inventory update task corresponding to the user purchase request is inserted into the message queue.

[0165] By adopting the above technical solution, the user purchase request in the message queue is adjusted according to the inventory quantity change difference, ensuring that the user purchase request with the inventory quantity change difference greater than the preset difference can receive a faster response.

[0166] Based on the same inventive concept, this embodiment of the application provides a multi-store inventory management system, please refer to Figure 9 , the system comprises:

[0167] Acquisition module 901, used to obtain user purchase request and tradable inventory quantity;

[0168] Memory 902, used to store a program of the multi-store inventory management method;

[0169] Processor 903, the program in the memory can be loaded and executed by the processor to implement the multi-store inventory management method.

[0170] By adopting the above technical solution, inventory quantities can be adjusted using a Redis database and message queue. During the adjustment process, the distributed locking mechanism of the Redis database can be used to lock and release inventory quantities. This ensures that other processing operations will not affect the current inventory operations when processing inventory quantities, ensuring inventory accuracy and consistency.

[0171] Those skilled in the art will clearly understand that for the sake of convenience and brevity, the division of the above-mentioned functional modules is only used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-mentioned systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0172] An embodiment of the present application provides a computer-readable storage medium storing a computer program that can be loaded by a processor and executed by a multi-store inventory management method.

[0173] Computer storage media include, for example, cloud servers, USB flash drives, mobile hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, and other media that can store program code. For example, the cloud server in the embodiment of the present application can be Tencent Cloud or Alibaba Cloud.

[0174] Based on the same inventive concept, an embodiment of the present application provides an intelligent terminal, including a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and execute a multi-store inventory management method.

[0175] Those skilled in the art will clearly understand that for the sake of convenience and brevity, the division of the above-mentioned functional modules is only used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the above-mentioned systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0176] The above are all preferred embodiments of the present application and are not intended to limit the scope of protection of this application. Unless otherwise specified, any feature disclosed in this specification (including the abstract and drawings) may be replaced by other equivalent or similar features. In other words, unless otherwise specified, each feature is merely an example of a series of equivalent or similar features.

Claims

1. A multi-store inventory management method, characterized in that: The method comprises: In response to obtaining a user purchase request sent by a user terminal, obtaining product information in the user purchase request, the product information including product type and product quantity; Obtain the tradable inventory quantity corresponding to the commodity type; If the quantity of the product is not greater than the tradable inventory quantity, the inventory quantity in the master database is updated through the Redis database and the message queue to obtain the updated inventory quantity. The Redis cluster corresponding to the Redis database is used to adjust the inventory quantity through a distributed locking mechanism. The distributed locking mechanism allows a single inventory update task to lock or unlock the master database at the same time. sending the updated inventory quantity to the user terminal; The method of updating the inventory quantity in the main database through the Redis database and the message queue to obtain the updated inventory quantity includes: generating an inventory update task corresponding to the user purchase request; Sending the inventory update task to the master database via the message queue, wherein the message queue is used to synchronize the inventory update task with the master database; Cache the inventory update task in the Redis cluster; After the master database completes the inventory update task, receiving the updated inventory quantity returned by the master database; The generating of the inventory update task corresponding to the user purchase request includes: When there are at least two user purchase requests, classify the user purchase requests according to the commodity type to obtain a user purchase request combination; Counting the total number of purchased commodities in the user purchase request combination according to the quantity of the commodities; The inventory update task is obtained according to the total number of purchased commodities and the commodity type.

2. The multi-store inventory management method according to claim 1, characterized in that: The method further comprises: Get the total inventory quantity corresponding to the product type; According to the total inventory quantity, the tradable inventory quantity is retrieved from a preset quantity mapping table; The tradable inventory quantity is sent to the user terminal.

3. The multi-store inventory management method according to claim 1, characterized in that: The method further comprises: acquiring first geographic information of the user terminal according to the user purchase request; Determine a target store based on the user's purchase request, where the target store refers to a store that sells the product type; Sending product quantity query information to the store terminal corresponding to the target store; Receiving inventory quantity feedback information returned by the store terminal; Determining a candidate pickup store terminal from the store terminals according to the inventory quantity feedback information; Acquire second geographic information of the candidate pickup store terminal; Based on the first geographic information and the second geographic information, a target pickup store terminal is determined from the candidate pickup store terminals.

4. The multi-store inventory management method according to claim 3, characterized in that: The method comprises: If the candidate pickup store terminal is not determined, obtaining third geographic information of the store terminal; Determine a candidate collection store terminal based on the first geographic information and the third geographic information, and obtain the current inventory quantity of the candidate collection terminal; Calculating a difference in the quantity of goods according to the current inventory quantity and the user's purchase request; Searching for nearby store terminals located near the candidate collection store terminal based on the geographic information of the candidate collection store terminal; Obtaining a target nearby store terminal and a transfer inventory quantity corresponding to the target nearby store terminal based on the commodity quantity difference, the commodity inventory of the nearby store terminal, and a commodity sales forecast plan; The master database is updated according to the transferred inventory quantity.

5. The multi-store inventory management method according to claim 4, characterized in that: The receiving of inventory quantity feedback information returned by the store terminal further includes: Storing the inventory quantity feedback information in an inventory message queue; Extracting the last inventory quantity record from the inventory message queue; Calculating the inventory quantity change difference between the inventory quantity feedback information and the inventory quantity record; In a case where the inventory quantity change difference is greater than a preset difference, the inventory update task corresponding to the user purchase request is inserted into the message queue according to the inventory quantity change difference.

6. A multi-store inventory management system, characterized in that: The system is used to execute the multi-store inventory management method according to any one of claims 1 to 5, and the system includes: The acquisition module is used to obtain user purchase requests and tradable inventory quantities; A memory for storing a program for the multi-store inventory management method; The program in the memory can be loaded and executed by the processor to implement the multi-store inventory management method.

7. An intelligent terminal, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Article inventory updating method and device, storage medium and electronic equipment

    CN118195479A