CN-116049491-B - Data generation method, device, computer equipment and storage medium
Abstract
The present application relates to a data generation method, apparatus, computer device, storage medium and computer program product. The method comprises the steps of obtaining multiple groups of consumption relations, wherein the consumption relations comprise product identifications and raw material identifications, product list numbers corresponding to the product identifications and raw material list numbers corresponding to the raw material identifications, comparing the consumption relations with each initial chain in an initial chain set according to each consumption relation in the multiple groups of consumption relations, updating the initial chain set based on comparison results until the last consumption relation in the multiple groups of consumption relations is obtained, obtaining a reference chain set, wherein the initial chain comprises a plurality of nodes, node identifications corresponding to each node and a single number set, and obtaining a circulating chain set based on the reference chain with state information in the reference chain set as a circulating state. By adopting the method, the data generation efficiency can be improved.
Inventors
- TAN XIAOFAN
- QIAN QI
- XIA XIANGYU
- TAN QINTUAN
- LUO TAO
Assignees
- 金蝶软件(中国)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20230118
Claims (11)
- 1. A method of data generation, the method comprising: obtaining a plurality of consumption relations, wherein the consumption relations comprise product identifiers, raw material identifiers, product list numbers corresponding to the product identifiers and raw material list numbers corresponding to the raw material identifiers; The method comprises the steps of obtaining an initial chain from an initial chain set and state information corresponding to the initial chain, determining a comparison method for comparing the initial chain based on the state information corresponding to the initial chain, comparing the initial chain with the group of the consumption relationships based on the comparison method, updating the initial chain if the comparison result is associated, repeatedly executing the steps of obtaining the initial chain and the state information corresponding to the initial chain from the initial chain set until the last initial chain in the initial chain set is obtained, obtaining an updated initial chain set until the last consumption relationship in the initial chain set is obtained, wherein the initial chain comprises a plurality of nodes, a node identifier corresponding to each node and a single number set; And obtaining a circulating chain set based on the reference chains with the state information of the reference chain set being circulating states.
- 2. The method of claim 1, wherein the circulating state is that node identifiers corresponding to two nodes in the chain are identical, and the non-circulating state is that node identifiers corresponding to nodes in the chain are different.
- 3. The method of claim 1, wherein the comparing method is a first comparing method if the state information corresponding to the initial chain is an acyclic state, wherein the comparing the set of consumption relationships with the initial chain based on the comparing method, and wherein updating the initial chain if the comparing result is an association comprises: Acquiring a product identifier and a raw material identifier of the group of consumption relations, and a head identifier corresponding to a head node and a tail identifier corresponding to a tail node in the initial chain; Comparing the product identifier with the chain tail identifier, if the product identifier is consistent with the chain tail identifier, the comparison result is related, the product single number corresponding to the product identifier is added to a single number set corresponding to the chain tail node, an updated chain tail node is newly added after the chain tail node, the raw material identifier is used as a node identifier corresponding to the updated chain tail node, and the raw material single number corresponding to the raw material identifier is added to the single number set corresponding to the updated chain tail node to obtain an updated initial chain; If the product identifier is inconsistent with the chain end identifier, comparing the raw material identifier with the chain header identifier, if the raw material identifier is consistent with the chain header identifier, associating the comparison result, adding a raw material single number corresponding to the raw material identifier to a single number set corresponding to the chain head node, adding an updated chain head node in front of the chain head node, taking the product identifier as a node identifier corresponding to the updated chain head node, and adding a product single number corresponding to the product identifier to a single number set corresponding to the updated chain head node to obtain an updated initial chain; and obtaining the state information corresponding to the updated initial chain based on the node identifiers corresponding to the nodes in the updated initial chain.
- 4. The method of claim 3, wherein the obtaining the updated state information corresponding to the initial chain based on the node identifiers corresponding to the respective nodes in the updated initial chain includes: acquiring node identifiers corresponding to all nodes in the updated initial chain; Judging whether two identical node identifiers exist in the node identifiers, if so, determining that the state information corresponding to the updated initial chain is in a circulating state, and if not, determining that the state information corresponding to the updated initial chain is in a non-circulating state.
- 5. The method of claim 1, wherein the comparing the set of consumption relationships with the initial chain based on the comparing method is a second comparing method if the state information corresponding to the initial chain is a cyclic state, and wherein updating the initial chain if the comparing result is a correlation comprises: The method comprises the steps of obtaining a product identifier and a raw material identifier of the group of consumption relations and a circulating node identifier corresponding to an initial chain, wherein the circulating node identifier is the same node identifier corresponding to two different nodes in the initial chain, the two different nodes are a first circulating node and a second circulating node respectively, and the first circulating node is positioned in front of the second circulating node; comparing the product identifier and the raw material identifier with the circulating node identifier; if the product identifier is consistent with the circulating node identifier, acquiring a next node identifier corresponding to a next node adjacent to the first circulating node, if the raw material identifier is consistent with the next node identifier, the comparison result is associated, adding a product single number corresponding to the product identifier to a single number set corresponding to the first circulating node, and adding a raw material single number corresponding to the raw material identifier to a single number set corresponding to the next node, so as to obtain an updated initial chain; If the raw material identification is consistent with the circulating node identification, acquiring a previous node identification corresponding to a previous node adjacent to the second circulating node, if the product identification is consistent with the previous node identification, the comparison result is associated, the product single number is added to a single number set corresponding to the previous node, and the raw material single number is added to a single number set corresponding to the second circulating node, so that an updated initial chain is obtained; the updated state information corresponding to the initial chain is in a circulating state.
- 6. The method of claim 1, wherein after comparing the set of consumption relationships to the initial chains based on the comparison method, the method further comprises updating a number of non-associations corresponding to the set of consumption relationships if the comparison result is non-association, the obtaining an updated initial chain set up to a last initial chain in the initial chain set comprises: Counting the number of initial chains in the initial chain set to obtain chain counting times corresponding to the initial chain set; comparing the chain statistics with the non-association times; If the chain statistics times are the same as the non-association times, an initial chain is newly added in the initial chain set, and the initial chain is obtained based on the group consumption relation.
- 7. The method of claim 1, wherein the obtaining a plurality of consumption relationships comprises: acquiring a plurality of production list numbers and a plurality of raw material list numbers in a target time period; Acquiring a raw material list number from the raw material list numbers as a target raw material list number, and acquiring a target raw material list corresponding to the target raw material list number; acquiring a raw material identifier and a target production list number corresponding to the raw material identifier from the target raw material list, and acquiring a product identifier based on the target production list number; Obtaining a group of consumption relations based on the raw material identification and the target raw material list number, and the product identification and the target production list number; And obtaining a multi-group consumption relation until the last raw material list number in the raw material list numbers.
- 8. A data generation apparatus, the apparatus comprising: the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring a plurality of groups of consumption relations, wherein the consumption relations comprise product identifiers, raw material identifiers, product list numbers corresponding to the product identifiers and raw material list numbers corresponding to the raw material identifiers; The comparison module is used for acquiring an initial chain from the initial chain set and state information corresponding to the initial chain aiming at each group of consumption relations in the multiple groups of consumption relations; the method comprises the steps of obtaining an initial chain from an initial chain set and state information corresponding to the initial chain, obtaining an updated initial chain set until the last initial chain in the initial chain set is obtained, obtaining a reference chain set until the last consumption relation in a plurality of groups of consumption relations is obtained, comparing the group of consumption relations with the initial chain based on the comparison method, updating the initial chain if the comparison result is related, and repeatedly executing the steps of obtaining the initial chain and the state information corresponding to the initial chain from the initial chain set until the last consumption relation in the initial chain set is obtained, wherein the initial chain comprises a plurality of nodes, node identifiers corresponding to each node and a single number set, and the state information comprises a first comparison method corresponding to the non-circulation state and a second comparison method corresponding to the circulation state; And the selection module is used for obtaining the circulating chain set based on the reference chains with the state information of the circulating states in the reference chain set.
- 9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
- 11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
Description
Data generation method, device, computer equipment and storage medium Technical Field The present application relates to the field of computer technology, and in particular, to a data generating method, apparatus, computer device, storage medium, and computer program product. Background Production cycle nesting refers to the existence of a cyclic relationship between raw materials and products during production. For example, in the production process of A, B is used as a raw material, and in the production process of B, A is used as a raw material, or C generated by using A is used as a raw material. The cyclic nesting data is data describing the corresponding relation between the product identifier and the raw material identifier in the production cyclic nesting and the production list number corresponding to the product identifier and the raw material list number corresponding to the raw material identifier. In the traditional technology, the production list numbers and the raw material list numbers with corresponding relations are stored as a group of consumption data, an analyst needs to analyze a large amount of consumption data in a target time period to obtain circulation nesting data in the target time period, and the generation efficiency of the circulation nesting data is low. Disclosure of Invention In view of the foregoing, it is desirable to provide a data generating method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the data generating efficiency. In a first aspect, the present application provides a data generation method. The method comprises the following steps: obtaining a plurality of consumption relations, wherein the consumption relations comprise product identifiers, raw material identifiers, product list numbers corresponding to the product identifiers and raw material list numbers corresponding to the raw material identifiers; Comparing the consumption relation with each initial chain in an initial chain set aiming at each consumption relation in the multiple consumption relations, and updating the initial chain set based on the comparison result until the last consumption relation in the multiple consumption relations is obtained to obtain a reference chain set, wherein the initial chain comprises a plurality of nodes, and node identifiers and single number sets corresponding to each node; And obtaining a circulating chain set based on the reference chains with the state information of the reference chain set being circulating states. In one embodiment, the comparing the set of consumption relationships to each of the initial chains in the initial chain set and updating the initial chain set based on the comparison comprises: acquiring an initial chain and state information corresponding to the initial chain from the initial chain set; Determining a comparison method for comparing the initial chain based on the state information corresponding to the initial chain; based on the comparison method, comparing the group consumption relation with the initial chain, and if the comparison result is related, updating the initial chain; And repeatedly executing the steps of acquiring an initial chain from the initial chain set and the state information corresponding to the initial chain until the last initial chain in the initial chain set to obtain an updated initial chain set. In one embodiment, the comparison method is a first comparison method if the state information corresponding to the initial chain is a non-cyclic state, the comparing the set of consumption relationships with the initial chain based on the comparison method, and if the comparison result is associated, updating the initial chain includes: Acquiring a product identifier and a raw material identifier of the group of consumption relations, and a head identifier corresponding to a head node and a tail identifier corresponding to a tail node in the initial chain; Comparing the product identifier with the chain tail identifier, if the product identifier is consistent with the chain tail identifier, the comparison result is related, the product single number corresponding to the product identifier is added to a single number set corresponding to the chain tail node, an updated chain tail node is newly added after the chain tail node, the raw material identifier is used as a node identifier corresponding to the updated chain tail node, and the raw material single number corresponding to the raw material identifier is added to the single number set corresponding to the updated chain tail node to obtain an updated initial chain; if the product identifier is inconsistent with the chain end identifier, comparing the raw material identifier with the chain header identifier, if the raw material identifier is consistent with the chain header identifier, the comparison result is associated, the raw material single number corresponding to the raw material identifier is ad