Logistics billing engine system and method
By constructing an adjacency matrix and anomaly detection mechanism in the logistics billing system, the problems of inflexible billing and anomaly risks in the existing system under different contracts and business scenarios are solved, realizing flexible rate calculation and efficient settlement statement generation, and improving billing accuracy and efficiency.
Patent Information
- Application Number
- PCT/CN2026/092536
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-06
- Filing Date
- 2026-04-23
- Publication Date
- 2026-11-12
AI Technical Summary
Existing logistics billing systems struggle to achieve flexible rate calculations for different contracts and business scenarios, and lack the ability to automatically merge multiple dimensions, resulting in insufficient billing accuracy and efficiency, especially posing anomaly risks in large-scale orders and cross-organizational collaborations.
By acquiring billing documents, extracting business and metering fields, matching pre-configured billing rules for cost calculation, constructing an adjacency matrix for graph search, combining individual and group anomaly detection, generating settlement statements and forming invoices, and utilizing knowledge graphs for data storage and reasoning to improve consolidation accuracy.
It enables flexible rate calculation under different business scenarios, improves the accuracy and efficiency of automatic merging of billing results, reduces the processing time of abnormal orders, and enhances the applicability and controllability of the system.
Smart Images

Figure CN2026092536_12112026_PF_FP_ABST
Abstract
Description
Logistics Billing Engine System and Method Technical Field
[0001] This application relates to the field of logistics and transportation technology, and more specifically, to a logistics billing engine system and method. Background Technology
[0002] In existing logistics billing systems, fixed rules are typically set to calculate costs for transportation orders, shipping documents, etc., and settlement statements and bills are collected manually or semi-automatically after the calculation is completed. Technical issues
[0003] However, these traditional solutions often employ simple field matching or single-judgment patterns, making it difficult to accommodate flexible rates across different contracts and business scenarios. Furthermore, with the continuous expansion of logistics scale and the diversification of order types, relying solely on simple field equality or a few rules makes it challenging to automatically and effectively identify and merge a large number of similar orders or duplicate business entries. In addition, individual orders may present potential anomaly risks due to data entry errors, carrier irregularities, or other reasons. Traditional systems often require manual verification to avoid miscalculations or duplicate billing, a time-consuming and unsystematic approach. Especially when dealing with large order volumes, multiple dimensions, or cross-organizational collaboration, existing methods generally lack robust anomaly detection mechanisms and multi-dimensional automatic merging capabilities, failing to meet the higher demands of the modern logistics industry for billing accuracy and settlement efficiency. Technical solutions
[0004] To address the shortcomings of existing technologies, this application provides a logistics billing engine system and method.
[0005] Firstly, this application provides a logistics billing engine method, including:
[0006] Obtain the billing document and extract the business field and metering field from the billing document;
[0007] Based on the business fields and metering fields, match the pre-configured billing rules to generate the corresponding cost calculation scheme;
[0008] Based on the aforementioned cost calculation scheme, the metering fields are calculated to obtain the billing result;
[0009] The billing results and related document information are collected, multiple billing result groups are constructed based on the association of business fields, and a corresponding settlement bill is generated according to each billing result group.
[0010] According to the pre-set merging rules, multiple settlement orders are aggregated and a bill is formed;
[0011] The process of generating a settlement statement also includes: assigning a unique identifier to each billing result, constructing an adjacency matrix based on the matching of business fields between the billing results; performing a graph search on the non-zero correlation in the adjacency matrix, and merging multiple billing results with correlation that meet a preset threshold to generate a single settlement statement;
[0012] Before merging to generate a single billing statement, the method further includes: performing individual anomaly detection on each of the billing results; in response to the billing result meeting the anomaly determination criteria, marking it as an anomaly and excluding it from the construction of the adjacency matrix; and constructing the adjacency matrix and performing graph search only on the billing results that have not been marked as anomalies.
[0013] As an optional implementation, the matching of pre-configured billing rules includes:
[0014] Perform conditional judgments on the business fields to determine the corresponding rate field range;
[0015] Based on the rate field range, the metering field is segmented to obtain segmented rates;
[0016] Based on the segmented fee rates, the fee calculation scheme is generated.
[0017] As an optional implementation, the method for generating the cost calculation scheme further includes:
[0018] Set a minimum billing amount and a maximum billing amount. If the calculated billing result is less than the minimum billing amount, the minimum billing amount will be used; if it is greater than the maximum billing amount, the maximum billing amount will be used.
[0019] Set a minimum billing quantity and a maximum billing quantity. When the calculated quantity is less than the minimum billing quantity, the minimum billing quantity is used; when it is greater than the maximum billing quantity, the maximum billing quantity is used.
[0020] As an optional implementation, the step of collecting the billing results and related document information, constructing multiple billing result groups based on the association of business fields, and generating a corresponding settlement statement according to each billing result group includes:
[0021] The billing results are filtered according to pre-set filtering conditions, wherein the filtering conditions include at least one of carrier, shipper, and transportation type;
[0022] In response to identical order date, shipping route, consignee, and delivery address information, multiple billing results that meet the filtering conditions are merged to generate a single bill.
[0023] As an optional implementation, the step of aggregating multiple settlement orders and forming a bill according to pre-set merging rules includes:
[0024] The billing statement is filtered according to pre-set billing generation filtering conditions, which include at least one of customer identifier, billing cycle or organization dimension.
[0025] In response to meeting the bill generation filtering conditions, multiple single settlement statements are aggregated and merged;
[0026] The consolidated settlement information is summarized into a single bill.
[0027] As an optional implementation, after merging multiple billing result groups using the adjacency matrix and generating a single bill, the method further includes:
[0028] For each of the billing result groups, perform group anomaly detection. In response to the billing result group meeting the group anomaly judgment conditions, mark the billing result group as anomaly pending review and perform splitting or isolation processing.
[0029] In response to the determination that there is no group anomaly, a single billing statement corresponding to the billing result group is output.
[0030] As an optional implementation, the step of aggregating multiple settlement orders and forming a bill according to a pre-set merging rule further includes:
[0031] Create graph nodes in the knowledge graph database to represent business entities such as settlement statements, orders, carriers, transportation routes, and billing cycles, as well as relationship edges to represent dependencies or associations between these business entities.
[0032] The key field information of the settlement statement is written into the knowledge graph database to form a graph data structure oriented towards bill consolidation;
[0033] Based on pre-configured business rules or inference engines, inference operations are performed on the settlement order nodes and their relationships in the knowledge graph database to automatically identify the set of settlement order nodes that meet the bill consolidation conditions;
[0034] The set of settlement order nodes identified by the inference operation is processed in conjunction with the adjacency matrix or anomaly detection module. When it is determined that there is no anomaly, the merged bill is output. If it is determined that there is an anomaly, the relevant settlement order is split or isolated for dynamic aggregation of the bill.
[0035] As an optional implementation, the step of aggregating multiple settlement orders and forming a bill according to a pre-set merging rule further includes:
[0036] The vectorized field information generated for each order is read from the storage medium, and batch similarity calculation is performed on the vectorized field information to form a partially segmented adjacency matrix, which records the non-zero similarity between order pairs;
[0037] When importing the adjacency matrix into the knowledge graph database, a corresponding graph node is created or updated for each order, and a relationship edge is established or updated between the graph nodes based on the similarity results in the adjacency matrix. The relationship edge carries a similarity vector or association attribute.
[0038] For order sets with similarity greater than a preset similarity threshold and the same field values, generate super nodes. In the knowledge graph database, treat the super nodes as single node objects and attach the differentiated fields of each order in the order set as additional vectors.
[0039] When performing bill aggregation, it is determined whether each order meets the merging conditions based on the supernode and its attached vector, and reasoning is performed in combination with cross-entity information. In response to meeting the bill merging conditions, a corresponding bill node is created in the knowledge graph database and associated with the relevant order node.
[0040] Secondly, this application provides a logistics billing engine system, including:
[0041] The data acquisition module obtains billing documents and extracts business fields and metering fields from the billing documents.
[0042] The first calculation module matches the business field and the metering field with the pre-configured billing rules to generate the corresponding cost calculation scheme.
[0043] The second calculation module performs calculations on the metering field based on the cost calculation scheme to obtain the billing result;
[0044] The settlement module collects the billing results and related document information, constructs multiple billing result groups based on the association of business fields, and generates a corresponding settlement document for each billing result group.
[0045] The generation module aggregates multiple settlement orders and forms a bill based on pre-defined merging rules. Beneficial effects
[0046] Compared with existing technologies, this application significantly improves the flexibility and accuracy of automatic billing merging by introducing an adjacency matrix and multi-stage anomaly detection after obtaining billing results. First, by assigning a unique identifier to each billing result and constructing an adjacency matrix based on business fields, graph search or clustering is performed on results that meet certain correlation thresholds. This efficiently identifies and merges orders that are "partially similar" or "multi-dimensionally similar," reducing manual judgment. Second, by excluding individual anomalies before merging and then performing group anomaly detection after merging, potential anomalies in a single transaction or group can be effectively intercepted, providing security for subsequent billing aggregation. Finally, through various optional implementation methods such as minimum / maximum billing limits and segmented rates, the granularity and controllability of the cost calculation process are further enhanced, significantly improving the applicability and computational efficiency of the logistics billing engine in different business scenarios. This avoids problems such as incorrect merging, missed merging, and untimely processing of abnormal orders caused by simple rules in traditional systems. Attached Figure Description
[0047] Figure 1 is a flowchart of the logistics billing engine method provided in an embodiment of this application;
[0048] Figure 2 is a schematic diagram of a billing system provided in an embodiment of this application;
[0049] Figure 3 is a flowchart of a group anomaly detection method provided in an embodiment of this application;
[0050] Figure 4 is a schematic diagram of the logistics billing engine system provided in the embodiments of this application.
[0051] Attached reference numerals: 10, data acquisition module; 20, first calculation module; 30, second calculation module; 40, settlement module; 50, generation module. Embodiments of the present invention
[0052] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0053] Referring to Figure 1, which is a flowchart of the logistics billing engine method provided in an embodiment of this application, the method includes steps S101 to S105, wherein:
[0054] S101: Obtain the billing document and extract the business field and metering field from the billing document;
[0055] S102: Based on the business field and the metering field, match the pre-configured billing rules to generate the corresponding cost calculation scheme;
[0056] S103: Based on the cost calculation scheme, perform calculations on the metering field to obtain the billing result;
[0057] S104: Collect the billing results and related document information, construct multiple billing result groups based on the association of business fields, and generate corresponding settlement statements according to each billing result group;
[0058] S105: According to the pre-set merging rules, aggregate multiple settlement orders and form a bill.
[0059] In practice, the billing document is first retrieved from the business system. This document may include transportation orders or shipping documents. To facilitate subsequent cost calculations, business fields and measurement fields need to be extracted after retrieving the billing document. Business fields typically reflect the conditions required for billing (such as transportation route, vehicle type, carrier, shipper, etc.), while measurement fields are used for specific numerical calculations (such as weight, volume, quantity, mileage, etc.). By categorizing these fields, appropriate billing rules can be matched based on the specific field type in subsequent steps.
[0060] When matching pre-configured billing rules, the corresponding rate range can be retrieved or determined based on the value of the business field, or the metering field can be segmented according to the combination conditions of the business fields to generate a cost calculation scheme. This cost calculation scheme includes information such as the calculation method, rate reference, and restrictions for different metering fields. Subsequently, based on the cost calculation scheme, the aforementioned metering fields are calculated to obtain the billing result. The calculation process may include multiplying by the rate or performing numerical processing such as adding, capping, and guaranteeing.
[0061] After obtaining the billing results, the system will aggregate the results with the corresponding document information to form a settlement statement. The settlement statement can be considered a relatively complete record of expenses, containing all field information and calculation processes related to this calculation, providing a basis for subsequent consolidation processing or financial reconciliation. Finally, according to pre-set consolidation rules, multiple settlement statements that meet the corresponding conditions are aggregated to generate an invoice.
[0062] In practice, the merging rules can include organizational dimensions, billing cycles, or other filtering conditions to classify and summarize settlement statements.
[0063] By following the steps above, a rule-based logistics billing engine method can be implemented, which can meet the cost calculation needs of various business scenarios and simplify the subsequent settlement process.
[0064] As an optional implementation, the matching of pre-configured billing rules includes:
[0065] Perform conditional judgments on the business fields to determine the corresponding rate field range;
[0066] Based on the rate field range, the metering field is segmented to obtain segmented rates;
[0067] Based on the segmented fee rates, the fee calculation scheme is generated.
[0068] In practice, when making conditional judgments on business fields, the corresponding rate field range can be determined based on the transportation route, vehicle type, consignor, or other business-related attributes under different business scenarios.
[0069] Specifically, the system first retrieves the values of the business fields. For example, when the transportation route is within a specific region, it matches the corresponding rate range table; or, for example, when the vehicle type is a large vehicle, it matches another rate range table. Through this matching process, the subsequent segmentation rules for the metering field can be refined.
[0070] Subsequently, based on the matched rate field range, the measurement field is segmented. For example, for the weight field, 0 to 10 tons can be defined as the first rate tier, 10 to 20 tons as the second rate tier, and weights exceeding 20 tons as the third rate tier. Each rate tier corresponds to one or more rate calculation parameters. By segmenting the measurement field, the system can obtain segmented rates to differentiate cost levels across different weight ranges or other numerical ranges.
[0071] Based on the segmented rates, a cost calculation scheme is further generated. This cost calculation scheme may include the rate values used for the metering field in each segment, the cumulative calculation method, or other additional rules (such as minimum cost, maximum cost limits, etc.).
[0072] In this way, the solution is ultimately output to the subsequent billing steps for calculating costs for specific business orders or shipping documents, enabling the flexible and accurate application of corresponding segmented rates under different business field conditions, and achieving multi-dimensional and refined billing processing.
[0073] As an optional implementation, the method for generating the cost calculation scheme further includes:
[0074] Set a minimum billing amount and a maximum billing amount. If the calculated billing result is less than the minimum billing amount, the minimum billing amount will be used; if it is greater than the maximum billing amount, the maximum billing amount will be used.
[0075] Set a minimum billing quantity and a maximum billing quantity. When the calculated quantity is less than the minimum billing quantity, the minimum billing quantity is used; when it is greater than the maximum billing quantity, the maximum billing quantity is used.
[0076] In practical implementation, to better control the upper and lower limits of costs or quantities when generating the cost calculation scheme, the system can first define a minimum billing amount and a maximum billing amount. After completing the calculation of the metering field, if the calculated billing result is less than the minimum billing amount, the billing result is corrected to the minimum billing amount; if the calculated billing result is greater than the maximum billing amount, it is corrected to the maximum billing amount. This method effectively avoids extreme cases of excessively low or high costs during the billing process.
[0077] Furthermore, the system can control the minimum and maximum billing quantities involved in billing. For example, if the quantity calculated based on the metering field or segmented rate is less than the minimum billing quantity, the result will be corrected to the minimum billing quantity; if it is greater than the maximum billing quantity, it will be corrected to the maximum billing quantity. This ensures that the quantity values remain within a reasonable range during the calculation process, avoiding abnormal deviations in order volume or shipment volume at the billing end.
[0078] The aforementioned minimum billing amount, maximum billing amount, minimum billing quantity, and maximum billing quantity can be configured according to fixed thresholds or dynamically adjusted based on business scenarios or seasonal changes. This allows for timely correction of extreme billing results without affecting normal billing logic, improving the overall stability and rationality of billing. Combined with the basic segmented rate system, this implementation allows the system to perform standardized billing based on interval rates when generating cost calculation schemes, while also meeting more diverse business needs through effective upper and lower limits on costs and quantities.
[0079] As an optional implementation, the step of collecting the billing results and related document information, constructing multiple billing result groups based on the association of business fields, and generating a corresponding settlement statement according to each billing result group includes:
[0080] The billing results are filtered according to pre-set filtering conditions, wherein the filtering conditions include at least one of carrier, shipper, and transportation type;
[0081] In response to identical order date, shipping route, consignee, and delivery address information, multiple billing results that meet the filtering conditions are merged to generate a single bill.
[0082] In practice, during the process of compiling billing results and related document information into a settlement statement, the system first filters the billing results according to pre-defined filtering conditions. These filtering conditions can include business dimensions such as carrier, shipper, and transportation type. Specifically, the system reads the carrier, shipper, and transportation type fields corresponding to each billing result and marks the results that meet the specified conditions as mergeable objects for initial grouping in subsequent merging operations.
[0083] Next, the system checks the order date, shipping route, consignee, and delivery address fields of these mergeable objects. If multiple billing results have the same values in these fields, they are merged to generate a single settlement statement. This merging operation can sum or integrate key data such as cost details, quantity, and weight of related billing results and record them centrally in the settlement statement. This reduces the number of duplicate settlement documents and improves efficiency in subsequent settlements or reconciliations. Once generated, this settlement statement can be used for subsequent bill aggregation or financial reconciliation processes.
[0084] In this way, through this filtering and merging mechanism based on multi-dimensional business fields, the system can simplify the settlement management process while maintaining billing accuracy.
[0085] As an optional implementation, the step of aggregating multiple settlement orders and forming a bill according to pre-set merging rules includes:
[0086] The billing statement is filtered according to pre-set billing generation filtering conditions, which include at least one of customer identifier, billing cycle or organization dimension.
[0087] In response to meeting the bill generation filtering conditions, multiple single settlement statements are aggregated and merged;
[0088] The consolidated settlement information is summarized into a single bill.
[0089] In practice, after a single settlement statement is generated, the system further filters all settlement statements based on pre-defined billing generation filtering conditions. These filtering conditions may include business factors such as customer identification, billing cycle, or organizational dimension. For example, the system can search for all settlement statements generated within a predefined billing cycle (such as monthly or quarterly), aggregate settlement statements generated at different times for the same customer based on customer identification, or centrally process settlement statements belonging to the same business department based on organizational dimension.
[0090] When the aforementioned bill generation filtering conditions are met, the system aggregates and merges multiple single settlement bills that meet the conditions. Specifically, the system can first perform merging rule verification on these settlement bills to be merged, such as checking whether they come from the same customer or the same billing cycle, or whether they meet specific revenue or expense accounting requirements. If all conditions are met, the corresponding expense details, quantities, time intervals, and related field information are uniformly summarized at the billing level. This merging operation simplifies the subsequent financial reconciliation or auditing process and avoids too many scattered settlement documents from the same customer or the same billing cycle.
[0091] After the consolidation is completed, the system will consolidate the settlement information generated by the consolidation into a single bill. This bill may include all consolidated fees, total quantities, and other additional information corresponding to the customer identifier or billing period, facilitating subsequent comprehensive auditing, invoicing, or reconciliation operations.
[0092] In this way, by aggregating and merging multiple settlement statements, we can improve the efficiency of bill management and ensure the consistency and integrity of bill data both vertically and horizontally, thus providing data support for subsequent financial processes.
[0093] As an optional implementation, the step of collecting the billing results and related document information to form a settlement statement further includes:
[0094] Assign a unique identifier to each billing result and construct an adjacency matrix based on the matching of business fields between billing results;
[0095] A graph search is performed on the non-zero correlation in the adjacency matrix, and multiple billing results with correlation satisfying a preset threshold are merged to generate a single bill.
[0096] In practical implementation, in order to more flexibly aggregate billing results and related document information into a single settlement statement, the system can use an adjacency matrix to represent the correlation between different billing results, and automatically identify billing results that can be merged through graph search or clustering methods. Specifically, this may include the following steps:
[0097] First, each billing result is assigned a unique identifier, and its key business fields are recorded. These key business fields may include the transportation route, carrier, consignee, consignor, vehicle type, and transportation time. Next, for any two billing results, the system reads the values of their business fields and calculates their correlation, such as determining whether their origin and destination are consecutive, whether their transportation times overlap, whether they use the same carrier, or whether their vehicle types are compatible. If two billing results meet preset conditions in at least one or more business fields, a non-zero value is written to the corresponding position in the adjacency matrix to indicate that they have a potential for merging; otherwise, the value is set to zero.
[0098] After constructing the adjacency matrix, the system can perform graph search or clustering based on a pre-set threshold. Specifically, the system traverses each non-zero element in the adjacency matrix; if its value is greater than or equal to the threshold, it determines that the corresponding two billing results have a high degree of correlation and belong to the category of mergeable objects. Through depth-first search (DFS), breadth-first search (BFS), or other clustering algorithms, the system can group several billing results with sufficiently high correlation into the same group. Once all billing results in a group have been identified, the system merges the information of all billing results in that group to form a single bill.
[0099] During the billing process, the system will also merge the relevant fee details of the billing results within the group. For example, duplicate fields will be deduplicated, quantity, weight or other cumulative fields will be summarized, and a unified settlement time or settlement identifier will be registered in the billing statement.
[0100] For example, assign a unique identifier to each pending order: read the basic information and billing results of each order, and record its place of shipment, place of receipt, carrier, transportation time and other business fields that affect the merging;
[0101] Constructing an adjacency matrix: Create one for N orders within the system. Given matrix A. If order i and order j have a mergeable condition, then in Write the corresponding correlation degree (such as a weighted calculation based on the continuity of the transportation route, the time overlap rate, the vehicle matching degree, etc.) at the specified location; otherwise, record 0.
[0102] Clustering or graph search is performed based on a pre-set correlation threshold: nodes containing elements in the matrix that are greater than the correlation threshold are grouped, and related orders are automatically identified into the same aggregate set.
[0103] Generate a single settlement statement: Merge the cost details of grouped orders and record them in a single settlement statement;
[0104] The merged settlement statement is provided to subsequent billing processing modules, such as bill aggregation, financial reconciliation, or statistical analysis.
[0105] This approach, combining adjacency matrix and graph search, effectively overcomes the limitations of relying solely on consistency of business fields for merging. It enables grouping of billing results that are "partially similar" or "multi-dimensionally similar," further improving the efficiency and accuracy of settlement statement aggregation. The merged single settlement statement can be directly incorporated into subsequent billing or reconciliation processes, offering greater flexibility and intelligence compared to traditional methods based on complete matching of business fields.
[0106] Through the above process, the system can quickly identify related orders or waybills in scenarios with a large number of multi-dimensional billing results, according to a predefined correlation model and threshold, reducing manual judgment or the generation of duplicate settlement statements, thereby improving reconciliation and settlement efficiency.
[0107] As an optional implementation, before merging the billing results based on the adjacency matrix, the method further includes:
[0108] Individual anomaly detection is performed on each of the billing results. If the billing result meets the anomaly determination criteria, it is marked as an anomaly and excluded from the construction of the adjacency matrix.
[0109] An adjacency matrix is constructed and a graph search is performed only for the billing results that are not marked as abnormal.
[0110] As an optional implementation, after merging multiple billing result groups using the adjacency matrix and generating a single bill, the method further includes:
[0111] For each of the billing result groups, perform group anomaly detection. In response to the billing result group meeting the group anomaly judgment conditions, mark the billing result group as anomaly pending review and perform splitting or isolation processing.
[0112] In response to the determination that there is no group anomaly, a single billing statement corresponding to the billing result group is output.
[0113] In practical implementation, to reduce the interference of obviously abnormal billing results on the subsequent adjacency matrix construction and merging process, the system first performs "individual anomaly detection" before merging billing results based on the adjacency matrix. The main steps include:
[0114] Obtaining Billing Results and Identifying Anomalies: After completing the billing calculation on the billing documents, the system obtains several billing results. For each billing result, the system checks it according to pre-configured "individual anomaly detection criteria." These criteria may include: whether the weight, volume, mileage, or other numerical fields far exceed the normal business range; whether the billing amount deviates significantly from the historical average; whether the customer is on a blacklist or a high-risk carrier; and whether the entry time or date field is missing or contains obvious errors. When a billing result is determined to meet the above anomaly criteria, it is marked as "anomaly" and recorded in the anomaly list or stored separately for subsequent review.
[0115] Excluding billing results marked as abnormal: The system only retains billing results that have not been marked as abnormal for subsequent adjacency matrix construction and graph search processes. For billing results marked as abnormal, a temporary settlement statement can be generated separately or the process can be manually reviewed to avoid the mixing of abnormal and normal data, which would lead to inaccurate settlement statements.
[0116] Building and merging adjacency matrices: After excluding individual anomalies, the remaining normal billing results are used to build an adjacency matrix based on the similarity or relevance of business fields. Subsequently, the system executes graph search or clustering algorithms to aggregate billing results with relevance meeting a preset threshold into the same billing statement. This part of the process can be referred to the description of adjacency matrices and graph search in the aforementioned implementation.
[0117] By employing the above methods, the system can eliminate orders or billing results with obvious abnormalities before constructing the adjacency matrix, reducing the probability of erroneous merging and ensuring the accuracy and reliability of subsequent settlement statements.
[0118] Further, please refer to Figure 3, which is a flowchart of a group anomaly detection method provided in an embodiment of this application. To further address the issue that "group anomalies" may only appear after order / billing results are merged, the system adds a "group anomaly detection" step after merging multiple billing result groups using an adjacency matrix and generating a single settlement statement. This step mainly includes steps A to D, wherein:
[0119] Step A: Obtain the merged billing result groups: Based on the aforementioned adjacency matrix and graph search algorithm, the system initially merges several billing results that meet the relevance threshold into one or more billing result groups, and generates a corresponding bill for each group. At this time, the individual billing results within the group do not show any abnormalities, but from an overall perspective, there may be potential risks such as "over-aggregation" or "excessive overlap in timeliness".
[0120] Step B: Perform group anomaly detection: The system extracts statistical indicators or feature vectors for each merged billing result group, such as: total order weight, total volume, and total number of items within the group; overlap between order quantity and time interval; whether orders were generated in a concentrated period of time; excessive concentration of carriers or vehicle types; and whether there are unreasonable consecutive jumps in route distribution. If an indicator is detected to exceed a preset threshold or match the "group anomaly detection criteria," the group is marked as "anomaly pending review" to trigger subsequent splitting or isolation operations.
[0121] Step C: Splitting or Isolating Abnormal Groups: When a billing result group is determined to be an abnormal group, the system can provide several processing methods, such as: Isolating the entire group: Mark all settlement orders in the group as abnormal, temporarily prevent them from being output to the billing summary process, and prompt for manual review or further splitting. Partial splitting: If further analysis reveals that only some orders within the group are abnormal, those orders can be removed from the group and processed separately, allowing the remaining normal orders to continue to generate settlement orders.
[0122] Step D: Output Normal Settlement Statements: For billing result groups where no group anomalies were detected, the system directly outputs the corresponding single settlement statement, which is then incorporated into subsequent billing generation or financial reconciliation processes. By performing secondary anomaly detection after merging, the system can minimize the chance of missing "group anomalies" that only manifest at the overall level. By adding a "group anomaly detection" step after merging, the system can balance routine anomaly checks for individual orders with overall risk identification for order groups, effectively improving its ability to identify potential anomalies after merging, thereby ensuring the reliability and accuracy of generated settlement statements and bills.
[0123] In this way, by combining individual anomaly detection before adjacency matrix merging with group anomaly detection after merging, the system can promptly identify potential problems at different granularity levels (individual billing results and overall order groups), reducing the risk of missed or incorrect judgments. After determining group anomalies, the system can choose to split or isolate the abnormal order groups according to business needs, achieving flexible isolation of abnormal order groups and preventing erroneous information from spreading to subsequent billing or reconciliation processes. This multi-stage detection solution is suitable for large-scale, multi-scenario logistics billing systems, and can improve the level of control over order anomalies and financial risks while ensuring the efficiency of automated merging.
[0124] For example, as shown in Figure 2, which is a schematic diagram of a billing system provided in an embodiment of this application, there are currently 5 billing results to be processed, numbered O1, O2, O3, O4, and O5. The system needs to collect these billing results and generate a settlement statement for subsequent bill consolidation or reconciliation operations.
[0125] The "blacklisted carrier Z" in O2 means that the order is extremely high risk;
[0126] O3, O4, and O5 may seem normal when viewed separately, but if they are shipped together on adjacent routes in a short period of time, it may cause "group anomalies" after merging (such as "excessive overlap in delivery time" or "over-aggregation").
[0127] The first stage is individual anomaly detection. The company has configured several "individual anomaly" judgment rules, such as: if the carrier is on the blacklist, it is considered a high-risk anomaly; if the weight or cost exceeds a certain limit, it is also considered an anomaly; if a field is obviously missing or the timestamp is unreasonable, it is also considered an anomaly.
[0128] After reading the data from O1, O2, O3, O4, and O5, the system judges according to the above rules: the carrier in O2 is "blacklisted carrier Z", which triggers rule 1, so O2 is marked as an "abnormal order"; the remaining O1, O3, O4, and O5 do not have significant violations or extreme value limits at the individual data level, and are temporarily judged as "normal".
[0129] The system will remove O2 from the subsequent automatic merging process or place it in the "Abnormal and Pending Review" list for further manual evaluation. Only O1, O3, O4, and O5 will be retained to proceed to the next steps of "Adjacency Matrix Construction" and "Graph Search".
[0130] The second stage is adjacency matrix merging. Using O1, O3, O4, and O5 as nodes, the correlation degree is calculated based on fields such as "shipping location - receiving location", "shipping time period", "vehicle type", and "carrier". For example, O1 and O3: both have shipping locations in City A, both have receiving locations in City B, similar shipping times, the same vehicle type, and the same carrier, so their correlation degree is high and may reach a certain set threshold.
[0131] For example, O4 and O5 have the same origin (City B), the same destination (City D), similar shipping times, and the same vehicle type and carrier, indicating a high degree of correlation.
[0132] For example, O1 / O3 and O4 / O5: the place of shipment and the place of receipt are not exactly the same, and there are slight differences in time, so the correlation is low or zero.
[0133] Based on the non-zero correlation in the matrix, the system first merges O1 and O3 into group A; then merges O4 and O5 into another group B. A preliminary settlement statement is generated for each group.
[0134] Group A: Contains O1 and O3;
[0135] Group B: Contains O4 and O5;
[0136] The third stage is group anomaly detection. After the initial merging is completed, the system performs group-level checks on group A and group B:
[0137] For Group A: After combining O1 and O3, the total weight is 800 + 900 = 1700 kg. The time difference is 30 minutes, and the route is from City A to City B. Compared with historical statistics, 1700 kg is not significantly excessive in the small vehicle category; the time overlaps significantly but does not exceed the threshold (the system allows multiple orders to be shipped from City A to City B within 2 hours); therefore, Group A did not trigger "group anomaly".
[0138] For Group B inspection: After combining O4 and O5, the total weight = 850 + 2000 = 2850 kg, and the shipments were all in City B and the receiving city D, with very close times (10:00 and 10:30). According to the company's "Group Anomaly Judgment Conditions": if a route concentrates more than 2500 kg within 1 hour, it is easy to cause capacity overload or timeliness conflicts; at this time, the system detected that 2850 kg > 2500 kg threshold and judged it as "excessive concentration". Therefore, the system marked Group B as "abnormal pending review" and did not directly output the settlement statement, but triggered a notification in the system background or manual review.
[0139] In handling group anomalies, the system can further break down the group based on strategies. For example, it can check if O5's delivery time might be delayed to avoid excessive overlap; or allow manual verification of whether the carrier can transport nearly 3 tons of goods in the same time period. If an anomaly is confirmed, the group can be split into separate order settlement statements or delayed; if the business personnel confirm that the capacity is sufficient, the merging process can be restarted, and a normal settlement statement can be output.
[0140] No group anomalies were detected in group A (O1+O3). The system officially generated settlement statement A, with the cost details accumulated (500+550=1050 yuan, etc.), and recorded the merging time, total quantity, etc. in the settlement statement.
[0141] Group B (O4+O5) has been marked as an abnormal group due to excessive aggregation. Depending on the company settings, a "manual review" or "split and then merge" process can be initiated. The official settlement statement B will not be output temporarily, or a temporary settlement statement with the "abnormal and pending review" label will be output to prevent errors in subsequent billing data.
[0142] O2 was removed from the individual anomaly detection system because the carrier was on the blacklist. The system can generate a separate abnormal settlement form E2, awaiting review and processing by senior management or manual review.
[0143] In this example, through a multi-stage process of "individual anomalies first, then group anomalies": the obvious risks of O2 are identified and eliminated in time; O4+O5 only show the risk of "over-aggregation" after the initial merging, and the system is able to prevent the erroneous merging from entering the subsequent billing process in time; O1+O3 successfully completes the merging and outputs a normal settlement statement, ensuring that normal orders are not disturbed.
[0144] As an optional implementation, in order to effectively utilize the adjacency matrix in ultra-large-scale orders or cross-organizational multi-business scenarios, the system combines the generation and maintenance process of the adjacency matrix with the data structure of the knowledge graph, and decomposes and partitions the adjacency matrix in the graph.
[0145] Specifically, for each order or billing result, a corresponding node is first created in the knowledge graph, and based on its shipping location, delivery location, carrier, business scenario, and other fields, it is initially divided into different graph partitions or subgraphs.
[0146] For example, orders from different legal entities, different organizational dimensions, or different payment terms can be stored in their respective subgraphs or partitions. This eliminates the need for the system to include pairwise relationships for all orders in a single graph or adjacency matrix, significantly reducing memory and computational burden.
[0147] Within each graph partition, the system generates a local adjacency matrix for orders within that partition, referring to the previously described similarity or correlation calculation methods, and records the corresponding edge relationships and attributes in the graph. If two orders meet similarity conditions or have potential merging value in several business fields, a similarity edge is added to the pair of order nodes in the knowledge graph, or the correlation attribute of an existing edge is updated. Once the local adjacency matrix is constructed within a partition, the system can perform routine merging or bill aggregation operations locally, as long as the business entity to which the orders belong and the financial rules are consistent, they can be directly merged to generate a single bill. For orders that still require settlement merging across partitions or legal entities, the system can dynamically assemble or connect the local adjacency matrix information of multiple partitions through federated queries or cross-subgraph searches at the knowledge graph level. If, during the inspection, it is found that orders from multiple partitions meet the consolidation criteria, and the deeper relationships such as customer credit, tax system, or cooperation agreement also meet the requirements, the system will create a corresponding consolidated bill node in the global knowledge graph, associate the order nodes or settlement node in each partition with this bill node, and mark the reason, time, and audit information for this cross-partition consolidation in the graph.
[0148] In practical implementation, the system can use a hierarchical or supernode approach to reduce overly granular storage caused by massive orders. If a large number of orders within certain subgraphs are almost identical in fields such as shipping location, vehicle type, and time window, they can be aggregated into a supernode to represent the similarity of this type of order at the top level. When more granular merging or anomaly detection is required, the system drills down to the specific order level contained in the supernode to retrieve the corresponding local adjacency information or partition content. Through this strategy combining partitioning and hierarchical structure, the system can effectively manage, retrieve, and infer the correlation of millions or even hundreds of millions of orders in the knowledge graph. It can also incrementally maintain the similarity edges of related subgraphs or supernodes when updating order data, thus balancing high concurrency and real-time requirements.
[0149] After maintaining the adjacency matrix in partitions or hierarchies, the system further performs cross-entity reasoning and queries based on the multi-entity relationships of the knowledge graph when aggregating or processing bills. When merging bills, in addition to referencing the similarity information of orders within the same region or legal entity, it also checks the contract to which the order belongs, customer credit scores, historical dispute records, and whether there are financial sharing agreements between legal entities. If all the above dimensions meet the merging strategy, multiple settlement bill nodes or order nodes can be merged into the same bill node across partitions and subgraphs. If the carrier corresponding to a certain region or legal entity has a high risk, or the customer is on an abnormal list, this part of the settlement bill can be split or isolated according to pre-set rules to avoid erroneous merging or the spread of financial risks. In this way, the system forms a comprehensive data network within the knowledge graph covering adjacency matrix correlation and semantic information such as contracts, credit, and organizations, and can execute more flexible decision-making logic during the bill aggregation stage.
[0150] In the above process, the system can combine existing graph databases and big data frameworks to deploy the calculation and partitioned storage of local adjacency matrices as distributed tasks, using multiple nodes to calculate order similarity in parallel or perform large-scale graph traversal. For federated queries or cross-partition inference, multi-graph retrieval or joint indexes of graph databases can be used to obtain order, settlement, and contract information across legal entities, payment periods, or geographical regions in a timely manner.
[0151] This approach maintains rapid response times for local orders across different zones while enabling consolidated decision-making and audit tracking across the entire system when unified reconciliation or financial analysis is required. By decomposing the adjacency matrix and embedding it into a knowledge graph, the system achieves data scaling and real-time high-concurrency access across multiple business scenarios. Furthermore, it leverages graph reasoning to identify deeper business rules and anomalies, thus providing robust scalability and accuracy for large-scale logistics billing and multi-dimensional financial accounting.
[0152] For example, the system first receives and parses a massive data file containing order information in the background. Each order stores its key field values in vector form, including the shipping location, delivery location, vehicle type, carrier, and billing amount. The system calculates the similarity between orders from these vectors, for example, by comparing the matching degree of identical fields or vector distance. The similarity results are stored in a distributed file system, forming a block-based adjacency matrix representation. Each block may correspond to pairing information between tens of thousands of orders, recording the identifiers of the two orders, their similarity vectors, and their feature scores.
[0153] At the knowledge graph level, each order node is assigned a globally unique ID, and order pairing information in the similarity blocks is mapped to edges in the graph. When importing these edges, the system stores order nodes belonging to the same legal entity or grouped by similar fields on the same database shard according to business logic partitioning rules. The import process iterates through the block file, reading line by line (order A, order B, similarity value) and creating or updating an edge entity, setting its attributes such as similarity=a certain value or time_overlap=a certain time difference. To avoid overloading a single shard, the system combines pre-configured sharding strategies to distribute order nodes by organization, geographical region, or billing period range, and marks the partition information to which nodes and edges belong in the graph metadata.
[0154] For example, when importing order nodes and their matching relationships into a knowledge graph, each edge entity, in addition to recording the identifiers of order A and order B, also has two key attributes: similarity and time overlap. Similarity represents the cosine similarity between the feature vectors V_A and V_B corresponding to order A and order B. The similarity value ranges from 0 to 1; a higher value indicates a higher degree of matching between the two orders in key fields such as shipping location, delivery location, vehicle type, carrier, and billing amount.
[0155] The time overlap (time_overlap) indicates how close two orders are in time, calculated by the difference between their timestamps (in Unix timestamps, minutes, or hours). A smaller time_overlap value indicates that the two orders are closer in time.
[0156] In subsequent sharding strategies and replenishment task generation, the system can set thresholds based on the above attribute values to batch merge or prioritize highly similar orders with close time intervals, so as to avoid overloading of a single shard and improve scheduling efficiency.
[0157] During runtime, if the system detects that a shard contains a large number of highly similar orders with almost identical fields, it creates a "supernode" within that shard. This supernode stores the common attributes of these orders as a vector, while the remaining personalized fields are treated as a sub-vector list for later retrieval when performing more refined merging or splitting of some orders. This reduces the number of nodes that actually need to be maintained within a shard and also reduces the traversal scale during graph retrieval or updates. At the graph database level, the supernode is still presented as a regular node, but it contains structured fields that reference the sub-order list and is incrementally updated based on changes in similarity.
[0158] In bill aggregation, if orders need to be merged across multiple partitions or shards, the system first retrieves the cross-shard positions of these orders in the central scheduling module, and then queries the corresponding graph database instance to obtain similarity edges and other business information of the orders. The engine reads order vector data and similarity fields from different shards, and merges or calculates them again to confirm whether they can belong to the same bill node. If the order nodes involved have similar or the same business entity's contracts, and the additional conditions such as credit rating and tax rules in the knowledge graph match the merging criteria, the system will generate or update a bill node, establish a relationship with the relevant order nodes, and mark the new aggregation state at the "supernode" layer or vector block layer. If any shard returns an anomaly or finds that the legal entity to which the order belongs is incompatible with other orders, the system will split or isolate the order according to the anomaly handling strategy and will not perform cross-shard bill merging.
[0159] After order or similarity data is updated, the system can trigger an incremental calculation to correct the attributes of the block adjacency matrix and knowledge graph edges. For example, when the carrier field of an order changes, or when a new order's similarity to an existing order exceeds a threshold, the system will add corresponding entries to the existing adjacency matrix blocks and add or update an edge between order nodes in the corresponding shard of the graph database. Fields such as similarity or time overlap will be rewritten synchronously to ensure consistency between the knowledge graph and the underlying adjacency blocks. Ultimately, this approach of decomposing and managing the adjacency matrix in the graph allows the system to maintain good computational efficiency and storage scalability even with massive amounts of order data. By associating similarity vectors with business fields in the same graph, it provides a consistent data foundation and a dynamically scalable processing mode for subsequent multi-dimensional bill merging, anomaly detection, or reconciliation.
[0160] Based on the same inventive concept, this application also provides a logistics billing engine system corresponding to the logistics billing engine method. Since the principle of the system in this application is similar to the logistics billing engine method described above, the implementation of the system can refer to the implementation of the method, and the repeated parts will not be described again.
[0161] Referring to Figure 4, which is a schematic diagram of the logistics billing engine system provided in an embodiment of this application, the system includes:
[0162] The data acquisition module 10 acquires billing documents and extracts business fields and metering fields from the billing documents.
[0163] The first calculation module 20 matches the business field and the metering field with the pre-configured billing rules to generate the corresponding cost calculation scheme.
[0164] The second calculation module 30 performs calculations on the metering field based on the cost calculation scheme to obtain the billing result;
[0165] The settlement module 40 collects the billing results and related document information, constructs multiple billing result groups based on the association of business fields, and generates a corresponding settlement document based on each billing result group.
[0166] The generation module 50 aggregates multiple settlement orders and forms a bill according to the pre-set merging rules.
[0167] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
Claims
1. A logistics billing engine method, characterized in that, include: Obtain the billing document and extract the business field and metering field from the billing document; Based on the business fields and metering fields, match the pre-configured billing rules to generate the corresponding cost calculation scheme; Based on the aforementioned cost calculation scheme, the metering fields are calculated to obtain the billing result; The billing results and related document information are collected, multiple billing result groups are constructed based on the association of business fields, and a corresponding settlement bill is generated according to each billing result group. According to the pre-set merging rules, multiple settlement orders are aggregated and a bill is formed; The process of generating a settlement statement also includes: assigning a unique identifier to each billing result, constructing an adjacency matrix based on the matching of business fields between the billing results; performing a graph search on the non-zero correlation in the adjacency matrix, and merging multiple billing results with correlation that meet a preset threshold to generate a single settlement statement; Before merging to generate a single billing statement, the method further includes: performing individual anomaly detection on each of the billing results; in response to the billing result meeting the anomaly determination criteria, marking it as an anomaly and excluding it from the construction of the adjacency matrix; and constructing the adjacency matrix and performing graph search only on the billing results that have not been marked as anomalies.
2. The logistics billing engine method according to claim 1, characterized in that, The pre-configured billing rules for matching include: Perform conditional judgments on the business fields to determine the corresponding rate field range; Based on the rate field range, the metering field is segmented to obtain segmented rates; Based on the segmented fee rates, the fee calculation scheme is generated.
3. The logistics billing engine method according to claim 1, characterized in that, When generating the cost calculation scheme, the method also includes: Set a minimum billing amount and a maximum billing amount. If the calculated billing result is less than the minimum billing amount, the minimum billing amount will be used; if it is greater than the maximum billing amount, the maximum billing amount will be used. Set a minimum billing quantity and a maximum billing quantity. When the calculated quantity is less than the minimum billing quantity, the minimum billing quantity is used; when it is greater than the maximum billing quantity, the maximum billing quantity is used.
4. The logistics billing engine method according to claim 1, characterized in that, The process of collecting the billing results and related document information, constructing multiple billing result groups based on the association of business fields, and generating a corresponding settlement statement for each billing result group includes: The billing results are filtered according to pre-set filtering conditions, wherein the filtering conditions include at least one of carrier, shipper, and transportation type; In response to identical order date, shipping route, consignee, and delivery address information, multiple billing results that meet the filtering conditions are merged to generate a single bill.
5. The logistics billing engine method according to claim 4, characterized in that, The process of aggregating multiple settlement orders and forming a bill according to pre-set consolidation rules includes: The billing statement is filtered according to pre-set billing generation filtering conditions, which include at least one of customer identifier, billing cycle or organization dimension. In response to meeting the bill generation filtering conditions, multiple single settlement statements are aggregated and merged; The consolidated settlement information is summarized into a single bill.
6. The logistics billing engine method according to claim 5, characterized in that, After merging multiple billing result groups using the adjacency matrix and generating a single bill, the process also includes: For each of the billing result groups, perform group anomaly detection. In response to the billing result group meeting the group anomaly judgment conditions, mark the billing result group as anomaly pending review and perform splitting or isolation processing. In response to the determination that there is no group anomaly, a single billing statement corresponding to the billing result group is output.
7. The logistics billing engine method according to claim 6, characterized in that, The process of aggregating multiple settlement orders and forming a bill according to pre-set consolidation rules also includes: Create graph nodes in the knowledge graph database to represent business entities such as settlement statements, orders, carriers, transportation routes, and billing cycles, as well as relationship edges to represent dependencies or associations between these business entities. The key field information of the settlement statement is written into the knowledge graph database to form a graph data structure oriented towards bill consolidation; Based on pre-configured business rules or inference engines, inference operations are performed on the settlement order nodes and their relationships in the knowledge graph database to automatically identify the set of settlement order nodes that meet the bill consolidation conditions; The set of settlement order nodes identified by the inference operation is processed in conjunction with the adjacency matrix or anomaly detection module. When it is determined that there is no anomaly, the merged bill is output. If it is determined that there is an anomaly, the relevant settlement order is split or isolated for dynamic aggregation of the bill.
8. The logistics billing engine method according to claim 7, characterized in that, The process of aggregating multiple settlement orders and forming a bill according to pre-set consolidation rules also includes: The vectorized field information generated for each order is read from the storage medium, and batch similarity calculation is performed on the vectorized field information to form a partially segmented adjacency matrix, which records the non-zero similarity between order pairs; When importing the adjacency matrix into the knowledge graph database, a corresponding graph node is created or updated for each order, and a relationship edge is established or updated between the graph nodes based on the similarity results in the adjacency matrix. The relationship edge carries a similarity vector or association attribute. For order sets with similarity greater than a preset similarity threshold and the same field values, generate super nodes. In the knowledge graph database, treat the super nodes as single node objects and attach the differentiated fields of each order in the order set as additional vectors. When performing bill aggregation, it is determined whether each order meets the merging conditions based on the supernode and its attached vector, and reasoning is performed in combination with cross-entity information. In response to meeting the bill merging conditions, a corresponding bill node is created in the knowledge graph database and associated with the relevant order node.
9. A logistics billing engine system, used to implement the logistics billing engine method according to any one of claims 1-8, characterized in that, include: The data acquisition module obtains billing documents and extracts business fields and metering fields from the billing documents. The first calculation module matches the business field and the metering field with the pre-configured billing rules to generate the corresponding cost calculation scheme. The second calculation module performs calculations on the metering field based on the cost calculation scheme to obtain the billing result; The settlement module collects the billing results and related document information, constructs multiple billing result groups based on the association of business fields, and generates a corresponding settlement document for each billing result group. The generation module aggregates multiple settlement orders and forms a bill based on pre-defined merging rules.
