Data generation method and device, computer device, and storage medium
By comparing and updating the consumption relationship between products and raw materials during the production process, a highly efficient set of circular chains is generated, solving the problem of low generation efficiency in traditional technologies and realizing the rapid generation of nested circular data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KINGDEE SOFTWARE(CHINA) CO LTD
- Filing Date
- 2023-01-18
- Publication Date
- 2026-05-12
AI Technical Summary
In traditional technologies, the generation of nested data is inefficient, requiring analysts to analyze large amounts of data to obtain nested data for the target time period.
By acquiring multiple sets of consumption relationships, each set of consumption relationships is compared with the initial chain set, and the initial chain set is updated based on the comparison results until a reference chain set is obtained. A circular chain set is generated using the state information as the reference chain in the circular state.
提高了循环链条集合的生成效率,通过精简耗用关系的比对速度和更新效率,提高了数据生成的整体效率。
Smart Images

Figure CN116049491B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data generation method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] Nested production cycles refer to a cyclical relationship between raw materials and products during the production process. For example, the production of product A uses raw material B, and the production of product B uses raw material A, or it uses product C generated from product A as raw material. Nested production cycle data describes the correspondence between product identifiers and raw material identifiers, as well as the correspondence between the production order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier.
[0003] In traditional technology, production order numbers and raw material order numbers with corresponding relationships are saved as a set of consumption data. Analysts need to analyze a large amount of consumption data within the target time period to obtain nested data within the target time period. The generation efficiency of nested data is low. Summary of the Invention
[0004] Therefore, it is necessary to provide a data generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve data generation efficiency in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a data generation method. The method includes:
[0006] Obtain multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier;
[0007] For each of the multiple sets of consumption relationships, the consumption relationship is compared with each initial chain in the initial chain set, and the initial chain set is updated based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships is obtained, thus obtaining a reference chain set; the initial chain includes multiple nodes, as well as a set of node identifiers and order numbers corresponding to each node;
[0008] Based on the reference chains in the reference chain set whose state information is in a cyclic state, a cyclic chain set is obtained.
[0009] In one embodiment, comparing the set of consumption relationships with each initial chain in the initial chain set, and updating the initial chain set based on the comparison results, includes:
[0010] Obtain an initial chain from the initial chain set, along with the corresponding state information of the initial chain;
[0011] Based on the state information corresponding to the initial chain, a comparison method is determined to compare with the initial chain;
[0012] Based on the comparison method, the consumption relationship is compared with the initial chain. If the comparison result is a correlation, the initial chain is updated.
[0013] Repeat the steps of obtaining an initial chain from the initial chain set and the corresponding state information of the initial chain until the last initial chain in the initial chain set is obtained, to obtain an updated initial chain set.
[0014] In one embodiment, if the state information corresponding to the initial chain is a non-cyclic state, then the comparison method is a first comparison method; the step of comparing the consumption relationship with the initial chain based on the comparison method, and updating the initial chain if the comparison result is a correlation, includes:
[0015] Obtain the product identifier and raw material identifier of the group of consumption relationships, as well as the chain head identifier corresponding to the chain head node and the chain tail identifier corresponding to the chain tail node in the initial chain;
[0016] The product identifier and the chain tail identifier are compared. If the product identifier and the chain tail identifier are consistent, the comparison result is an association. The product order number corresponding to the product identifier is added to the order number set corresponding to the chain tail node. An updated chain tail node is added after the chain tail node. The raw material identifier is used as the node identifier corresponding to the updated chain tail node, and the raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the updated chain tail node to obtain the updated initial chain. The updated chain tail node serves as the chain tail node of the updated initial chain.
[0017] If the product identifier is inconsistent with the chain tail identifier, the raw material identifier is compared with the chain head identifier. If the raw material identifier is consistent with the chain head identifier, the comparison result is associated. The raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the chain head node. An updated chain head node is added before the chain head node. The product identifier is used as the node identifier corresponding to the updated chain head node, and the product order number corresponding to the product identifier is added to the order number set corresponding to the updated chain head node to obtain the updated initial chain. The updated chain head node serves as the chain head node of the updated initial chain.
[0018] Based on the node identifiers corresponding to each node in the updated initial chain, the state information corresponding to the updated initial chain is obtained.
[0019] In one embodiment, obtaining the state information corresponding to the updated initial chain based on the node identifiers corresponding to each node in the updated initial chain includes:
[0020] Obtain the node identifier corresponding to each node in the updated initial chain;
[0021] Determine whether there are two identical node identifiers among the node identifiers. If there are two identical node identifiers, then the state information corresponding to the updated initial chain is determined to be a cyclic state. If there are no two identical node identifiers, then the state information corresponding to the updated initial chain is determined to be a non-cyclic state.
[0022] In one embodiment, if the state information corresponding to the initial chain is a cyclic state, then the comparison method is a second comparison method; the step of comparing the consumption relationship with the initial chain based on the comparison method, and updating the initial chain if the comparison result is an association, includes:
[0023] Obtain the product identifier and raw material identifier of the consumption relationship set, as well as the cycle node identifier corresponding to the initial chain; the cycle node identifier is the same node identifier corresponding to two different nodes in the initial chain, the two different nodes are the first cycle node and the second cycle node, and the first cycle node is located before the second cycle node;
[0024] Compare the product identifier and the raw material identifier with the cycle node identifier;
[0025] If the product identifier is consistent with the loop node identifier, then obtain the next node identifier corresponding to the next node adjacent to the first loop node. If the raw material identifier is consistent with the next node identifier, then the comparison result is associated. Add the product order number corresponding to the product identifier to the order number set corresponding to the first loop node, and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the next node to obtain the updated initial chain.
[0026] If the raw material identifier is consistent with the cycle node identifier, then obtain the previous node identifier corresponding to the previous node adjacent to the second cycle node. If the product identifier is consistent with the previous node identifier, then the comparison result is associated. Add the product order number to the order number set corresponding to the previous node, and add the raw material order number to the order number set corresponding to the second cycle node to obtain the updated initial chain.
[0027] The updated initial chain corresponds to a loop state.
[0028] In one embodiment, after comparing the set of consumption relationships with the initial chain based on the comparison method, the method further includes: if the comparison result is non-associative, updating the non-associative count corresponding to the set of consumption relationships; obtaining the updated initial chain set up to the last initial chain in the initial chain set includes:
[0029] The number of initial chains in the initial chain set is counted to obtain the chain count corresponding to the initial chain set;
[0030] Compare the number of chain counts with the number of non-associative counts;
[0031] If the number of chain counts is the same as the number of non-association counts, then a new initial chain is added to the initial chain set; the initial chain is obtained based on the consumption relationship of the set.
[0032] In one embodiment, obtaining multiple sets of consumption relationships includes:
[0033] Obtain multiple production order numbers and multiple raw material order numbers within a target time period;
[0034] Obtain one raw material order number from the plurality of raw material order numbers as the target raw material order number, and obtain the target raw material order corresponding to the target raw material order number;
[0035] Obtain the raw material identifier and the target production order number corresponding to the raw material identifier from the target raw material list, and obtain the product identifier based on the target production order number;
[0036] Based on the raw material identifier and the target raw material order number, as well as the product identifier and the target production order number, a set of consumption relationships is obtained;
[0037] Multiple consumption relationships are obtained by continuing until the last raw material order number among the multiple raw material order numbers.
[0038] Secondly, this application also provides a data generation apparatus. The apparatus includes:
[0039] The acquisition module is used to acquire multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier;
[0040] The comparison module is used to compare each set of consumption relationships in the multiple sets of consumption relationships with each initial chain in the initial chain set, and update the initial chain set based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships, to obtain a reference chain set; the initial chain includes multiple nodes, and a set of node identifiers and order numbers corresponding to each node;
[0041] The selection module is used to obtain a set of circular chains based on the reference chains in the set whose state information is in a circular state.
[0042] 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:
[0043] Obtain multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier;
[0044] For each of the multiple sets of consumption relationships, the consumption relationship is compared with each initial chain in the initial chain set, and the initial chain set is updated based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships is obtained, thus obtaining a reference chain set; the initial chain includes multiple nodes, as well as a set of node identifiers and order numbers corresponding to each node;
[0045] Based on the reference chains in the reference chain set whose state information is in a cyclic state, a cyclic chain set is obtained.
[0046] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0047] Obtain multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier;
[0048] For each of the multiple sets of consumption relationships, the consumption relationship is compared with each initial chain in the initial chain set, and the initial chain set is updated based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships is obtained, thus obtaining a reference chain set; the initial chain includes multiple nodes, as well as a set of node identifiers and order numbers corresponding to each node;
[0049] Based on the reference chains in the reference chain set whose state information is in a cyclic state, a cyclic chain set is obtained.
[0050] The aforementioned data generation method, apparatus, computer equipment, storage medium, and computer program product acquire multiple sets of consumption relationships. For each set of consumption relationships, the set is compared with each initial chain in the initial chain set, and the initial chain set is updated based on the comparison results, until the last set of consumption relationships is acquired, resulting in a reference chain set. Based on the reference chains in the reference chain set whose state information is cyclic, a cyclic chain set is obtained. By acquiring consumption relationships, the consumption relationships concisely and objectively represent the correspondence between product identifiers and raw material identifiers, as well as the correspondence between product order numbers and raw material order numbers. The consumption relationships are compared with each initial chain in the initial chain set to obtain the comparison results. Due to the simplification of consumption relationships, the comparison speed is improved. The initial chain set is updated based on the comparison results. All of the above steps are performed by computer equipment, improving the execution efficiency of the above steps, thereby improving the generation efficiency of the cyclic chain set. Attached Figure Description
[0051] Figure 1 This is a diagram illustrating the application environment of a data generation method in one embodiment;
[0052] Figure 2 This is a flowchart illustrating a data generation method in one embodiment;
[0053] Figure 3 This is a flowchart illustrating the initial chain set update step in one embodiment;
[0054] Figure 4 This is a flowchart illustrating the non-cyclic initial chain alignment step in one embodiment;
[0055] Figure 5 This is a flowchart illustrating the initial chain alignment step in one embodiment;
[0056] Figure 6 This is a flowchart illustrating the steps for obtaining consumption relationships in one embodiment;
[0057] Figure 7 This is a schematic diagram of a circulating chain in one embodiment;
[0058] Figure 8 This is a schematic diagram of a terminal displaying a circular chain in one embodiment;
[0059] Figure 9 This is a structural block diagram of a data generation device in one embodiment;
[0060] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0061] 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.
[0062] The data generation method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated on server 104 or placed on a cloud or other network server. Both the terminal and server can be used independently to execute the data generation method provided in this embodiment. The terminal and server can also work together to execute the data generation method provided in this embodiment. For example, a computer device acquires multiple sets of consumption relationships. For each set of consumption relationships, it compares the set with each initial chain in the initial chain set, and updates the initial chain set based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships is reached, obtaining a reference chain set. Based on the reference chains in the reference chain set whose state information is in a cyclic state, a cyclic chain set is obtained. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0063] In one embodiment, such as Figure 2 As shown, a data generation method is provided. This method can be applied to a computer device, which can be a terminal or a server. The method can be executed independently by the terminal or server, or it can be implemented through interaction between the terminal and the server. This embodiment illustrates the application of this method to a computer device, including steps 202 to 206.
[0064] Step 202: Obtain multiple sets of consumption relationships; the consumption relationships include product identifiers and raw material identifiers, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier.
[0065] In this context, consumption relationships refer to the correspondence between products and raw materials during the production process. Consumption relationships include, but are not limited to, product identifiers and raw material identifiers, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier. A set of consumption relationships includes one product identifier and one raw material identifier. A product identifier is a string representing a product. There is a one-to-one correspondence between product identifiers and products. A product identifier can be the product name, product code, or product number, etc. A raw material identifier is a string representing a raw material. There is a one-to-one correspondence between raw material identifiers and raw materials. A raw material identifier can be the raw material name, raw material code, or raw material number, etc. The product corresponding to a product identifier is produced from one or more raw materials corresponding to one or more raw material identifiers. A product order number refers to a production order number, or a number composed of a production order number and a label. If there is only one data corresponding to a product identifier in the production order corresponding to the production order number, then the product order number is the production order number. If there are multiple data corresponding to product identifiers in the production order, then the product order number is composed of the production order number and the label corresponding to the product identifier. The raw material order number refers to the material requisition order number, or a number composed of the material requisition order number and a label. If there is only one data corresponding to a raw material identifier in the material requisition order corresponding to the material requisition order number, then the raw material order number is the material requisition order number. If there are multiple data corresponding to raw material identifiers in the material requisition order, then the raw material order number is composed of the material requisition order number and the label corresponding to the raw material identifier.
[0066] For example, a computer device acquires multiple sets of consumption relationships within a target time period.
[0067] In one embodiment, a computer device acquires multiple sets of initial consumption relationships within a target time period, compares these multiple sets of initial consumption relationships, and merges the initial consumption relationships with the same product identifier and raw material identifier to obtain multiple sets of consumption relationships within the target time period.
[0068] Step 204: For each set of consumption relationships in the multiple sets of consumption relationships, compare the set of consumption relationships with each initial chain in the initial chain set, and update the initial chain set based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships, to obtain the reference chain set; the initial chain includes multiple nodes, as well as the node identifier and single number set corresponding to each node.
[0069] The initial chain set refers to a collection containing one or more initial chains. The initial chain set can be pre-set, containing one initial chain with a head node and a tail node. The node identifier corresponding to the head node is a preset identifier, and the node identifier corresponding to the tail node is a preset identifier. The preset identifiers for the head and tail nodes can be the same or different, and the preset identifiers are unique to both product and raw material identifiers. The initial chain set can also be obtained based on one or more sets of consumption relationships. For example, a set of consumption relationships can be randomly selected from the above multiple sets, and an initial chain can be obtained from this set, containing a head node and a tail node. The node identifier corresponding to the head node is the product identifier in the consumption relationship, and the node identifier corresponding to the tail node is the raw material identifier in the consumption relationship. The comparison result refers to the result obtained by comparing the consumption relationship with the initial chain. The comparison result can be divided into associated and non-associated. The node identifier is a string representing a node in the initial chain. The node identifier can be a product identifier or a raw material identifier. The order number set refers to a set consisting of at least one of the production order number and the raw material order number corresponding to the node identifier. The order number set may include one or more numbers.
[0070] For example, a computer device obtains a set of consumption relationships from multiple sets of consumption relationships, uses this set as a comparison consumption relationship, compares the comparison set of consumption relationships with each initial chain in the initial chain set, and updates the initial chain set based on the comparison results to obtain an updated initial chain set. This updated initial chain set is then used as the initial chain set. The device then obtains the next set of consumption relationships from the multiple sets of consumption relationships, uses this next set as a comparison consumption relationship, and repeats the step of comparing the comparison set of consumption relationships with each initial chain in the initial chain set until the last set of consumption relationships is obtained, thus obtaining a reference chain set. The initial chain includes multiple nodes, and a set of node identifiers and serial numbers corresponding to each node.
[0071] Step 206: Based on the reference chains in the reference chain set whose state information is in a cyclic state, obtain the cyclic chain set.
[0072] In this context, status information refers to the information recording whether a chain is in a cyclic state. Status information can be represented by numbers, characters, or text. For example, 0 represents a non-cyclic state, 1 represents a cyclic state, A represents a non-cyclic state, and B represents a cyclic state. A cyclic state occurs when two nodes in the chain have the same node identifier. A non-cyclic state occurs when all nodes in the chain have different node identifiers. For example, chain ABCA is a cyclic state, while chain ABCD is a non-cyclic state. A set of cyclic chains is a set of chains that are in a cyclic state.
[0073] For example, the computer device selects reference chains in the reference chain set whose state information is in a cyclic state, and forms a cyclic chain set by selecting the reference chains in a cyclic state.
[0074] In one embodiment, the above data generation method further includes: displaying a reference chain in the set of circular chains on a terminal.
[0075] In one embodiment, the data generation method further includes: obtaining query conditions and displaying the reference chains in the circular chain set corresponding to the query conditions on the terminal.
[0076] In the above data generation method, by obtaining the consumption relationship, which concisely represents the correspondence between product identifiers and raw material identifiers, as well as the correspondence between product order numbers and raw material order numbers, the consumption relationship is compared with each initial chain in the initial chain set to obtain the comparison result between the consumption relationship and the initial chain. Due to the simplification of the consumption relationship, the comparison speed is improved. The initial chain set is updated according to the comparison result. All of the above steps are performed by computer equipment, which improves the execution efficiency of the above steps, thereby improving the generation efficiency of the cyclic chain set.
[0077] In one embodiment, such as Figure 3 As shown, comparing this set of consumption relationships with each initial chain in the initial chain set, and updating the initial chain set based on the comparison results includes:
[0078] Step 302: Obtain an initial chain from the initial chain set, along with the corresponding state information of the initial chain.
[0079] For example, the computer device obtains an initial chain from the initial chain set, and then obtains the state information corresponding to the initial chain.
[0080] Step 304: Based on the state information corresponding to the initial chain, determine the comparison method to be compared with the initial chain.
[0081] The comparison method refers to the method used to compare the consumption relationship and the initial chain. The comparison method corresponds to the state information. The state information includes cyclic states and acyclic states. Therefore, the comparison method includes a first comparison method corresponding to the acyclic state and a second comparison method corresponding to the cyclic state. The first comparison method and the second comparison method can be set according to actual needs.
[0082] For example, a comparison method in which a computer device determines the consumption relationship based on the state information corresponding to the initial chain and compares it with the initial chain.
[0083] Step 306: Based on the comparison method, compare the consumption relationship of this group with the initial chain. If the comparison result is a correlation, then update the initial chain.
[0084] In this context, "association" refers to a situation where the product identifier or raw material identifier in the consumption relationship is the same as the node identifier of the corresponding node in the initial chain. "Non-association" refers to a situation where neither the product identifier nor the raw material identifier in the consumption relationship is the same as the node identifier of the corresponding node in the initial chain.
[0085] For example, the computer uses a comparison method corresponding to the state information of the initial chain to compare the consumption relationship with the initial chain and obtain the comparison result. If the comparison result is a correlation, the initial chain is updated based on the consumption relationship.
[0086] Step 308: Repeat the steps of obtaining an initial chain from the initial chain set and the corresponding state information of the initial chain, until the last initial chain in the initial chain set is obtained, to obtain the updated initial chain set.
[0087] For example, the computer device repeatedly executes steps 302, 304 and 306 until the last initial chain in the initial chain set, to obtain an updated initial chain set.
[0088] In this embodiment, based on the state information corresponding to the initial chains in the initial chain set, a comparison method is determined to compare the consumption relationship with the initial chains. The determined comparison method is used to compare the consumption relationship with the initial chains. Different comparison methods are used for initial chains with different state information, which improves the accuracy of the comparison results. The initial chain set is updated based on the comparison results to obtain the updated initial chain set, which improves the accuracy of the updated initial chain set.
[0089] In one embodiment, such as Figure 4 As shown, if the state information corresponding to the initial chain is a non-cyclic state, then the comparison method is the first comparison method; based on the comparison method, the consumption relationship is compared with the initial chain. If the comparison result is a correlation, then the initial chain is updated, including:
[0090] Step 402: Obtain the product identifier and raw material identifier of the consumption relationship, as well as the chain head identifier corresponding to the chain head node and the chain tail identifier corresponding to the chain tail node in the initial chain.
[0091] In this context, the head node refers to the first node in the chain, and the tail node refers to the last node. The head node identifier is a string representing the first node; it can be a raw material identifier or a product identifier. Similarly, the tail node identifier is a string representing the last node; it can also be a raw material identifier or a product identifier.
[0092] For example, the computer device obtains the product identifier and raw material identifier of the group of consumption relationships, as well as the chain head identifier corresponding to the chain head node and the chain tail identifier corresponding to the chain tail node in the initial chain.
[0093] Step 404: Compare the product identifier and the chain tail identifier. If the product identifier and the chain tail identifier are the same, the comparison result is associated. Add the product order number corresponding to the product identifier to the order number set corresponding to the chain tail node. Add an updated chain tail node after the chain tail node. Use the raw material identifier as the node identifier corresponding to the updated chain tail node, and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the updated chain tail node to obtain the updated initial chain. The updated chain tail node is used as the chain tail node of the updated initial chain.
[0094] In this context, updating the tail node refers to adding a new node after the initial tail node. The updated tail node serves as the last node of the updated initial chain.
[0095] For example, the computer device compares the product identifier and the chain tail identifier. If the product identifier and the chain tail identifier are consistent, the comparison result is a correlation. The product order number corresponding to the product identifier is added to the order number set corresponding to the chain tail node. Then, an updated chain tail node is added after the chain tail node. The raw material identifier is used as the node identifier corresponding to the updated chain tail node, and the raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the updated chain tail node to obtain the updated initial chain. The updated chain tail node is used as the chain tail node of the updated initial chain.
[0096] Step 406: If the product identifier and the chain tail identifier are inconsistent, compare the raw material identifier with the chain head identifier. If the raw material identifier and the chain head identifier are consistent, the comparison result is associated. Add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the chain head node. Add an updated chain head node before the chain head node, use the product identifier as the node identifier corresponding to the updated chain head node, and add the product order number corresponding to the product identifier to the order number set corresponding to the updated chain head node to obtain the updated initial chain. The updated chain head node is used as the chain head node of the updated initial chain.
[0097] Updating the head node refers to adding a new node before the initial head node. The updated head node serves as the first node in the updated initial chain.
[0098] For example, if the product identifier and the chain tail identifier are inconsistent, the computer device compares the raw material identifier with the chain head identifier. If the raw material identifier and the chain head identifier are consistent, the comparison result is a correlation. The raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the chain head node. Then, an updated chain head node is added before the chain head node, and the product identifier is used as the node identifier corresponding to the updated chain head node. The product order number corresponding to the product identifier is added to the order number set corresponding to the updated chain head node, resulting in the updated initial chain. The updated chain head node is used as the chain head node of the updated initial chain.
[0099] Step 408: Based on the node identifiers corresponding to each node in the updated initial chain, obtain the state information corresponding to the updated initial chain.
[0100] For example, the computer device determines the state information of the updated initial chain based on the node identifiers corresponding to each node in the updated initial chain.
[0101] In this embodiment, a comparison method corresponding to the status information is used to compare the consumption relationship and the initial chain. If the comparison result is a correlation, the initial chain is updated based on the consumption relationship. The updated initial chain records the correspondence between the product identifier and the raw material identifier in the consumption relationship, and the status information of the updated initial chain is updated in a timely manner, which improves the accuracy of the updated initial chain status information and provides accurate basic data for subsequent comparisons.
[0102] In one embodiment, the state information corresponding to the updated initial chain, based on the node identifiers corresponding to each node in the updated initial chain, includes:
[0103] Obtain the node identifiers corresponding to each node in the updated initial chain; determine whether there are two identical node identifiers. If there are two identical node identifiers, determine that the state information corresponding to the updated initial chain is a cyclic state; if there are no two identical node identifiers, determine that the state information corresponding to the updated initial chain is a non-cyclic state.
[0104] For example, the computer device obtains the node identifiers corresponding to each node in the updated initial chain, and then compares the node identifiers. If there are two identical node identifiers, the state information corresponding to the updated initial chain is determined to be a cyclic state; if there are no two identical node identifiers, the state information corresponding to the updated initial chain is determined to be an acyclic state.
[0105] In one embodiment, the computer device obtains the node identifiers corresponding to each node in the updated initial chain, counts the number of each node identifier, and if there is a node identifier with two identifiers, the state information corresponding to the updated initial chain is determined to be a cyclic state; if there is no node identifier with two identifiers, the state information corresponding to the updated initial chain is determined to be an acyclic state.
[0106] In this embodiment, by identifying the node identifiers corresponding to each node in the updated initial chain, the state information of the updated initial chain is determined. Timely determination of the state information of the updated initial chain provides accurate basic data for subsequent comparisons and improves the accuracy of subsequent comparison results.
[0107] In one embodiment, such as Figure 5 As shown, if the state information corresponding to the initial chain is a cyclic state, then the comparison method is the second comparison method; based on the comparison method, the consumption relationship of this group is compared with the initial chain. If the comparison result is a correlation, then the initial chain is updated including:
[0108] Step 502: Obtain the product identifier and raw material identifier of the consumption relationship, as well as the cycle node identifier corresponding to the initial chain; the cycle node identifier is the same node identifier corresponding to two different nodes in the initial chain, the two different nodes are the first cycle node and the second cycle node, and the first cycle node is located before the second cycle node.
[0109] In this context, a cycle node identifier refers to the same identifier corresponding to different nodes in a chain. For example, in the chain ABCA, A is the cycle node identifier, the first cycle node is the head node of the chain, and the second cycle node is the tail node of the chain.
[0110] For example, the computer device obtains the product identifier and raw material identifier of the set of consumption relationships, as well as the loop node identifier corresponding to the initial chain.
[0111] In one embodiment, the state information includes a state identifier and a cycle node identifier. If the state corresponding to the state identifier is a cycle state, then the cycle node identifier is the node identifier corresponding to the cycle node. If the state corresponding to the state identifier is a non-cycle state, then the cycle node identifier is empty.
[0112] In one embodiment, if the initial chain is in a cyclic state, the node identifiers corresponding to each node in the initial chain are obtained, and then the obtained node identifiers are compared, and the node identifiers with the same identifier are determined as the cyclic node identifiers of the initial chain.
[0113] Step 504: Compare the product identifier and raw material identifier with the cycle node identifier.
[0114] For example, the computer device compares the product identifier with the cycle node identifier to obtain a comparison result between the product identifier and the cycle node identifier, and then compares the raw material identifier with the cycle node identifier to obtain a comparison result between the raw material identifier and the cycle node identifier.
[0115] Step 506: If the product identifier is consistent with the loop node identifier, obtain the next node identifier corresponding to the next node adjacent to the first loop node. If the raw material identifier is consistent with the next node identifier, the comparison result is associated. Add the product order number corresponding to the product identifier to the order number set corresponding to the first loop node, and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the next node to obtain the updated initial chain.
[0116] In this context, the "adjacent next node" refers to the node that follows the first cycle node and is adjacent to it. This can be understood as follows: if the nodes in the initial chain are arranged horizontally, the adjacent next node is the node to the right of the first cycle node; if the nodes in the initial chain are arranged vertically, the adjacent next node is the node below the first cycle node. The next node identifier is a string representing the adjacent next node.
[0117] For example, if the computer device determines that the product identifier is consistent with the loop node identifier, it obtains the identifier of the next node corresponding to the next node adjacent to the first loop node, and then compares the raw material identifier with the next node identifier. If the raw material identifier is consistent with the next node identifier, the comparison result is determined to be associated. The product order number corresponding to the product identifier is added to the order number set corresponding to the first loop node, and the raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the next node, thus obtaining the updated initial chain.
[0118] Step 508: If the raw material identifier is consistent with the cycle node identifier, obtain the identifier of the previous node corresponding to the previous node adjacent to the second cycle node. If the product identifier is consistent with the previous node identifier, the comparison result is associated. Add the product order number to the order number set corresponding to the previous node, and add the raw material order number to the order number set corresponding to the second cycle node to obtain the updated initial chain.
[0119] Here, the adjacent preceding node refers to the node that is placed before the second cycle node and is adjacent to the second cycle node. The preceding node identifier is a string that represents the adjacent preceding node.
[0120] For example, if the computer device determines that the raw material identifier is consistent with the cycle node identifier, it obtains the identifier of the previous node corresponding to the previous node adjacent to the second cycle node, and then compares the product identifier with the previous node identifier. If the product identifier is consistent with the previous node identifier, it determines that the comparison result is associated, adds the product order number to the order number set corresponding to the previous node, adds the raw material order number to the order number set corresponding to the second cycle node, and obtains the updated initial chain.
[0121] Step 510: The updated initial chain's state information is a loop state.
[0122] For example, the computer device determines the updated state information of the initial chain as a loop state.
[0123] In this embodiment, for the initial chain in the cyclic state, the second comparison method is used to compare the consumption relationship with the initial chain, keeping the nodes of the initial chain unchanged, and only updating the set of single numbers corresponding to the nodes. The updated initial chain still maintains the cyclic state, providing accurate basic data for subsequent comparisons.
[0124] In one embodiment, after comparing the set of consumption relationships with the initial chain based on the comparison method, the method further includes: if the comparison result is non-associative, updating the non-associative count corresponding to the set of consumption relationships; until the last initial chain in the initial chain set, the updated initial chain set includes:
[0125] The number of initial chains in the initial chain set is counted to obtain the chain count corresponding to the initial chain set; the chain count is compared with the non-association count; if the chain count and the non-association count are the same, a new initial chain is added to the initial chain set; the initial chain is obtained based on this set of consumption relationships.
[0126] The chain count refers to the total number of initial chains included in the initial chain set. The non-association count refers to the total number of initial chains in the initial chain set that are not associated with a set of consumption relationships.
[0127] For example, the computer device counts the number of initial chains in the initial chain set to obtain the chain count corresponding to the initial chain set. Then, it compares the chain count with the non-association count. If the chain count and the non-association count are the same, a new initial chain is added to the initial chain set. The aforementioned initial chain is obtained based on this set of consumption relationships.
[0128] In one embodiment, if the number of chain counts is the same as the number of non-association counts, a new initial chain is created in the initial chain set. The initial chain includes two nodes, namely the chain head node and the chain tail node. The node identifier of the chain head node is the product identifier in the consumption relationship, and the node identifier of the chain tail node is the raw material identifier in the consumption relationship. The order number set corresponding to the chain head node includes the product order number corresponding to the product identifier, and the order number set corresponding to the chain tail node includes the raw material order number corresponding to the raw material identifier. The state information corresponding to the initial chain is a non-cyclic state.
[0129] In this embodiment, if the comparison results between a set of consumption relationships and each initial chain in the initial chain set are all unrelated, then a new initial chain is added to the initial chain set based on the consumption relationship. The new initial chain contains the correspondence between product identifiers and raw material identifiers in the consumption relationship, ensuring the integrity of the data in the initial chain set.
[0130] In one embodiment, such as Figure 6 As shown, obtaining multiple sets of consumption relationships includes:
[0131] Step 602: Obtain multiple production order numbers and multiple raw material order numbers within the target time period.
[0132] The target time period refers to a period of time that has already passed. The target time period can be set according to actual needs, such as each month or each quarter.
[0133] For example, a computer device acquires multiple production order numbers and multiple raw material order numbers within a target time period.
[0134] Step 604: Obtain one raw material order number from multiple raw material order numbers as the target raw material order number, and obtain the target raw material order corresponding to the target raw material order number.
[0135] The target raw material order refers to a document that records raw material requisition data. The data recorded in the target raw material order includes, but is not limited to, the raw material identifier and the corresponding production order number.
[0136] For example, the computer device obtains one raw material order number from multiple raw material order numbers as the target raw material order number, and then obtains the target raw material order corresponding to the target raw material order number.
[0137] In one embodiment, the computer device obtains the generation date of the raw material order corresponding to the raw material order number, sorts the raw material order numbers based on the generation date to obtain the order corresponding to each raw material order number, and selects a raw material order number from multiple raw material order numbers as the target raw material order number based on the order corresponding to the raw material order numbers.
[0138] Step 606: Obtain the raw material identifier and the corresponding target production order number from the target raw material list, and obtain the product identifier based on the target production order number.
[0139] For example, the computer device obtains the raw material identifier and the target production order number corresponding to the raw material identifier from the target raw material list, then obtains the target production order corresponding to the target production order number, and obtains the product identifier from the target production.
[0140] Step 608: Based on the raw material identifier and target raw material order number, and the product identifier and target production order number, a set of consumption relationships is obtained.
[0141] For example, the computer device establishes a correspondence between product identifiers and raw material identifiers, then associates the product order number with the product identifier and the raw material order number with the raw material identifier to obtain a set of consumption relationships.
[0142] Step 610 continues until the last raw material order number among multiple raw material order numbers, resulting in multiple sets of consumption relationships.
[0143] For example, the next raw material order number is obtained from multiple raw material order numbers as the target raw material order number, and the target raw material order corresponding to the target raw material order number is obtained. Steps 606 and 608 are repeated until the last raw material order number among the multiple raw material order numbers, so as to obtain multiple sets of consumption relationships.
[0144] In this embodiment, the correspondence between production orders and raw material orders is converted into a consumption relationship. The consumption relationship only includes the required product identifier, raw material identifier, production order number, and raw material order number. The data in the consumption relationship is more concise than the data in the production order and raw material order. Due to the simplification of the consumption relationship, the speed of subsequent comparison is improved.
[0145] In one exemplary embodiment, the process of generating nested data between products and raw materials during the production process is as follows:
[0146] Obtain multiple production order numbers and multiple raw material order numbers within the target time period. Obtain the generation date of the raw material order corresponding to each raw material order number. Sort the raw material order numbers based on their generation dates to obtain the sequence corresponding to each raw material order number. Based on the sequence of the raw material order numbers, select one raw material order number from the multiple raw material order numbers as the target raw material order number. Then, obtain the target raw material order corresponding to the target raw material order number. From the target raw material order number, obtain the raw material identifier and the target production order number corresponding to the raw material identifier. Obtain the target production order number corresponding to the target production order number. From the target production order number, obtain the product identifier. Establish the correspondence between the product identifier and the raw material identifier. Then, associate the product order number with the product identifier and associate the raw material order number with the raw material identifier to obtain a set of consumption relationships. Repeat the above steps until the last raw material order number among the multiple raw material order numbers, obtaining multiple sets of consumption relationships.
[0147] Obtain the first set of consumption relationships. Based on the first set of consumption relationships, create a new initial chain in the initial chain set. The new initial chain includes two nodes: the chain head node and the chain tail node. The node identifier of the chain head node is the product identifier in the consumption relationship, and the node identifier of the chain tail node is the raw material identifier in the consumption relationship. The order number set corresponding to the chain head node includes the product order number corresponding to the product identifier, and the order number set corresponding to the chain tail node includes the raw material order number corresponding to the raw material identifier. The state information corresponding to the new initial chain is a non-cyclic state, thus obtaining the initial chain set.
[0148] To obtain the next set of consumption relationships, retrieve an initial chain from the initial chain set, and then obtain the corresponding state information of the initial chain. Based on the state information of the initial chain, determine the comparison method to compare with the initial chain. If the state information of the initial chain is a non-cyclic state, the comparison method is the first comparison method. The comparison process between the initial chain and the consumption relationship is as follows: Obtain the product identifier and raw material identifier of this set of consumption relationships, as well as the chain head identifier corresponding to the chain head node and the chain tail identifier corresponding to the chain tail node in the initial chain. Compare the product identifier and the chain tail identifier. If the product identifier and the chain tail identifier are consistent, the comparison result is an association. Add the product order number corresponding to the product identifier to the order number set corresponding to the chain tail node. Add an update chain tail node after the chain tail node. Add the raw material identifier... The updated initial chain is obtained by using the updated tail node as the node identifier and adding the raw material order number corresponding to the raw material identifier to the order number set corresponding to the updated tail node. The updated tail node serves as the tail node of the updated initial chain. If the product identifier is inconsistent with the tail identifier, the raw material identifier is compared with the head identifier. If the raw material identifier is consistent with the head identifier, the comparison result is associated. The raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the head node. An updated head node is added before the head node. The product identifier is used as the node identifier corresponding to the updated head node, and the product order number corresponding to the product identifier is added to the order number set corresponding to the updated head node. The updated initial chain is obtained, and the updated head node serves as the head node of the updated initial chain.
[0149] Obtain the node identifiers corresponding to each node in the updated initial chain, and then compare the node identifiers. If two identical node identifiers exist, the state information corresponding to the updated initial chain is determined to be cyclic; otherwise, the state information is determined to be acyclic. If the comparison result between the consumption relationship and the initial chain is non-correlated, update the non-correlated count corresponding to that consumption relationship.
[0150] If the state information corresponding to the initial chain is a cycle state, then the comparison method is the second comparison method. The comparison process between the initial chain and the consumption relationship is as follows: obtain the product identifier and raw material identifier of the consumption relationship, as well as the cycle node identifier corresponding to the initial chain, compare the product identifier with the cycle node identifier to obtain the comparison result between the product identifier and the cycle node identifier, and then compare the raw material identifier with the cycle node identifier to obtain the comparison result between the raw material identifier and the cycle node identifier. If the product identifier matches the loop node identifier, then obtain the identifier of the next node adjacent to the first loop node. Then compare the raw material identifier with the next node identifier. If the raw material identifier matches, the comparison result is determined to be associated. Add the product order number corresponding to the product identifier to the order number set corresponding to the first loop node, and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the next node, obtaining the updated initial chain. If the raw material identifier matches the loop node identifier, then obtain the identifier of the previous node adjacent to the second loop node. Then compare the product identifier with the previous node identifier. If the product identifier matches, the comparison result is determined to be associated. Add the product order number to the order number set corresponding to the previous node, and add the raw material order number to the order number set corresponding to the second loop node, obtaining the updated initial chain. The state information of the updated initial chain is determined to be a loop state. If the comparison result between the consumption relationship and the initial chain is not associated, then update the number of non-associated transactions corresponding to that consumption relationship.
[0151] Obtain the next initial chain from the initial chain set, and repeat the above process until the last initial chain in the initial chain set is obtained. Count the number of initial chains in the initial chain set to obtain the chain count corresponding to the initial chain set. Then compare the chain count with the non-association count. If the chain count and the non-association count are the same, add a new initial chain to the initial chain set based on the consumption relationship.
[0152] Obtain the next set of consumption relationships, and repeat the above process until the last set of consumption relationships is obtained, resulting in a reference chain set. Select the cyclic chains in the reference chain set whose state information is cyclic. The cyclic chains are as follows: Figure 7 As shown, the loop chain is displayed on the terminal. The loop chain displayed on the terminal is as follows: Figure 8 As shown.
[0153] In the above data generation method, by obtaining the consumption relationship, which concisely represents the correspondence between product identifiers and raw material identifiers, as well as the correspondence between product order numbers and raw material order numbers, the consumption relationship is compared with each initial chain in the initial chain set to obtain the comparison result between the consumption relationship and the initial chain. Due to the simplification of the consumption relationship, the comparison speed is improved. The initial chain set is updated according to the comparison result. All of the above steps are performed by computer equipment, which improves the execution efficiency of the above steps, thereby improving the generation efficiency of the cyclic chain set.
[0154] It should be understood that although the steps in the flowcharts of the embodiments described above 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 embodiments described above 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.
[0155] Based on the same inventive concept, this application also provides a data generation apparatus for implementing the data generation method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data generation apparatus embodiments provided below can be found in the limitations of the data generation method described above, and will not be repeated here.
[0156] In one embodiment, such as Figure 9 As shown, a data generation apparatus is provided, comprising: an acquisition module 902, a comparison module 904, and a selection module 906, wherein:
[0157] The acquisition module 902 is used to acquire multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier;
[0158] The comparison module 904 is used to compare each set of consumption relationships in the multiple sets of consumption relationships with each initial chain in the initial chain set, and update the initial chain set based on the comparison results, until the last set of consumption relationships in the multiple sets of consumption relationships, to obtain the reference chain set; the initial chain includes multiple nodes, as well as the node identifier and single number set corresponding to each node;
[0159] Select module 906 is used to obtain a set of circular chains based on the reference chains in the reference chain set whose state information is in a circular state.
[0160] In one embodiment, the comparison module 904 is further configured to: obtain an initial chain and its corresponding state information from the initial chain set; determine a comparison method for comparing with the initial chain based on the state information corresponding to the initial chain; compare the consumption relationship with the initial chain based on the comparison method, and update the initial chain if the comparison result is an association; and repeatedly execute the steps of obtaining an initial chain and its corresponding state information from the initial chain set until the last initial chain in the initial chain set, to obtain the updated initial chain set.
[0161] In one embodiment, the comparison module 904 is further configured to: obtain the product identifier and raw material identifier of the consumption relationship, as well as the chain head identifier corresponding to the chain head node and the chain tail identifier corresponding to the chain tail node in the initial chain; compare the product identifier and the chain tail identifier; if the product identifier and the chain tail identifier are consistent, the comparison result is an association; add the product order number corresponding to the product identifier to the order number set corresponding to the chain tail node; add an updated chain tail node after the chain tail node; use the raw material identifier as the node identifier corresponding to the updated chain tail node; and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the updated chain tail node to obtain the updated initial chain; and update the chain tail node as the updated initial chain. The chain tail node; if the product identifier and the chain tail identifier are inconsistent, the raw material identifier and the chain head identifier are compared. If the raw material identifier and the chain head identifier are consistent, the comparison result is associated. The raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the chain head node. An updated chain head node is added before the chain head node. The product identifier is used as the node identifier corresponding to the updated chain head node, and the product order number corresponding to the product identifier is added to the order number set corresponding to the updated chain head node, thus obtaining the updated initial chain; the updated chain head node is used as the chain head node of the updated initial chain; based on the node identifiers corresponding to each node in the updated initial chain, the status information corresponding to the updated initial chain is obtained.
[0162] In one embodiment, the comparison module 904 is further configured to: obtain the node identifiers corresponding to each node in the updated initial chain; determine whether there are two identical node identifiers; if there are two identical node identifiers, determine that the state information corresponding to the updated initial chain is a cyclic state; if there are no two identical node identifiers, determine that the state information corresponding to the updated initial chain is a non-cyclic state.
[0163] In one embodiment, the comparison module 904 is further configured to: obtain the product identifier and raw material identifier of the consumption relationship, and the cycle node identifier corresponding to the initial chain; the cycle node identifier is the same node identifier corresponding to two different nodes in the initial chain, the two different nodes being the first cycle node and the second cycle node, the first cycle node being located before the second cycle node; compare the product identifier and raw material identifier with the cycle node identifier; if the product identifier matches the cycle node identifier, obtain the identifier of the next node adjacent to the first cycle node; if the raw material identifier matches the next node identifier, the comparison result is an association. Add the product order number corresponding to the product identifier to the order number set corresponding to the first loop node, and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the next node to obtain the updated initial chain; if the raw material identifier is consistent with the loop node identifier, obtain the previous node identifier corresponding to the previous node adjacent to the second loop node; if the product identifier is consistent with the previous node identifier, the comparison result is associated, add the product order number to the order number set corresponding to the previous node, and add the raw material order number to the order number set corresponding to the second loop node to obtain the updated initial chain; the status information corresponding to the updated initial chain is the loop state.
[0164] In one embodiment, the comparison module 904 is further configured to: count the number of initial chains in the initial chain set to obtain the chain count corresponding to the initial chain set; compare the chain count with the non-association count; if the chain count is the same as the non-association count, add an initial chain to the initial chain set; the initial chain is obtained based on the consumption relationship.
[0165] In one embodiment, the acquisition module 902 is further configured to: acquire multiple production order numbers and multiple raw material order numbers within a target time period; acquire one raw material order number from the multiple raw material order numbers as a target raw material order number, and acquire the target raw material order corresponding to the target raw material order number; acquire the raw material identifier and the target production order number corresponding to the raw material identifier from the target raw material order, and acquire the product identifier based on the target production order number; obtain a set of consumption relationships based on the raw material identifier and the target raw material order number, as well as the product identifier and the target production order number; and obtain multiple sets of consumption relationships until the last raw material order number among the multiple raw material order numbers.
[0166] Each module in the aforementioned data generation 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.
[0167] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. 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 stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. 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 the computer program is executed by the processor, it implements a data generation method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0168] Those skilled in the art will understand that Figure 10 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.
[0169] 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.
[0170] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0171] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0172] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0173] 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, and when executed, it 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.
[0174] 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.
[0175] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent 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. A data generation method, characterized in that, The method includes: Obtain multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier; For each set of consumption relationships, an initial chain and its corresponding state information are obtained from the initial chain set. Based on the state information of the initial chain, a comparison method is determined to compare it with the initial chain. Based on the comparison method, the consumption relationship is compared with the initial chain. If the comparison result is an association, the initial chain is updated. The steps of obtaining an initial chain and its corresponding state information from the initial chain set are repeated until the last initial chain in the initial chain set, resulting in an updated initial chain set. This process continues until the last set of consumption relationships in the multiple sets of consumption relationships is reached, resulting in a reference chain set. The initial chain includes multiple nodes, and a set of node identifiers and single numbers corresponding to each node. The state information includes cyclic and non-cyclic states. The comparison method includes a first comparison method corresponding to the non-cyclic state and a second comparison method corresponding to the cyclic state. Based on the reference chains in the reference chain set whose state information is in a cyclic state, a cyclic chain set is obtained.
2. The method according to claim 1, characterized in that, The cyclic state refers to the existence of two nodes in the chain with the same node identifier, while the non-cyclic state refers to the existence of nodes in the chain with different node identifiers.
3. The method according to claim 1, characterized in that, If the state information corresponding to the initial chain is a non-cyclic state, then the comparison method is the first comparison method; the step of comparing the consumption relationship with the initial chain based on the comparison method, and updating the initial chain if the comparison result is a correlation, includes: Obtain the product identifier and raw material identifier of the group of consumption relationships, as well as the chain head identifier corresponding to the chain head node and the chain tail identifier corresponding to the chain tail node in the initial chain; The product identifier and the chain tail identifier are compared. If the product identifier and the chain tail identifier are consistent, the comparison result is an association. The product order number corresponding to the product identifier is added to the order number set corresponding to the chain tail node. An updated chain tail node is added after the chain tail node. The raw material identifier is used as the node identifier corresponding to the updated chain tail node, and the raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the updated chain tail node to obtain the updated initial chain. The updated chain tail node serves as the chain tail node of the updated initial chain. If the product identifier is inconsistent with the chain tail identifier, the raw material identifier is compared with the chain head identifier. If the raw material identifier is consistent with the chain head identifier, the comparison result is associated. The raw material order number corresponding to the raw material identifier is added to the order number set corresponding to the chain head node. An updated chain head node is added before the chain head node. The product identifier is used as the node identifier corresponding to the updated chain head node, and the product order number corresponding to the product identifier is added to the order number set corresponding to the updated chain head node to obtain the updated initial chain. The updated chain head node serves as the chain head node of the updated initial chain. Based on the node identifiers corresponding to each node in the updated initial chain, the state information corresponding to the updated initial chain is obtained.
4. The method according to claim 3, characterized in that, The process of obtaining the state information corresponding to the updated initial chain based on the node identifiers of each node in the updated initial chain includes: Obtain the node identifier corresponding to each node in the updated initial chain; Determine whether there are two identical node identifiers among the node identifiers. If there are two identical node identifiers, then the state information corresponding to the updated initial chain is determined to be a cyclic state. If there are no two identical node identifiers, then the state information corresponding to the updated initial chain is determined to be a non-cyclic state.
5. The method according to claim 1, characterized in that, If the state information corresponding to the initial chain is a cyclic state, then the comparison method is the second comparison method; the step of comparing the consumption relationship with the initial chain based on the comparison method, and updating the initial chain if the comparison result is a correlation, includes: Obtain the product identifier and raw material identifier of the consumption relationship set, as well as the cycle node identifier corresponding to the initial chain; the cycle node identifier is the same node identifier corresponding to two different nodes in the initial chain, the two different nodes are the first cycle node and the second cycle node, and the first cycle node is located before the second cycle node; Compare the product identifier and the raw material identifier with the cycle node identifier; If the product identifier is consistent with the loop node identifier, then obtain the next node identifier corresponding to the next node adjacent to the first loop node. If the raw material identifier is consistent with the next node identifier, then the comparison result is associated. Add the product order number corresponding to the product identifier to the order number set corresponding to the first loop node, and add the raw material order number corresponding to the raw material identifier to the order number set corresponding to the next node to obtain the updated initial chain. If the raw material identifier is consistent with the cycle node identifier, then obtain the previous node identifier corresponding to the previous node adjacent to the second cycle node. If the product identifier is consistent with the previous node identifier, then the comparison result is associated. Add the product order number to the order number set corresponding to the previous node, and add the raw material order number to the order number set corresponding to the second cycle node to obtain the updated initial chain. The updated initial chain corresponds to a loop state.
6. The method according to claim 1, characterized in that, After comparing the set of consumption relationships with the initial chain based on the comparison method, the method further includes: if the comparison result is non-associative, then updating the non-associative count corresponding to the set of consumption relationships; the step of obtaining the updated initial chain set up to the last initial chain in the initial chain set includes: The number of initial chains in the initial chain set is counted to obtain the chain count corresponding to the initial chain set; Compare the number of chain counts with the number of non-associative counts; If the number of chain counts is the same as the number of non-association counts, then a new initial chain is added to the initial chain set; the initial chain is obtained based on the consumption relationship of the set.
7. The method according to claim 1, characterized in that, The acquisition of multiple sets of consumption relationships includes: Obtain multiple production order numbers and multiple raw material order numbers within a target time period; Obtain one raw material order number from the plurality of raw material order numbers as the target raw material order number, and obtain the target raw material order corresponding to the target raw material order number; Obtain the raw material identifier and the target production order number corresponding to the raw material identifier from the target raw material list, and obtain the product identifier based on the target production order number; Based on the raw material identifier and the target raw material order number, as well as the product identifier and the target production order number, a set of consumption relationships is obtained; Multiple consumption relationships are obtained by continuing until the last raw material order number among the multiple raw material order numbers.
8. A data generation apparatus, characterized in that, The device includes: The acquisition module is used to acquire multiple sets of consumption relationships; the consumption relationship includes product identifier and raw material identifier, as well as the product order number corresponding to the product identifier and the raw material order number corresponding to the raw material identifier; The comparison module is used to: obtain an initial chain from the initial chain set and the corresponding state information of the initial chain for each set of consumption relationships; determine a comparison method to compare with the initial chain based on the state information of the initial chain; compare the consumption relationship with the initial chain based on the comparison method; if the comparison result is an association, update the initial chain; repeat the step of obtaining an initial chain from the initial chain set and the corresponding state information of the initial chain until the last initial chain in the initial chain set, to obtain an updated initial chain set; and continue until the last set of consumption relationships in the multiple sets of consumption relationships, to obtain a reference chain set; the initial chain includes multiple nodes and a set of node identifiers and single numbers corresponding to each node; the state information includes cyclic state and non-cyclic state; the comparison method includes a first comparison method corresponding to the non-cyclic state and a second comparison method corresponding to the cyclic state; The selection module is used to obtain a set of circular chains based on the reference chains in the set whose state information is in a circular state.
9. 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 7.
10. 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 7.
11. A computer program product, comprising a computer program, 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 7.