CN113935691A - Inventory deduction method and device, electronic equipment and computer readable medium - Google Patents
Inventory deduction method and device, electronic equipment and computer readable medium Download PDFInfo
- Publication number
- CN113935691A CN113935691A CN202111220064.9A CN202111220064A CN113935691A CN 113935691 A CN113935691 A CN 113935691A CN 202111220064 A CN202111220064 A CN 202111220064A CN 113935691 A CN113935691 A CN 113935691A
- Authority
- CN
- China
- Prior art keywords
- inventory
- deduction
- local
- unified
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 230000004044 response Effects 0.000 claims abstract description 64
- 238000004590 computer program Methods 0.000 claims description 9
- 230000009467 reduction Effects 0.000 description 15
- 238000010586 diagram Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 239000003795 chemical substances by application Substances 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000003111 delayed effect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000000116 mitigating effect Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000013475 authorization Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 239000002904 solvent Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/08—Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
- G06Q10/087—Inventory or stock management, e.g. order filling, procurement or balancing against orders
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0207—Discounts or incentives, e.g. coupons or rebates
- G06Q30/0222—During e-commerce, i.e. online transactions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0207—Discounts or incentives, e.g. coupons or rebates
- G06Q30/0239—Online discounts or incentives
Landscapes
- Business, Economics & Management (AREA)
- Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Entrepreneurship & Innovation (AREA)
- Marketing (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Game Theory and Decision Science (AREA)
- Human Resources & Organizations (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The application discloses a stock deduction method, a device, electronic equipment and a computer readable medium, which relate to the technical field of computers, wherein one specific embodiment comprises the steps of receiving a stock deduction request, and carrying out local stock deduction based on the stock deduction request; in response to determining that the local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request; in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is conducted on the basis of the inventory deduction request, and information of successful ordering of the user is returned; and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information. And the local deduction and the unified inventory deduction are combined, so that the performance pressure of the unified inventory deduction is relieved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for inventory deduction, an electronic device, and a computer-readable medium.
Background
At present, in the promotion activities of e-commerce companies, price reduction of some articles is one of the most common sales promotion and play methods, the inventory of the articles is limited, how to ensure that the articles are not over-sold and not over-sold in high-concurrency scenes such as second killing and the like, and meanwhile, the system can be ensured to bear the normal operation of extremely high concurrency access, and the method becomes an essential important link of e-commerce systems.
When inventory deduction is carried out through a single machine deduction, local deduction and remote unified deduction, the situation that high-concurrency second killing scenes cannot be met, article selling is reduced, article over-selling is achieved, and performance bottlenecks easily occur in unified cache.
In the process of implementing the present application, the inventor finds that at least the following problems exist in the prior art:
when inventory deduction is carried out through a single machine deduction, local deduction and remote unified deduction, the situation that high-concurrency second killing scenes cannot be met, article selling is reduced, article over-selling is achieved, and performance bottlenecks easily occur in unified cache.
Disclosure of Invention
In view of this, embodiments of the present application provide a method and an apparatus for inventory deduction, an electronic device, and a computer readable medium, which can solve the problem that a high-concurrency second killing scenario cannot be met, and a performance bottleneck is likely to occur in article underselling, article oversubscription, and unified cache when inventory deduction is performed through a single stand-alone deduction, local deduction, and remote unified deduction mode in the prior art.
To achieve the above object, according to an aspect of an embodiment of the present application, there is provided an inventory deduction method, including:
receiving an inventory deduction request, and performing local inventory deduction based on the inventory deduction request;
in response to determining that the local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request;
in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is conducted on the basis of the inventory deduction request, and information of successful ordering of the user is returned;
and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information.
Optionally, the local inventory deduction based on the inventory deduction request includes:
determining the inventory deduction amount corresponding to the inventory deduction request;
comparing the inventory deduction amount with the local inventory, determining that the local inventory deduction is successful in response to determining that the inventory deduction amount is smaller than the local inventory, and determining that the local inventory deduction is failed in response to determining that the inventory deduction amount is larger than the local inventory.
Optionally, prior to receiving the inventory deduction request, the method further comprises:
determining unified inventory, downtime and quantity of inventory storage containers;
and determining the local inventory according to the unified inventory, the downtime rate and the quantity of the inventory storage containers.
Optionally, determining a local inventory comprises:
determining average inventory according to the quantity of the unified inventory and the inventory storage containers;
determining the cache allowance according to the average inventory, the downtime rate and the quantity of inventory storage containers;
and determining the local inventory according to the average inventory and the inventory allowance.
Optionally, the local inventory deduction based on the inventory deduction request includes:
and in response to determining that the inventory storage container corresponding to the local inventory is down, calling the inventory storage container which normally works to perform local inventory pre-deduction.
Optionally, the method further comprises:
the local inventory is stored in the form of atomic variables for ongoing inventory deduction.
Optionally, the method further comprises:
and storing the unified inventory in a queue form to obtain a unified inventory queue so as to deduct the unified inventory based on the unified inventory queue.
Optionally, the method further comprises:
and traversing the rest inventory storage containers to execute corresponding local inventory deduction based on the inventory deduction request in response to determining that the local inventory deduction fails, and returning inventory deduction failure information in response to determining that the local inventory deduction corresponding to all the inventory storage containers fails and does not perform unified inventory deduction any more.
In addition, this application still provides a device is subtracted in inventory, includes:
a receiving unit configured to receive an inventory deduction request, and perform local inventory deduction based on the inventory deduction request;
a pre-deduction unit configured to perform a unified inventory pre-deduction based on the inventory deduction request in response to determining that the local inventory pre-deduction is successful;
the inventory deduction unit is configured to respond to the fact that the unified inventory pre-deduction is successful, carry out deduction on the local inventory and the unified inventory based on the inventory deduction request and return the order placing success information of the user; and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information.
Optionally, the receiving unit is further configured to:
determining the inventory deduction amount corresponding to the inventory deduction request;
comparing the inventory deduction amount with the local inventory, determining that the local inventory deduction is successful in response to determining that the inventory deduction amount is smaller than the local inventory, and determining that the local inventory deduction is failed in response to determining that the inventory deduction amount is larger than the local inventory.
Optionally, the inventory abatement device further comprises: a local inventory determination unit configured to:
determining unified inventory, downtime and quantity of inventory storage containers;
and determining the local inventory according to the unified inventory, the downtime rate and the quantity of the inventory storage containers.
Optionally, the local inventory determination unit is further configured to:
determining average inventory according to the quantity of the unified inventory and the inventory storage containers;
determining the cache allowance according to the average inventory, the downtime rate and the quantity of inventory storage containers;
and determining the local inventory according to the average inventory and the inventory allowance.
Optionally, the receiving unit is further configured to:
and in response to determining that the inventory storage container corresponding to the local inventory is down, calling the inventory storage container which normally works to perform local inventory pre-deduction.
Optionally, the inventory abatement device further comprises: a storage unit configured to:
the local inventory is stored in the form of atomic variables for ongoing inventory deduction.
Optionally, the inventory abatement device further comprises: a storage unit configured to:
and storing the unified inventory in a queue form to obtain a unified inventory queue so as to deduct the unified inventory based on the unified inventory queue.
Optionally, the pre-clipping unit is further configured to:
and traversing the rest inventory storage containers to execute corresponding local inventory deduction based on the inventory deduction request in response to determining that the local inventory deduction fails, and returning inventory deduction failure information in response to determining that the local inventory deduction corresponding to all the inventory storage containers fails and does not perform unified inventory deduction any more.
In addition, this application still provides an inventory deduction electronic equipment, includes: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement the inventory deduction method as described above.
In addition, the present application also provides a computer readable medium, on which a computer program is stored, which when executed by a processor implements the inventory deduction method as described above.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of receiving a stock deduction request, and carrying out local stock deduction on based on the stock deduction request; in response to determining that the local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request; and in response to determining that the unified inventory pre-deduction fails, rejecting a deduction request for the local inventory and the unified inventory, and returning inventory deduction failure information, or in response to determining that the unified inventory pre-deduction succeeds, carrying out deduction on the local inventory and the unified inventory based on the inventory deduction request, and returning order placing success information of a user. And the local deduction and the unified inventory deduction are combined, so that the performance pressure of the unified inventory deduction is relieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a further understanding of the application and are not to be construed as limiting the application. Wherein:
FIG. 1 is a schematic diagram of a primary flow of an inventory deduction method according to a first embodiment of the present application;
FIG. 2 is a schematic diagram of a main flow of an inventory deduction method according to a second embodiment of the present application;
fig. 3 is a schematic diagram of an application scenario of the inventory deduction method according to the third embodiment of the present application;
FIG. 4 is a schematic diagram of the main units of an inventory abatement device according to an embodiment of the present application;
FIG. 5 is an exemplary system architecture diagram to which embodiments of the present application may be applied;
fig. 6 is a schematic structural diagram of a computer system suitable for implementing the terminal device or the server according to the embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of an inventory deduction method according to a first embodiment of the present application, and as shown in fig. 1, the inventory deduction method includes:
and step S101, receiving the inventory deduction request, and carrying out local inventory deduction based on the inventory deduction request.
In this embodiment, an execution subject (for example, a server) of the inventory deduction method may receive the inventory deduction request through a wired connection or a wireless connection. In particular, the executive agent, upon receiving the inventory deduction request, may invoke a load balancing service to distribute the inventory deduction request to available inventory storage containers to cause the inventory storage solvent to perform local inventory deduction based on the inventory deduction request. The local inventory deduction is not an actual inventory deduction, but may be a reduction of the virtual number of the inventory made when the local inventory is sufficient compared to the inventory to be reduced for the inventory reduction request, or may indicate that the deduction was successful without making a reduction of the virtual number of the inventory when the local inventory is sufficient compared to the inventory to be reduced for the inventory reduction request.
Specifically, the local inventory deduction based on the inventory deduction request comprises the following steps:
the execution main body determines the inventory deduction amount corresponding to the inventory deduction request; comparing the inventory deduction amount with the local inventory of the inventory storage container distributed by the load balancing service, determining that the local inventory deduction amount is successful in response to the fact that the inventory deduction amount is smaller than the local inventory, further triggering a unified inventory deduction process, and determining that the local inventory deduction amount is failed in response to the fact that the inventory deduction amount is larger than the local inventory.
Specifically, the local inventory deduction based on the inventory deduction request comprises the following steps:
and in response to determining that the inventory storage container corresponding to the local inventory is down, calling the inventory storage container which normally works to perform local inventory pre-deduction. When the execution main body determines that the inventory storage container corresponding to the local inventory is down, the storage container which normally works can be detected, and the inventory deduction request is sent to the inventory storage container which normally works so as to carry out pre-deduction of the local inventory of the inventory storage container which normally works.
In this embodiment, specifically, the inventory deduction method further includes:
and traversing the rest inventory storage containers to execute corresponding local inventory deduction based on the inventory deduction request in response to determining that the local inventory deduction fails, and returning inventory deduction failure information in response to determining that the local inventory deduction corresponding to all the inventory storage containers fails and does not perform unified inventory deduction any more.
Specifically, when the executive agent determines that the local inventory deduction fails, indicating that the local inventory may not be deducted enough, the executive agent may send an inventory deduction request to other inventory storage containers, i.e., traverse the remaining inventory storage containers, so that the traversal of the arriving inventory storage containers continues the local inventory deduction based on the inventory deduction request until the local inventory deduction succeeds. If the local inventory corresponding to each inventory storage container fails to be deducted after traversing the rest inventory storage containers, the fact that the local inventory of all the inventory storage containers is not deducted sufficiently is indicated, and a sold-out prompt message can be directly returned. Unified inventory pre-deduction is not performed any more, so that unified cache pressure is relieved to a certain extent, and the phenomenon that a huge inventory deduction request amount collapses a unified cache is avoided.
And step S102, in response to the fact that the local inventory deduction is determined to be successful, unified inventory deduction is conducted based on the inventory deduction request.
And when the execution main body determines that the local inventory pre-deduction is successful, triggering a unified inventory pre-deduction process, and further performing unified inventory pre-deduction based on the inventory deduction request. Comparing the inventory deduction amount corresponding to the inventory deduction request with the unified inventory, and when the inventory deduction amount corresponding to the inventory deduction request is smaller than the unified inventory, indicating that the unified inventory deduction is successful; and when the inventory deduction amount corresponding to the inventory deduction request is larger than the unified inventory, indicating that the unified inventory deduction fails.
And step S103, in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is carried out based on the inventory deduction request, and the order placing success information of the user is returned.
And step S104, in response to the fact that the unified inventory pre-deduction fails, rejecting deduction requests of the local inventory and the unified inventory, and returning inventory deduction failure information.
In the embodiment of the application, the unified inventory is a total inventory amount used for avoiding the over-selling condition.
If the executive determines that the local inventory pre-reduction is successful but the consolidated inventory pre-reduction fails, it indicates that the total inventory remaining (i.e., consolidated inventory) is not enough to be reduced, and if the actual reduction of the local inventory is still performed when the consolidated inventory pre-reduction fails, an over-selling condition of the item may result. Therefore, in response to determining that the unified inventory pre-deduction fails, the executive body rejects the deduction request of the local inventory and the unified inventory, and does not actually deduct the local inventory and the unified inventory, so as to avoid the over-selling condition caused by actual delivery. And if the execution main body determines that the local inventory pre-deduction is successful and the unified inventory pre-deduction is successful, the execution main body indicates that the current remaining total inventory is enough to carry out inventory deduction corresponding to the inventory deduction request, actual deduction of the local inventory and the unified inventory is carried out based on the inventory deduction request, the order placing success information of the user is returned, and then the subsequent goods delivery process is carried out.
The embodiment performs local inventory deduction based on the inventory deduction request by receiving the inventory deduction request; in response to determining that the local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request; and in response to determining that the unified inventory pre-deduction fails, rejecting a deduction request for the local inventory and the unified inventory, and returning inventory deduction failure information, or in response to determining that the unified inventory pre-deduction succeeds, carrying out deduction on the local inventory and the unified inventory based on the inventory deduction request, and returning order placing success information of a user. And the local deduction and the unified inventory deduction are combined, so that the performance pressure of the unified inventory deduction is relieved.
Fig. 2 is a schematic main flow chart of an inventory deduction method according to a second embodiment of the present application, and as shown in fig. 2, the inventory deduction method includes:
step S201, determining unified inventory, downtime and quantity of inventory storage containers.
Specifically, the stock is unified, for example, 100. The downtime, i.e., the chance of a failure of an inventory storage container, is, for example, 10%. The delay probability is not counted and limited, and can be determined according to actual conditions. The number of inventory storage containers may be, for example, the number of machines that store the inventory, and may be the number of servers that store the inventory, for example, 5.
Step S202, determining local inventory according to the unified inventory, the downtime and the quantity of the inventory storage containers.
The executing agent, after determining the unified inventory, the downtime, and the number of inventory storage containers, may perform an allocation of the local inventory of each inventory storage container. In an example, a certain inventory is evenly distributed to each inventory storage container, meanwhile, a certain reserved cache inventory quota is added for each inventory storage container on the basis of the average inventory quota, and local memory storage is adopted, so that local inventory is obtained. Therefore, when the inventory storage containers are delayed, because each inventory storage container has the reserved cache allowance, the inventory allowance on the delayed inventory storage container can still be reduced on other inventory storage containers, and the condition of selling lots of inventory storage containers is ensured.
Specifically, determining local inventory includes:
an average inventory is determined based on the unified inventory and the number of inventory storage containers.
Specifically, first, the execution principal may determine an average inventory according to the unified inventory and the number of inventory storage containers, and specifically, may determine a ratio of the unified inventory to the number of inventory storage containers as the average inventory.
And determining the cache allowance according to the average inventory, the downtime rate and the quantity of the inventory storage containers.
Specifically, the cache margin is the average inventory/[ (1-downtime) × number of inventory storage containers ], where "/" means "divided by". For example, the downtime rate is expected to be 10%, the total inventory is 100 for 5 switchboard machines, the average inventory is 10, and the cache margin is 10/(0.9 × 5) 20/9, and the cache margin setting principle may be: if the amount of cache is less than 1, and the downtime inventory is distributed to other machines as much as possible, the cache margin may be set to 3. The cache margin setting principle is not specifically limited in the embodiment of the application, and the setting can be performed based on the actual situation.
And determining the local inventory according to the average inventory and the inventory allowance.
Local inventory is average inventory + cache margin.
According to the method and the device, the cache allowance is reserved for the local inventory of each inventory storage container, so that when the inventory storage container is shut down, the inventory on the shut-down inventory storage container can still be deducted from other inventory storage containers which work normally, the condition that the articles are not sold less is ensured, and the controllability of the sales volume of the articles is ensured.
The inventory deduction method further comprises the following steps:
the local inventory is stored in the form of atomic variables for ongoing inventory deduction. The local inventory can be stored by adopting atomic variables, and the problem of multithread concurrency does not exist.
The inventory deduction method further comprises the following steps:
and storing the unified inventory in a queue form to obtain a unified inventory queue so as to deduct the unified inventory based on the unified inventory queue. And if the local inventory deduction is successful, requesting the remote unified inventory to carry out deduction, storing the remote unified inventory in a queue form by adopting redis cache, and realizing the deduction of the inventory by adopting pop-up operation of an inventory queue, thereby ensuring the atomicity and the performance.
And step S203, receiving the inventory deduction request, and performing local inventory deduction based on the inventory deduction request.
And step S204, responding to the fact that the local inventory deduction is successful, and conducting unified inventory deduction based on the inventory deduction request.
Step S205, in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is carried out based on the inventory deduction request, and the information of successful ordering of the user is returned;
and step S206, in response to determining that the unified inventory pre-deduction fails, rejecting a deduction request for the local inventory and the unified inventory, and returning inventory deduction failure information.
The principle of step S203 to step S205 is similar to that of step S101 to step S103, and is not described here again.
According to the embodiment of the application, the local inventory deduction is firstly carried out once, when the local inventory is insufficient, the system directly returns that the user is sold out, the unified inventory deduction is not carried out any more, the unified cache pressure is relieved to a certain extent, and the condition that a large network request amount spans the redis cache is avoided. The reserved buffer inventory and the unified inventory deduction are combined, so that the condition of under-selling and over-selling due to the reserved buffer are avoided. On the basis of average inventory, reserving buffer inventory for each inventory storage container to avoid the condition of low sales; and a redis queue is adopted to realize the deduction of unified inventory amount, so that the over-selling condition is avoided. Local deduction and unified inventory deduction are combined, and unified inventory deduction performance pressure is relieved.
Fig. 3 is a schematic view of an application scenario of the inventory deduction method according to the third embodiment of the present application. The inventory deduction method can be applied to the multi-level deduction scene of the inventory of the articles. As shown in fig. 3, the server 302 receives the inventory deduction request 301, and performs local pre-deduction of the local inventory (e.g., local inventory 1, local inventory 2, local inventory 3) based on the inventory deduction request 301. The server 302 performs a consolidated pre-deduction of the consolidated inventory 303 based on the inventory deduction request 301 in response to determining that the local pre-deduction of the local inventory (which may be, for example, any one or more of local inventory 1, local inventory 2, local inventory 3) is successful. The server 302, in response to determining that the consolidated pre-deduction of the consolidated inventory 303 is successful, performs deduction of the local inventory (which may be any one or more of local inventory 1, local inventory 2, and local inventory 3, for example) and the consolidated inventory 303 based on the inventory deduction request 301, and returns a user ordering success information. The server 302, in response to determining that the unified pre-deduction of the unified inventory 303 fails, rejects the deduction requests for the local inventory (which may be any one or more of the local inventory 1, the local inventory 2, the local inventory 3, for example) and the unified inventory 303, returning inventory deduction failure information. There may be a plurality of local inventories, for example, there may be n local inventories, and the specific value of n is not limited in the embodiment of the present application.
According to the embodiment of the application, the local inventory deduction is firstly carried out once, when the local inventory is insufficient, the system directly returns that the user is sold out, the unified inventory deduction is not carried out any more, the unified cache pressure is relieved to a certain extent, and the condition that a large network request amount spans the redis cache is avoided. The reserved buffer inventory and the unified inventory deduction are combined, so that the condition of under-selling and over-selling due to the reserved buffer are avoided.
Fig. 4 is a schematic diagram of the main units of an inventory abatement device according to an embodiment of the present application. As shown in fig. 4, the stock reducing apparatus includes a receiving unit 401, a pre-reducing unit 402, and a stock reducing unit 403.
A receiving unit 401 configured to receive an inventory deduction request, and perform local inventory deduction based on the inventory deduction request;
a pre-deduction unit 402 configured to perform a unified inventory pre-deduction based on the inventory deduction request in response to determining that the local inventory pre-deduction is successful;
an inventory deduction unit 403 configured to, in response to determining that the unified inventory pre-deduction is successful, perform deduction of the local inventory and the unified inventory based on the inventory deduction request, and return an order placing success message to the user; and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information.
In some embodiments, the receiving unit 401 is further configured to: determining the inventory deduction amount corresponding to the inventory deduction request; comparing the inventory deduction amount with the local inventory, determining that the local inventory deduction is successful in response to determining that the inventory deduction amount is smaller than the local inventory, and determining that the local inventory deduction is failed in response to determining that the inventory deduction amount is larger than the local inventory.
In some embodiments, the inventory abatement device further comprises, not shown in fig. 4: a local inventory determination unit configured to: determining unified inventory, downtime and quantity of inventory storage containers; and determining the local inventory according to the unified inventory, the downtime rate and the quantity of the inventory storage containers.
In some embodiments, the local inventory determination unit is further configured to: determining average inventory according to the quantity of the unified inventory and the inventory storage containers; determining the cache allowance according to the average inventory, the downtime rate and the quantity of inventory storage containers; and determining the local inventory according to the average inventory and the inventory allowance.
In some embodiments, the receiving unit 401 is further configured to: and in response to determining that the inventory storage container corresponding to the local inventory is down, calling the inventory storage container which normally works to perform local inventory pre-deduction.
In some embodiments, the inventory abatement device further comprises, not shown in fig. 4: a storage unit configured to: the local inventory is stored in the form of atomic variables for ongoing inventory deduction.
In some embodiments, the inventory abatement device further comprises, not shown in fig. 4: a storage unit configured to: and storing the unified inventory in a queue form to obtain a unified inventory queue so as to deduct the unified inventory based on the unified inventory queue.
In some embodiments, the pre-clipping unit 402 is further configured to: and traversing the rest inventory storage containers to execute corresponding local inventory deduction based on the inventory deduction request in response to determining that the local inventory deduction fails, and returning inventory deduction failure information in response to determining that the local inventory deduction corresponding to all the inventory storage containers fails and does not perform unified inventory deduction any more.
It should be noted that, in the present application, the stock reduction method and the stock reduction apparatus have corresponding relation in the specific implementation contents, and therefore, the repeated contents are not described again.
Fig. 5 illustrates an exemplary system architecture 500 to which the inventory reduction method or inventory reduction apparatus of embodiments of the present application may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having inventory deduction screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) supporting inventory deduction requests submitted by users using the terminal devices 501, 502, 503. The background management server can receive the inventory deduction request and carry out local inventory deduction on based on the inventory deduction request; in response to determining that the local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request; in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is conducted on the basis of the inventory deduction request, and information of successful ordering of the user is returned; and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information. And the local deduction and the unified inventory deduction are combined, so that the performance pressure of the unified inventory deduction is relieved.
It should be noted that the inventory reduction method provided in the embodiment of the present application is generally executed by the server 505, and accordingly, the inventory reduction device is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a terminal device of an embodiment of the present application. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the computer system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output section 607 including a signal processing section such as a Cathode Ray Tube (CRT), a liquid crystal credit authorization inquiry processor (LCD), and the like, and a speaker and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to embodiments disclosed herein, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present application are executed when the computer program is executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, a pre-mitigation unit, and an inventory mitigation unit. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to receive an inventory deduction request and perform a local inventory deduction based on the inventory deduction request; in response to determining that the local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request; in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is conducted on the basis of the inventory deduction request, and information of successful ordering of the user is returned; and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information.
According to the technical scheme of the embodiment of the application, the performance pressure of the unified inventory deduction is relieved by combining the local deduction and the unified inventory deduction.
The above-described embodiments should not be construed as limiting the scope of the present application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (12)
1. An inventory deduction method, comprising:
receiving an inventory deduction request, and performing local inventory deduction based on the inventory deduction request;
in response to determining that local inventory deduction is successful, performing unified inventory deduction based on the inventory deduction request;
in response to the fact that the unified inventory pre-deduction is successful, deduction of the local inventory and the unified inventory is conducted on the basis of the inventory deduction request, and ordering success information of a user is returned;
and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information.
2. The method of claim 1, wherein the local inventory deduction based on the inventory deduction request comprises:
determining the inventory deduction amount corresponding to the inventory deduction request;
comparing the inventory deduction amount with a local inventory, determining that local inventory pre-deduction is successful in response to determining that the inventory deduction amount is smaller than the local inventory, and determining that local inventory pre-deduction is failed in response to determining that the inventory deduction amount is larger than the local inventory.
3. The method of claim 1, wherein prior to said receiving an inventory deduction request, the method further comprises:
determining unified inventory, downtime and quantity of inventory storage containers;
and determining local inventory according to the unified inventory, the downtime and the quantity of the inventory storage containers.
4. The method of claim 3, wherein the determining a local inventory comprises:
determining an average inventory according to the unified inventory and the quantity of the inventory storage containers;
determining the cache allowance according to the average inventory, the downtime and the quantity of the inventory storage containers;
and determining local inventory according to the average inventory and the cache allowance.
5. The method of claim 1, wherein the local inventory deduction based on the inventory deduction request comprises:
and in response to determining that the inventory storage container corresponding to the local inventory is down, calling the inventory storage container which normally works to pre-deduct the local inventory.
6. The method of claim 1, further comprising:
storing the local inventory in the form of atomic variables for ongoing inventory deduction.
7. The method of claim 1, further comprising:
and storing the unified inventory in a queue form to obtain a unified inventory queue, and deducting the unified inventory based on the unified inventory queue.
8. The method of claim 1, further comprising:
and traversing the rest inventory storage containers to execute corresponding local inventory deduction based on the inventory deduction request in response to determining that the local inventory deduction fails, and returning inventory deduction failure information in response to determining that the local inventory deduction corresponding to all the inventory storage containers fails and does not perform unified inventory deduction any more.
9. An inventory deduction device, comprising:
a receiving unit configured to receive an inventory deduction request, and perform local inventory deduction based on the inventory deduction request;
a pre-deduction unit configured to perform a unified inventory pre-deduction based on the inventory deduction request in response to determining that a local inventory pre-deduction is successful;
the inventory deduction unit is configured to respond to the fact that unified inventory pre-deduction is successful, carry out deduction on the local inventory and the unified inventory based on the inventory deduction request, and return order placing success information of a user; and in response to determining that the unified inventory pre-deduction fails, rejecting deduction requests for the local inventory and the unified inventory and returning inventory deduction failure information.
10. The apparatus of claim 9, wherein the receiving unit is further configured to:
determining the inventory deduction amount corresponding to the inventory deduction request;
comparing the inventory deduction amount with a local inventory, determining that local inventory pre-deduction is successful in response to determining that the inventory deduction amount is smaller than the local inventory, and determining that local inventory pre-deduction is failed in response to determining that the inventory deduction amount is larger than the local inventory.
11. An inventory deduction electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111220064.9A CN113935691A (en) | 2021-10-20 | 2021-10-20 | Inventory deduction method and device, electronic equipment and computer readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111220064.9A CN113935691A (en) | 2021-10-20 | 2021-10-20 | Inventory deduction method and device, electronic equipment and computer readable medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113935691A true CN113935691A (en) | 2022-01-14 |
Family
ID=79280570
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111220064.9A Pending CN113935691A (en) | 2021-10-20 | 2021-10-20 | Inventory deduction method and device, electronic equipment and computer readable medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113935691A (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111401752A (en) * | 2020-03-18 | 2020-07-10 | 北京泓慧国际能源技术发展有限公司 | Flywheel energy storage frequency modulation sharing processing method, device and system and electronic equipment |
CN113360570A (en) * | 2021-05-31 | 2021-09-07 | 紫光云技术有限公司 | High-concurrency system inventory module implementation method |
-
2021
- 2021-10-20 CN CN202111220064.9A patent/CN113935691A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111401752A (en) * | 2020-03-18 | 2020-07-10 | 北京泓慧国际能源技术发展有限公司 | Flywheel energy storage frequency modulation sharing processing method, device and system and electronic equipment |
CN113360570A (en) * | 2021-05-31 | 2021-09-07 | 紫光云技术有限公司 | High-concurrency system inventory module implementation method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110866709B (en) | Method and device for merging orders | |
CN105376111B (en) | Resource allocation methods and device | |
CN110738436B (en) | Method and device for determining available inventory | |
CN111047243A (en) | Method and device for determining logistics distribution cost | |
CN110706093A (en) | Accounting processing method and device | |
CN110599277A (en) | Inventory deduction method and device | |
CN112132674A (en) | Transaction processing method and device | |
CN111127181A (en) | Voucher bookkeeping method and device | |
CN111580882B (en) | Application program starting method, device, computer system and medium | |
CN111275450B (en) | Processing method and system of associated preferential information after commodity return | |
CN113449994A (en) | Assignment method, assignment device, electronic device, medium, and program product for job ticket | |
CN111833037A (en) | Account management method and device | |
CN111401752A (en) | Flywheel energy storage frequency modulation sharing processing method, device and system and electronic equipment | |
CN113765871B (en) | Method and device for managing fort machine | |
CN113379258A (en) | Inventory management method and device | |
CN107609852B (en) | Method and apparatus for processing payment requests | |
CN113935691A (en) | Inventory deduction method and device, electronic equipment and computer readable medium | |
CN113077220A (en) | User request processing method and device | |
CN114090247A (en) | Method, device, equipment and storage medium for processing data | |
CN113592470A (en) | Service processing method and device, electronic equipment and storage medium | |
CN112884382A (en) | Resource quota management method, device, equipment and storage medium of cloud platform | |
CN113554373A (en) | Method and device for managing ex-warehouse of three-dimensional warehouse | |
CN106878369B (en) | Service processing method and device | |
CN112015745B (en) | Data management method and device | |
CN112053106A (en) | Method and device for managing delivery of articles |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |