Waybill receivable and payable accounting method and system based on rule engine

By using a rule engine-based approach for waybill accounting, and leveraging text recognition and graph clustering to generate heterogeneous business graph structures, the efficiency and accuracy issues of multi-source heterogeneous data accounting are resolved, achieving efficient and reliable waybill cost accounting.

CN121998635APending Publication Date: 2026-05-08YUNMAIYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YUNMAIYUN TECH CO LTD
Filing Date
2026-01-19
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing waybill accounting methods suffer from low efficiency and inaccuracy when dealing with multi-source heterogeneous data, and lack the ability to deeply model business relationship networks, leading to frequent accounting errors.

Method used

A rule-based engine approach is adopted, which uses text recognition, entity relationship extraction and graph clustering to generate a business heterogeneous graph structure for logical consistency verification and cost accounting, and combines manual review to ensure accuracy.

Benefits of technology

It improves the automation and accuracy of waybill accounting, reduces accounting errors, enhances accounting efficiency and transparency, and supports anomaly verification and reconciliation traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998635A_ABST
    Figure CN121998635A_ABST
Patent Text Reader

Abstract

The invention provides a waybill receivable and payable accounting method and system based on a rule engine, and the method comprises the steps: carrying out the text recognition and structural document information extraction of a multi-source waybill set, and obtaining a waybill document set; carrying out waybill entity identification and entity relationship extraction on the waybill document set to obtain a waybill entity information set, and carrying out entity alignment and entity conflict resolution on the waybill entity information set based on a graph clustering mode to obtain a standard entity information set; generating a service heterogeneous graph structure based on the waybill service relationship and the standard entity information set, and performing logic consistency verification and association conflict detection according to the service heterogeneous graph structure to obtain an abnormal entity list; carrying out expense accounting and rule chain explanation on the standard entity information by utilizing an accounting rule engine to obtain a primary accounting list; and performing associated entity traceability and logic inversion correction on the abnormal entity list based on the business heterogeneous graph structure, and performing manual recheck on a correction result to obtain a standard accounting list.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial automation service technology, and in particular to a method and system for accounting for waybills receivables and payables based on a rule engine. Background Technology

[0002] Waybill data, as a core information carrier in the logistics business process, is complex in structure, diverse in source, and significantly varies in format, directly affecting enterprises' ability to track the transportation process, calculate costs, manage risks, and collaborate across systems. With the development of technologies such as intelligent information extraction, knowledge graphs, and graph computing, building automated intelligent accounting systems has become a key direction for improving the level of business-finance integration and risk control capabilities.

[0003] However, current mainstream waybill accounting methods still face significant technical bottlenecks when dealing with complex business realities and massive amounts of heterogeneous data. First, existing methods typically treat waybill data processing and cost accounting rules as separate processes, relying on manual or semi-automated methods to handle multi-source, heterogeneous waybill documents. Extracted fields must be manually configured into rigid, flat accounting rule tables, resulting in lengthy processes that are difficult to adapt to frequent changes in customers, routes, and contract terms, leading to low accounting efficiency and high error rates. Second, most technical frameworks focus on single-point, field-level validation and calculation, lacking the ability to deeply model and gain consistency insights into the complex multi-party business relationship network behind waybills. They cannot systematically detect logical conflicts and compliance risks across documents and entities, causing accounting errors to often only be discovered during post-audit, resulting in losses. Summary of the Invention

[0004] (a) Technical problems to be solved To address the shortcomings of existing technologies, this invention provides a method and system for waybill accounts receivable and payable accounting based on a rule engine. It has the advantages of unified processing of multi-source data, flexible configuration of business rules, and global self-correction accounting. It solves the problems of low automation, difficulty in ensuring accuracy, and low efficiency in waybill accounting scenarios caused by multi-source heterogeneity and semantic complexity, dynamic and ever-changing accounting rules, and the lack of understanding of business relationship networks in existing technologies.

[0005] (II) Technical Solution To achieve the above objectives, the present invention provides the following technical solution: This invention provides a method for calculating accounts receivable and payable for waybills based on a rule engine, comprising the following steps: The accounting rule engine is configured based on the waybill accounting rules, and the pre-acquired multi-source waybill set is subjected to text recognition, layout analysis and structured document information extraction to obtain the waybill document set; Using an external feature injection approach, the domain knowledge base is used to identify waybill entities and extract entity relationships from the waybill document set to obtain a waybill entity information set. Then, based on graph clustering, the waybill entity information set is used to perform entity alignment and multi-strategy entity conflict resolution to obtain a standard entity information set. Based on the waybill business relationships in the domain knowledge base and the standard entity information set, a business heterogeneous graph structure is generated. Based on the business heterogeneous graph structure, logical consistency verification, root cause entity inference, and association conflict detection are performed on the standard entity information set to obtain an abnormal entity list. The accounting rule engine is used to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list to obtain a primary accounting list; Based on the accounting rule engine and the business heterogeneous graph structure, the abnormal entity list is traced back to related entities and logically reversed and corrected. The correction results and the primary accounting list are then manually reviewed to obtain the standard accounting list.

[0006] According to a preferred embodiment of the present invention, an accounting rule engine is configured based on the waybill accounting rules, and text recognition, layout analysis and structured document information extraction are performed on the pre-acquired multi-source waybill set to obtain a waybill document set; Using an external feature injection approach, the domain knowledge base is used to identify waybill entities and extract entity relationships from the waybill document set to obtain a waybill entity information set. Then, based on graph clustering, the waybill entity information set is used to perform entity alignment and multi-strategy entity conflict resolution to obtain a standard entity information set. Based on the waybill business relationships in the domain knowledge base and the standard entity information set, a business heterogeneous graph structure is generated. Based on the business heterogeneous graph structure, logical consistency verification, root cause entity inference, and association conflict detection are performed on the standard entity information set to obtain an abnormal entity list. The accounting rule engine is used to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list to obtain a primary accounting list; Based on the accounting rule engine and the business heterogeneous graph structure, the abnormal entity list is traced back to related entities and logically reversed and corrected. The correction results and the primary accounting list are then manually reviewed to obtain the standard accounting list.

[0007] According to another preferred embodiment of the present invention, the configuration of the accounting rule engine based on the waybill accounting rule includes: The waybill accounting rules are structured and parsed, and a meta-model of the accounting rules is generated based on the parsing results; The rule field set is extracted from the accounting rule meta-model, and the field type inference and dependency analysis are performed on the rule field set to obtain a field dependency directed graph; The accounting rule meta-model is transformed into a logical expression to obtain a set of rule expressions, and the set of rule expressions is verified for consistency in syntax and semantics to obtain a set of verification expressions. Based on the field dependency directed graph, rule conflict detection and conflict resolution are performed on the verification expression set to obtain a standard expression set. The standard expression set is topologically sorted according to the field dependency directed graph to obtain the accounting rule chain, and the accounting rule engine is loaded and instantiated according to the accounting rule chain.

[0008] According to another preferred embodiment of the present invention, the step of performing text recognition, layout analysis, and structured document information extraction on the pre-acquired multi-source waybill set to obtain a waybill document set includes: The image format of the pre-acquired multi-source waybill set is converted to obtain a waybill image set, and the waybill image set is then subjected to image standardization and image enhancement processing to obtain an enhanced waybill image set; The enhanced waybill image set is subjected to text detection and text recognition to obtain a waybill text block information set; The enhanced waybill image set is analyzed for layout content and divided into layout areas to obtain a layout area set, and layout structure information is generated based on the layout area set; Based on the page layout information, the text order of the waybill text block information set is restored and cross-regional information is reorganized to obtain a reorganized text information set. The reconstructed text information set is used to locate text fields and associate field information to obtain a set of field association relationships; Based on the set of field associations, the recombined text information set is subjected to structured information extraction and formatted output to obtain a waybill document set.

[0009] According to another preferred embodiment of the present invention, the external feature injection-based method utilizes a domain knowledge base to perform waybill entity recognition and entity relationship extraction on the waybill document set to obtain a waybill entity information set, including: The waybill fields in the waybill document set are cleaned and their character formats are standardized. The waybill document set is then segmented into a text sequence according to the text order to obtain a preprocessed text sequence. Based on the domain knowledge base, entity dictionary matching is performed on the preprocessed text sequence to obtain a candidate entity field set, and word feature embedding is performed on the preprocessed text sequence to obtain a text feature sequence; The candidate entity field set is injected as an external feature into the corresponding position of the text feature sequence to obtain an enhanced text feature sequence. The enhanced text feature sequence is then encoded using a self-attention mechanism to obtain a context field encoded sequence. The context field encoding sequence is decoded based on a conditional random field to obtain a decoded entity field set. Then, based on the domain knowledge base, the decoded entity field set is linked and semantically normalized to obtain a standard entity field set. Extract the entity field encoding set corresponding to the standard entity field set from the context field encoding, and extract the relationship between any two entity field codes in the entity field encoding set based on the multi-head attention mechanism to obtain the entity relationship set; The entity relationship set is filtered by confidence based on the original confidence score, multi-head attention score, and relation constraints corresponding to the domain knowledge base to obtain a standard entity relationship set. A waybill entity information set is then generated based on the standard entity relationship set and the standard entity field set.

[0010] According to another preferred embodiment of the present invention, the method of performing entity alignment and multi-strategy entity conflict resolution on the waybill entity information set based on graph clustering to obtain a standard entity information set includes: The waybill entity information set is indexed inverted based on entity attributes, and the waybill entity information set is quickly retrieved and matched based on exact matching rules and fuzzy matching strategies to obtain a set of candidate aligned entity pairs. The context entities of each entity in the candidate aligned entity pair set are taken as the context entities in the waybill entity information set, and multi-dimensional feature normalization and multi-dimensional similarity calculation are performed on the candidate aligned entity pair set and each entity in the context entity set to obtain the entity semantic similarity matrix. An entity similarity graph structure is constructed using each entity corresponding to the entity semantic similarity matrix as a node, similarity relationship as an edge, and multidimensional semantic similarity as an edge weight. The edges of the entity similarity graph structure are then pruned according to the edge weights to obtain a standard entity graph structure. The standard entity graph structure is clustered based on a graph clustering algorithm to obtain an entity cluster set. Internal conflict detection is then performed on each entity cluster in the entity cluster set to obtain an attribute conflict entity set. The conflict set of the attribute conflict is resolved by confidence voting, time-series priority filtering and statistical fusion respectively, and the consistency of the conflict set after conflict resolution is verified by the domain knowledge base to obtain the verification entity set. The entity cluster set is updated using the verified entity set, and a standard entity information set is generated based on the updated entity cluster set.

[0011] According to another preferred embodiment of the present invention, the step of generating a business heterogeneous graph structure based on the waybill business relationships in the domain knowledge base and the standard entity information set includes: The waybill business relationships are extracted from the domain knowledge base, and the waybill business relationships are processed into a pattern to obtain a business relationship pattern. Traverse each standard entity in the standard entity information set, match the node type from the business relationship pattern based on the entity type of the standard entity, and instantiate the business graph node according to the node type; Based on the business relationship pattern and the entity relationships in the standard entity information set, corresponding business directed edges are generated for each business graph node. A primary business network topology is constructed based on all business graph nodes and all business directed edges. Constraint verification and redundancy elimination are performed on the primary business network topology based on the business relationship pattern to obtain the standard business network topology. The standard service network topology is encapsulated using an attribute graph to obtain a service heterogeneous graph structure.

[0012] According to another preferred embodiment of the present invention, the step of performing logical consistency verification, root cause entity inference, and association conflict detection on the standard entity information set based on the business heterogeneous graph structure to obtain an abnormal entity list includes: Constraint rules are extracted from the heterogeneous business graph structure, and a structured logic verification template set is generated. Based on the logical verification template set, subgraph pattern matching is performed on the heterogeneous business graph structure to obtain the entity context relationship chain; Based on the logical verification template set, logical consistency verification is performed on each subgraph instance in the entity context relationship chain, and a logical anomaly instance set is generated according to the verification results. Based on the graph clustering algorithm, the set of logical anomaly instances in the heterogeneous business graph structure is clustered to obtain anomaly clusters, and the root cause entity inference is performed on the anomaly clusters to obtain an anomaly root cause entity set. A multi-dimensional anomaly score is performed on each anomaly entity in the set of anomaly root cause entities, and the set of anomaly root cause entities is prioritized according to the score results to obtain a primary anomaly list. The initial anomaly list is filtered by an anomaly threshold to obtain an anomaly entity list.

[0013] According to another preferred embodiment of the present invention, the step of using the accounting rule engine to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list to obtain a primary accounting list includes: The entity information in the standard entity information set, excluding the abnormal entity list, is aggregated into a security entity information set. Extract the static context set and dynamic context set corresponding to the security entity information set from the business heterogeneous graph structure and the domain knowledge base; The static context set and the dynamic context set are injected into the accounting rule engine as global facts; The accounting rule engine after fact injection is used to perform rule triggering matching, rule execution and cost flow calculation on the security entity information set to obtain a cost accounting list. The entire chain of the accounting rule chain during rule execution by the accounting rule engine is captured to obtain a rule chain explanation document. The rule chain explanation document and the cost accounting list are then associated and encapsulated to obtain a primary accounting list.

[0014] According to another preferred embodiment of the present invention, the step of performing associated entity tracing and logical inversion correction on the abnormal entity list based on the accounting rule engine and the business heterogeneous graph structure includes: Starting with each entity in the list of abnormal entities, subgraph pattern matching is performed in the business heterogeneous graph structure to obtain an abnormal association subgraph; Each entity in the abnormal association subgraph is selected as the target association entity, and a local dependency is constructed on the target association entity based on the accounting rule chain in the accounting rule engine to obtain the entity local dependency graph. The entity local dependency graph is aligned and fused using the business heterogeneous graph structure to obtain a fused dependency graph. Reverse tracing is then performed based on the dependency edges of the fused dependency graph to obtain the target source entity and the target tracing path. All variable attribute nodes in the target tracing path are identified, and the variable attribute nodes are solved in reverse based on the accounting rule engine to obtain a set of candidate correction hypotheses. The set of corrected hypotheses is mapped to the heterogeneous service graph structure to obtain a set of corrected service graph snapshots; The static consistency check of the corrected business graph snapshot set is performed based on the constraint rules in the domain knowledge base, and the dynamic simulation calculation of the corrected business graph snapshot set is performed using the calculation rule engine. Based on the results of the static consistency check and the dynamic simulation calculation, the candidate correction hypothesis set is subjected to multi-dimensional correction scoring to obtain the candidate correction score set. Based on the candidate correction score set, the candidate correction hypothesis set is threshold-filtered to obtain the standard correction hypothesis set, and the correction result is generated according to the standard correction hypothesis set, the target tracing path, and the candidate correction score set.

[0015] To achieve at least one of the above-mentioned objectives, the present invention further provides a waybill accounts receivable and payable accounting system based on a rule engine. The system includes a document extraction module, an entity extraction module, an anomaly detection module, a primary accounting module, and a secondary accounting module, wherein: The document extraction module configures the accounting rule engine based on the waybill accounting rules, and performs text recognition, layout analysis and structured document information extraction on the pre-acquired multi-source waybill set to obtain the waybill document set; The entity extraction module uses a domain knowledge base to identify waybill entities and extract entity relationships from the waybill document set based on external feature injection to obtain a waybill entity information set. Then, it performs entity alignment and multi-strategy entity conflict resolution on the waybill entity information set based on graph clustering to obtain a standard entity information set. The anomaly detection module generates a business heterogeneous graph structure based on the waybill business relationships in the domain knowledge base and the standard entity information set, and performs logical consistency verification, root cause entity inference, and association conflict detection on the standard entity information set based on the business heterogeneous graph structure to obtain an abnormal entity list. The primary accounting module uses the accounting rule engine to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list, to obtain the primary accounting list; The secondary accounting module performs related entity tracing and logical inversion correction on the abnormal entity list based on the accounting rule engine and the business heterogeneous graph structure, and manually reviews the correction results and the primary accounting list to obtain the standard accounting list.

[0016] The present invention further provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above-described method for calculating waybill receivables and payables based on a rule engine.

[0017] (III) Beneficial Effects Compared with existing technologies, the present invention provides a method and system for accounting for waybills receivables and payables based on a rule engine, which has the following advantages: This rule-based waybill accounts receivable and payable accounting method incorporates domain knowledge as a strong signal into the deep learning model through dictionary matching and feature injection strategies. It utilizes a dictionary to ensure high recall of key entities, and employs self-attention and conditional random field models to achieve high-precision context-dependent identification and boundary determination. Multi-head attention efficiently models semantic interactions between entities, making relation extraction more accurate. Entity alignment and conflict resolution address issues such as duplicate occurrences of the same entity, inconsistent names, and conflicting field values ​​in multi-source waybill data, enabling cross-document and cross-source entity fusion. Inverted indexing, context extraction, and multi-dimensional semantic similarity matrix matching methods ensure comprehensive initial matching coverage and improve entity matching efficiency. Furthermore, graph structures and graph clustering form stable entity cluster structures, automatically assigning identical entities to the same cluster. Finally, a conflict resolution mechanism rationally merges field differences caused by different sources, improving the accuracy and standardization of the final entity data.

[0018] This rule engine-based waybill receivable and payable accounting method effectively avoids interference from erroneous data with subsequent accounting logic by constructing a safe entity information set through filtering abnormal entities. By synchronously extracting static and dynamic context from the business heterogeneous graph structure and domain knowledge base, it achieves precise definition of entity business semantics, providing a global factual basis for the rule engine and improving the accuracy of rule execution. After injecting the context into the rule engine, the cost accounting logic becomes interpretable and scalable, and complex billing rules can be automatically reasoned according to the business link sequence. By capturing the entire link trajectory of the rule execution process and generating rule chain explanation documents, the cost results become traceable and auditable, improving accounting transparency and providing a data foundation for subsequent anomaly verification and reconciliation chain tracing.

[0019] This rule-engine-based waybill accounts receivable and payable accounting method achieves precise tracing from abnormal entities to upstream source entities through the bidirectional integration of a business heterogeneous graph structure and an accounting rule engine. It also realizes structured reverse derivation of the rule chain through local dependency construction and fusion dependency graph, enabling the system to automatically identify variable attribute nodes that may cause anomalies and generate multiple correction hypotheses. The correction effect is verified through static consistency verification and dynamic simulation accounting, and the optimal correction scheme is selected based on multi-dimensional correction scores. This significantly improves the accuracy and reliability of automated repair. At the same time, the introduction of manual review as the final confirmation step ensures compliance and improves the business reliability of the accounting results, thereby improving the efficiency of waybill accounting. Attached Figure Description

[0020] Figure 1 The diagram shown is a flowchart of a waybill receivable and payable accounting method based on a rule engine according to the present invention. Detailed Implementation

[0021] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious modifications will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.

[0022] It is understood that the term "a" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple, and the term "a" should not be understood as a limitation on the number.

[0023] Example 1: Please combine Figure 1 This invention discloses a method for calculating accounts receivable and payable for waybills based on a rules engine. The method includes the following steps: The accounting rule engine is configured based on the waybill accounting rules, and the pre-acquired multi-source waybill set is subjected to text recognition, layout analysis and structured document information extraction to obtain the waybill document set.

[0024] The waybill accounting rules refer to the sum of business logic and calculation standards that determine the receivables and payables for each transportation service in the fields of logistics, supply chain, and financial settlement. Receivables refer to the fees that need to be collected from customers, and payables refer to the fees that need to be paid to carriers. The corresponding fee calculation rules are different for each type of cargo, such as weight, volume, distance, cargo type, additional fees, and discounts. The multi-source waybill set is a collection of multiple waybills from different sources, which can be scanned images, mobile phone photos, electronic waybill PDF files, or waybill webpage screenshots, etc.

[0025] Specifically, the configuration of the accounting rule engine based on waybill accounting rules includes: The waybill accounting rules are structured and parsed, and a meta-model of the accounting rules is generated based on the parsing results; The rule field set is extracted from the accounting rule meta-model, and the field type inference and dependency analysis are performed on the rule field set to obtain a field dependency directed graph; The accounting rule meta-model is transformed into a logical expression to obtain a set of rule expressions, and the set of rule expressions is verified for consistency in syntax and semantics to obtain a set of verification expressions. Based on the field dependency directed graph, rule conflict detection and conflict resolution are performed on the verification expression set to obtain a standard expression set. The standard expression set is topologically sorted according to the field dependency directed graph to obtain the accounting rule chain, and the accounting rule engine is loaded and instantiated according to the accounting rule chain.

[0026] The structured parsing refers to transforming the natural language-described waybill accounting rules into a computationally achievable structured form. The accounting rule metamodel includes elements such as conditions, actions, priorities, and scope of effect. Conditions consist of attributes, operators, and values, for example: cargo type == "dangerous goods". Actions refer to the calculation or assignment operations performed. Priorities are the numerical values ​​used to resolve rule conflicts. The scope of effect includes customers, routes, and time ranges. Structured parsing can be performed using dependency parsing, and the accounting rule metaengine is generated through rule template traversal and matching. The rule field set refers to the collection of various waybill fields in the accounting rule metamodel, such as weight, volume, number of pieces, and destination. Field types can be inferred based on context or field semantics. Dependency analysis can be performed on the rule fields referenced in the expression by traversing the assignment statements in the rule actions. For example, in the action "total cost = weight * unit price", it can be analyzed that "total cost" depends on "weight" and "unit price", and a field dependency directed graph can be constructed based on the analyzed dependencies and field types.

[0027] In detail, the logical expression transformation refers to converting the conditions, actions, etc. in the accounting rule metamodel into computable logical expressions. This transformation can be achieved through rule templates and parameter substitution, for example, transforming it into the form of the template IF <field><operator><value> THEN <action>. The consistency verification of syntax and semantics refers to using a syntax rule parser such as BNF or EBNF to check whether the transformed rule expression conforms to the syntax specification. On the basis of correct syntax, further checks are made on whether the logical expression and business meaning are semantically the same through field range checks or type checks. Rule conflict detection can be performed through condition coverage detection or priority verification, and conflict resolution can be achieved through action merging strategies or priority decisions.

[0028] Specifically, the step of performing text recognition, layout analysis, and structured document information extraction on the pre-acquired multi-source waybill set to obtain a waybill document set includes: The image format of the pre-acquired multi-source waybill set is converted to obtain a waybill image set, and the waybill image set is then subjected to image standardization and image enhancement processing to obtain an enhanced waybill image set; The enhanced waybill image set is subjected to text detection and text recognition to obtain a waybill text block information set; The enhanced waybill image set is analyzed for layout content and divided into layout areas to obtain a layout area set, and layout structure information is generated based on the layout area set; Based on the page layout information, the text order of the waybill text block information set is restored and cross-regional information is reorganized to obtain a reorganized text information set. The reconstructed text information set is used to locate text fields and associate field information to obtain a set of field association relationships; Based on the set of field associations, the recombined text information set is subjected to structured information extraction and formatted output to obtain a waybill document set.

[0029] The image format conversion refers to converting all multi-source waybills into waybill images of a unified image format, such as taking screenshots of waybills in HTML or PDF format and converting all images to PNG format. Image standardization includes resolution normalization and angle correction of the waybill images. Image enhancement processing includes noise suppression, brightness enhancement, and contrast enhancement. Text detection can be performed using differentiable binarization detection methods, and text recognition can be performed using Optical Character Recognition (OCR), handwriting recognition, and barcode or QR code parsing methods. The waybill text block information set contains the original confidence level and coordinate information of each text field. Page content analysis and page area division refer to identifying and dividing the text block areas, table areas, barcode areas, handwriting areas, etc., in the waybill, generating a page area set. The page structure information includes the content attributes and position information of each page. Text order restoration refers to restoring the text order based on the coordinate information, positional sequence, and logical text order of each page in the page structure information. The cross-regional information reorganization refers to merging and reorganizing waybill text blocks that are sequential in location and belong to the same content in the corresponding order. The text field positioning includes keyword positioning and field recognition. The field information association refers to performing key-value pair matching and rule template matching based on the identified information and field keywords to determine the field mapping relationship between fields and obtain a set of field association relationships. The structured information extraction refers to extracting fields from the reorganized text information set according to a preset document structure, and performing value parsing and normalization processing to obtain a waybill document set. The document structure can be JSON, table structure, or object model structure.

[0030] By performing meta-modeling and generating field dependency directed graphs, implicit business knowledge can be made explicit and structured, making complex rules manageable and analyzable. Through conflict detection and topological sorting, computational contradictions can be eliminated at the source, ensuring the determinism and high performance of accounting results. By analyzing the layout and identifying structural regions, the position and function of text in a document can be identified. Through text order restoration and cross-regional recombination based on the layout structure, complex situations such as scattered fields, misaligned tables, and handwritten additions in actual waybills can be resolved, restoring the true semantics of the business. By locating and associating fields, the original text is transformed into key-value pairs, providing directly usable data for rule engine accounting, improving the accuracy of waybill information entry and cost accounting.

[0031] Using an external feature injection approach, the domain knowledge base is used to identify waybill entities and extract entity relationships from the waybill document set, resulting in a waybill entity information set. Then, based on graph clustering, the waybill entity information set is used for entity alignment and multi-strategy entity conflict resolution, resulting in a standard entity information set.

[0032] The domain knowledge base refers to the external common sense and industry consensus that are pre-organized for waybill billing and accounting scenarios, including a standard name library for fee items, a classification and coding of goods types, a thesaurus of operator synonyms, a standard name library for routes and regions, a customer classification and a library of exclusive protocol terms, etc. The various waybill entity information in the waybill entity information set refers to the entity data information in the waybill document, such as weight, logistics route and other information.

[0033] In this embodiment of the invention, the method based on external feature injection utilizes a domain knowledge base to perform waybill entity recognition and entity relationship extraction on the waybill document set, resulting in a waybill entity information set, including: The waybill fields in the waybill document set are cleaned and their character formats are standardized. The waybill document set is then segmented into a text sequence according to the text order to obtain a preprocessed text sequence. Based on the domain knowledge base, entity dictionary matching is performed on the preprocessed text sequence to obtain a candidate entity field set, and word feature embedding is performed on the preprocessed text sequence to obtain a text feature sequence; The candidate entity field set is injected as an external feature into the corresponding position of the text feature sequence to obtain an enhanced text feature sequence. The enhanced text feature sequence is then encoded using a self-attention mechanism to obtain a context field encoded sequence. The context field encoding sequence is decoded based on a conditional random field to obtain a decoded entity field set. Then, based on the domain knowledge base, the decoded entity field set is linked and semantically normalized to obtain a standard entity field set. Extract the entity field encoding set corresponding to the standard entity field set from the context field encoding, and extract the relationship between any two entity field codes in the entity field encoding set based on the multi-head attention mechanism to obtain the entity relationship set; The entity relationship set is filtered by confidence based on the original confidence score, multi-head attention score, and relation constraints corresponding to the domain knowledge base to obtain a standard entity relationship set. A waybill entity information set is then generated based on the standard entity relationship set and the standard entity field set.

[0034] The process includes character cleaning using regular expressions to remove noisy characters, abnormal spaces, or misidentified special symbols; character format unification using lookup and replacement to standardize unit characters (full-width or half-width characters); bidirectional maximum matching for text sequence segmentation; entity dictionary matching using a domain knowledge base to construct an entity dictionary; rapid scanning and locating of all possible entity fields in the preprocessed text sequence using algorithms such as Trie trees and Aho-Corasick automata to generate a candidate entity field set; word feature embedding using pre-trained components such as Word2Vec, GloVe, and FastText; and external feature injection using feature concatenation or type embedding. Sequence decoding based on conditional random fields involves inputting the context field encoded sequence into a linear layer, predicting scores for each entity label at each position, receiving these scores through a conditional random field, learning transition probabilities between labels, and decoding the globally optimal label sequence using the Viterbi algorithm to determine entity boundaries and types, thus obtaining the decoded entity fields.

[0035] In detail, entity linking can be performed by calculating the semantic similarity between entity fields and standard entities in the domain knowledge base. Semantic normalization refers to unifying the units of numerical entities, unifying the format of date entities, and unifying the standard value mapping of synonym entities. Extracting the entity field encoding set corresponding to the standard entity field set from the context field encoding means extracting the encoding vector of the corresponding position interval from the context field encoding sequence according to the start and end position index of each entity in the standard entity field set in the original sequence. For entities spanning multiple characters, a fixed-length vector representation is obtained through average pooling to form the entity field encoding set. Relation extraction refers to using multi-head attention to perform attention weighting on two entity fields and classifying the relationship through a fully connected layer to determine the corresponding entity relationship. The comprehensive confidence score can be obtained by weighted averaging of the original confidence score and the multi-head attention score. Confidence threshold filtering and constraint filtering are performed based on the relationship constraints and the comprehensive confidence score to aggregate the passed entity relationships into a standard entity relationship set.

[0036] In detail, the graph clustering-based method performs entity alignment and multi-strategy entity conflict resolution on the waybill entity information set to obtain a standard entity information set, including: The waybill entity information set is indexed inverted based on entity attributes, and the waybill entity information set is quickly retrieved and matched based on exact matching rules and fuzzy matching strategies to obtain a set of candidate aligned entity pairs. The context entities of each entity in the candidate aligned entity pair set are taken as the context entities in the waybill entity information set, and multi-dimensional feature normalization and multi-dimensional similarity calculation are performed on the candidate aligned entity pair set and each entity in the context entity set to obtain the entity semantic similarity matrix. An entity similarity graph structure is constructed using each entity corresponding to the entity semantic similarity matrix as a node, similarity relationship as an edge, and multidimensional semantic similarity as an edge weight. The edges of the entity similarity graph structure are then pruned according to the edge weights to obtain a standard entity graph structure. The standard entity graph structure is clustered based on a graph clustering algorithm to obtain an entity cluster set. Internal conflict detection is then performed on each entity cluster in the entity cluster set to obtain an attribute conflict entity set. The conflict set of the attribute conflict is resolved by confidence voting, time-series priority filtering and statistical fusion respectively, and the consistency of the conflict set after conflict resolution is verified by the domain knowledge base to obtain the verification entity set. The entity cluster set is updated using the verified entity set, and a standard entity information set is generated based on the updated entity cluster set.

[0037] The entity attributes include the entity's waybill number, mobile phone number, barcode, and customer code. The exact matching rule refers to using entities with the same attributes as candidate alignment pairs. The fuzzy matching strategy refers to using entities with similar attributes as candidate alignment pairs. The context entities refer to adjacent fields, inline and column cells, and entities in preceding and following text segments within the same waybill. The multidimensional feature normalization refers to fusing and normalizing the multidimensional features of each entity, such as name, address, and type. Cosine similarity algorithm can be used for multidimensional similarity calculation. The graph clustering algorithm refers to the Louvain graph clustering algorithm or hierarchical clustering algorithm. The internal conflict detection includes type conflict detection, value range conflict detection, and knowledge base constraint conflict detection. The statistical fusion method is the weighted median method. The generation of a standard entity information set based on the updated entity cluster set refers to generating a standard entity for each entity cluster. The attribute value of the standard entity is a unified value after resolution, and a globally unique standard entity ID is assigned. A mapping relationship is established between the standard entity ID and all original entity IDs in the cluster. All standard entities are integrated, and a conflict-free and normalized standard entity information set is output.

[0038] By employing dictionary matching and feature injection strategies, domain knowledge can be integrated into the deep learning model as a strong signal. This approach ensures high recall of key entities using a dictionary and achieves high-precision context-dependent identification and boundary determination through self-attention and conditional random field models. Multi-head attention efficiently models semantic interactions between entities, making relation extraction more accurate. Entity alignment and conflict resolution address issues such as duplicate occurrences of the same entity, inconsistent names, and conflicting field values ​​in multi-source waybill data, enabling cross-document and cross-source entity fusion. Inverted indexing, context extraction, and multi-dimensional semantic similarity matrix matching methods ensure comprehensive initial matching coverage and improve entity matching efficiency. Furthermore, graph structures and graph clustering form stable entity cluster structures, allowing identical entities to automatically belong to the same cluster. Conflict resolution mechanisms are used to reasonably merge field differences caused by different sources, improving the accuracy and standardization of the final entity data.

[0039] Based on the waybill business relationships in the domain knowledge base and the standard entity information set, a business heterogeneous graph structure is generated. Then, based on the business heterogeneous graph structure, logical consistency verification, root cause entity inference, and association conflict detection are performed on the standard entity information set to obtain an abnormal entity list.

[0040] The waybill business relationship refers to the interpretable business semantic relationship derived from business processes, role relationships, billing logic, and batch logic in the waybill accounting scenario. This includes basic structural relationships, accounting relationships, and association relationships. Basic structural relationships include, for example, shipper-issue-waybill, consignee-receive-waybill, etc. Accounting relationships include, for example, shipper-accounts receivable-fee items, consignee-payable-fee items, etc. Association relationships include, for example, waybill-belong-to-same-contract, multiple waybills-belong-to-unified-batch, etc. The business heterogeneous graph structure is a graph structure data model used to formally and structurally represent complex business relationships. In this model, nodes represent different types of business entities, and edges represent different types of business relationships. The waybill business relationship is a business-level relationship, while the entity relationship is a text-level relationship.

[0041] Specifically, the step of generating a business heterogeneous graph structure based on the waybill business relationships in the domain knowledge base and the standard entity information set includes: The waybill business relationships are extracted from the domain knowledge base, and the waybill business relationships are processed into a pattern to obtain a business relationship pattern. Traverse each standard entity in the standard entity information set, match the node type from the business relationship pattern based on the entity type of the standard entity, and instantiate the business graph node according to the node type; Based on the business relationship pattern and the entity relationships in the standard entity information set, corresponding business directed edges are generated for each business graph node. A primary business network topology is constructed based on all business graph nodes and all business directed edges. Constraint verification and redundancy elimination are performed on the primary business network topology based on the business relationship pattern to obtain the standard business network topology. The standard service network topology is encapsulated using an attribute graph to obtain a service heterogeneous graph structure.

[0042] The pattern processing refers to converting waybill business relationships into machine-recognizable relationship patterns, including relationship type, direction, edge generation rules, and priority. The entity type based on standard entities matches node types from the business relationship patterns, and instantiating business graph nodes according to the node types refers to instantiating business graph nodes based on standard entity IDs, original entity ID mappings, main attributes, source confidence, and timestamps. The business directed edges include attributes such as relationship type, direction, source identifier, confidence, and timestamp, where the source identifier is, for example, rule generation or entity relationship derivation. The constraint verification refers to checking whether cardinality constraints defined in the pattern are violated, such as checking whether a waybill node has multiple directed edges corresponding to shippers and whether the edge directions are correct. The redundancy elimination refers to merging duplicate edges caused by data redundancy, retaining the highest confidence source or aggregated source metadata after merging.

[0043] In detail, the step of performing logical consistency verification, root cause entity inference, and association conflict detection on the standard entity information set based on the business heterogeneous graph structure to obtain an abnormal entity list includes: Constraint rules are extracted from the heterogeneous business graph structure, and a structured logic verification template set is generated. Based on the logical verification template set, subgraph pattern matching is performed on the heterogeneous business graph structure to obtain the entity context relationship chain; Based on the logical verification template set, logical consistency verification is performed on each subgraph instance in the entity context relationship chain, and a logical anomaly instance set is generated according to the verification results. Based on the graph clustering algorithm, the set of logical anomaly instances in the heterogeneous business graph structure is clustered to obtain anomaly clusters, and the root cause entity inference is performed on the anomaly clusters to obtain an anomaly root cause entity set. A multi-dimensional anomaly score is performed on each anomaly entity in the set of anomaly root cause entities, and the set of anomaly root cause entities is prioritized according to the score results to obtain a primary anomaly list. The initial anomaly list is filtered by an anomaly threshold to obtain an anomaly entity list.

[0044] The logical verification template includes fields such as rule ID, applicable node / edge type, triggering condition, rule expression, severity level, priority, and whether it can be automatically corrected. For example, the time sequence rule is "pickup time < receipt time", the cardinality rule is "each waybill can only have 1 shipper", and the amount aggregation rule is "total cost lines = total cost". The k-hop algorithm can be used for subgraph pattern matching, traversing all subgraph instances that meet the rule triggering conditions, and constructing an entity context relationship chain based on all subgraph instances. The entity context relationship chain includes the context relationship of entities, the corresponding path length, edge type sequence, and the involved entity node IDs. The logical consistency verification refers to analyzing whether each subgraph instance is logically correct based on the corresponding logical verification template. If the logical verification fails, a corresponding... The logical anomaly instances include the triggering rule ID, the set of entity nodes and edges involved, the conflicting attributes and their values, and the calculated difference value. The root cause entity inference refers to inferring the entity most likely to cause all anomalies in the cluster as the root cause entity by analyzing the distribution of anomaly instances, attribute dependencies, and the centrality index of entities in the graph. The multi-dimensional anomaly scoring includes weighted anomaly scoring based on dimensions such as the number of triggered anomaly instances and rule severity level, statistical significance of attribute deviation, source confidence of entity data, and the influence range of the entity in the business heterogeneous graph. The anomaly threshold filtering refers to determining whether the anomaly score of each primary anomaly in the primary anomaly list is greater than a preset anomaly threshold. If so, the corresponding primary anomalies are aggregated into an anomaly entity list as anomaly entities.

[0045] By structurally converting the nodes, edges, and their relationship patterns in the heterogeneous business graph into logical verification templates, the system can uniformly constrain core business rules such as timing, cardinality, and monetary dependencies between waybill entities from a global perspective. By utilizing the entity context relationship chain generated by subgraph pattern matching, it can accurately capture business associations across multiple entities and paths, enabling logical verification to go beyond local field comparisons and perform consistency verification based on complete business semantics. Through anomaly clustering and root cause inference, the system can effectively identify representative key entities behind batch anomalies, reducing false alarms and improving traceability efficiency. Through multi-dimensional fusion scoring and threshold filtering, it can accurately screen abnormal entities and improve the accuracy of waybill accounting.

[0046] The accounting rule engine is used to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list to obtain a primary accounting list.

[0047] In detail, the step of using the accounting rule engine to perform cost accounting and rule chain interpretation on entity information in the standard entity information set, excluding the abnormal entity list, to obtain a preliminary accounting list, including: The entity information in the standard entity information set, excluding the abnormal entity list, is aggregated into a security entity information set. Extract the static context set and dynamic context set corresponding to the security entity information set from the business heterogeneous graph structure and the domain knowledge base; The static context set and the dynamic context set are injected into the accounting rule engine as global facts; The accounting rule engine after fact injection is used to perform rule triggering matching, rule execution and cost flow calculation on the security entity information set to obtain a cost accounting list. The entire chain of the accounting rule chain during rule execution by the accounting rule engine is captured to obtain a rule chain explanation document. The rule chain explanation document and the cost accounting list are then associated and encapsulated to obtain a primary accounting list.

[0048] The static context refers to the context related to each entity information, such as customer level and contract terms. The dynamic context refers to the context such as historical discount rates. The use of the accounting rule engine after fact injection to perform rule triggering matching, rule execution, and cost flow calculation on the security entity information set refers to using the accounting rule engine to automatically match the security entity information with the conditions in the rule chain through pattern matching algorithms such as the Rete algorithm. The successfully matched security entity information is used as the agenda, and all agendas are executed according to the priority strategy to calculate the payable and chargeable fees. The full-link trajectory capture refers to using a preset listener mechanism to listen to and record events in the accounting rule chain. The key information recorded includes the input value of each security entity information, the ID and conditions of each triggered rule, the data state changes before and after each rule execution, and the triggering dependencies between rules. These events are organized according to timeline and causal relationship, and these events are reconstructed into a tree-like or graph-like rule chain explanation document through methods such as business term mapping. The association encapsulation can be encapsulated as a JSON array in a strong association manner.

[0049] By filtering abnormal entities to construct a secure entity information set, erroneous data can be effectively prevented from interfering with subsequent accounting logic. By synchronously extracting static and dynamic context from the business heterogeneous graph structure and domain knowledge base, the precise definition of entity business semantics is achieved, providing a global factual basis for the rule engine and improving the accuracy of rule execution. After injecting the context into the rule engine, the cost accounting logic becomes interpretable and scalable, and complex billing rules can be automatically reasoned according to the business link sequence. By capturing the entire link trajectory of the rule execution process and generating rule chain explanation documents, the cost results become traceable and auditable, improving accounting transparency and providing a data foundation for subsequent anomaly verification and reconciliation chain tracing.

[0050] Based on the accounting rule engine and the business heterogeneous graph structure, the abnormal entity list is traced back to related entities and logically reversed and corrected. The correction results and the primary accounting list are then manually reviewed to obtain the standard accounting list.

[0051] Specifically, the step of performing associated entity tracing and logical inversion correction on the abnormal entity list based on the accounting rule engine and the business heterogeneous graph structure includes: Starting with each entity in the list of abnormal entities, subgraph pattern matching is performed in the business heterogeneous graph structure to obtain an abnormal association subgraph; Each entity in the abnormal association subgraph is selected as the target association entity, and a local dependency is constructed on the target association entity based on the accounting rule chain in the accounting rule engine to obtain the entity local dependency graph. The entity local dependency graph is aligned and fused using the business heterogeneous graph structure to obtain a fused dependency graph. Reverse tracing is then performed based on the dependency edges of the fused dependency graph to obtain the target source entity and the target tracing path. All variable attribute nodes in the target tracing path are identified, and the variable attribute nodes are solved in reverse based on the accounting rule engine to obtain a set of candidate correction hypotheses. The set of corrected hypotheses is mapped to the heterogeneous service graph structure to obtain a set of corrected service graph snapshots; The static consistency check of the corrected business graph snapshot set is performed based on the constraint rules in the domain knowledge base, and the dynamic simulation calculation of the corrected business graph snapshot set is performed using the calculation rule engine. Based on the results of the static consistency check and the dynamic simulation calculation, the candidate correction hypothesis set is subjected to multi-dimensional correction scoring to obtain the candidate correction score set. Based on the candidate correction score set, the candidate correction hypothesis set is threshold-filtered to obtain the standard correction hypothesis set, and the correction result is generated according to the standard correction hypothesis set, the target tracing path, and the candidate correction score set.

[0052] The subgraph pattern matching method is the same as in the above steps, namely, k-hop matching centered on the abnormal entity. The local dependency construction refers to analyzing all rules in the accounting rule chain that directly or indirectly use the entity attribute. The action parts of these rules are parsed to construct an entity local dependency graph with attributes as nodes and computational dependencies as directed edges. The reverse tracing is performed by tracing back along the dependency edges of the fusion dependency graph, with the target associated entity as the endpoint. The variable attribute node refers to an entity node whose node value may be inaccurate. The reverse solution refers to solving the candidate reasonable value range of each variable attribute node by solving equations, interval propagation, or sampling, and using each variable attribute node and its corresponding candidate value as candidate correction hypotheses. The static consistency verification refers to verifying constraint rules based on type, range, and business rules. The dynamic simulation accounting refers to performing cost accounting according to the accounting cost engine, recording the simulation results, and determining whether the anomaly has been eliminated. The multi-dimensional correction scoring refers to weighted scoring based on multiple dimensions such as the magnitude of change before and after correction, the degree of conflict elimination, and historical confidence.

[0053] Specifically, the manual review of the correction results and the primary accounting list to obtain the standard accounting list refers to performing dynamic simulation calculations on each standard correction hypothesis set in the correction results to obtain a correction accounting result list, feeding the correction accounting result list and the correction results back to the client for manual review, and then combining the manual review results with the primary accounting list to form the standard accounting list.

[0054] By integrating the business heterogeneous graph structure with the accounting rule engine, the system achieves precise tracing from abnormal entities to upstream source entities. Through local dependency construction and dependency graph fusion, it realizes structured reverse derivation of the rule chain, enabling the system to automatically identify variable attribute nodes that may cause anomalies and generate multiple correction hypotheses. The correction effect is verified through static consistency verification and dynamic simulation accounting, and the optimal correction scheme is selected based on multi-dimensional correction scores. This significantly improves the accuracy and reliability of automated repair. At the same time, the introduction of manual review as the final confirmation step ensures compliance and improves the business reliability of the accounting results, thereby improving the efficiency of waybill accounting.

[0055] Example 2: This invention discloses a waybill accounts receivable and payable accounting system based on a rule engine. The system includes a document extraction module, an entity extraction module, an anomaly detection module, a primary accounting module, and a secondary accounting module, wherein: The document extraction module configures the accounting rule engine based on the waybill accounting rules, and performs text recognition, layout analysis and structured document information extraction on the pre-acquired multi-source waybill set to obtain the waybill document set; The entity extraction module uses a domain knowledge base to identify waybill entities and extract entity relationships from the waybill document set based on external feature injection to obtain a waybill entity information set. Then, it performs entity alignment and multi-strategy entity conflict resolution on the waybill entity information set based on graph clustering to obtain a standard entity information set. The anomaly detection module generates a business heterogeneous graph structure based on the waybill business relationships in the domain knowledge base and the standard entity information set, and performs logical consistency verification, root cause entity inference, and association conflict detection on the standard entity information set based on the business heterogeneous graph structure to obtain an abnormal entity list. The primary accounting module uses the accounting rule engine to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list, to obtain the primary accounting list; The secondary accounting module performs related entity tracing and logical inversion correction on the abnormal entity list based on the accounting rule engine and the business heterogeneous graph structure, and manually reviews the correction results and the primary accounting list to obtain the standard accounting list.

[0056] The processes described above with reference to the flowcharts in the embodiments disclosed in this invention can be implemented as computer software programs. The embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs the functions defined in the methods of this application. It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wire segments, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless segments, wire segments, optical fibers, RF, etc., or any suitable combination thereof.

[0057] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0058] Those skilled in the art should understand that the embodiments of the present invention described above and shown in the accompanying drawings are merely examples and do not limit the present invention. The purpose of the present invention has been fully and effectively achieved. The functions and structural principles of the present invention have been shown and explained in the embodiments. Without departing from the stated principles, the implementation of the present invention may have any variations or modifications.

Claims

1. A method for accounting for waybills receivables and payables based on a rule engine, characterized in that, The method includes: The accounting rule engine is configured based on the waybill accounting rules, and the pre-acquired multi-source waybill set is subjected to text recognition, layout analysis and structured document information extraction to obtain the waybill document set; Using an external feature injection approach, the domain knowledge base is used to identify waybill entities and extract entity relationships from the waybill document set to obtain a waybill entity information set. Then, based on graph clustering, the waybill entity information set is used to perform entity alignment and multi-strategy entity conflict resolution to obtain a standard entity information set. Based on the waybill business relationships in the domain knowledge base and the standard entity information set, a business heterogeneous graph structure is generated. Based on the business heterogeneous graph structure, logical consistency verification, root cause entity inference, and association conflict detection are performed on the standard entity information set to obtain an abnormal entity list. The accounting rule engine is used to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list to obtain a primary accounting list; Based on the accounting rule engine and the business heterogeneous graph structure, the abnormal entity list is traced back to related entities and logically reversed and corrected. The correction results and the primary accounting list are then manually reviewed to obtain the standard accounting list.

2. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The accounting rule engine configured based on waybill accounting rules includes: The waybill accounting rules are structured and parsed, and a meta-model of the accounting rules is generated based on the parsing results; The rule field set is extracted from the accounting rule meta-model, and the field type inference and dependency analysis are performed on the rule field set to obtain a field dependency directed graph; The accounting rule meta-model is transformed into a logical expression to obtain a set of rule expressions, and the set of rule expressions is verified for consistency in syntax and semantics to obtain a set of verification expressions. Based on the field dependency directed graph, rule conflict detection and conflict resolution are performed on the verification expression set to obtain a standard expression set. The standard expression set is topologically sorted according to the field dependency directed graph to obtain the accounting rule chain, and the accounting rule engine is loaded and instantiated according to the accounting rule chain.

3. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The process of performing text recognition, layout analysis, and structured document information extraction on the pre-acquired multi-source waybill set yields a waybill document set, including: The image format of the pre-acquired multi-source waybill set is converted to obtain a waybill image set, and the waybill image set is then subjected to image standardization and image enhancement processing to obtain an enhanced waybill image set; The enhanced waybill image set is subjected to text detection and text recognition to obtain a waybill text block information set; The enhanced waybill image set is analyzed for layout content and divided into layout areas to obtain a layout area set, and layout structure information is generated based on the layout area set; Based on the page layout information, the text order of the waybill text block information set is restored and cross-regional information is reorganized to obtain a reorganized text information set. The reconstructed text information set is used to locate text fields and associate field information to obtain a set of field association relationships; Based on the set of field associations, the recombined text information set is subjected to structured information extraction and formatted output to obtain a waybill document set.

4. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The external feature injection-based method utilizes a domain knowledge base to perform waybill entity recognition and entity relationship extraction on the waybill document set, resulting in a waybill entity information set, including: The waybill fields in the waybill document set are cleaned and their character formats are standardized. The waybill document set is then segmented into a text sequence according to the text order to obtain a preprocessed text sequence. Based on the domain knowledge base, entity dictionary matching is performed on the preprocessed text sequence to obtain a candidate entity field set, and word feature embedding is performed on the preprocessed text sequence to obtain a text feature sequence; The candidate entity field set is injected as an external feature into the corresponding position of the text feature sequence to obtain an enhanced text feature sequence. The enhanced text feature sequence is then encoded using a self-attention mechanism to obtain a context field encoded sequence. The context field encoding sequence is decoded based on a conditional random field to obtain a decoded entity field set. Then, based on the domain knowledge base, the decoded entity field set is linked and semantically normalized to obtain a standard entity field set. Extract the entity field encoding set corresponding to the standard entity field set from the context field encoding, and extract the relationship between any two entity field codes in the entity field encoding set based on the multi-head attention mechanism to obtain the entity relationship set; The entity relationship set is filtered by confidence based on the original confidence score, multi-head attention score, and relation constraints corresponding to the domain knowledge base to obtain a standard entity relationship set. A waybill entity information set is then generated based on the standard entity relationship set and the standard entity field set.

5. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The graph clustering-based method is used to align entities in the waybill entity information set and resolve multi-strategy entity conflicts, resulting in a standard entity information set, including: The waybill entity information set is indexed inverted based on entity attributes, and the waybill entity information set is quickly retrieved and matched based on exact matching rules and fuzzy matching strategies to obtain a set of candidate aligned entity pairs. The context entities of each entity in the candidate aligned entity pair set are taken as the context entities in the waybill entity information set, and multi-dimensional feature normalization and multi-dimensional similarity calculation are performed on the candidate aligned entity pair set and each entity in the context entity set to obtain the entity semantic similarity matrix. An entity similarity graph structure is constructed using each entity corresponding to the entity semantic similarity matrix as a node, similarity relationship as an edge, and multidimensional semantic similarity as an edge weight. The edges of the entity similarity graph structure are then pruned according to the edge weights to obtain a standard entity graph structure. The standard entity graph structure is clustered based on a graph clustering algorithm to obtain an entity cluster set. Internal conflict detection is then performed on each entity cluster in the entity cluster set to obtain an attribute conflict entity set. The conflict set of the attribute conflict is resolved by confidence voting, time-series priority filtering and statistical fusion respectively, and the consistency of the conflict set after conflict resolution is verified by the domain knowledge base to obtain the verification entity set. The entity cluster set is updated using the verified entity set, and a standard entity information set is generated based on the updated entity cluster set.

6. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The step of generating a business heterogeneous graph structure based on the waybill business relationships in the domain knowledge base and the standard entity information set includes: The waybill business relationships are extracted from the domain knowledge base, and the waybill business relationships are processed into a pattern to obtain a business relationship pattern. Traverse each standard entity in the standard entity information set, match the node type from the business relationship pattern based on the entity type of the standard entity, and instantiate the business graph node according to the node type; Based on the business relationship pattern and the entity relationships in the standard entity information set, corresponding business directed edges are generated for each business graph node. A primary business network topology is constructed based on all business graph nodes and all business directed edges. Constraint verification and redundancy elimination are performed on the primary business network topology based on the business relationship pattern to obtain the standard business network topology. The standard service network topology is encapsulated using an attribute graph to obtain a service heterogeneous graph structure.

7. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The step involves performing logical consistency verification, root cause entity inference, and association conflict detection on the standard entity information set based on the business heterogeneity graph structure to obtain an abnormal entity list, including: Constraint rules are extracted from the heterogeneous business graph structure, and a structured logic verification template set is generated. Based on the logical verification template set, subgraph pattern matching is performed on the heterogeneous business graph structure to obtain the entity context relationship chain; Based on the logical verification template set, logical consistency verification is performed on each subgraph instance in the entity context relationship chain, and a logical anomaly instance set is generated according to the verification results. Based on the graph clustering algorithm, the set of logical anomaly instances in the heterogeneous business graph structure is clustered to obtain anomaly clusters, and the root cause entities of the anomaly clusters are inferred to obtain an anomaly root cause entity set. A multi-dimensional anomaly score is performed on each anomaly entity in the set of anomaly root cause entities, and the set of anomaly root cause entities is prioritized according to the score results to obtain a primary anomaly list. The initial anomaly list is filtered by an anomaly threshold to obtain an anomaly entity list.

8. A method for accounting for waybills receivables and payables based on a rule engine according to claim 7, characterized in that, The process involves using the accounting rule engine to perform cost accounting and rule chain interpretation on entity information in the standard entity information set, excluding the abnormal entity list, to obtain a preliminary accounting list, including: The entity information in the standard entity information set, excluding the abnormal entity list, is aggregated into a security entity information set. Extract the static context set and dynamic context set corresponding to the security entity information set from the business heterogeneous graph structure and the domain knowledge base; The static context set and the dynamic context set are injected into the accounting rule engine as global facts; The accounting rule engine after fact injection is used to perform rule triggering matching, rule execution and cost flow calculation on the security entity information set to obtain a cost accounting list. The entire chain of the accounting rule chain during rule execution by the accounting rule engine is captured to obtain a rule chain explanation document. The rule chain explanation document and the cost accounting list are then associated and encapsulated to obtain a primary accounting list.

9. The method for accounting for waybills receivables and payables based on a rule engine according to claim 1, characterized in that, The process of performing associated entity tracing and logical inversion correction on the abnormal entity list based on the accounting rule engine and the business heterogeneous graph structure includes: Starting with each entity in the list of abnormal entities, subgraph pattern matching is performed in the business heterogeneous graph structure to obtain an abnormal association subgraph; Each entity in the abnormal association subgraph is selected as the target association entity, and a local dependency is constructed on the target association entity based on the accounting rule chain in the accounting rule engine to obtain the entity local dependency graph. The entity local dependency graph is aligned and fused using the business heterogeneous graph structure to obtain a fused dependency graph. Reverse tracing is then performed based on the dependency edges of the fused dependency graph to obtain the target source entity and the target tracing path. All variable attribute nodes in the target tracing path are identified, and the variable attribute nodes are solved in reverse based on the accounting rule engine to obtain a set of candidate correction hypotheses. The set of corrected hypotheses is mapped to the heterogeneous service graph structure to obtain a set of corrected service graph snapshots; The static consistency check of the corrected business graph snapshot set is performed based on the constraint rules in the domain knowledge base, and the dynamic simulation calculation of the corrected business graph snapshot set is performed using the calculation rule engine. Based on the results of the static consistency check and the dynamic simulation calculation, the candidate correction hypothesis set is subjected to multi-dimensional correction scoring to obtain the candidate correction score set. Based on the candidate correction score set, the candidate correction hypothesis set is threshold-filtered to obtain the standard correction hypothesis set, and the correction result is generated according to the standard correction hypothesis set, the target tracing path, and the candidate correction score set.

10. A waybill receivable and payable accounting system based on a rule engine, characterized in that, The system includes a document extraction module, an entity extraction module, an anomaly detection module, a primary accounting module, and a secondary accounting module, wherein: The document extraction module configures the accounting rule engine based on the waybill accounting rules, and performs text recognition, layout analysis and structured document information extraction on the pre-acquired multi-source waybill set to obtain the waybill document set; The entity extraction module uses a domain knowledge base to identify waybill entities and extract entity relationships from the waybill document set based on external feature injection to obtain a waybill entity information set. Then, it performs entity alignment and multi-strategy entity conflict resolution on the waybill entity information set based on graph clustering to obtain a standard entity information set. The anomaly detection module generates a business heterogeneous graph structure based on the waybill business relationships in the domain knowledge base and the standard entity information set, and performs logical consistency verification, root cause entity inference, and association conflict detection on the standard entity information set based on the business heterogeneous graph structure to obtain an abnormal entity list. The primary accounting module uses the accounting rule engine to perform cost accounting and rule chain interpretation on entity information in the standard entity information set other than the abnormal entity list, to obtain the primary accounting list; The secondary accounting module performs related entity tracing and logical inversion correction on the abnormal entity list based on the accounting rule engine and the business heterogeneous graph structure, and manually reviews the correction results and the primary accounting list to obtain the standard accounting list.