Inventory determination method and apparatus, computer device, and storage medium

By converting target documents into inventory model objects and determining the initial master-detail tables, simultaneous calculation of real-time and in-transit inventory is achieved, solving the problem of low inventory calculation efficiency in existing technologies and improving the efficiency and flexibility of inventory management.

CN116308085BActive Publication Date: 2026-05-12KINGDEE DEEKING CLOUDCOMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KINGDEE DEEKING CLOUDCOMPUTING CO LTD
Filing Date
2023-03-02
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing technology requires statistical analysis of all outbound and inbound documents when querying inventory balances, resulting in low inventory calculation efficiency. Each additional document type requires recoding, increasing the computational burden.

Method used

By obtaining the inventory parameters of the target document, converting them into an inventory model object that includes multiple information fields, and determining the initial master table and initial slave table, the initial master table is updated using the inventory parameters, and then the initial slave table is updated using the target master table and information fields, thus realizing the simultaneous calculation of real-time inventory and in-transit inventory.

Benefits of technology

It improves the efficiency of inventory determination, avoids additional coding steps, simplifies the data structure for different types of inventory, and enhances the flexibility and accuracy of inventory management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116308085B_ABST
    Figure CN116308085B_ABST
Patent Text Reader

Abstract

The application relates to an inventory determination method and device, computer equipment and a storage medium. The method comprises the following steps: determining an inventory parameter corresponding to a target bill, and converting the target bill into an inventory model object comprising a plurality of information fields when the inventory parameter represents that inventory updating is started; determining an initial master table and an initial slave table corresponding to the inventory model object, and then performing inventory updating on the initial master table according to the inventory parameter to obtain a target master table, so that inventory updating can be performed on the initial slave table according to the target master table and the plurality of information fields to obtain a target slave table. The method can improve the efficiency of inventory determination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of enterprise management software technology, and in particular to an inventory determination method, apparatus, computer equipment, and storage medium. Background Technology

[0002] Inventory management is one of the core components of an enterprise resource planning system. It is the most important input and output information for production management and supply chain management, and it serves as the information foundation for enterprise material demand planning, material inbound and outbound operations, etc. The design of inventory management restricts the performance and user experience of the entire information system.

[0003] Currently, whenever an inventory balance query is needed, all outbound and inbound documents are statistically analyzed to calculate the immediate inventory balance. Then, different document types are coded separately to calculate the in-transit inventory for documents of the same type. However, each new document type requires recoding and the addition of new coding fields, which undoubtedly increases the efficiency of inventory calculation. Therefore, how to simultaneously calculate both immediate and in-transit inventory to improve the efficiency of inventory determination is the problem this application aims to solve. Summary of the Invention

[0004] Therefore, it is necessary to provide an inventory determination method, apparatus, computer equipment, and computer-readable storage medium that can improve the efficiency of inventory calculation in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a method for determining inventory. The method includes:

[0006] Obtain the target document and determine the inventory parameters corresponding to the target document;

[0007] When the inventory parameter indicates that inventory updates are enabled, the target document is converted into an inventory model object that includes multiple information fields.

[0008] Determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the inventory in transit.

[0009] The initial master table is updated with inventory based on the inventory parameters to obtain the target master table;

[0010] The target sub-table is obtained by updating the inventory of the initial sub-table using the target master table and multiple information fields.

[0011] In one embodiment, before obtaining the target document, the method further includes: obtaining a document template and creating an initial document based on the document template; the initial document includes a preset database table name and entered document information; configuring the inventory parameters of the initial document according to document business requirements to obtain candidate documents; the document business requirements include any one of saving a document, approving a document, unapproving a document, and deleting a document; associating the inventory parameters in the candidate documents with the corresponding program file to obtain the target document; the program file is used to perform logical calculations of the inventory of the target document.

[0012] In one embodiment, after determining the inventory parameters corresponding to the target document, the method further includes: determining whether an inventory reconciliation operation for multiple historical documents is being performed; if yes, obtaining a reconciliation prompt and stopping inventory calculation for the target document; if no, determining whether the inventory parameters indicate that inventory updates are enabled, and stopping inventory calculation for the target document when the inventory parameters indicate that inventory updates are not enabled.

[0013] In one embodiment, converting the target document into an inventory model object including multiple information fields includes: determining a reference document corresponding to the target document; the reference document represents a document that provides a reference basis for document information entry for the target document; performing a preliminary calculation on the target document based on the reference document to obtain a calculated target document; and converting the calculated target document containing multiple document information into an inventory model object including multiple information fields.

[0014] In one embodiment, the step of performing preliminary calculations on the target document based on the reference document to obtain the calculated target document includes: determining a reference field in the reference document and determining a modified field corresponding to the reference field in the target document; determining the difference between the field value of the reference field and the field value of the modified field; updating the field value of the modified field in the target document to the difference to obtain the calculated target document.

[0015] In one embodiment, the inventory model object includes a database table name; the initial master table includes multiple master table fields; determining the initial master table and initial slave table corresponding to the inventory model object includes: determining the initial master table corresponding to the database of the real-time inventory based on the database table name; determining the target master table field among the multiple master table fields; the target master table field includes the target primary key internal code; obtaining multiple slave tables, and filtering the initial slave table from the multiple slave tables based on the target master table field.

[0016] In one embodiment, the information field includes a product value; updating the initial master table according to the inventory parameters to obtain a target master table includes: determining the value of a first field corresponding to the real-time inventory basic quantity field in the initial master table; determining a first calculation result of the first field value and the product value according to the inventory parameters; updating the first field value in the initial master table to the first calculation result to obtain the target master table.

[0017] In one embodiment, after updating the first field value in the initial master table to the first calculation result to obtain the target master table, the method further includes: when the real-time inventory basic quantity field in the target master table corresponds to a negative value, inverting the product value to obtain a new product value; and returning to the step of determining the first calculation result of the first field value and the product value based on the inventory parameters to continue.

[0018] In one embodiment, updating the inventory of the initial sub-table using the target master table and multiple information fields to obtain the target sub-table includes: determining multiple dimension master table fields in the target master table, and determining whether the field value of each dimension master table field is the same as the field value of any sub-table field in the initial sub-table; if they are all the same, updating the field value of the target primary key in the target master table to the field value of the associated primary key in the initial sub-table to obtain a candidate sub-table; and updating the inventory of the candidate sub-table according to the multiple information fields to obtain the target sub-table.

[0019] In one embodiment, the information field includes a product value; the step of updating the inventory of the candidate sub-table based on multiple information fields to obtain a target sub-table includes: determining the second field value corresponding to the basic quantity field of in-transit inventory in the candidate sub-table; determining a second calculation result of the second field value and the product value based on the inventory parameters; and updating the second field value in the candidate main table to the second calculation result to obtain the target sub-table.

[0020] Secondly, this application also provides an inventory determination device. The device includes:

[0021] The document conversion module is used to obtain the target document and determine the inventory parameters corresponding to the target document; when the inventory parameters indicate that inventory updates are enabled, the target document is converted into an inventory model object including multiple information fields.

[0022] The target master table determination module is used to determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the in-transit inventory; and the initial master table is updated according to the inventory parameters to obtain the target master table.

[0023] The target sub-table determination module is used to update the inventory of the initial sub-table using the target master table and multiple information fields to obtain the target sub-table.

[0024] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0025] Obtain the target document and determine the inventory parameters corresponding to the target document;

[0026] When the inventory parameter indicates that inventory updates are enabled, the target document is converted into an inventory model object that includes multiple information fields.

[0027] Determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the inventory in transit.

[0028] The initial master table is updated with inventory based on the inventory parameters to obtain the target master table;

[0029] The target sub-table is obtained by updating the inventory of the initial sub-table using the target master table and multiple information fields.

[0030] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the following steps:

[0031] Obtain the target document and determine the inventory parameters corresponding to the target document;

[0032] When the inventory parameter indicates that inventory updates are enabled, the target document is converted into an inventory model object that includes multiple information fields.

[0033] Determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the inventory in transit.

[0034] The initial master table is updated with inventory based on the inventory parameters to obtain the target master table;

[0035] The target sub-table is obtained by updating the inventory of the initial sub-table using the target master table and multiple information fields.

[0036] The aforementioned inventory determination method, apparatus, computer equipment, and storage medium, by determining the inventory parameters corresponding to the target document and, when the inventory parameters indicate that inventory updates are enabled, can convert the target document into an inventory model object including multiple information fields. By determining the initial master table and initial slave table corresponding to the inventory model object, and then updating the initial master table based on the inventory parameters, the target master table can be obtained. Thus, the initial slave table can be updated using the target master table and multiple information fields to obtain the target slave table. Since this application directly calculates both immediate inventory and in-transit inventory based on the inventory parameters in the inventory model object, compared to the traditional method of separately encoding documents of different document types, this application eliminates the need for additional encoding. It directly converts the target document into a uniformly formatted inventory model object, and, upon determining the initial master table and initial slave table corresponding to the inventory model object, can quickly update the inventory of different types, thus improving the efficiency of inventory determination. Attached Figure Description

[0037] Figure 1 This is a diagram illustrating the application environment of the inventory determination method in one embodiment;

[0038] Figure 2 This is a flowchart illustrating an inventory determination method in one embodiment;

[0039] Figure 3 This is a schematic diagram illustrating the principle of enabling inventory updates in one embodiment;

[0040] Figure 4 This is a flowchart illustrating the process of determining an inventory model object in one embodiment;

[0041] Figure 5 This is a flowchart illustrating the process of determining the target from the table in one embodiment;

[0042] Figure 6 This is a flowchart illustrating the inventory determination method in another embodiment;

[0043] Figure 7 This is a structural block diagram of an inventory determination device in one embodiment;

[0044] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0046] The inventory determination method provided in this application can be applied to, for example... Figure 1 In the application environment shown, there are terminal 102 and server 104. Terminal 102 can communicate with server 104 via a network. Server 104 is used to obtain the target document provided by terminal 102 and determine the inventory parameters corresponding to the target document. When the inventory parameters indicate that inventory updates are enabled, the target document is converted into an inventory model object including multiple information fields. The server 104 determines the initial master table and initial slave table corresponding to the inventory model object. Server 104 is also used to update the initial master table according to the inventory parameters to obtain the target master table, and update the initial slave table according to the target master table and multiple information fields to obtain the target slave table. Terminal 102 can be used to display the target master table and the target slave table. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0047] In one embodiment, such as Figure 2 As shown, an inventory determination method is provided. Taking the application of this method to computer equipment as an example, the computer equipment can provide... Figure 1 The terminal or server in the process includes the following steps:

[0048] Step 202: Obtain the target document and determine the inventory parameters corresponding to the target document.

[0049] The target document contains pre-configured associated inventory parameters; these parameters are used to determine whether to initiate an inventory update operation through the target document.

[0050] Specifically, the computer device can be a platform that displays a document selection interface. Responding to the user's selection on this interface, the target document is obtained. The computer device can parse the target document to obtain the corresponding inventory parameters. When the inventory parameters include either an increase or decrease in inventory, these parameters indicate that the inventory can be used to initiate an inventory update operation through the target document.

[0051] In one embodiment, before obtaining the target document, the method further includes: obtaining a document template and creating an initial document based on the document template; matching the inventory parameters of the initial document with the document business requirements to obtain candidate documents; and associating the inventory parameters in the candidate documents with the corresponding program files to obtain the target document.

[0052] The initial document includes preset database table names and user-entered document information; document business requirements include any one of the following: saving a document, approving a document, unapproving a document, and deleting a document; the program file is used to perform logical inventory calculations on the target document. The document template includes various document fields required for inventory calculation, such as basic unit quantity and product internal code.

[0053] Specifically, such as Figure 3 As shown, Figure 3 This is a schematic diagram illustrating the principle of enabling inventory updates. When the computer device selects a document template from the document template library, it can inherit from the template to obtain a pre-created initial document. The computer device can also create an initial document directly from a blank document. When the document's business requirement is to save or approve a document, the computer device can configure the inventory increase parameter with the initial document to obtain candidate documents; when the document's business requirement is to un-approve or delete a document, the computer device can configure the inventory decrease parameter with the initial document to obtain candidate documents.

[0054] Specifically, "Save document" indicates that when the initial document is saved, an inventory update operation is performed using the initial document; "Audit document" indicates that when the initial document is audited, an inventory update operation is performed using the initial document; "Unaudit document" indicates that when the initial document is unaudited, an inventory update operation is performed using the initial document; and "Delete document" indicates that when the initial document is deleted, an inventory update operation is performed using the initial document.

[0055] Furthermore, the computer equipment is pre-configured with program files corresponding to the inventory parameters. These program files can be Java files that exist as plugins, and the plugins can be presented as functional controls. When the computer equipment associates the inventory parameters in the candidate documents with the program files, it can obtain the target documents that can be used for inventory update operations.

[0056] In one embodiment, a computer device can automatically incorporate the created target document into the enterprise's inventory reports without requiring additional coding of the target document.

[0057] In one embodiment, the computer device can support the expansion and continuous development of the business based on a document template and in response to other business control parameters added by the user.

[0058] In one embodiment, the computer device can pre-configure document fields, inventory parameters, and program files in a document template. When the document template is directly inherited, a target document ready for inventory update operations can be obtained. Therefore, since the document template includes program files that directly perform logical calculations for inventory on the target document, it can improve the user's development efficiency and reduce the risk of code errors.

[0059] Step 204: When the inventory parameter representation enables inventory updates, the target document is converted into an inventory model object that includes multiple information fields.

[0060] The information fields included in the inventory model object may include, for example, product value, auxiliary attributes, batch number, shelf life, etc.

[0061] Specifically, when a user performs a target operation on a target document with entered document information, the computer device stores the target document in the form of a document data packet. Target operations include, but are not limited to, saving the document, approving the document, unapproving the document, and deleting the document. Since the data packet structures formed by different types of documents are not the same, that is, the data source forms are not the same, when the inventory parameter characterization enables inventory updates, the computer device calculates and encapsulates the document data packet to obtain a uniformly formatted inventory model object that can be used for inventory calculation.

[0062] In one embodiment, when a user performs a target operation on a target document, the computer device calls a pre-configured program file for the target document, enabling logical calculations of inventory based on the target document.

[0063] Step 206: Determine the initial master table and initial slave table corresponding to the inventory model object.

[0064] The initial master table represents the inventory table corresponding to the immediate inventory; the initial slave table represents the inventory table corresponding to the in-transit inventory. Immediate inventory represents the inventory that should be summarized and recorded whenever and wherever there is an change in inventory, that is, a kind of inventory that actually exists in the warehouse; in-transit inventory represents the inventory that has not yet arrived at its destination, is in transit, or is waiting for transit and is stored in the means of transport.

[0065] The initial document is pre-configured with its own database table name, which corresponds to the database of the real-time inventory.

[0066] Specifically, since each real-time inventory database is associated with a corresponding in-transit inventory database, the computer can directly determine the initial master table corresponding to the real-time inventory database and the initial slave table corresponding to the in-transit inventory database based on the database table names. The initial master table represents the real-time inventory result obtained after inventory calculation based on historical documents; the initial slave table represents the in-transit inventory result obtained after inventory calculation based on historical documents.

[0067] Step 208: Update the inventory of the initial master table according to the inventory parameters to obtain the target master table.

[0068] The initial master table includes multiple master table fields, including the first field to be updated. The first field to be updated includes fields such as the real-time inventory basic quantity field (fqty) and the real-time inventory auxiliary quantity field (fauxqty), which are fields whose inventory values ​​need to be changed.

[0069] Specifically, the computer equipment determines the first field to be updated in the initial master table based on the information fields in the inventory model object, and updates the inventory value of the field corresponding to the first field to be updated according to the information fields and inventory parameters to obtain the target master table. For example, if the basic quantity field of the real-time inventory corresponds to 2 packages and the auxiliary quantity field of the real-time inventory corresponds to 10 items, then the database representing the real-time inventory corresponding to the initial master table has stored 2 packages of goods, and each package contains 5 items.

[0070] Step 210: Update the inventory of the initial sub-table using the target master table and multiple information fields to obtain the target sub-table.

[0071] The initial sub-table includes multiple sub-table fields, including a second field to be updated. The second field to be updated is, for example, the basic quantity field of in-transit inventory (fpreqty) and the auxiliary quantity field of in-transit inventory (fpreauxqty), which are fields whose inventory values ​​need to be changed.

[0072] Specifically, when it is determined that the fields in the target master table and the fields in the initial slave table are related, the computer device determines the second field to be updated in the initial slave table based on the information fields in the inventory model object. Then, by updating the field values ​​corresponding to the second field to be updated according to the information fields and inventory parameters, the target slave table is obtained. For example, if the basic quantity field of in-transit inventory corresponds to 1 package and the auxiliary quantity field of in-transit inventory corresponds to 5 items, then the database representing the immediate inventory of the initial slave table already stores 1 package of goods, and each package contains 5 items.

[0073] The aforementioned inventory determination method, by determining the inventory parameters corresponding to the target document and, when the inventory parameters indicate that inventory updates are enabled, converts the target document into an inventory model object containing multiple information fields. By determining the initial master table and initial slave table corresponding to the inventory model object, and then updating the initial master table based on the inventory parameters, the target master table can be obtained. Thus, the initial slave table can be updated using the target master table and multiple information fields to obtain the target slave table. Since this application directly calculates both immediate and in-transit inventory based on the inventory parameters in the inventory model object, compared to the traditional method of separately encoding documents of different document types, this application eliminates the need for additional encoding. It directly converts the target document into a uniformly formatted inventory model object, and, upon determining the initial master table and initial slave table corresponding to the inventory model object, quickly updates different types of inventory, improving the efficiency of inventory determination.

[0074] Furthermore, since only a small number of inventory increase or decrease parameters are configured in the initial document, no other business parameters need to be configured, nor is it necessary to consider the structural issues of different inventory tables. The inventory update operation is directly initiated through the target document based on the inventory parameters, further improving the efficiency of inventory updates. At the same time, since users only need to select the target document to perform the inventory update operation, the threshold for inventory management is lowered, and the flexibility of inventory management is also enhanced.

[0075] In one embodiment, after determining the inventory parameters corresponding to the target document, the method further includes: determining whether an inventory reconciliation operation for multiple historical documents is being performed; if yes, a reconciliation prompt message is obtained, and inventory calculation for the target document is stopped; if no, it is determined whether the inventory parameters indicate that inventory updates are enabled, and when the inventory parameters indicate that inventory updates are not enabled, inventory calculation for the target document is stopped.

[0076] Specifically, because inventory managers perform inventory audits or reconciliations at different times, various inventories can be considered temporarily closed. Therefore, before calculating inventory for the target document, the computer system checks whether inventory reconciliation operations are currently underway, i.e., reconciliations between multiple historical documents. If so, the computer system stops calculating inventory for the target document and displays a reconciliation prompt to the user operating the target document. If not, the computer system checks whether inventory updates are enabled based on inventory parameters. If inventory updates are not enabled, the computer system continues calculating inventory for the target document.

[0077] In this embodiment, by checking in advance whether inventory reconciliation operations are being performed in various inventories, unnecessary inventory update operations are avoided when real-time inventory or inventory in transit is temporarily closed, thus saving resource consumption in inventory processing.

[0078] In one embodiment, such as Figure 4 As shown, Figure 4 This is a flowchart illustrating the process of determining the inventory model object. Converting the target document into an inventory model object containing multiple information fields includes the following steps:

[0079] Step 402: Determine the reference document corresponding to the target document.

[0080] Among them, reference documents are documents that provide reference for the entry of document information for the target document.

[0081] Specifically, when the document processing requirement is to modify a document, the computer system responds to the user's selection, determines the selected reference document, and allows the user to perform modifications such as entering new document information based on the reference document, thus obtaining the target document. For example, if the quantity of goods in reference document A is 10, when the document needs to be modified, the target document B with a quantity of goods of 15 can be obtained.

[0082] Step 404: Perform preliminary calculations on the target document based on the reference document to obtain the calculated target document.

[0083] In one embodiment, a preliminary calculation is performed on the target document based on the reference document to obtain the calculated target document, including: determining the reference field in the reference document and determining the modified field corresponding to the reference field in the target document; determining the difference between the field value of the reference field and the field value of the modified field; updating the field value of the modified field in the target document to the difference to obtain the calculated target document.

[0084] Specifically, since the reference field represents the field that provides the basis for the modification operation of the target document, such as the quantity of goods in the reference document A in the example above, and the modification field is the quantity of goods in the target document B, the computer device determines that the difference between the field value of the reference field and the field value of the modification field is 5, and then uses the difference of 5 as the quantity of goods in the calculated target document.

[0085] Step 406: Convert the calculated target document containing multiple document information into an inventory model object containing multiple information fields.

[0086] Specifically, since the inventory model object has a fixed field expression format, the computer equipment can map and transform the document information in the calculated target document according to the field expression format to obtain an inventory model object with a unified format that can be used for inventory calculation.

[0087] In one embodiment, each target document includes multiple entries, and the format-converted inventory model object can be viewed as a collection of objects.

[0088] In this embodiment, for document business requirements that need to be modified, the difference between the target document and the reference document is determined, and the target document can be preliminarily calculated based on the difference. This allows for the accurate acquisition of the format-converted inventory model object, avoiding the situation where inventory is updated incorrectly simply because of document modification.

[0089] In one embodiment, determining the initial master table and initial slave table corresponding to the inventory model object includes: determining the initial master table corresponding to the database of real-time inventory based on the database table name; determining the target master table field among multiple master table fields; obtaining multiple slave tables, and filtering the initial slave table from the multiple slave tables based on the target master table field.

[0090] The inventory model object includes the database table name; the initial master table includes multiple master table fields; the target master table fields include the target primary key (fid1), and the target master table fields represent the fields that play a role in the association with the slave tables; the slave tables include multiple slave table fields, and the slave table fields include the primary key (fid2) that is associated with the corresponding master table.

[0091] Specifically, the computer device identifies the database corresponding to the database table name as the initial master table corresponding to the real-time inventory database. When the target master table field is the target primary key, the computer device can use the slave table corresponding to the primary key with the same primary key as the target primary key as the initial slave table. For example, if the target primary key (fid1) in the initial master table is inventory ID1, the primary key (fid1) in slave table 1 is ID1, and the primary key (fid2) in slave table 2 is ID2. Therefore, slave table 1 will be used as the initial slave table.

[0092] In this embodiment, by identifying the target master table field in the master table, the association query between the initial slave table and the initial master table can be quickly realized, ensuring the accuracy of subsequent inventory updates.

[0093] In one embodiment, after determining the initial master table corresponding to the inventory model object, the computer device also needs to check the real-time inventory corresponding to the initial master table to determine whether the real-time inventory is in a locked state. Only when the real-time inventory is in an unlocked state can the computer device perform inventory update operations on the initial master table in batches.

[0094] In one embodiment, updating the inventory of the initial master table according to inventory parameters to obtain the target master table includes: determining the first field value corresponding to the real-time inventory basic quantity field in the initial master table; determining the first calculation result of the first field value and the product value according to the inventory parameters; and updating the first field value in the initial master table to the first calculation result to obtain the target master table.

[0095] The information fields in the inventory model object include product values.

[0096] Specifically, since the initial master table represents the real-time inventory result obtained after inventory calculation based on historical documents, that is, the first field value corresponding to the real-time inventory basic quantity field represents the historical inventory value. When the information field in the inventory model object is a product value, the computer device needs to update the product quantity to the first field value of the initial master table to obtain the updated target master table. When the inventory parameter is an increase in inventory, the computer device adds the first field value and the product value to obtain the first calculation result; when the inventory parameter is a decrease in inventory, the computer device determines the difference between the first field value and the product value to obtain the first calculation result.

[0097] In one embodiment, since multiple inventory model objects need to be updated in batches, when an inventory model object is being updated for the first time, the computer device adds a new inventory record; when an inventory model object is not being updated for the first time, the computer device determines the corresponding target inventory record and updates the initial master table referred to by the target inventory record.

[0098] In one embodiment, after obtaining the target master table, the computer device can use the target master table as the new initial master table and return to the process of obtaining the target document to continue.

[0099] In one embodiment, after obtaining the target master table, the computer device can use the target master table as the new initial master table, determine the new inventory model object among multiple inventory model objects, and then return to the process of determining the initial master table and initial slave table corresponding to the inventory model object to continue.

[0100] In this embodiment, by determining whether the inventory model object is undergoing its first inventory update, and when it is not undergoing its first inventory update, determining the first calculation result between the first field value and the product value, and then accurately obtaining the target main table through the first calculation result, the accuracy of the database for determining real-time inventory is improved.

[0101] In one embodiment, the computer device records an inventory change identifier, which can be a primary key in a main table field or an inventory ID. When the inventory in the initial main table is updated to match the target main table, the inventory change identifier also changes. For example, when the first field value of 10 in the initial main table is updated to the first field value of 20 in the target main table, the inventory ID1 in the inventory record referred to by the initial main table changes to inventory ID2.

[0102] In one embodiment, the computer device pushes the inventory change identifier for each change to a message queue. When a user subscribes to the relevant services of the message queue, they can read the inventory information corresponding to the inventory change identifier, so that the inventory information can be used as a reference for subsequent processing of other business.

[0103] In one embodiment, after a computer device pushes an inventory change identifier via a message queue, the pushed inventory change identifier can be cleared.

[0104] In one embodiment, after updating the first field value in the initial master table to the first calculation result and obtaining the target master table, the method further includes: when the real-time inventory basic quantity field in the target master table corresponds to a negative value, inverting the product value to obtain a new product value; and returning to the step of determining the first calculation result of the first field value and the product value based on the inventory parameters to continue.

[0105] Specifically, the computer equipment also needs to perform a negative inventory check, that is, to determine whether there are negative values ​​in the real-time inventory basic quantity field of the target master table. If so, the computer equipment performs a rollback operation on the target master table, that is, the computer equipment inverts the product values ​​in the information fields of the inventory model object to obtain new product values. The computer equipment continues to update the inventory of the initial master table based on the new product values ​​and inventory parameters until a new target master table is obtained.

[0106] In this embodiment, by performing a negative inventory check on the real-time inventory corresponding to the target master table, erroneous updates to the real-time inventory are avoided. This also prevents unnecessary processing of the target slave table when updating the inventory of the initial slave table through the target master table, thereby reducing system resource consumption.

[0107] In one embodiment, such as Figure 5 As shown, Figure 5 This is a flowchart illustrating the process of determining the target subsidiary table. Using the target master table and multiple information fields, the initial subsidiary table is updated with inventory to obtain the target subsidiary table, which includes:

[0108] Step 502: Determine multiple dimension master table fields in the target master table, and determine whether the field value of each dimension master table field is the same as the field value of any slave table field in the initial slave table.

[0109] The target master table's main table fields include the target primary key (fid1), the first field to be updated, and the dimension master table fields. The dimension master table fields include the product internal code (fmaterialid1), auxiliary attribute internal code (fauxpropid1), warehouse internal code (fstockid1), warehouse location internal code (fspid1), batch (fbatchno1), production date (fkfdate1), and expiration date (fvaliddate1). The initial slave table's slave table fields include the primary key (fid2), the second field to be updated, the related primary key (fivid), the product internal code (fmaterialid2), auxiliary attribute internal code (fauxpropid2), warehouse internal code (fstockid2), warehouse location internal code (fspid2), batch (fbatchno2), production date (fkfdate2), expiration date (fvaliddate2), and document type (fbilltype).

[0110] Specifically, the computer device iterates through each dimension field of the target master table in turn, and when the field value of each dimension field is the same as the field value of any field in the initial slave table, the primary key code can be updated.

[0111] Step 504: If all are the same, update the field value of the target primary key in the target main table to the field value of the associated primary key in the initial secondary table to obtain the candidate secondary table.

[0112] Specifically, the computer equipment determines the field value of the target primary key in the target master table, and updates the field value of the associated primary key in the initial slave table using the field value of the target primary key, thus obtaining a candidate slave table.

[0113] Step 506: Update the inventory of the candidate sub-table based on multiple information fields to obtain the target sub-table.

[0114] In one embodiment, updating the inventory of a candidate subsidiary table based on multiple information fields to obtain a target subsidiary table includes: determining the second field value corresponding to the basic quantity field of in-transit inventory in the candidate subsidiary table; determining a second calculation result of the second field value and the product value based on inventory parameters; and updating the second field value in the candidate parent table to the second calculation result to obtain the target subsidiary table.

[0115] The information fields in the inventory model object include product values.

[0116] Specifically, the candidate subsidiary table records the current inventory result obtained after calculating inventory from historical documents; that is, the second field value corresponding to the basic quantity field of in-transit inventory represents the historical inventory value. When the information field in the inventory model object is a product value, the computer device needs to update the product quantity to the first field value of the candidate subsidiary table to obtain the updated target subsidiary table. When the inventory parameter is an increase in inventory, the computer device adds the second field value and the product value to obtain the second calculation result; when the inventory parameter is a decrease in inventory, the computer device determines the difference between the second field value and the product value to obtain the second calculation result. It is easy to understand that the second field value corresponding to the basic quantity field of in-transit inventory is not exactly the same as the first field value corresponding to the basic quantity field of current inventory.

[0117] In one embodiment, when a computer device responds to a user's selection operation for a document type, it determines multiple target sub-tables corresponding to the selected target document type.

[0118] In this embodiment, the update basis of the target sub-table is determined by different dimensions of the master table fields, which enables the batch determination of various update parameters in the target sub-table by combining the inventory model object, thereby accurately obtaining the target sub-table.

[0119] In one embodiment, such as Figure 6As shown, another inventory determination method is provided, including the following steps: S601: The computer device responds to the target operation performed by the user's target document, such as saving the document, auditing the document, etc.; S602: The computer device checks whether an inventory reconciliation operation is being performed in various inventory categories. If yes, then execute S603; otherwise, execute S604. S603: The computer device receives a reconciliation prompt and stops calculating the inventory for the target document; S604: Initialize thread-local variables, i.e., initialize inventory parameters, etc.; S605: The computer device determines whether the inventory parameters indicate that inventory updates are enabled. If not, then stop calculating the inventory for the target document; if yes, then execute S606. S606: When inventory parameters indicate that inventory updates are enabled, the target document is converted into an inventory model object containing multiple information fields; S607: Multiple inventory model objects are updated in batches; S608: The computer device also needs to check the real-time inventory corresponding to the initial master table to determine whether the real-time inventory is in a locked state. If so, inventory calculation for the target document is stopped; otherwise, S609 is executed. S609: For each inventory model object in the batch inventory model object, the initial master table and initial slave table corresponding to the inventory model object are determined; S610: The initial master table is updated according to the inventory parameters to obtain the target master table for real-time inventory; S611: The target slave table for in-transit inventory is updated through the inventory model object; S612: The computer device records the updated inventory change flag; S613: The computer device performs a negative inventory check and rolls back the target master table when a negative inventory is detected; S614: The computer device pushes the inventory change flag through the message queue; S615: The updated inventory change flag is cleared, and the inventory calculation operation ends.

[0120] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0121] Based on the same inventive concept, this application also provides an inventory determination apparatus for implementing the inventory determination method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the inventory determination apparatus provided below can be found in the limitations of the inventory determination method described above, and will not be repeated here.

[0122] In one embodiment, such as Figure 7 As shown, an inventory determination device 700 is provided, including: a document conversion module 702, a target master table determination module 704, and a target slave table determination module 706, wherein:

[0123] The document conversion module 702 is used to obtain the target document and determine the inventory parameters corresponding to the target document; when the inventory parameters indicate that inventory updates are enabled, the target document is converted into an inventory model object that includes multiple information fields.

[0124] The target master table determination module 704 is used to determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the in-transit inventory; the initial master table is updated according to the inventory parameters to obtain the target master table.

[0125] The target sub-table determination module 706 is used to update the inventory of the initial sub-table using the target master table and multiple information fields to obtain the target sub-table.

[0126] In one embodiment, the inventory determination device 700 further includes a document configuration module 708, used to obtain a document template and create an initial document based on the document template; the initial document includes a preset database table name and entered document information; according to the document business requirements, the inventory parameters of the initial document are configured to obtain candidate documents; the document business requirements include any one of saving a document, approving a document, unapproving a document, and deleting a document; the inventory parameters in the candidate documents are associated with the corresponding program file to obtain the target document; the program file is used to perform logical calculations on the inventory of the target document.

[0127] In one embodiment, the inventory determination device 700 further includes a verification judgment module 710, which is used to determine whether an inventory verification operation of multiple historical documents is being performed; if yes, a verification prompt message is obtained and the inventory calculation for the target document is stopped; if no, it is determined whether the inventory parameter indicates that inventory update is enabled, and when the inventory parameter indicates that inventory update is not enabled, the inventory calculation for the target document is stopped.

[0128] In one embodiment, the document conversion module 702 is further configured to determine the reference document corresponding to the target document; the reference document represents the document that provides a reference basis for the entry of document information for the target document; perform preliminary calculations on the target document based on the reference document to obtain the calculated target document; and convert the calculated target document containing multiple document information into an inventory model object including multiple information fields.

[0129] In one embodiment, the document conversion module 702 is further configured to determine a reference field in a reference document and determine the modified field corresponding to the reference field from the target document; determine the difference between the field value of the reference field and the field value of the modified field; update the field value of the modified field in the target document to the difference, and obtain the calculated target document.

[0130] In one embodiment, the target master table determination module 704 further includes an initial table determination module 7041, which is used to determine the initial master table corresponding to the database of real-time inventory based on the database table name; determine the target master table field among multiple master table fields; the target master table field includes the target primary key internal code; obtain multiple slave tables, and filter the initial slave table from the multiple slave tables based on the target master table field.

[0131] In one embodiment, the target master table determination module 704 is further configured to determine the first field value corresponding to the real-time inventory basic quantity field in the initial master table; determine the first calculation result of the first field value and the product value based on the inventory parameters; update the first field value in the initial master table to the first calculation result to obtain the target master table.

[0132] In one embodiment, the target master table determination module 704 further includes an inventory check module 7042, which is used to invert the product value when the real-time inventory basic quantity field in the target master table corresponds to a negative value, to obtain a new product value; and return to the step of determining the first calculation result of the first field value and the product value based on the inventory parameters to continue.

[0133] In one embodiment, the target sub-table determination module 706 is used to determine multiple dimension master table fields in the target master table, and determine whether the field value of each dimension master table field is the same as the field value of any sub-table field in the initial sub-table; if they are all the same, the field value of the target primary key internal code in the target master table is updated to the field value of the associated primary key internal code in the initial sub-table to obtain the candidate sub-table; the candidate sub-table is updated in inventory according to multiple information fields to obtain the target sub-table.

[0134] In one embodiment, the target sub-table determination module 706 is further configured to determine the second field value corresponding to the basic quantity field of in-transit inventory in the candidate sub-table; determine the second calculation result of the second field value and the product value based on the inventory parameters; update the second field value in the candidate main table to the second calculation result to obtain the target sub-table.

[0135] Each module in the aforementioned inventory determination device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0136] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements an inventory determination method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0137] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0138] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0139] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0140] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0141] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0142] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0143] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. An inventory determination method, characterized in that, The method includes: Obtain the target document and determine the inventory parameters corresponding to the target document; When the inventory parameter indicates that inventory updates are enabled, the target document is converted into an inventory model object that includes multiple information fields. Determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the inventory in transit. The initial master table is updated with inventory based on the inventory parameters to obtain the target master table; The target sub-table is obtained by updating the inventory of the initial sub-table using the target master table and multiple information fields.

2. The method according to claim 1, characterized in that, Prior to obtaining the target document, the method further includes: Obtain a document template and create an initial document based on the document template; the initial document includes a preset database table name and the entered document information; Based on the document business requirements, configure the inventory parameters of the initial document to obtain candidate documents; the document business requirements include any one of saving documents, approving documents, unapproving documents, and deleting documents; The inventory parameters in the candidate documents are associated with the corresponding program files to obtain the target documents; the program files are used to perform logical calculations on the inventory of the target documents.

3. The method according to claim 1, characterized in that, After determining the inventory parameters corresponding to the target document, the method further includes: Determine whether an inventory reconciliation operation is being performed on multiple historical documents; If so, a verification prompt message will be received, and inventory calculation for the target document will be stopped; If not, determine whether the inventory parameter indicates that inventory updates are enabled, and if the inventory parameter indicates that inventory updates are not enabled, stop calculating the inventory for the target document.

4. The method according to claim 1, characterized in that, The step of converting the target document into an inventory model object including multiple information fields includes: Identify the reference document corresponding to the target document; the reference document represents a document that provides a reference basis for the entry of document information for the target document; Based on the reference document, a preliminary calculation is performed on the target document to obtain the calculated target document; The calculated target document, which contains multiple document information, is converted into an inventory model object that includes multiple information fields.

5. The method according to claim 4, characterized in that, The step of performing preliminary calculations on the target document based on the reference document to obtain the calculated target document includes: Identify the reference fields in the reference document, and determine the modification fields corresponding to the reference fields from the target document; Determine the difference between the field value of the reference field and the field value of the modified field; The field value of the modified field in the target document is updated to the difference to obtain the calculated target document.

6. The method according to claim 1, characterized in that, The inventory model object includes a database table name; the initial master table includes multiple master table fields; determining the initial master table and initial slave table corresponding to the inventory model object includes: Based on the database table name, determine the initial main table corresponding to the database of the real-time inventory; Determine a target primary table field from among multiple primary table fields; the target primary table field includes the target primary key internal code. Obtain multiple child tables, and filter out the initial child table from the multiple child tables based on the target parent table fields.

7. The method according to claim 1, characterized in that, The information fields include product values; the step of updating the initial master table based on the inventory parameters to obtain the target master table includes: Determine the value of the first field corresponding to the real-time inventory basic quantity field in the initial master table; Based on the inventory parameters, determine the first calculation result of the first field value and the product value; The first field value in the initial main table is updated to the first calculation result to obtain the target main table.

8. The method according to claim 7, characterized in that, After updating the first field value in the initial master table to the first calculation result to obtain the target master table, the method further includes: When the real-time inventory basic quantity field in the target main table corresponds to a negative value, the product value is inverted to obtain a new product value. The process returns to the first calculation result of determining the first field value and the product value based on the inventory parameters and continues.

9. The method according to claim 1, characterized in that, The step of updating the initial subsidiary table to obtain the target subsidiary table by using the target master table and multiple information fields includes: Identify multiple dimension master table fields in the target master table, and determine whether the field value of each dimension master table field is the same as the field value of any slave table field in the initial slave table; If all are the same, then update the field value of the target primary key internal code in the target main table to the field value of the associated primary key internal code in the initial secondary table to obtain the candidate secondary table; Based on multiple information fields, the candidate sub-table is updated with inventory to obtain the target sub-table.

10. The method according to claim 9, characterized in that, The information fields include product values; the step of updating the inventory of the candidate subsidiary table based on multiple information fields to obtain the target subsidiary table includes: Determine the value of the second field corresponding to the basic quantity field of in-transit inventory in the candidate table; Based on the inventory parameters, a second calculation result is determined for the second field value and the product value; The second field value in the candidate main table is updated to the second calculation result to obtain the target secondary table.

11. An inventory determination device, characterized in that, The device includes: The document conversion module is used to obtain the target document and determine the inventory parameters corresponding to the target document; when the inventory parameters indicate that inventory updates are enabled, the target document is converted into an inventory model object including multiple information fields. The target master table determination module is used to determine the initial master table and initial slave table corresponding to the inventory model object; the initial master table represents the inventory table corresponding to the real-time inventory; the initial slave table represents the inventory table corresponding to the in-transit inventory; and the initial master table is updated according to the inventory parameters to obtain the target master table. The target sub-table determination module is used to update the inventory of the initial sub-table using the target master table and multiple information fields to obtain the target sub-table.

12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.