Data synchronization method and related device
By establishing a correspondence between costs and document details between the terminal and the cloud, and performing accounting only on local costs of the same type, the problem of low cost synchronization efficiency in existing technologies is solved, achieving more efficient cost synchronization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KINGDEE SMART TECH (SHENZHEN) CO LTD
- Filing Date
- 2023-04-24
- Publication Date
- 2026-08-04
AI Technical Summary
Existing cost synchronization methods result in high computational resource consumption, low synchronization efficiency, and poor user experience in scenarios where micro-enterprises and individual users frequently modify documents and supplement historical documents.
By obtaining the newly added costs in the cloud and their corresponding document details, a correspondence is established with the local document details, and cost accounting is only performed on the same type of local costs, reducing duplicate calculations.
It improved cost synchronization efficiency, shortened synchronization time, and enhanced user experience.
Smart Images

Figure CN116483927B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more particularly to data synchronization methods and related devices. Background Technology
[0002] Currently, there are tens of millions of small and micro enterprises and individual businesses in China, making simple and easy-to-use lightweight inventory management systems the preferred choice for many users. In addition to providing document entry functions, these systems can also perform cost accounting based on the entered documents, which is also a key focus for users' business analysis.
[0003] Generally, these systems typically offer multi-terminal data synchronization, allowing users to exchange differing data across multiple terminals through various synchronization methods, ensuring data consistency. This is because once a document is saved, it is fixed and will not change due to changes in other content; however, cost records will change due to the entry of new data. For example, when a sales transaction occurs and a sales document is generated, the corresponding quantity of goods will decrease, and the total cost of that quantity of goods will decrease proportionally.
[0004] Therefore, in scenarios where small and micro-sized enterprises and individual users frequently modify documents and supplement historical documents, the current system only provides document synchronization between multiple terminals. Cost synchronization is achieved by performing cost accounting locally on each terminal based on the synchronized document data. Specifically, every time a new document for product A is entered, modified, or synchronized on a terminal, the cost records of all documents corresponding to product A after the date of the new document will be recalculated to recalculate the cost amount of that product, thus achieving cost synchronization between multiple terminals.
[0005] The existing cost synchronization method involves initiating cost accounting for each newly added document and related documents. The cost records for the new documents are already stored on other terminals, but this process still requires recalculation on the local terminal. This method consumes significant computing resources, is inefficient, and can lead to a poor user experience. Summary of the Invention
[0006] This application provides a data synchronization method and related equipment to improve cost synchronization efficiency.
[0007] The first aspect of this application provides a data synchronization method applied to a terminal, comprising:
[0008] Obtain the cloud-based new costs and the cloud-based document details corresponding to each cloud-based new cost, wherein the cloud-based new costs are costs that exist on the cloud server but not on the terminal;
[0009] Establish a correspondence between each cloud-based new cost and its corresponding local document details, wherein the local document details corresponding to each cloud-based new cost are consistent with the cloud-based document details corresponding to each cloud-based new cost;
[0010] Determine the local cost of the same type corresponding to each cloud-added cost from multiple local costs. The local cost includes costs that correspond to any local document detail. The business date corresponding to the local cost of the same type is later than the business date corresponding to the corresponding cloud-added cost, and the goods corresponding to the local cost of the same type are the same as the goods corresponding to the corresponding cloud-added cost.
[0011] Perform a cost accounting operation on each local cost of the same type to update each local cost of the same type.
[0012] In one specific implementation, before acquiring the new cloud-based costs, the method further includes:
[0013] Send local cost data to the cloud server so that the cloud server can determine the new cloud cost based on the local cost data. The local cost data includes each local cost contained in the terminal and the local document details corresponding to each local cost.
[0014] In one specific implementation, after performing the cost accounting operation on each similar local cost, the method further includes:
[0015] If the local cost corresponding to any local document detail changes, then the changed local cost corresponding to any local document detail is marked as a cost to be synchronized.
[0016] If the preset upload conditions are met, each local cost to be synchronized and the local document details corresponding to each local cost to be synchronized will be uploaded to the cloud server.
[0017] In one specific implementation, establishing the correspondence between each new cloud cost and the corresponding local document details includes:
[0018] Each new cloud cost is assigned as the target new cloud cost in turn.
[0019] If a corresponding local cost exists in the target local document detail, then the local cost corresponding to the target local document detail is marked as a cost to be deleted, and a correspondence is established between the target cloud-added cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-added cost.
[0020] If the target local document detail does not have a corresponding local cost, then a correspondence is established between the target cloud-based new cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-based new cost.
[0021] The method further includes:
[0022] If the preset idle condition is met, then delete each cost to be deleted.
[0023] In one specific implementation, the method further includes:
[0024] If any local cost changes, then determine the business date corresponding to that local cost and the goods corresponding to that local cost;
[0025] If the business date corresponding to any of the local costs is earlier than the business date corresponding to the latest local cost of the same type, then the local cost corresponding to the goods that is the goods corresponding to any of the local costs and whose business date is later than the business date corresponding to any of the local costs is marked as a cost to be calculated. The goods corresponding to the latest local cost of the same type are the same as the goods corresponding to any of the local costs.
[0026] If the preset idle conditions are met, cost accounting will be performed for each cost to be calculated.
[0027] In one specific implementation, the method further includes:
[0028] In response to a deletion operation on any local document, mark the local document as a deleted document, mark the local document details corresponding to the local document as deleted document details, and delete the local cost corresponding to the deleted document.
[0029] In response to the document synchronization command, the document identifier of each deleted document is sent to the cloud server.
[0030] A second aspect of this application provides a data synchronization method applied to a cloud server, comprising:
[0031] The receiving terminal sends local cost data, which includes each local cost and the local document details corresponding to each local cost.
[0032] The local cost data and the cloud cost data are compared to determine the additional cloud cost; the additional cloud cost is the difference cost between the cloud server and the terminal.
[0033] Send the newly added cloud costs and the cloud document details corresponding to each newly added cloud cost to the terminal so that the terminal can synchronize execution costs.
[0034] A third aspect of this application provides a terminal, including:
[0035] The acquisition unit is used to acquire cloud-based new costs and cloud document details corresponding to each cloud-based new cost, wherein the cloud-based new costs are costs that exist on the cloud server but not on the terminal.
[0036] The establishment unit is used to establish the correspondence between each cloud-based new cost and the corresponding local document details, wherein the local document details corresponding to each cloud-based new cost are consistent with the cloud-based document details corresponding to each cloud-based new cost;
[0037] A determining unit is used to determine, from multiple local costs, the same type of local cost corresponding to each cloud-added cost, wherein the local cost includes costs that correspond to any local document detail, the business date corresponding to the same type of local cost is later than the business date corresponding to the corresponding cloud-added cost, and the goods corresponding to the same type of local cost are the same as the goods corresponding to the corresponding cloud-added cost.
[0038] The accounting unit is used to perform cost accounting operations on each local cost of the same type in order to update each local cost of the same type.
[0039] In one specific implementation, the terminal further includes: a sending unit;
[0040] The sending unit is used to send local cost data to the cloud server so that the cloud server can determine the new cloud cost based on the local cost data. The local cost data includes each local cost contained in the terminal and the local document details corresponding to each local cost.
[0041] In one specific implementation, the terminal further includes: a marking unit and an uploading unit;
[0042] The marking unit is used to mark the changed local cost corresponding to any local document detail as a cost to be synchronized if the local cost corresponding to any local document detail changes.
[0043] The upload unit is used to upload each local cost to be synchronized and the local document details corresponding to each local cost to be synchronized to the cloud server if the preset upload conditions are met.
[0044] In one specific implementation, the establishment unit is specifically used to sequentially determine each cloud-based new cost as the target cloud-based new cost;
[0045] If a corresponding local cost exists in the target local document detail, then the local cost corresponding to the target local document detail is marked as a cost to be deleted, and a correspondence is established between the target cloud-added cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-added cost.
[0046] If the target local document detail does not have a corresponding local cost, then a correspondence is established between the target cloud-based new cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-based new cost.
[0047] The terminal further includes: a deletion unit;
[0048] The deletion unit is used to delete each cost to be deleted if a preset idle condition is met.
[0049] In one specific implementation, the terminal further includes: a determining unit and a marking unit;
[0050] The determining unit is used to determine the business date corresponding to any local cost and the goods corresponding to any local cost if any local cost changes.
[0051] The marking unit is used to mark the local cost corresponding to any local cost as a cost to be calculated if the business date corresponding to any local cost is earlier than the business date corresponding to the latest local cost of the same type.
[0052] The accounting unit is also used to perform cost accounting for each cost to be accounted for if a preset idle condition is met.
[0053] In one specific implementation, the terminal further includes: a marking unit and a sending unit;
[0054] The marking unit is used to mark any local document as a deleted document in response to a deletion operation on any local document, mark the local document details corresponding to any local document as deleted document details, and delete the local cost corresponding to the deleted document.
[0055] The sending unit is used to send the document identifier of each deleted document to the cloud server in response to the document synchronization command.
[0056] A fourth aspect of this application provides a cloud server, including:
[0057] The receiving unit is used to receive local cost data sent by the terminal, wherein the local cost data includes each local cost and the local document details corresponding to each local cost;
[0058] A determining unit is used to compare the local cost data and the cloud cost data to determine the new cloud cost; the new cloud cost is the difference cost between the cloud server and the terminal.
[0059] The sending unit is used to send the cloud-based new costs and the cloud document details corresponding to each cloud-based new cost to the terminal, so that the terminal can synchronize execution costs.
[0060] A fifth aspect of this application provides a computer device, including:
[0061] Central processing unit, memory, and input / output interfaces;
[0062] The memory is either a short-term storage memory or a persistent storage memory;
[0063] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method described in the first or second aspect.
[0064] A sixth aspect of this application provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the method described in the first or second aspect.
[0065] A seventh aspect of this application provides a computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described in the first or second aspect.
[0066] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: each new cost added in the cloud can be directly synchronized from the cloud server to the terminal, while only local costs of the same type associated with the new cost added in the cloud need to be calculated by the terminal. Compared with the existing technical solutions, the cost calculation process for new costs added in the cloud is reduced, the cost synchronization time is greatly shortened, the cost synchronization efficiency is improved, and the user experience can be effectively enhanced. Attached Figure Description
[0067] Figure 1 This is a system architecture diagram of the data synchronization method disclosed in an embodiment of this application;
[0068] Figure 2 This is a schematic flowchart of a data synchronization method disclosed in an embodiment of this application;
[0069] Figure 3This is another schematic diagram of the data synchronization method disclosed in the embodiments of this application;
[0070] Figure 4 This is a schematic diagram of the structure of a terminal disclosed in an embodiment of this application;
[0071] Figure 5 This is a schematic diagram of the structure of a cloud server disclosed in an embodiment of this application;
[0072] Figure 6 This is a schematic diagram of the structure of a computer device disclosed in an embodiment of this application. Detailed Implementation
[0073] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0074] This application provides a data synchronization method and related equipment to improve cost synchronization efficiency.
[0075] To better illustrate the technical solutions of the embodiments of this application, the technical concepts that will appear in the following text will be explained in advance.
[0076] Documents can include various business documents that affect inventory changes, such as sales orders, purchase orders, and inventory count sheets. Each document corresponds to one or more detailed records of goods entering and leaving the inventory. Each document detail records the quantity and amount of a single item in the corresponding document. Each document detail also has a corresponding cost record, used to record the changes in quantity, cost amount, current quantity, and current cost amount of the corresponding document detail after a new business activity occurs.
[0077] In addition, when a new document is generated, the new current cost and inventory quantity need to be calculated based on the cost and quantity of the goods before the transaction, as well as the changes in transaction cost and quantity in the newly generated cost record. For example, in normal sales transactions, the quantity will decrease, and the cost will decrease proportionally; in normal purchase transactions, the quantity will increase, and the cost will increase dynamically (depending on the specific business rules, the cost unit price can be calculated using methods such as: moving weighted average, most recent purchase price, monthly average, etc.).
[0078] Please refer to the following: Figure 1To better implement the data synchronization method of this application embodiment, this application embodiment provides an inventory management system that can synchronize inventory management documents and cost records. The inventory management system includes at least: a cloud server 101, a terminal 1021, and a terminal 1022. Each terminal in the inventory management system can execute the data synchronization method of this application by loading software. Terminals 1021 and 1022 can both be used to perform document management. The cloud server 101 is used to receive new costs generated by terminal 1021 or terminal 1022 and send them to terminal 1021 or terminal 1022. New costs generated and uploaded to the cloud server 101 by terminals other than itself are also sent to the cloud server 101.
[0079] Please see Figure 2 Based on the aforementioned inventory management system, this application provides a data synchronization method, including the following steps:
[0080] 201. Obtain the cloud-based new costs and the cloud-based document details corresponding to each cloud-based new cost. The cloud-based new costs are costs that exist on the cloud server but not on the terminal.
[0081] As can be seen from the foregoing, in this embodiment, the cost record (or cost) corresponds one-to-one with the document details. In other words, the cost record exists based on the document details. If the document details are not synchronized, the cost cannot be accurately synchronized from the cloud. Therefore, it is important to note that before a terminal synchronizes costs from the cloud or receives new costs from any terminal in the cloud, the party being synchronized (the sender) needs to synchronize the latest document details to the synchronizing party (the receiver). That is, for a single synchronization between the terminal and / or the cloud server, the document, document details, and cost must be synchronized for the synchronization to be considered complete.
[0082] Specifically, each document detail also corresponds to a document. That is to say, you can first synchronize the new document and then synchronize the new document details, or you can first synchronize the new document and then the synchronizing party calculates the new document details locally based on the new document obtained from the synchronization. This embodiment does not make specific limitations on the method of synchronizing the new document details.
[0083] After the document details are synchronized, you can obtain the new costs from the synchronized party and the corresponding cloud document details for each new cost. Here, this refers to the new cloud costs and the corresponding cloud document details for each new cloud cost. It should be noted that because costs are associated with document details, it is necessary to obtain the document details corresponding to the costs to determine the document details to which each new cloud cost belongs.
[0084] 202. Establish a correspondence between each new cost added in the cloud and the corresponding local document details, ensuring that the local document details corresponding to each new cost added in the cloud are consistent with the cloud document details corresponding to each new cost added in the cloud.
[0085] Establishing a correspondence means recording the relationship between the two (new costs added in the cloud and their corresponding local costs). The consistency between the local document details corresponding to each new cost added in the cloud and the cloud document details corresponding to each new cost added in the cloud can be achieved by configuring the document detail identifier, or by judging the specific content of the document details; no specific limitation is made here.
[0086] Specifically, in practical applications, each new cost added in the cloud will be identified as the target new cost in turn, and each new cost will be processed sequentially. Typically, the document details corresponding to new costs in the cloud fall into two categories: 1. Document details that did not exist before the current local synchronization on the synchronizing party. In this case, after synchronizing the corresponding document details to the synchronizing party and before the current synchronization is completed, cost accounting will not be performed on this document detail to determine the corresponding cost; 2. Document details that did not exist before the current local synchronization on the synchronizing party, i.e., no corresponding local cost. After synchronizing the corresponding document details during the current document synchronization process, cost accounting can be skipped. Instead, the correspondence between the new cloud cost and the document detail will be established when the cost synchronization is completed after the document synchronization is finished.
[0087] For the two scenarios above, if it is scenario 1, the local cost corresponding to the target cloud-based new cost (that is, the local cost corresponding to the target local document details) needs to be marked as a cost to be deleted first, and then the correspondence between the target cloud-based new cost and the target local document details needs to be established; if it is scenario 2, the correspondence between the target cloud-based new cost and the target local document details can be established directly. Specifically, the method of establishing the correspondence can be determined as needed, and this application embodiment does not impose specific limitations.
[0088] 203. Determine the local cost of the same type corresponding to each new cloud cost from multiple local costs. Local costs include costs that correspond to any local document detail. The business date corresponding to the local cost of the same type is later than the business date corresponding to the new cloud cost, and the goods corresponding to the local cost of the same type are the same as the goods corresponding to the new cloud cost.
[0089] As explained in the preceding introduction to cost accounting concepts, in an inventory management system, if a document is added or modified, it is necessary to determine the business date of this added or modified document and the goods involved. If the determined business date is not the latest business date among the multiple documents (i.e., documents containing that goods) corresponding to the determined goods, then each cost associated with the determined goods whose date is later than the determined business date needs to be recalculated to ensure cost accuracy. For example, product 1 has costs A, B, and C, and the order of their corresponding business dates is cost A, cost B, and cost C, respectively. If cost B changes (possibly due to a modification to the document corresponding to cost B), then cost accounting for cost C needs to be recalculated. It should be noted that, regardless of whether the cost is cloud-based or local, the business date corresponding to the cost is related to the business date of the documents associated with the cost's document details. In addition, the business date of the documents mentioned above and below refers to the date on which the corresponding business occurred (such as the date on which the sales business occurred corresponding to the sales document), and not the recording date of the document (the date on which the document is entered into the inventory management system).
[0090] It should be noted that the aforementioned content mentions that "the business date corresponding to the same type of local cost is later than the business date corresponding to the corresponding cloud-based new cost." In other words, in a set of correspondences (each set of correspondences includes one cloud-based new cost and one local cost of the same type corresponding to the aforementioned cloud-based new cost), the business date of the local cost of the same type is later than the business date of the corresponding (or, in other words, within the same set of correspondences) cloud-based new cost.
[0091] 204. Perform a cost accounting operation on each local cost of the same type to update each local cost of the same type.
[0092] Cost accounting is performed on each local cost with a business date earlier than that of the same type (the corresponding goods are the same as those corresponding to the same type of local cost) to ensure the consistency and accuracy of cost records across different terminals after synchronization. The specific accounting method is similar to the cost accounting method in existing technical solutions, and will not be elaborated here.
[0093] In this embodiment, each newly added cost in the cloud can be directly synchronized from the cloud server to the terminal. Only local costs of the same type associated with the newly added cost in the cloud require cost accounting to be performed by the terminal. Compared with existing technical solutions, this reduces the cost accounting process for newly added costs in the cloud, significantly shortens cost synchronization time, improves cost synchronization efficiency, and effectively enhances user experience.
[0094] Based on the foregoing embodiments, in some specific implementations, the new cloud cost can also be determined in the following way: send local cost data to the cloud server so that the cloud server can determine the new cloud cost based on the local cost data. The local cost data includes each local cost contained in the terminal and the local document details corresponding to each local cost.
[0095] Specifically, the cloud server can compare the local cost data of the terminal with the cloud cost data (referring to cost data stored on the cloud server, including cloud costs and cloud document details corresponding to each cloud cost). It can then determine cost data that is not present on the current synchronizing terminal but exists on the cloud server (i.e., cost data synchronized to the cloud server from other terminals besides the current synchronizing terminal), which is the cloud-added cost, and thus the new cost that the current synchronizing terminal needs to obtain. It is understood that if the cloud server's computing resources are limited, the cloud server can also send the cloud cost data to the current synchronizing terminal so that the current synchronizing terminal can determine the cloud-added cost using the same method described above. This application does not specifically limit the method for determining the cloud-added cost.
[0096] It should be noted that the local costs, local data, local document details, etc., referred to in the foregoing and following embodiments of this application as local data are any data that is stored on the terminal and has an established association relationship. For example, if any document detail is stored locally and has an established association relationship with any local document and / or any cost, then that document detail can be considered a local document detail.
[0097] In some specific implementations, the cloud server can determine the new cloud cost and the cloud document details corresponding to each new cloud cost in the following ways: receiving local cost data sent by the terminal, the local cost data including each local cost and the local document details corresponding to each local cost; comparing the local cost data and the cloud cost data to determine the new cloud cost; the new cloud cost is the difference cost between the cloud server and the terminal; sending the new cloud cost and the cloud document details corresponding to each new cloud cost to the terminal to synchronize the terminal's execution cost.
[0098] Specifically, each cloud cost is used as a determinant in turn. If the cloud document details corresponding to the determinant are inconsistent with any local document details obtained, then the determinant is determined to be a new cloud cost.
[0099] Furthermore, to better achieve cost synchronization and management within the inventory management system, different flags can be configured for different local costs, allowing the terminal to determine what operation can be performed on that cost. Specifically, to determine whether a cost record needs to be synchronized, recalculated, or deleted, three status flags for the cost record need to be configured: whether it has been synchronized (pending synchronization flag), whether it has been calculated (pending calculation flag), and whether it needs to be deleted (pending deletion flag), as detailed in the following examples.
[0100] 1. Pending synchronization marker
[0101] Changes to local costs corresponding to local document details include, but are not limited to: updates to local costs due to cost accounting, and the establishment of a correspondence between local document details and any newly added costs in the cloud. Therefore, to ensure consistency of cost records across multiple platforms, it is necessary to promptly record cost records that occur and need to be synchronized to other platforms. This can be achieved through the following steps: If the local cost corresponding to any local document detail changes, mark the changed local cost corresponding to that local document detail as a cost to be synchronized; if the preset upload conditions are met, upload each local cost to be synchronized and the corresponding local document detail to the cloud server.
[0102] Specifically, if any local cost is an updated or changed local cost, then this local cost is a new cost for the cloud server and needs to be uploaded to the cloud server during synchronization, i.e., marked as pending synchronization. It's important to note that the local cost corresponding to the same local document detail may change multiple times. To address this, the terminal typically periodically retains the latest changed local cost for that local document detail and deletes other changed local costs to maintain the uniqueness of the local cost corresponding to the local document detail, thereby ensuring the accuracy of synchronization.
[0103] 2. Marked for deletion
[0104] Step 202 can be implemented in the following ways: Each cloud-based new cost is sequentially identified as the target cloud-based new cost; if a corresponding local cost exists in the target local document detail, the local cost corresponding to the target local document detail is marked as a cost to be deleted, and a correspondence is established between the target cloud-based new cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-based new cost; if no corresponding local cost exists in the target local document detail, a correspondence is established between the target cloud-based new cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-based new cost; if a preset idle condition is met, each cost to be deleted is deleted.
[0105] Specifically, the document details corresponding to the newly added cost in the target cloud may be document details that existed on the terminal before this synchronization (a synchronization includes document synchronization and cost synchronization, see the aforementioned related embodiments for details), or they may be document details added by the terminal in this synchronization. Therefore, in the first case, the corresponding target local document details have corresponding local costs, which need to be deleted; in the second case, the corresponding local document details do not have corresponding local costs, so there are no local costs to be deleted.
[0106] In the first scenario, to expedite the synchronization of newly added costs in the cloud, one can first mark the local cost corresponding to the target local document details as a cost to be deleted (i.e., configure a deletion mark for the local cost). Then, when the terminal meets preset idle conditions, each cost to be deleted can be removed. These preset idle conditions could include the terminal's available resources exceeding a preset threshold, or the inventory management system not currently performing a synchronization operation; no specific limitations are specified here.
[0107] 3. Marks to be calculated
[0108] Based on the foregoing embodiments, this application embodiment further includes the following steps: if any local cost changes, determine the business date corresponding to any local cost and the goods corresponding to any local cost; if the business date corresponding to any local cost is earlier than the business date corresponding to the latest local cost of the same type, mark the local cost corresponding to any local cost whose business date is later than the business date corresponding to any local cost as a cost to be calculated, and the goods corresponding to the latest local cost of the same type are the same as the goods corresponding to any local cost; if a preset idle condition is met, perform cost accounting for each cost to be calculated. Here, the latest local cost of the same type is the local cost with the latest business date among the multiple local costs corresponding to the corresponding goods. For example, there are local cost 1 for product A (business date is February 14, 2023), local cost 2 for product A (business date is February 25, 2023), and local cost 3 for product B (business date is February 26, 2023). If any of the aforementioned local costs is local cost 1, then the latest local cost of the same type corresponding to local cost 1 is local cost 2.
[0109] Additionally, it should be noted that if any local cost is the latest local cost among the multiple local costs corresponding to the same product, then there is no need to mark that local cost, because a change in the local cost with the latest business date will not affect the local costs of the same product with an earlier (business date).
[0110] Specifically, as described in the aforementioned embodiments, if the local cost corresponding to any local document detail in the inventory management system changes (including but not limited to additions, modifications, and replacements), it is necessary to determine whether the change in local cost will cause errors in any other local costs. Only a portion of the local costs need to be recalculated. Therefore, following the aforementioned steps, the business date corresponding to each cost to be calculated is later than the business date corresponding to a newly added cost in the cloud, and the goods corresponding to the cost to be calculated are consistent with the goods corresponding to the newly added cost in the cloud. The preset idle conditions can be configured as needed; specific details can be found in the aforementioned embodiments, and are not limited here.
[0111] Furthermore, in actual business operations, the synchronization of deleted documents during the document synchronization process can be achieved in the following ways: In response to a deletion operation on any local document, mark any local document as a deleted document, mark the local document details corresponding to any local document as deleted document details, and delete the local cost corresponding to the deleted document; In response to a document synchronization command, send the document identifier of each deleted document to the cloud server.
[0112] Specifically, to ensure document recoverability, when a user deletes a document in the inventory management system, the device does not actually delete the document. Instead, it marks the document and does not display it to the user, thus preserving recoverability while making the user believe the (invisible) document has been deleted. Simultaneously, for the accuracy of cost calculation, although the related local document details are not deleted, the related local costs need to be deleted. Afterwards, if a document synchronization command is received, the document identifier of each local document marked as deleted is directly uploaded to the cloud server. Then, other terminals can use the document identifiers of deleted documents in the cloud server to perform deletion operations on the corresponding local documents, marking the document as deleted, marking the document details of the deleted document as deleted document details, and deleting the corresponding local costs. It should be noted that there is no sequential relationship between marking deleted documents, marking deleted document details, and deleting the corresponding local costs; these three steps can be performed simultaneously or at different times, without limitation here.
[0113] The preceding sections described various embodiments of the data synchronization method of this application. The following section describes the data synchronization method of an embodiment of this application in a specific scenario.
[0114] The principle for achieving multi-terminal cost synchronization is as follows: 1. When any local cost on a terminal changes, that cost is marked as a cost to be synchronized. 2. When a terminal needs to synchronize new costs added to the cloud server: obtain the new costs in the cloud; establish the correspondence between the new costs in the cloud and the corresponding local document details; determine and update each local cost of the same type; after completing the above steps, upload the local costs to be synchronized to the cloud to ensure the consistency of cost data between the terminal and the cloud server.
[0115] Please see Figure 3 If terminals A and B exist, the synchronization process shown in the diagram will be executed. In the diagram, cloud synchronization refers to the process by which the terminal obtains the new costs from the cloud and uploads the local new costs to the cloud server.
[0116] Depend on Figure 3 As shown, the purpose of cloud synchronization by any terminal is to maintain data consistency between the cloud and the terminal. Therefore, depending on the situation (i.e., the differences in data between the cloud server and the terminal), cloud synchronization requires one ( Figure 3 First cloud synchronization of B (or two) Figure 3 (This is the only cloud synchronization for terminal A). Terminal A discovered that sales order 1A and sales order 1B were different, and that the business time of sales order 1A was earlier than that of sales order 1B, so it recalculated cost record 1B. After synchronizing, terminal B discovered that the new cost record 1B was inconsistent with the old cost record 1B locally, so it directly replaced the original cost record 1B with the new cost record 1B without recalculation. The new product 2 added by terminal A and the new product 3 added by terminal B are two unrelated products, and their costs have already been calculated on their respective terminals, so no calculation is needed when they are synchronized to the other terminal. When the new client (here to the inventory management software system) is installed on terminal C, since there are no records locally, no calculation is needed, and all cost records from the cloud server can be directly retrieved and saved.
[0117] In this embodiment, the terminal can independently calculate costs based on newly saved documents, and calculate and store both document data and cost records on the terminal. This is a necessary technical implementation for a standalone system (i.e., an inventory management system). However, when used as an offline function of an online system (i.e., using the inventory management system offline), in addition to saving document data offline, it is still necessary to calculate and store cost records in real time.
[0118] It should be noted that the aforementioned local cost data and cloud server cost data refer to the same user. Cloud servers and terminals can actually store data from different users, especially cloud servers. Therefore, multi-user cost data can be stored by associating different user information within the same terminal and / or cloud server.
[0119] In addition, the terminal mentioned above that appears as the executing entity refers to the terminal that is currently performing cost synchronization, which can be any terminal in the inventory and sales system, without specific limitations here.
[0120] Please see Figure 4 This application provides a terminal, including:
[0121] The acquisition unit 401 is used to acquire cloud-based new costs and cloud document details corresponding to each cloud-based new cost. Cloud-based new costs are costs that exist on the cloud server but not on the terminal.
[0122] Establish unit 402 to establish the correspondence between each cloud-based new cost and the corresponding local document details, and the local document details corresponding to each cloud-based new cost are consistent with the cloud document details corresponding to each cloud-based new cost;
[0123] The determination unit 403 is used to determine the local cost of the same type corresponding to each cloud-added cost from multiple local costs. The local cost includes the cost that corresponds to any local document detail. The business date corresponding to the local cost of the same type is later than the business date corresponding to the corresponding cloud-added cost, and the goods corresponding to the local cost of the same type are the same as the goods corresponding to the corresponding cloud-added cost.
[0124] Accounting unit 404 is used to perform cost accounting operations on each local cost of the same type to update each local cost of the same type.
[0125] In one specific implementation, the terminal further includes: a sending unit;
[0126] The sending unit is used to send local cost data to the cloud server so that the cloud server can determine the new costs in the cloud based on the local cost data. The local cost data includes each local cost contained in the terminal and the local document details corresponding to each local cost.
[0127] In one specific implementation, the terminal also includes: a marking unit and an uploading unit;
[0128] The marking unit is used to mark the updated local cost corresponding to each local cost of the same type as the cost to be synchronized;
[0129] The marking unit is also used to mark the changed local cost corresponding to any local document detail as a cost to be synchronized if the local cost corresponding to any local document detail changes.
[0130] The upload unit is used to upload each local cost to be synchronized and the local document details corresponding to each local cost to be synchronized to the cloud server if the preset upload conditions are met.
[0131] In one specific implementation, a unit 402 is established, which is specifically used to sequentially determine each cloud-based new cost as the target cloud-based new cost;
[0132] If a corresponding local cost exists for the target local document detail, then the local cost corresponding to the target local document detail is marked as a cost to be deleted, and a correspondence is established between the target cloud-added cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-added cost.
[0133] If the target local document details do not have a corresponding local cost, then establish a correspondence between the target cloud-added cost and the target local document details; the target local document details are the local document details corresponding to the target cloud-added cost.
[0134] The terminal also includes: a deletion unit;
[0135] The deletion unit is used to delete each cost to be deleted if a preset idle condition is met.
[0136] In one specific implementation, the terminal further includes: a determining unit and a marking unit;
[0137] The determination unit is used to determine the business date corresponding to any local cost and the goods corresponding to any local cost if any local cost changes.
[0138] The marking unit is used to mark the local cost that is the product corresponding to any local cost and whose corresponding business date is later than the business date corresponding to any local cost as a cost to be calculated if the business date corresponding to any local cost is earlier than the business date corresponding to the latest local cost of the same type. The product corresponding to the latest local cost of the same type is the same as the product corresponding to any local cost.
[0139] The accounting unit 404 is also used to perform cost accounting for each cost to be accounted for if the preset idle conditions are met.
[0140] In one specific implementation, the terminal further includes: a marking unit and a sending unit;
[0141] The marking unit is used to respond to a deletion operation on any local document by marking any local document as a deleted document, marking the local document details corresponding to any local document as deleted document details, and deleting the local cost corresponding to the deleted document.
[0142] The sending unit is used to send the document identifier of each deleted document to the cloud server in response to the document synchronization command.
[0143] Please see Figure 5 This application provides a cloud server, including:
[0144] The receiving unit 501 is used to receive local cost data sent by the terminal. The local cost data includes each local cost and the local document details corresponding to each local cost.
[0145] Unit 502 is used to compare local cost data and cloud cost data to determine the new cloud cost; the new cloud cost is the difference cost between the cloud server and the terminal.
[0146] Sending unit 503 is used to send cloud-based new costs and cloud document details corresponding to each cloud-based new cost to the terminal so that the terminal execution costs are synchronized.
[0147] Figure 6 This is a schematic diagram of a computer device structure provided in an embodiment of this application. The computer device 600 may include one or more central processing units (CPUs) 601 and a memory 605, in which one or more application programs or data are stored.
[0148] The memory 605 can be volatile or persistent storage. The program stored in the memory 605 can include one or more modules, each module including a series of instruction operations on the computer device. Furthermore, the central processing unit 601 can be configured to communicate with the memory 605 and execute the series of instruction operations stored in the memory 605 on the computer device 600.
[0149] The computer device 600 may also include one or more power supplies 602, one or more wired or wireless network interfaces 603, one or more input / output interfaces 604, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0150] The central processing unit 601 can perform the aforementioned... Figures 1 to 5 The methods described in the illustrated embodiments will not be elaborated further here.
[0151] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0152] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0153] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0154] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0155] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0156] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the data synchronization method described above.
Claims
1. A data synchronization method, characterized in that, Applied to a terminal, the method includes: Obtain the cloud-based new costs and the cloud-based document details corresponding to each cloud-based new cost, wherein the cloud-based new costs are costs that exist on the cloud server but not on the terminal; Establish a correspondence between each cloud-based new cost and its corresponding local document details, wherein the local document details corresponding to each cloud-based new cost are consistent with the cloud-based document details corresponding to each cloud-based new cost; wherein, the consistency between the local document details corresponding to each cloud-based new cost and the cloud-based document details corresponding to each cloud-based new cost is achieved by configuring document detail identifiers or by judging through the content of document details; Determine the local cost of the same type corresponding to each cloud-added cost from multiple local costs. The local cost includes costs that correspond to any local document detail. The business date corresponding to the local cost of the same type is later than the business date corresponding to the corresponding cloud-added cost, and the goods corresponding to the local cost of the same type are the same as the goods corresponding to the corresponding cloud-added cost. Perform a cost accounting operation on each local cost of the same type to update each local cost of the same type.
2. The method according to claim 1, characterized in that, Prior to acquiring the additional costs in the cloud, the method further includes: Send local cost data to the cloud server so that the cloud server can determine the new cloud cost based on the local cost data. The local cost data includes each local cost contained in the terminal and the local document details corresponding to each local cost.
3. The method according to claim 1 or 2, characterized in that, The method further includes: If the local cost corresponding to any local document detail changes, then the changed local cost corresponding to any local document detail is marked as a cost to be synchronized. If the preset upload conditions are met, each local cost to be synchronized and the local document details corresponding to each local cost to be synchronized will be uploaded to the cloud server.
4. The method according to claim 1, characterized in that, The process of establishing the correspondence between each new cloud cost and its corresponding local document details includes: Each new cloud cost is assigned as the target new cloud cost in turn. If a corresponding local cost exists in the target local document detail, then the local cost corresponding to the target local document detail is marked as a cost to be deleted, and a correspondence is established between the target cloud-added cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-added cost. If the target local document detail does not have a corresponding local cost, then a correspondence is established between the target cloud-based new cost and the target local document detail; the target local document detail is the local document detail corresponding to the target cloud-based new cost. The method further includes: If the preset idle condition is met, then delete each cost to be deleted.
5. The method according to claim 1, characterized in that, The method further includes: If any local cost changes, then determine the business date corresponding to that local cost and the goods corresponding to that local cost; If the business date corresponding to any of the local costs is earlier than the business date corresponding to the latest local cost of the same type, then the local cost corresponding to the goods that is the goods corresponding to any of the local costs and whose business date is later than the business date corresponding to any of the local costs is marked as a cost to be calculated. The goods corresponding to the latest local cost of the same type are the same as the goods corresponding to any of the local costs. If the preset idle conditions are met, cost accounting will be performed for each cost to be calculated.
6. The method according to claim 1, characterized in that, The method further includes: In response to a deletion operation on any local document, mark the local document as a deleted document, mark the local document details corresponding to the local document as deleted document details, and delete the local cost corresponding to the deleted document. In response to the document synchronization command, the document identifier of each deleted document is sent to the cloud server.
7. A data synchronization method, characterized in that, Applied to cloud servers, the method includes: The receiving terminal sends local cost data, which includes each local cost and the local document details corresponding to each local cost. The local cost data and the cloud cost data are compared to determine the additional cloud cost; the additional cloud cost is the difference cost between the cloud server and the terminal. The system sends the newly added cloud costs and the corresponding cloud document details to the terminal, enabling the terminal to establish a correspondence between each newly added cloud cost and its corresponding local document details. It then determines the local cost of the same type corresponding to each newly added cloud cost from multiple local costs and performs cost accounting operations on each local cost of the same type to update it. The local document details corresponding to each newly added cloud cost are consistent with the cloud document details corresponding to each newly added cloud cost. This consistency is achieved by configuring a document detail identifier or by judging the content of the document details.
8. A terminal, characterized in that, include: The acquisition unit is used to acquire cloud-based new costs and cloud document details corresponding to each cloud-based new cost, wherein the cloud-based new costs are costs that exist on the cloud server but not on the terminal. The establishment unit is used to establish the correspondence between each cloud-based new cost and the corresponding local document details, wherein the local document details corresponding to each cloud-based new cost are consistent with the cloud-based document details corresponding to each cloud-based new cost; wherein, the consistency between the local document details corresponding to each cloud-based new cost and the cloud-based document details corresponding to each cloud-based new cost is achieved by configuring a document detail identifier or by judging through the content of the document details. The determining unit determines the local cost of the same type corresponding to each cloud-added cost from multiple local costs. The local cost includes the cost that corresponds to any local document detail. The business date corresponding to the local cost of the same type is later than the business date corresponding to the corresponding cloud-added cost, and the goods corresponding to the local cost of the same type are the same as the goods corresponding to the corresponding cloud-added cost. The accounting unit is used to perform cost accounting operations on each local cost of the same type in order to update each local cost of the same type.
9. A cloud server, characterized in that, include: The receiving unit is used to receive local cost data sent by the terminal, wherein the local cost data includes each local cost and the local document details corresponding to each local cost; A determining unit is used to compare the local cost data and the cloud cost data to determine the new cloud cost; the new cloud cost is the difference cost between the cloud server and the terminal. The sending unit is configured to send the cloud-based new costs and the cloud-based document details corresponding to each cloud-based new cost to the terminal, so that the terminal can perform operations to establish a correspondence between each cloud-based new cost and the corresponding local document details, determine the local cost of the same type corresponding to each cloud-based new cost from multiple local costs, and perform cost accounting operations on each local cost of the same type to update each local cost of the same type; wherein, the local document details corresponding to each cloud-based new cost are consistent with the cloud-based document details corresponding to each cloud-based new cost; the consistency between the local document details corresponding to each cloud-based new cost and the cloud-based document details corresponding to each cloud-based new cost is achieved by configuring a document detail identifier or by judging through the content of the document details.
10. A computer device, characterized in that, include: Central processing unit, memory, and input / output interfaces; The memory is either a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method of any one of claims 1 to 7.
11. A computer storage medium, characterized in that, The computer storage medium stores instructions that, when executed on the computer, cause the computer to perform the method as described in any one of claims 1 to 7.
12. A computer program product comprising instructions that, when run on a computer, cause the computer to perform the method as described in any one of claims 1 to 7.