CN112395465A - Invoice data processing method and device, electronic equipment and readable storage medium - Google Patents

Invoice data processing method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112395465A
CN112395465A CN202011335661.1A CN202011335661A CN112395465A CN 112395465 A CN112395465 A CN 112395465A CN 202011335661 A CN202011335661 A CN 202011335661A CN 112395465 A CN112395465 A CN 112395465A
Authority
CN
China
Prior art keywords
target
bill
branch
nodes
elements
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011335661.1A
Other languages
Chinese (zh)
Other versions
CN112395465B (en
Inventor
李秋炆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202011335661.1A priority Critical patent/CN112395465B/en
Publication of CN112395465A publication Critical patent/CN112395465A/en
Application granted granted Critical
Publication of CN112395465B publication Critical patent/CN112395465B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/12Accounting
    • G06Q40/125Finance or payroll

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a method and a device for processing invoice data, and belongs to the field of computers. The method comprises the following steps: acquiring a first set consisting of invoicing amounts of invoices of a target object, wherein elements in the first set correspond to the invoices one by one; acquiring a target bill amount of a target bill to be settled of a target object; tiling elements in the first set as nodes of a binary tree; if the candidate branch formed by the nodes meets the target preset condition, stopping continuously tiling the elements in the first set from the candidate branch, and taking the candidate branch as a reserved first branch; the target preset condition comprises that the sum of the corresponding elements in the candidate branches is within a preset threshold range, and the minimum boundary value and the maximum boundary value of the preset threshold range are respectively the sum of the target bill amount, the target bill amount and the preset threshold; identifying a target element corresponding to the first branch with the least number of nodes in the first set; and associating the target invoice corresponding to the target element with the target bill to be settled.

Description

Invoice data processing method and device, electronic equipment and readable storage medium
Technical Field
The application belongs to the technical field of computers, and particularly relates to an invoice data processing method and device, electronic equipment and a readable storage medium.
Background
At present, under the business handling scene of enterprise financial settlement, a party A often provides a settlement bill, a party B provides a settlement invoice after confirmation, then the party A performs correlation matching of the bill and the invoice, after the matching is completed, the party A initiates payment to the party B, and the settlement process is completed.
When the bill and the invoice are matched in an associated mode, the value-added tax invoice of a client is scanned manually, and the scanned electronic images are manually associated with the bill one by one. When the invoice quantity and the bill data are both small, the manual association can meet the business requirements, but when the magnitude is increased to thousands of levels, the workload of the manual association becomes huge and errors easily occur.
Therefore, the scheme of manually associating the invoice and the bill in the related art has the problems of low efficiency and high error rate.
Disclosure of Invention
The embodiment of the application aims to provide an invoice data processing method, an invoice data processing device, an electronic device and a readable storage medium, which can solve the problems of low efficiency and high error rate existing in a scheme of manually associating invoices and bills in the related art.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides an invoice data processing method, where the method includes:
acquiring a first set consisting of invoicing amount of invoices of a target object, wherein elements in the first set correspond to the invoices in a one-to-one mode;
acquiring a target bill amount of a target bill to be settled of the target object;
tiling elements in the first set as nodes of a binary tree;
if the candidate branch formed by the tiled nodes meets the target preset condition, stopping performing the tiling operation on other elements which are not tiled in the first set from the candidate branch, and taking the candidate branch as a reserved first branch;
the target preset condition comprises that the sum of the elements corresponding to the nodes in the candidate branch is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
identifying a target element corresponding to a node in a target branch of the binary tree in the first set, wherein the target branch is the first branch with the least number of nodes;
and associating the target invoice corresponding to the target element with the target bill to be settled.
In a second aspect, an embodiment of the present application provides an invoice data processing apparatus, including:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a first set formed by invoicing amount of invoices of a target object, and elements in the first set correspond to the invoices in a one-to-one manner;
the second acquisition module is used for acquiring the target bill amount of the target bill to be settled of the target object;
a tiling module, configured to tile elements in the first set as nodes of a binary tree;
a setting module, configured to, if a candidate branch formed by tiled nodes meets a target preset condition, stop continuing a tiling operation of other elements that are not tiled in the first set from the candidate branch, and use the candidate branch as a reserved first branch;
the target preset condition comprises that the sum of the elements corresponding to the nodes in the candidate branch is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
an identifying module, configured to identify a target element corresponding to a node in a target branch of the binary tree in the first set, where the target branch is the first branch with the smallest number of nodes;
and the association module is used for associating the target invoice corresponding to the target element with the target bill to be settled.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In the embodiment of the application, by tiling the elements in the first set formed by the invoicing amount of the invoice of the target object as the nodes of the binary tree, and judging whether the candidate branch formed by the tiled nodes meets the target preset condition or not in the process of tiling, if yes, the candidate branch can be used as a reserved first branch, target elements corresponding to nodes in the first branch with the least number of nodes are identified, so as to find the minimum number of invoices which can meet the target preset condition in the invoices of the target object, the target invoices in the first set corresponding to the target elements can be associated with the target bills to be settled, so that the bills to be settled can be automatically associated with the minimum invoices, and the invoice utilization rate and the association efficiency and accuracy of the invoices and the bills are improved; moreover, the method can also cover a scene of many-to-many correlation between the invoices and the bills with more frequency and higher complexity, so that the scene of correlation between the invoices and the bills is more comprehensive; and on the premise of meeting the association efficiency, the association accuracy and the high utilization rate of the invoices are ensured, and the bill settlement period is finally shortened.
Drawings
FIG. 1 is a flow chart of a method of processing invoice data according to one embodiment of the present application;
FIG. 2 is a schematic diagram of an element traversal process of one embodiment of the present application;
FIG. 3 is a schematic diagram of an element traversal process of another embodiment of the present application;
FIG. 4 is a block diagram of an invoice data processing apparatus according to an embodiment of the present application;
FIG. 5 is a diagram of a hardware configuration of an electronic device according to an embodiment of the present application;
fig. 6 is a schematic hardware configuration diagram of an electronic device according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The processing method of the invoice data provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof.
The inventor finds that in the process of implementing the application, because the payable bills of a general company have information of the name of the settlement company, the bill amount and the tax payment amount, and the value-added tax invoices have the invoice head-up, the invoice amount and the tax payment amount, the payable bills and the value-added tax invoices have one-to-one correspondence between the three parameters. The inventor considers that when the settlement company name and the invoice are the same as the new line, the invoice and the invoice are proved to have the associated basic condition, based on which, the invoice set and the invoice set for association can be determined, and then based on the condition that the sum of the bills and the sum of the invoices are the same, the association of the payable invoice with the minimum number of invoices is realized.
In addition, the inventor considers that the existing manual invoice and bill association scheme can only solve three association scenes of 1 to 1, 1 to more or more to 1, and cannot associate bills with the minimum number of invoices, when too many invoices or unreasonable invoices are used for association, the invoicing workload of a client is increased, the real bills to be settled are interfered, and the workload with more financial consumption is required to be corrected manually. Moreover, for many-to-many association scenarios with the most frequency and the highest complexity, the manual association scheme cannot provide a solution.
To this end, the inventor provides a method for processing invoice data to manually correlate the above problems of the scheme, and the method is described in detail in the following with reference to different embodiments.
Referring to fig. 1, a flowchart of an invoice data processing method according to an embodiment of the present application is shown, where the method may specifically include the following steps:
step 101, acquiring a first set consisting of invoicing amounts of invoices of a target object;
the present application aims to automatically associate the invoice and the bill to be settled of the same object, so that the invoice in this step and the target bill to be settled in step 102 belong to the same object, that is, the target object. In one example, the target object may be a business for which the invoice is headed and for which the name of the settlement company for the target bill to be settled is also the business.
In addition, the invoice can be any invoice, such as a value-added tax invoice and a common invoice.
The first set S: a collection of numbers representing invoiced amounts of a plurality of invoices, for example company a.
The elements in the first set S correspond to the multiple invoices in a one-to-one manner, that is, the invoice amount of each invoice to be associated of company a is taken as one element in the first set S, even if the invoice amounts of the two invoices are the same, the two invoice amounts belong to two elements in the first set, for example, two elements in the set S are also 4.
For example, S ═ 2,8,11,4,4,3,7,9,1 ].
102, acquiring a target bill amount of a target bill to be settled of the target object;
in one example, the sum of the bill amounts of the target bills to be settled of the settlement company name company a is the target bill amount sum.
The target bill to be settled may be different according to different needs, for example, the target bill to be settled is all bills to be settled with the name of the settlement company, company a, or is part of bills to be settled with the name of the settlement company, company a.
Optionally, in one embodiment, when step 102 is executed, it may be implemented by:
s201, accumulating the bill amount of the bill to be settled according to different bill amounts of the bill to be settled of the target object, and generating the accumulated sum of the bill amount matched with the different bill amounts;
s202, each bill set to be settled corresponding to each accumulated sum of the bill amount is respectively used as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated sum of the bill amount;
and S203, accumulating and taking each bill amount as a target bill amount of the target bill to be settled.
For example, for all bills to be settled (e.g., M bills) with the company name of company a, each bill has a bill amount, and the bill amounts can be summarized according to different bill amounts, so that a plurality of sum can be obtained.
For example, for M bills, the bill amount of each bill can be determined and used as the target bill amount of the target bill to be settled according to 1 bill as the target bill to be settled, that is, the bill amount is obtained as sum for each bill, and M (i.e., C) can be obtained1 M) (ii) each sum (wherein the different sums may be the same or different herein); for M bills, summarizing the bill amount according to each 2 bills to obtain C2 MEach sum; for M bills, summarizing the bill amount according to 3 bills to obtain C3 MEach sum; … … for M bills, summarizing the bill amount according to M bills to obtain CM MOne (i.e., 1) sum;
thus, C can be obtained1 M+C2 M+C3 M+……CM MAnd each sum may have a sum with the same value, so that each sum (i.e., the sum of each bill amount) may correspond to at least one bill set to be settled.
For the plurality of sum obtained, each set of bills to be settled corresponding to each sum may be respectively used as a target bill to be settled, and the corresponding sum is used as a target bill amount of the target bill to be settled, for example, the set of bills to be settled corresponding to sum 6 includes a set of bills 1, a set of bills 2 and 3, in other words, the bill amount of bill 1 is 6 (e.g., in units of yuan), and the sum of the bill amounts of bill 2 and bill 3 is 6 (e.g., in units of yuan).
Then when associating the bill with the invoice is performed with sum of 100, the target bill to be settled for associating the invoice can be bill 1, or can be a combination of bill 2 and bill 3. Then bill 1 may be selected to be associated with the least number of target invoices found if the least number of invoices need to be associated with the least number of invoices, based on the difference in demand. If the need is to associate the bill with only the minimum number of invoices, the minimum number of invoices found can be associated with bill 1 or the combination of bills 2 and 3, so as to realize the many-to-many association of the invoices and the bills.
In the embodiment of the application, when the target bill to be settled for the associated invoice is set, the bill amount of the bill to be settled of the target object can be accumulated according to different bill amounts, and the sum of the bill amounts matched with the different bill amounts is generated; then, each bill set to be settled corresponding to each accumulated sum of the bill amounts is respectively used as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated sum of the bill amounts; finally, each sum of the bill amounts is used as the target bill amount of the target bill to be settled, so that the target bill amount of the target bill to be settled is more various, and the set of bills to be settled with the same target bill amount is more various, so that when the target bill to be settled is associated with the bill, not only can the scenes of one-to-one, one-to-many and many-to-one association of the bill and the invoice be covered, but also the scenes of many-to-many association can be covered, and the automatic association of the scenes with higher complexity of the bill and the invoice is realized.
In this application, the execution sequence of step 101 and step 102 is not limited, and the two steps are parallel steps, and may be executed sequentially or simultaneously.
Step 103, tiling the elements in the first set as nodes of a binary tree;
the elements in the first set S may be used as nodes of a binary tree to be tiled, and whether a candidate branch formed by the tiled nodes meets a target preset condition is determined in the tiling process, so as to determine whether to continue tiling other elements in the first set S according to a determination result.
In the embodiment of the present application, instead of performing traversal and tiling operations on all elements in the first set S (that is, exhausting all combinations of the elements in the first set S), and then determining which nodes of the branches satisfy the target preset condition, the complexity is high, the amount of data to be determined is large, and the efficiency is lower, but whether a candidate branch formed by the tiled nodes satisfies the target preset condition is determined in the tiling process, and the tiling and determining processes are performed synchronously, so that the computational complexity and the amount of data of the system can be greatly reduced, and the association efficiency can be improved.
Step 104, if the candidate branch formed by the tiled nodes meets a target preset condition, stopping the tiling operation of other elements (or second elements) which are not tiled in the first set from the candidate branch, and taking the candidate branch as a reserved first branch;
the target preset condition comprises that the accumulated sum of first elements corresponding to nodes in the candidate branches is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
for example, the sum (i.e. the target bill amount) of the round for associating the invoice and the bill is 6, since in the actual application process, the total amount of the invoice for associating the bill needs to reach 6, and may be higher than 6, but may not be lower than 6, and the units of the amounts for associating the invoice and the bill are the same here, and will not be described here again. Therefore, a preset threshold value, for example, 0.5, may be set, and therefore, the preset threshold value range may be [ sum, sum +0.5], for example [6,6.5], that is, when a target invoice for associating a target bill to be settled is found from the first set S, the total amount of invoice money of multiple invoices can be regarded as a group of possible solutions as long as the total amount of invoice money of the multiple invoices is within the range of [6,6.5], and since the purpose of the present application is to find the minimum number of invoices to associate the bill, the present application is named as a possible solution.
Optionally, the method in the embodiment of fig. 1 may be further optimized to improve the calculation efficiency, and specifically, after step 103, the method in accordance with the embodiment of the present application may further include:
and 105, if the candidate branch formed by the tiled nodes does not meet the target preset condition, pruning the candidate branch, or continuing the tiling operation of the second elements which are not tiled in the first set from the candidate branch.
The target preset condition comprises that the accumulated sum of first elements corresponding to nodes in the candidate branches is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
therefore, the step 105 may be specifically described as if the cumulative sum of the elements (i.e. the first element) in the candidate branch formed by the tiled node is greater than the maximum boundary value, determining that the candidate branch formed by the tiled node does not satisfy the target preset condition, and performing pruning processing on the candidate branch formed by the first element; and under the condition that the accumulated sum of the first elements is smaller than the minimum boundary value, determining that a candidate branch formed by the tiled node does not meet a target preset condition, and continuing the tiling operation of other elements (namely the second elements) which are not tiled in the first set from the candidate branch.
Optionally, if there is the reserved first branch in the binary tree, the target preset condition further includes: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch that have been reserved in the binary tree. Step 105 may be further specifically described as determining that the candidate branch formed by the tiled nodes does not satisfy the target preset condition if the number of the first nodes is greater than the number of the second nodes, so as to perform pruning on the candidate branch;
that is, when the target preset condition includes that the accumulated sum of elements corresponding to nodes in the candidate branch is within a preset threshold range, and the number of first nodes in the candidate branch is less than or equal to the number of second nodes in the first branch that is reserved in the binary tree, then the trigger condition for pruning the candidate branch may include that the accumulated sum of elements in the candidate branch formed by tiled nodes is greater than the maximum boundary value, or that the number of first nodes is greater than the number of second nodes.
The following embodiments will also preset conditions for the target including: the detailed description of the case that the number of the first nodes of the candidate branch is less than or equal to the number of the second nodes of the first branch already reserved in the binary tree is given, and is not repeated here.
After step 103, step 104 or step 105 may be executed alternatively.
In one example, the embodiment of fig. 1 and the embodiment including step 105 are described with reference to fig. 2, which illustrates that sum is 6, the preset threshold range is [6,6.5], and the first set S is [2,8,11,4,4,3,7,9,1 ]:
the dashed line between two nodes in fig. 2 indicates that the branch is pruned, and the solid line between two nodes indicates that the branch is retained without pruning.
According to the arrangement order of the elements in the first set S, the elements are tiled into the binary tree as nodes from the element 2, then the element accumulation sum of the node 2 and the node 8 is 10, is not in [6,6.5], and exceeds 6.5, therefore, the candidate branch formed by the node 2 and the node 8 is pruned;
according to the above arrangement sequence, the element 11 in the first set S is taken as a child node of the node 2, so that the cumulative sum of the elements of the node 2 and the node 11 is 13, which is not in [6,6.5] and exceeds 6.5, and therefore, the candidate branch formed by the node 2 and the node 11 is pruned;
according to the above arrangement sequence, the element 4 in the first set S is taken as a child node of the node 2, and then the cumulative sum of the elements of the node 2 and the node 4 is 6, within [6,6.5], so that the second element which is not tiled is no longer found from the first set S according to the above arrangement sequence as a child node of the node 4, but a candidate branch formed by the node 2 and the node 4 is directly taken as a reserved first branch;
similarly, a candidate branch formed by another node 2 and a node 4 is reserved;
continuing the tiling operation, and taking the element 3 in the first set S as a child node of the node 2 according to the arrangement order, so that the sum of the element accumulations of the node 2 and the node 3 is 5, and is smaller than the minimum value 6 of [6,6.5], and therefore, the element 7 can be continuously selected as a child node of the node 3 according to the arrangement order, so that the sum of the element accumulations of the candidate branches formed by the node 2, the node 3, and the node 7 is 12, and exceeds 6.5, and therefore, pruning is performed on the candidate branches formed by the node 2, the node 3, and the node 7; in the same way, the candidate branches formed by the nodes 2, 3 and 9 are generated by continuous tiling, and the candidate branches are pruned; continuing tiling to generate a candidate branch consisting of the node 2, the node 3 and the node 1, wherein the element accumulated sum of the candidate branch is 6 and is within [6,6.5], so that the candidate branch consisting of the node 2, the node 3 and the node 1 is reserved as a first branch;
similarly, according to the above arrangement sequence, the element 7 in the first set S is further used as a child node of the node 2, so that the sum of the elements of the node 2 and the node 7 is 9, which exceeds 6.5, and therefore, the candidate branch formed by the node 2 and the node 7 is subjected to pruning processing;
similarly, according to the above arrangement sequence, the element 9 in the first set S is further used as a child node of the node 2, so that the sum of the elements of the node 2 and the node 9 is 11, which exceeds 6.5, and therefore, the candidate branch formed by the node 2 and the node 9 is subjected to pruning processing;
similarly, according to the above arrangement order, the element 1 in the first set S is again taken as the child node of the node 2, then the cumulative sum of the elements of the node 2 and the node 1 is 3, which is less than 6, but the tiling from the node 2 is already completed in the scenario of traversing from the node 2 to the element 1 as the child node, so the candidate branch formed by the node 2 and the node 1 is also subjected to pruning processing.
Fig. 2 only illustrates a tiling schematic situation in which the first element 2 in the first set is used as the first node of the binary tree, and in an actual processing process, after the tiling performed from the first element 2 is completed, the elements 8,11,4, 3,7,9, and 1 are used as the first nodes of the binary tree, respectively, according to the above arrangement order, and the tiling is continued according to the above arrangement order to search for the first branch meeting the target preset condition.
Finally, after tiling, a first branch is found that includes branch 1 (consisting of element 2 and element 4, with the number of nodes being 2), branch 2 (consisting of element 2 and another element 4, with the number of nodes being 2), branch 3 (consisting of element 2, element 3, and element 1, with the number of nodes being 3).
In the embodiment of the application, elements in a first set formed by the invoicing amount of the invoice of the target object are used as nodes of a binary tree to be tiled, whether a candidate branch formed by the tiled nodes meets a target preset condition is judged in the tiling process, if yes, the candidate branch can be used as a reserved first branch, and the target element corresponding to each node in the first branch with the minimum number of nodes is identified, so that the minimum number of invoices meeting the target preset condition in the invoice of the target object, namely the target invoice in the first set corresponding to the target element, can be found, and thus the minimum number of target invoices and the target bill to be settled are associated, the automatic association of the bill to be settled by using the minimum number of invoices is realized, and the association efficiency and accuracy of the invoice and the bill are improved; if the accumulated sum of elements in the candidate branch formed by the tiled nodes is larger than the maximum boundary value, or if the number of the first nodes is larger than the number of the second nodes, pruning is carried out on the candidate branch, and the element tiling is not required to be carried out on the candidate branch, so that excessive meaningless calculation is avoided on the candidate branch which does not meet the target preset condition, and the overall calculation efficiency of the method is improved; if the accumulated sum of the elements in the candidate branch formed by the tiled nodes is smaller than the minimum boundary value, the tiling operation is continuously carried out on other elements which are not tiled in the first set from the candidate branch, so that the target invoice meeting the target preset condition can be effectively found.
Step 106, identifying a target element corresponding to a node in a target branch of the binary tree in the first set;
wherein the target branch is the first branch with the least number of nodes;
since the objective of the present application is to find the lowest number of invoices to associate with the bill, the least node number of the first branch retained is branch 1 and branch 2, and the target element in branch 1 is element 2 and the top element 4 in the first set S, and the target element in branch 2 is element 2 and the bottom element 4 in the first set S.
And 107, associating the target invoice corresponding to the target element with the target bill to be settled.
For example, element 4 in the first set S, which is top ranked, is the number of invoice amounts for invoice 5, element 4 in the second set S is the number of invoice amounts for invoice 7, and element 2 in the first set S is the number of invoice amounts for invoice 3;
the target bill to be settled, such as sum 6, includes a bill set of bill 1 and a bill set of bill 2 and bill 3, in other words, the bill amount of bill 1 is 6 (e.g., in units of yuan), and the sum of the bill amounts of bill 2 and bill 3 is 6 (e.g., in units of yuan).
Then this step may associate two invoices, invoice 3, invoice 5, with invoice 1; or, the two invoices of invoice 3 and invoice 5 are associated with the two bills of bill 2 and bill 3;
and associating two invoices, invoice 3 and invoice 7, with invoice 1; alternatively, two invoices, invoice 3, invoice 7, are associated with two bills, bill 2 and bill 3.
In the embodiment of the application, by tiling the elements in the first set formed by the invoicing amount of the invoice of the target object as the nodes of the binary tree, and judging whether the candidate branch formed by the tiled nodes meets the target preset condition or not in the process of tiling, if yes, the candidate branch can be used as a reserved first branch, target elements corresponding to nodes in the first branch with the least number of nodes are identified, so as to find the minimum number of invoices which can meet the target preset condition in the invoices of the target object, the target invoices in the first set corresponding to the target elements can be associated with the target bills to be settled, so that the bills to be settled can be automatically associated with the minimum invoices, and the invoice utilization rate and the association efficiency and accuracy of the invoices and the bills are improved; moreover, the method can also cover a scene of many-to-many correlation between the invoices and the bills with more frequency and higher complexity, so that the scene of correlation between the invoices and the bills is more comprehensive; and on the premise of meeting the association efficiency, the association accuracy and the high utilization rate of the invoices are ensured, and the bill settlement period is finally shortened.
On the basis of any of the foregoing embodiments, when the step of tiling the elements in the first set as nodes of a binary tree in step 103 is performed, the elements in the first set may be randomly sorted, and then the elements in the first set may be sequentially tiled as nodes of the binary tree according to the sorting.
However, considering that in the random ordering scheme, when the method of the above-mentioned embodiment (particularly the method of the embodiment including step 105) is executed, it is possible to find that the candidate branch composed of the tiled elements does not satisfy the target preset condition after traversing the elements in the first set with a certain element as the first node of the binary tree (with S ═ 2,8,11,4,4,3,7,9,1], sum ═ 20, in the process of traversing the element 2 as the first node of the binary tree, it is found that the element sum of the candidate branch (2-8-4-4-1) is also smaller than 20 when traversing the last candidate branch composed of the element 2 as the first node of the binary tree sequentially with the element 2, the element 8, the element 4, and the element 1, and the target preset condition is not satisfied), therefore, the calculation amount of the method is still large, and therefore, in order to further reduce the calculation amount and improve the efficiency of associating the invoice with the bill, on the basis of any one of the above embodiments, in another embodiment of the present application, when the step 103 is executed, the elements in the first set may be sequentially tiled as nodes of the binary tree according to the order from large to small of the invoicing amounts corresponding to the elements in the first set.
Taking the first set S ═ 2,8,11,4,4,3,7,9,1 as an example, the elements may be tiled in order of 11,9,8,7,4,4,3,2,1 as nodes of a binary tree, so as to find a possible solution (i.e., a first branch); alternatively, the elements in the first set S may be reordered from large to small in the invoicing amount to obtain S '═ 11,9,8,7,4,4,3,2,1], and then the elements are sequentially tiled as nodes of the binary tree according to the order of the elements in the set S', so as to find a possible solution.
Taking as an example the method of the embodiment of the present application is executed by tiling the elements in order of their corresponding invoicing amounts from large to small as nodes of a binary tree, in one example, referring to fig. 3, sum is 6, and the preset threshold range is [6,6.5 ].
The dashed line between two nodes in fig. 3 indicates that the branch is pruned, the solid line between two nodes indicates that the branch is not pruned but is preserved, and the circle of the dashed line indicates that all candidate branches having the element inside the circle as the first node of the binary tree are pruned.
Sequentially tiling the elements in the set S as nodes of a binary tree in the order of 11,9,8,7,4,4,3,2,1, and then tiling the elements as the first node of the binary tree from the element 11, then because 11 is greater than 6.5, it is not necessary to traverse backward from the element 11 to tile the binary tree, and each candidate branch formed by the binary tree with the element 11 as the first node can be pruned directly, thereby greatly reducing the amount of computation, which is represented by a dashed circle with the number 11 shown in fig. 3;
similarly, each candidate branch consisting of a binary tree with element 9 as the first node is pruned, which is represented in fig. 3 by the dashed circle showing the number 9;
similarly, each candidate branch consisting of a binary tree with element 8 as the first node is pruned, which is represented in fig. 3 by the dashed circle showing the number 8;
similarly, each candidate branch consisting of a binary tree with element 7 as the first node is pruned, which is represented in fig. 3 by the dashed circle showing the number 7;
then, element 4 arranged at the head in the order of 11,9,8,7,4,4,3,2,1 is used as the head node of the binary tree, and the tiling is performed in the order, so that the element summation of node 4 and node 4 is 8, is not within [6,6.5], and already exceeds 6.5, and therefore, as shown in fig. 3, the candidate branch formed by node 4 and node 4 is pruned; similarly, the candidate branch formed by the node 4 and the node 3 is pruned; the candidate branch formed by the node 4 and the node 2 is reserved as a first branch; the candidate branch formed by the node 4 and the node 1 is pruned;
tiling the elements 4 arranged in the second one in the order of 11,9,8,7,4,4,3,2,1 as the first node of the binary tree in order, so that the sum of the elements of node 4 and node 3 is 7, is not within [6,6.5], and already exceeds 6.5, and therefore, as shown in fig. 3, the candidate branch formed by node 4 and node 3 is pruned; similarly, the candidate branch formed by the node 4 and the node 2 is reserved as the first branch; the candidate branch formed by the node 4 and the node 1 is pruned;
tiling the elements 3 in the order of 11,9,8,7,4,4,3,2,1 and then taking the element 3 as the first node of the binary tree, so that the sum of the elements of the node 3 and the nodes 2 and 1 is 6, within [6,6.5], and therefore, as shown in fig. 3, the candidate branch formed by the node 3 and the nodes 2 and 1 is reserved as the first branch;
tiling the elements 2 as the first node of the binary tree in the order of 11,9,8,7,4,4,3,2,1, so that the sum of the elements of node 2 and node 1 is 3, is not within [6,6.5], and is less than 6, and therefore, as shown in fig. 3, the candidate branch formed by node 2 and node 1 is pruned;
in the 11,9,8,7,4,4,3,2,1 order, element 1 is again taken as the first node of the binary tree, since there are no other elements following element 1 in the order, and the cumulative sum of element 1 is 1, less than 6, all candidate branches having element 1 as the first node of the binary tree are directly pruned, which is represented by the dashed circle with the number 1 shown in fig. 3.
In this embodiment of the application, when the elements in the first set are tiled as nodes of the binary tree, the elements in the first set may be tiled in sequence according to a descending order of the invoicing amounts corresponding to the elements in the first set, which is equivalent to that the elements required to be tiled are preprocessed in a sequence before being tiled, so that once the sum of the elements of the candidate branches formed by the tiled elements exceeds the maximum value of the preset threshold range, all the candidate branches in one traversal direction may be pruned, the pruning efficiency is greatly improved, the first branch meeting the target preset condition may be found more quickly, and thus the target branch hitting the fewest number of invoices is screened out from the first branch, and the efficiency of associating invoice bills with the fewest number of invoices is improved.
Optionally, on the basis of any one of the foregoing embodiments, if there is the reserved first branch in the binary tree, the target preset condition may further include: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch that have been reserved in the binary tree.
Taking an embodiment of sequentially tiling the elements in the first set as nodes of a binary tree in the order from large to small of the invoicing money amounts corresponding to the elements in the first set as an example, although the scheme further improves pruning efficiency, thereby greatly improving the correlation efficiency of the invoice and the bill and reducing the calculated amount, the scheme can obtain a plurality of groups of possible solutions, i.e., a number of first branches, and since the need is to associate bills with a minimum number of invoices, the condition that the solved target invoice is the "smallest subset" of the first set, in particular during tiling, the judgment condition for deciding whether to prune or reserve the candidate branch or continue the tiling is further added with a target preset condition that the first node number of the nodes in the candidate branch needs to be less than or equal to the second node number of the nodes in the reserved first branch in the binary tree.
Continuing with the example of fig. 3, as can be seen from the above description of the traversal process of fig. 3, three first branches are sequentially formed, namely, a branch a formed by the node 4 and the node 2, another branch B formed by the node 4 and the node 2, and a branch C formed by the node 3, the node 2, and the node 1.
Then before forming branch C, branch a and branch B are already formed, the number of nodes (i.e. the number of second nodes) of these two branches is 2, then in the process of tiling with element 3 as the first node of the binary tree, when forming a candidate branch composed of node 3, node 2 and node 1, since the number of nodes (the number of first nodes) of this candidate branch is already 3 and is greater than the number of second nodes (i.e. 2) of the already formed first branch, it is also possible to prune the above-mentioned branch C, so that only two first branches, namely branch a and branch B, are obtained in the tiling process.
From the perspective of the mathematical model, in the embodiment of the present application, in the process of the bifurcation operation, if there is already one possible solution (i.e., a first branch) and the length of the subset being computed (i.e., the candidate branch) exceeds the number of elements (i.e., the length) of the possible solution, the subset being computed (i.e., the candidate branch) may be pruned, and the other elements may be abandoned to be continuously tiled on the candidate branch, i.e., the solution on the branch may be abandoned, regardless of whether the sum of the elements of the subset being computed is within the preset threshold, so that the number of the first branch, i.e., the possible solution, may be greatly reduced.
Optionally, for example, a first branch D with a node number of 3 is formed first, then, if the node number of the candidate branch being calculated is 2 and the element cumulative sum of the candidate branch is also within the preset threshold range, the candidate branch is not required to be pruned or continuously tiled, and the candidate branch is retained as a second first branch E; then, during the process of continuing the tiling again, it is found that the node number of the candidate branch being calculated (i.e. the first node number) is also 2, and the second node number used for comparison with the first node number may be the node number of the branch D (i.e. 3) or the node number of the branch E (i.e. 2), and the second node number is preferably the least node number of the formed first branch (i.e. 2).
Then, based on this embodiment, in step 105, it may be determined that the candidate branch formed by the tiled nodes does not satisfy the target preset condition when the number of the first nodes is greater than the number of the second nodes, so as to perform pruning processing on the candidate branch.
In this embodiment, if there is a reserved first branch in the binary tree, that is, it indicates that at least one set of possible solutions (i.e., target invoices that can be used for associating target bills to be settled) has been obtained, the target preset condition may further include: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch reserved in the binary tree, so that the number of nodes of the candidate branch (i.e. the number of first nodes) obtained by tiling can be compared with the length of the possible solution (i.e. the number of second nodes) obtained by tiling in the process of performing the tiling operation on the elements in the first set, and if the number of first nodes is less than or equal to the number of second nodes, whether to prune or continue to tile the candidate branch can be decided based on whether the accumulated sum of the elements corresponding to the candidate branch is within a preset threshold range; if the number of the first nodes is greater than the number of the second nodes, whether the sum of the elements corresponding to the candidate branch is within the preset threshold range or not can indicate that the possible solution corresponding to the candidate branch is not the optimal solution (i.e., the minimum number of target invoices), so that the candidate branch can be directly pruned in the process of the tiled branching operation, the calculation amount is greatly reduced, the possible solutions for judgment, namely the number of the first branches, are reduced, and the automatic association efficiency of the invoices and the bills is improved.
Optionally, after the step of pruning the candidate branch in step 105, the method according to the embodiment of the present application may further include: and tiling the elements which are not tiled in the first set as nodes of the binary tree by adopting a backtracking method.
Among them, the backtracking method (exploration and backtracking method) is a preferred search method, also called heuristic method, which searches forward according to preferred conditions to achieve the goal. When a certain step is explored, if the original selection is not good or the target is not reached, the step is returned to be reselected, and the technology of returning to be returned to be a backtracking method if the step is not good.
As can be seen from the above description of the example of fig. 2, the preferred conditions of the backtracking method herein are the above target preset conditions, for example, the first set S is [2,8,11,4,4,3,7,9,1], sum is 6, and the preset threshold range is [6,6.5 ].
Then, according to the sequence order of the elements in the first set S, the elements 2 are tiled into the binary tree as the first node, and the element 8 is selected as the child node of the node 2 in the binary tree, so that the sum of the elements of the node 2 and the node 8 is 10, and is not in [6,6.5], that is, it is found that the selected element 8 cannot reach the target, and therefore, the candidate branch formed by the node 2 and the node 8 is pruned;
then, according to the above-mentioned ranking order, the element 11 in the first set S is selected back by one step again as the child node of the node 2, so that the cumulative sum of the elements of the node 2 and the node 11 is 13, which is not within [6,6.5] and exceeds 6.5, therefore, the candidate branch formed by the node 2 and the node 11 is pruned, that is, the selected element 11 is found to be unable to reach the target.
In the embodiment of the application, after pruning is performed on the candidate branches which do not meet the target preset condition, elements which are not tiled in the first set can be tiled as nodes of the binary tree by adopting a backtracking method, based on a mathematical model, application optimization is performed on the existing binary tree algorithm, and the backtracking method and pruning are combined, so that automatic association under a scene of many-to-many invoices and bills can be covered, the target that the minimum invoices are associated with bills to be settled is realized, the efficiency problem of manual association is solved, the calculation efficiency of the algorithm is improved, all possible solutions do not need to be searched and the optimal solution can be searched more efficiently.
By means of the above embodiments of the present application, the automatic association mechanism of the invoice and the bill is abstracted into a mathematical model, and the binary tree algorithm is combined to automatically calculate the optimal solution, in the process of algorithm construction, the method of the embodiments of the present application is gradually optimized, and finally, the binary tree scoring, backtracking and pruning are performed, so that the overall algorithm efficiency is improved, and the association result can be output within the second level regardless of the data volume of the invoice and the bill used for association.
In the invoice data processing method provided in the embodiment of the present application, the execution subject may be an invoice data processing device, or a control module in the invoice data processing device for executing the invoice data processing method. In the embodiment of the present application, a method for processing invoice data executed by an invoice data processing device is taken as an example, and the invoice data processing device provided in the embodiment of the present application is described.
Referring to FIG. 4, a block diagram of an invoice data processing apparatus of one embodiment of the present application is shown. The invoice data processing device comprises:
a first obtaining module 301, configured to obtain a first set of invoicing amounts of invoices of a target object, where elements in the first set correspond to the invoices in a one-to-one manner;
a second obtaining module 302, configured to obtain a target bill amount of a target to-be-settled bill of the target object;
a tiling module 303, configured to tile elements in the first set as nodes of a binary tree;
a setting module 304, configured to, if a candidate branch formed by tiled nodes meets a target preset condition, stop continuing the operation of tiling other elements that are not tiled in the first set from the candidate branch, and use the candidate branch as a reserved first branch;
the target preset condition comprises that the sum of the elements corresponding to the nodes in the candidate branch is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
an identifying module 305, configured to identify a target element corresponding to a node in a target branch of the binary tree in the first set, where the target branch is the first branch with the smallest number of nodes;
an associating module 306, configured to associate the target invoice corresponding to the target element with the target bill to be settled.
Optionally, if there is the reserved first branch in the binary tree, the target preset condition further includes: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch that have been reserved in the binary tree.
Optionally, the apparatus further comprises:
a pruning module, configured to prune the candidate branch if an accumulated sum of elements in the candidate branch formed by the tiled nodes is greater than the maximum boundary value, or if the first node number is greater than the second node number;
the tiling module 303 is further configured to, if the accumulated sum of the elements in the candidate branch formed by the tiled nodes is smaller than the minimum boundary value, continue the tiling operation on the other elements not tiled in the first set from the candidate branch.
Optionally, the tiling module 303 is further configured to tile the elements in the first set as nodes of a binary tree in sequence according to a descending order of the invoicing money amounts corresponding to the elements in the first set.
Optionally, the second obtaining module 302 includes:
the generation submodule is used for accumulating the bill amount of the bill to be settled according to different bill amounts of the bill to be settled of the target object to generate the accumulated sum of the bill amount matched with the different bill amounts;
the first setting submodule is used for respectively taking each bill set to be settled corresponding to the accumulated sum of the bill amount as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated sum of the bill amount;
and the second setting submodule is used for accumulating and taking each bill amount as a target bill amount of the target bill to be settled.
In the embodiment of the application, by tiling the elements in the first set formed by the invoicing amount of the invoice of the target object as the nodes of the binary tree, and judging whether the candidate branch formed by the tiled nodes meets the target preset condition or not in the process of tiling, if yes, the candidate branch can be used as a reserved first branch, target elements corresponding to nodes in the first branch with the least number of nodes are identified, so as to find the minimum number of invoices which can meet the target preset condition in the invoices of the target object, the target invoices in the first set corresponding to the target elements can be associated with the target bills to be settled, so that the bills to be settled can be automatically associated with the minimum invoices, and the invoice utilization rate and the association efficiency and accuracy of the invoices and the bills are improved; moreover, the method can also cover a scene of many-to-many correlation between the invoices and the bills with more frequency and higher complexity, so that the scene of correlation between the invoices and the bills is more comprehensive; and on the premise of meeting the association efficiency, the association accuracy and the high utilization rate of the invoices are ensured, and the bill settlement period is finally shortened.
The invoice data processing device in the embodiment of the application may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The invoice data processing device in the embodiment of the application may be a device with an operating system. The operating system may be an Android operating system (Android), an iOS operating system, or other possible operating systems, which is not specifically limited in the embodiments of the present application.
The processing device for invoice data provided in the embodiment of the present application can implement each process implemented by the above method embodiment, and is not described here again to avoid repetition.
Optionally, as shown in fig. 5, an electronic device 2000 is further provided in this embodiment of the present application, and includes a processor 2002, a memory 2001, and a program or an instruction stored in the memory 2001 and executable on the processor 2002, where the program or the instruction is executed by the processor 2002 to implement each process of the above-mentioned invoice data processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, it is not described here again.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and the non-mobile electronic devices described above.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 1000 includes, but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010.
Those skilled in the art will appreciate that the electronic device 1000 may further comprise a power source (e.g., a battery) for supplying power to various components, and the power source may be logically connected to the processor 1010 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 6 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 1010 is configured to obtain a first set of invoicing amounts of invoices of a target object, where elements in the first set correspond to the invoices in a one-to-one manner; acquiring a target bill amount of a target bill to be settled of the target object; tiling elements in the first set as nodes of a binary tree; if the candidate branch formed by the tiled nodes meets the target preset condition, stopping performing the tiling operation on other elements which are not tiled in the first set from the candidate branch, and taking the candidate branch as a reserved first branch; the target preset condition comprises that the sum of the elements corresponding to the nodes in the candidate branch is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively; identifying a target element corresponding to a node in a target branch of the binary tree in the first set, wherein the target branch is the first branch with the least number of nodes; and associating the target invoice corresponding to the target element with the target bill to be settled.
In the embodiment of the application, by tiling the elements in the first set formed by the invoicing amount of the invoice of the target object as the nodes of the binary tree, and judging whether the candidate branch formed by the tiled nodes meets the target preset condition or not in the process of tiling, if yes, the candidate branch can be used as a reserved first branch, target elements corresponding to nodes in the first branch with the least number of nodes are identified, so as to find the minimum number of invoices which can meet the target preset condition in the invoices of the target object, the target invoices in the first set corresponding to the target elements can be associated with the target bills to be settled, so that the bills to be settled can be automatically associated with the minimum invoices, and the invoice utilization rate and the association efficiency and accuracy of the invoices and the bills are improved; moreover, the method can also cover a scene of many-to-many correlation between the invoices and the bills with more frequency and higher complexity, so that the scene of correlation between the invoices and the bills is more comprehensive; and on the premise of meeting the association efficiency, the association accuracy and the high utilization rate of the invoices are ensured, and the bill settlement period is finally shortened.
Optionally, if there is the reserved first branch in the binary tree, the target preset condition further includes: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch that have been reserved in the binary tree.
In this embodiment of the present application, if there is a reserved first branch in the binary tree, that is, it indicates that at least one set of possible solutions (i.e., target invoices that can be used for associating target bills to be settled) has been obtained, the target preset condition may further include: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch reserved in the binary tree, so that the number of nodes of the candidate branch (i.e. the number of first nodes) obtained by tiling can be compared with the length of the possible solution (i.e. the number of second nodes) obtained by tiling in the process of performing the tiling operation on the elements in the first set, and if the number of first nodes is less than or equal to the number of second nodes, whether to prune or continue to tile the candidate branch can be decided based on whether the accumulated sum of the elements corresponding to the candidate branch is within a preset threshold range; if the number of the first nodes is greater than the number of the second nodes, whether the sum of the elements corresponding to the candidate branch is within the preset threshold range or not can indicate that the possible solution corresponding to the candidate branch is not the optimal solution (i.e., the minimum number of target invoices), so that the candidate branch can be directly pruned in the process of the tiled branching operation, the calculation amount is greatly reduced, the possible solutions for judgment, namely the number of the first branches, are reduced, and the automatic association efficiency of the invoices and the bills is improved.
Optionally, the processor 1010 is configured to perform pruning on the candidate branch if an accumulated sum of elements in the candidate branch formed by the tiled nodes is greater than the maximum boundary value, or if the first node number is greater than the second node number; and if the accumulated sum of the elements in the candidate branch formed by the tiled nodes is smaller than the minimum boundary value, continuing the tiling operation of other elements which are not tiled in the first set from the candidate branch.
In the embodiment of the application, elements in a first set formed by the invoicing amount of the invoice of the target object are used as nodes of a binary tree to be tiled, whether a candidate branch formed by the tiled nodes meets a target preset condition or not is judged in the tiling process, if yes, the candidate branch can be used as a reserved first branch, and the target element corresponding to each node in the first branch with the minimum number of nodes is identified, so that the minimum number of invoices meeting the target preset condition in the invoice of the target object, namely the target invoices in the first set corresponding to the target elements, can be associated with the target invoice to be settled, the automatic association of the bill to be settled by using the minimum number of invoices is realized, and the association efficiency and accuracy of the invoice and the bill are improved; if the accumulated sum of elements in the candidate branch formed by the tiled nodes is larger than the maximum boundary value, or if the number of the first nodes is larger than the number of the second nodes, pruning is carried out on the candidate branch, and the element tiling is not required to be carried out on the candidate branch, so that excessive meaningless calculation is avoided on the candidate branch which does not meet the target preset condition, and the overall calculation efficiency of the method is improved; if the accumulated sum of the elements in the candidate branch formed by the tiled nodes is smaller than the minimum boundary value, the tiling operation is continuously carried out on other elements which are not tiled in the first set from the candidate branch, so that the target invoice meeting the target preset condition can be effectively found.
Optionally, the processor 1010 is configured to tile the elements in the first set as nodes of a binary tree in sequence according to a descending order of the invoicing money amounts corresponding to the elements in the first set.
In the embodiment of the application, when the elements in the first set are tiled as nodes of the binary tree, the elements in the first set can be tiled in sequence according to the order from large to small of the invoicing amount corresponding to the elements in the first set, which is equivalent to that the elements required to be tiled are preprocessed in the sequence before being tiled, so that once the sum of the elements of the candidate branches formed by the tiled elements exceeds the maximum value of the preset threshold range, all the candidate branches in a traversal direction can be pruned, the pruning efficiency is greatly improved, the first branch meeting the target preset condition can be found more quickly, the target branch which hits the minimum number of invoices is screened out from the first branch, and the efficiency of associating bills with the minimum number of invoices is improved.
Optionally, the processor 1010 is configured to, for the bill to be settled of the target object, accumulate the bill amount of the bill to be settled according to different bill amounts, and generate a bill amount accumulated sum matching the different bill amounts; respectively taking each bill set to be settled corresponding to each accumulated bill sum as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated bill sum; and taking the accumulated sum of each bill amount as a target bill amount of the target bill to be settled.
In the embodiment of the application, when the target bill to be settled for the associated invoice is set, the bill amount of the bill to be settled of the target object can be accumulated according to different bill amounts, and the sum of the bill amounts matched with the different bill amounts is generated; then, each bill set to be settled corresponding to each accumulated sum of the bill amounts is respectively used as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated sum of the bill amounts; finally, each sum of the bill amounts is used as the target bill amount of the target bill to be settled, so that the target bill amount of the target bill to be settled is more various, and the set of bills to be settled with the same target bill amount is more various, so that when the target bill to be settled is associated with the bill, not only can the scenes of one-to-one, one-to-many and many-to-one association of the bill and the invoice be covered, but also the scenes of many-to-many association can be covered, and the automatic association of the scenes with higher complexity of the bill and the invoice is realized.
It should be understood that in the embodiment of the present application, the input Unit 1004 may include a Graphics Processing Unit (GPU) 10041 and a microphone 10042, and the Graphics Processing Unit 10041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also referred to as a touch screen. The touch panel 10071 may include two parts, a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 1009 may be used to store software programs as well as various data, including but not limited to application programs and operating systems. Processor 1010 may integrate an application processor that handles primarily operating systems, user interfaces, applications, etc. and a modem processor that handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 1010.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the above invoice data processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and so on.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the above invoice data processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, the description is omitted here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method of processing invoice data, the method comprising:
acquiring a first set consisting of invoicing amount of invoices of a target object, wherein elements in the first set correspond to the invoices in a one-to-one mode;
acquiring a target bill amount of a target bill to be settled of the target object;
tiling elements in the first set as nodes of a binary tree;
if the candidate branch formed by the tiled nodes meets the target preset condition, stopping performing the tiling operation on other elements which are not tiled in the first set from the candidate branch, and taking the candidate branch as a reserved first branch;
the target preset condition comprises that the sum of the elements corresponding to the nodes in the candidate branch is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
identifying a target element corresponding to a node in a target branch of the binary tree in the first set, wherein the target branch is the first branch with the least number of nodes;
and associating the target invoice corresponding to the target element with the target bill to be settled.
2. The method according to claim 1, wherein if there is the first branch reserved in the binary tree, the target preset condition further comprises: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch that have been reserved in the binary tree.
3. The method of claim 2, further comprising:
if the accumulated sum of elements in the candidate branch formed by the tiled nodes is larger than the maximum boundary value, or if the first node number is larger than the second node number, pruning the candidate branch;
and if the accumulated sum of the elements in the candidate branch formed by the tiled nodes is smaller than the minimum boundary value, continuing the tiling operation of other elements which are not tiled in the first set from the candidate branch.
4. The method of claim 1, wherein the tiling the elements of the first set as nodes of a binary tree comprises:
and according to the order from large to small of the invoicing money corresponding to the elements in the first set, sequentially tiling the elements in the first set as nodes of the binary tree.
5. The method of claim 1, wherein obtaining a target bill amount of a target bill to be settled of the target object comprises:
for the bill to be settled of the target object, accumulating the bill amount of the bill to be settled according to different bill amounts to generate a bill amount accumulated sum matched with the different bill amounts;
respectively taking each bill set to be settled corresponding to each accumulated bill sum as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated bill sum;
and taking the accumulated sum of each bill amount as a target bill amount of the target bill to be settled.
6. An invoice data processing apparatus, characterised in that the apparatus comprises:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a first set formed by invoicing amount of invoices of a target object, and elements in the first set correspond to the invoices in a one-to-one manner;
the second acquisition module is used for acquiring the target bill amount of the target bill to be settled of the target object;
a tiling module, configured to tile elements in the first set as nodes of a binary tree;
a setting module, configured to, if a candidate branch formed by tiled nodes meets a target preset condition, stop continuing a tiling operation of other elements that are not tiled in the first set from the candidate branch, and use the candidate branch as a reserved first branch;
the target preset condition comprises that the sum of the elements corresponding to the nodes in the candidate branch is within a preset threshold range, wherein the minimum boundary value and the maximum boundary value of the preset threshold range are the target bill amount and the sum of the target bill amount and a preset threshold respectively;
an identifying module, configured to identify a target element corresponding to a node in a target branch of the binary tree in the first set, where the target branch is the first branch with the smallest number of nodes;
and the association module is used for associating the target invoice corresponding to the target element with the target bill to be settled.
7. The apparatus of claim 6, wherein if the first branch reserved in the binary tree exists, the target preset condition further comprises: the number of first nodes of the candidate branch is less than or equal to the number of second nodes of the first branch that have been reserved in the binary tree.
8. The apparatus of claim 7, further comprising:
a pruning module, configured to prune the candidate branch if an accumulated sum of elements in the candidate branch formed by the tiled nodes is greater than the maximum boundary value, or if the first node number is greater than the second node number;
and the tiling module is further configured to continue tiling the other elements not tiled in the first set from the candidate branch if the accumulated sum of the elements in the candidate branch formed by the tiled nodes is smaller than the minimum boundary value.
9. The apparatus of claim 6,
and the tiling module is further configured to sequentially tile the elements in the first set as nodes of the binary tree according to a descending order of the invoicing money amounts corresponding to the elements in the first set.
10. The apparatus of claim 6, wherein the second obtaining module comprises:
the generation submodule is used for accumulating the bill amount of the bill to be settled according to different bill amounts of the bill to be settled of the target object to generate the accumulated sum of the bill amount matched with the different bill amounts;
the first setting submodule is used for respectively taking each bill set to be settled corresponding to the accumulated sum of the bill amount as a target bill to be settled of the target object, wherein the bill set to be settled is a second set formed by bills to be settled for generating the accumulated sum of the bill amount;
and the second setting submodule is used for accumulating and taking each bill amount as a target bill amount of the target bill to be settled.
CN202011335661.1A 2020-11-24 2020-11-24 Invoice data processing method and device, electronic equipment and readable storage medium Active CN112395465B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011335661.1A CN112395465B (en) 2020-11-24 2020-11-24 Invoice data processing method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011335661.1A CN112395465B (en) 2020-11-24 2020-11-24 Invoice data processing method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112395465A true CN112395465A (en) 2021-02-23
CN112395465B CN112395465B (en) 2022-07-12

Family

ID=74606265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011335661.1A Active CN112395465B (en) 2020-11-24 2020-11-24 Invoice data processing method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112395465B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020107794A1 (en) * 2001-02-05 2002-08-08 Furphy Thomas W. Method and system for processing transactions
CN102208061A (en) * 2011-06-03 2011-10-05 用友软件股份有限公司 Data cancel after verification processing device and method
CN106408358A (en) * 2016-12-08 2017-02-15 用友网络科技股份有限公司 Invoice management method and invoice management apparatus
US20170154384A1 (en) * 2015-12-01 2017-06-01 Oracle International Corporation Computerized invoice record and receipt record matching with automatic discrepancy resolution
CN110442571A (en) * 2019-06-28 2019-11-12 卓尔智联(武汉)研究院有限公司 A kind of data processing method, device and computer storage medium
CN110598007A (en) * 2019-09-09 2019-12-20 腾讯科技(深圳)有限公司 Bill file processing method, device, medium and electronic equipment
US20200242577A1 (en) * 2019-07-31 2020-07-30 Alibaba Group Holding Limited Blockchain-based electronic bill reimbursement method, apparatus, and electronic device
CN111784423A (en) * 2020-07-31 2020-10-16 广东电网有限责任公司梅州供电局 Invoice matching method and device, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020107794A1 (en) * 2001-02-05 2002-08-08 Furphy Thomas W. Method and system for processing transactions
CN102208061A (en) * 2011-06-03 2011-10-05 用友软件股份有限公司 Data cancel after verification processing device and method
US20170154384A1 (en) * 2015-12-01 2017-06-01 Oracle International Corporation Computerized invoice record and receipt record matching with automatic discrepancy resolution
CN106408358A (en) * 2016-12-08 2017-02-15 用友网络科技股份有限公司 Invoice management method and invoice management apparatus
CN110442571A (en) * 2019-06-28 2019-11-12 卓尔智联(武汉)研究院有限公司 A kind of data processing method, device and computer storage medium
US20200242577A1 (en) * 2019-07-31 2020-07-30 Alibaba Group Holding Limited Blockchain-based electronic bill reimbursement method, apparatus, and electronic device
CN110598007A (en) * 2019-09-09 2019-12-20 腾讯科技(深圳)有限公司 Bill file processing method, device, medium and electronic equipment
CN111784423A (en) * 2020-07-31 2020-10-16 广东电网有限责任公司梅州供电局 Invoice matching method and device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
GEORGE IOANNOU ET AL: "Solving the open vehicle routeing problem via a single parameter metaheuristic algorithm", 《JOURNAL OF THE OPERATIONAL RESEARCH SOCIETY》 *

Also Published As

Publication number Publication date
CN112395465B (en) 2022-07-12

Similar Documents

Publication Publication Date Title
CN111209977B (en) Classification model training and using method, device, equipment and medium
CN104142999B (en) Search result methods of exhibiting and device
CN106156092B (en) Data processing method and device
CN110704677B (en) Program recommendation method and device, readable storage medium and terminal equipment
CN111383005B (en) Digital currency flow direction tracking method and device
US11769125B2 (en) Method and apparatus for processing transaction requests in blockchain, device and medium
CN109215037A (en) Destination image partition method, device and terminal device
CN105930527A (en) Searching method and device
CN106326462A (en) Video index grading method and device
CN112395465B (en) Invoice data processing method and device, electronic equipment and readable storage medium
CN104424485A (en) Method and device for obtaining specific information based on image recognition
CN113111216B (en) Advertisement recommendation method, device, equipment and storage medium
CN111641868A (en) Preview video generation method and device and electronic equipment
CN115827944A (en) Big data analysis method and server based on Internet platform system optimization
CN106202456A (en) Send the method and device of picture
CN111340222B (en) Neural network model searching method and device and electronic equipment
CN103873769A (en) Image search systems and methods
CN111784045B (en) Optimization method, device, equipment and storage medium for delivery vehicle
CN115222483A (en) Financial product recommendation method and device, electronic equipment and storage medium
CN112329968A (en) Resource allocation method, device and storage medium
CN105488194B (en) A kind of similar users recognition methods and device
CN113343090B (en) Method, apparatus, device, medium and product for pushing information
CN113762668B (en) Method and device for generating task list
CN111368198B (en) Material pushing method and device, electronic equipment and storage medium
CN117635272A (en) Object recommendation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant