Preformed dish production batch traceability analysis method and system

By optimizing the field arrangement and hash summary of pre-made dishes production data, and using blockchain technology, data fragmentation and tampering problems of pre-made dishes production traceability system are solved, efficient and accurate traceability and anti-counterfeiting capabilities are achieved, and batches of quality problems can be quickly positioned.

CN120509910APending Publication Date: 2025-08-19HUNAN PENGJIFANG AGRI TECH DEV CO LTD
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202510639031.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

The existing pre-made vegetable production traceability system has the risks of data fragmentation, single-point failure of centralized databases and artificial tampering, which is difficult to meet the credibility requirements of food safety traceability, and it is impossible to associate specific production parameters, resulting in difficulty in positioning quality problems.

Method used

By obtaining multi-dimensional production information, using genetic algorithms to optimize field arrangement, generating long strings of dynamic optimization features, performing hash digest operations, forming a unique hash identification code, and writing it to the blockchain database, building a time stamp chain structure, generating multi-dimensional traceability encoding and packaging binding, and combining with the association map to achieve full-dimensional data traceability query.

Benefits of technology

It realizes the integrity and timeliness of data, improves data retrieval efficiency and anti-counterfeiting performance, can quickly locate batches of quality problems, reduce the number of recalls, and ensures the accuracy and anti-counterfeiting capabilities of traceability information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509910A_ABST
    Figure CN120509910A_ABST
Patent Text Reader

Abstract

The invention provides a prefabricated dish production batch traceability analysis method and system, and relates to the technical field of data processing, and the method comprises the steps: carrying out the field arrangement optimization of an original data set based on a genetic algorithm, determining the optimal field arrangement and combination through dynamic iterative calculation, carrying out the splicing processing of all data elements according to the optimized field sequence, and obtaining the traceability of the original data set; generating a long character string with dynamic optimization characteristics; hash digest operation is carried out on the generated long character string, a digital fingerprint with a fixed length is generated through a preset one-way encryption algorithm, and a unique Hash identification code of the production batch is formed; and writing the generated Hash identification code into a distributed node of a block chain database, constructing a storage time sequence record based on a timestamp chain structure, and establishing an index mapping relationship between the Hash identification code and the original data set. According to the invention, the data preprocessing fineness can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method and system for tracing and analyzing production batches of prepared dishes. Background Art

[0002] Currently, traceability of prepared food production mainly relies on traditional database management, QR code scanning, or RFID tagging technologies, but these methods have some limitations: For example, data from multiple processes, such as raw material procurement, processing parameters, and quality inspection records, is stored in disparate systems, lacking unified integration and leading to a breakdown in the traceability chain. Traditional centralized databases present single points of failure and the risk of tampering, making it difficult to meet the credibility requirements of food safety traceability. Existing methods often use batch numbers as unique identifiers, failing to link to specific production parameters (such as processing temperature and equipment numbers), making it difficult to pinpoint quality issues. For example, in the case of microbial contamination, traditional traceability systems can only trace back to the production batch, making it difficult to pinpoint operational anomalies in the specific processing step. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method and system for traceability analysis of pre-prepared food production batches, which can improve the precision of data preprocessing to ensure the accuracy and comprehensiveness of deformation monitoring.

[0004] In order to solve the above technical problems, the technical solutions of the present invention are as follows: In a first aspect, a method for traceability analysis of a production batch of a prepared meal comprises: Step 1: Acquire multi-dimensional production information generated during the pre-prepared meal production process, and structure the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information; Step 2: Optimize the field arrangement of the original data set based on a genetic algorithm, determine the optimal field arrangement and combination through dynamic iterative calculation, and concatenate each data element according to the optimized field order to generate a long string with dynamic optimization characteristics; Step 3: Perform a hash digest operation on the long string generated in step 2, and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch; Step 4: Write the hash identification code generated in step 3 into the distributed nodes of the blockchain database, construct a storage time series record based on the timestamp chain structure, and establish an index mapping relationship between the hash identification code and the original data set; Step 5: When a new production batch is added, the hash identification code in the blockchain is recursively matched to remove duplication and create a new block. A multi-dimensional traceability code containing an anti-counterfeiting mark is generated and laser-marked to bind it to the pre-prepared food packaging and build an associated map. In response to the scanning request, the hash identification code is extracted for verification and full-dimensional production chain data traceability query is implemented. Finally, an analysis report is generated for the multi-dimensional association analysis of the returned data.

[0005] In a second aspect, a pre-prepared meal production batch traceability analysis system includes: An acquisition module is used to acquire multi-dimensional production information generated during the production of pre-prepared dishes, and to structure and organize the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information; The calculation module is used to optimize the field arrangement of the original data set based on the genetic algorithm, determine the optimal field arrangement combination through dynamic iterative calculation, and splice each data element according to the optimized field order to generate a long string with dynamic optimization characteristics; A generation module is used to perform a hash digest operation on the generated long string and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch; Establish a module for writing the generated hash identification code into the distributed nodes of the blockchain database, constructing a storage time series record based on a timestamp chain structure, and establishing an index mapping relationship between the hash identification code and the original data set; The response module is used to recursively match the hash identification code in the blockchain to remove duplicates and create a new block when a new production batch is added, generate a multi-dimensional traceability code with an anti-counterfeiting mark, laser-mark it, bind it to the pre-prepared food packaging, and build an associated map, respond to scanning requests to extract the hash identification code for verification and realize full-dimensional production chain data traceability query, and finally generate an analysis report for the multi-dimensional association analysis of the returned data.

[0006] According to a third aspect, a computing device includes: one or more processors; The storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are implemented.

[0007] In a fourth aspect, a computer-readable storage medium stores a program, which implements the method when executed by a processor.

[0008] The above solution of the present invention includes at least the following beneficial effects.

[0009] By structuring and organizing multi-dimensional data such as raw material procurement, processing parameters, quality inspection records, and packaging information, we construct a raw data set covering the entire production chain, solving the problem of data fragmentation across multiple links in traditional traceability systems. For example, heterogeneous data such as raw material supplier qualifications, processing equipment operating parameters, and cold chain transportation temperature and humidity curves can be linked in real time to form a complete production "digital archive," allowing single quality issues to be traced back to specific links (e.g., excessive veterinary drug residues in a batch of chicken raw materials → identifying the supplier → tracing the flow of raw materials from the same batch).

[0010] Dynamic iterative calculations based on genetic algorithms overcome the limitations of traditional traceability systems' static field design. By adaptively adjusting the order of data fields, the system can optimize the data structure in real time based on production process changes (such as the addition of a sterilization step), ensuring the integrity and timeliness of traceability information. For example, when a new type of quick-freezing equipment is introduced, the system can automatically prioritize the "quick-freezing temperature-duration-equipment number" fields to prevent the omission of key parameters.

[0011] The optimized fields are concatenated into a long string in the optimal order, forming a data carrier with "dynamic fingerprint" characteristics. This technology not only improves data retrieval efficiency (the closer the field arrangement is to business logic, the faster the query response is by 30%-50%), but also strengthens the traceability priority of key data by assigning field weights (for example, quality inspection results fields are given higher weight than packaging information fields), achieving "data sorting on demand and targeted tracing."

[0012] A unique digital fingerprint is generated through hash summary calculations, and the hash identification code is written into the blockchain's distributed nodes. The blockchain's timestamp chain structure and consensus mechanism are used to ensure that production data is solidified and stored from the moment it is generated, eliminating the possibility of human tampering from the technical bottom level.

[0013] When adding new production batches, automatic deduplication is achieved by recursively matching the blockchain hash value to avoid duplicate records occupying storage resources, while ensuring that each batch corresponds to a unique blockchain identifier.

[0014] A multi-dimensional traceability code (such as a combination of QR code and laser code) containing a blockchain hash value is generated and bound to the packaging. Combined with association mapping technology, consumers can obtain full-chain data from raw materials to finished products with one click after scanning the code. At the same time, the laser-marked anti-counterfeiting mark can prevent packaging recycling and counterfeiting. Compared with traditional printed labels, the anti-counterfeiting performance is improved by more than 70%.

[0015] Cross-field correlation analysis of traceability data can automatically identify potential quality risks. Based on blockchain index mapping relationships, the specific production parameters and distribution paths of problematic batches can be quickly located. For example, if a batch of pre-prepared meals needs to be recalled due to foreign matter mixed in during packaging, the system can use hash identification codes to link the batch's production line number, packaging time, sales region, and other information, narrowing the recall scope to 3,000 products from a specific production line, reducing recalls by 80% compared to traditional "batch-level recalls." BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 The present invention provides a flowchart of a method for tracing the origin of pre-prepared food production batches.

[0017] Figure 2 This is a schematic diagram of a system for tracing and analyzing production batches of prepared dishes provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0019] like Figure 1 As shown, an embodiment of the present invention provides a method for tracing and analyzing the production batches of prepared dishes, comprising: Step 1: Acquire multi-dimensional production information generated during the pre-prepared meal production process, and structure the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information; Step 2: Optimize the field arrangement of the original data set based on a genetic algorithm, determine the optimal field arrangement and combination through dynamic iterative calculation, and concatenate each data element according to the optimized field order to generate a long string with dynamic optimization characteristics; Step 3: Perform a hash digest operation on the long string generated in step 2, and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch; Step 4: Write the hash identification code generated in step 3 into the distributed nodes of the blockchain database, construct a storage time series record based on the timestamp chain structure, and establish an index mapping relationship between the hash identification code and the original data set; Step 5: When a new production batch is added, the hash identification code in the blockchain is recursively matched to remove duplication and create a new block. A multi-dimensional traceability code containing an anti-counterfeiting mark is generated and laser-marked to bind it to the pre-prepared food packaging and build an associated map. In response to the scanning request, the hash identification code is extracted for verification and full-dimensional production chain data traceability query is implemented. Finally, an analysis report is generated for the multi-dimensional association analysis of the returned data.

[0020] In this embodiment, by structuring and organizing multi-dimensional data such as raw material procurement, processing parameters, quality inspection records, and packaging information, a raw data set covering the entire production chain is constructed, addressing the data fragmentation problem across multiple links in traditional traceability systems. For example, heterogeneous data such as raw material supplier qualifications, processing equipment operating parameters, and cold chain transportation temperature and humidity curves can be linked in real time to form a complete production "digital archive," allowing a single quality issue to be traced back to a specific link (e.g., excessive veterinary drug residue in a batch of chicken raw materials → identifying the supplier → tracing the flow of raw materials from the same batch).

[0021] Dynamic iterative calculations based on genetic algorithms overcome the limitations of traditional traceability systems' static field design. By adaptively adjusting the order of data fields, the system can optimize the data structure in real time based on production process changes (such as the addition of a sterilization step), ensuring the integrity and timeliness of traceability information. For example, when a new type of quick-freezing equipment is introduced, the system can automatically prioritize the "quick-freezing temperature-duration-equipment number" fields to prevent the omission of key parameters.

[0022] The optimized fields are concatenated into a long string in the optimal order, forming a data carrier with "dynamic fingerprint" characteristics. This technology not only improves data retrieval efficiency (the closer the field arrangement is to business logic, the faster the query response is by 30%-50%), but also strengthens the traceability priority of key data by assigning field weights (for example, quality inspection results fields are given higher weight than packaging information fields), achieving "data sorting on demand and targeted tracing."

[0023] A unique digital fingerprint is generated through hash summary calculations, and the hash identification code is written into the blockchain's distributed nodes. The blockchain's timestamp chain structure and consensus mechanism are used to ensure that production data is solidified and stored from the moment it is generated, eliminating the possibility of human tampering from the technical bottom level.

[0024] When adding new production batches, automatic deduplication is achieved by recursively matching the blockchain hash value to avoid duplicate records occupying storage resources, while ensuring that each batch corresponds to a unique blockchain identifier.

[0025] A multi-dimensional traceability code (such as a combination of QR code and laser code) containing a blockchain hash value is generated and bound to the packaging. Combined with association mapping technology, consumers can obtain full-chain data from raw materials to finished products with one click after scanning the code. At the same time, the laser-marked anti-counterfeiting mark can prevent packaging recycling and counterfeiting. Compared with traditional printed labels, the anti-counterfeiting performance is improved by more than 70%.

[0026] Cross-field correlation analysis of traceability data can automatically identify potential quality risks. Based on blockchain index mapping relationships, the specific production parameters and distribution paths of problematic batches can be quickly located. For example, if a batch of pre-prepared meals needs to be recalled due to foreign matter mixed in during packaging, the system can use hash identification codes to link the batch's production line number, packaging time, sales region, and other information, narrowing the recall scope to 3,000 products from a specific production line, reducing recalls by 80% compared to traditional "batch-level recalls."

[0027] In a preferred embodiment of the present invention, step 1 is to obtain multi-dimensional production information generated during the production of pre-prepared dishes, and to structure and organize the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information, including: By connecting with the supplier's management system, we automatically obtain raw material purchase orders (such as name, specification, batch, and purchase date) and logistics transportation records (such as transportation time, vehicle, temperature and humidity). For paper documents (such as quality inspection reports), we use scanning and recognition tools to extract key information (such as test results and expiration date).

[0028] Cold chain raw material traceability: For raw materials such as frozen meat, the electronic tags on the packaging (such as RFID tags) are read through handheld scanning devices to obtain breeding and slaughtering information (such as livestock and poultry numbers and quarantine certificates).

[0029] Processing parameter collection: Production equipment data: Install sensors on processing equipment (such as steamers, fryers, and quick freezers) to collect operating parameters in real time, such as: cooking temperature, pressure and duration; The oil temperature and frying time of the fryer; The temperature of the quick freezer and the time it takes for the product to reach freezing standards.

[0030] Retrofitting old equipment: If the equipment does not have an intelligent interface, install a simple sensor module (such as a temperature transmitter) to send data to the management system via wireless transmission.

[0031] Quality inspection record collection: Laboratory testing: Connect to the laboratory management system to automatically synchronize the inspection results of incoming raw materials, semi-finished products and finished products (such as microorganisms, heavy metals, and sensory indicators).

[0032] Online detection: Through metal detectors, weight sorters and other equipment, the detection results (such as whether there are foreign objects and whether the weight of a single package is qualified) are recorded in real time, and an alarm is automatically triggered when an abnormality occurs.

[0033] Packaging information collection: Production line data: Obtain packaging time (accurate to the second), production line number, and packaging material batch (such as carton batch number) from the packaging equipment system.

[0034] Coding and inspection: A traceability code is generated by a laser coding machine, and visual inspection equipment is used to check the appearance of the packaging (such as whether the label is skewed or the seal is tight) and record any defects.

[0035] Key steps in data structuring: 1. Data cleaning and standardization Deduplication and gap filling: Duplicate records are eliminated (such as multiple purchase orders in the same batch). For missing data (such as lost logistics temperature and humidity records), the missing data is reasonably supplemented based on the data from previous and subsequent time points (such as filling with temperature and humidity values from similar time periods).

[0036] Unified standards: Convert data from different sources into a unified format, such as: The temperature unit is unified as ℃; The date format is unified as "year-month-day hour:minute:second"; The names of raw materials are named according to national standards (such as "chicken breast" instead of simply "chicken").

[0037] Data association and integration: The batch number is the core identifier: a unique number is assigned to each production batch (such as "20250427-03-001", which includes the date, production line, and serial number) as the "key" to connect the raw material, processing, quality inspection, and packaging data.

[0038] Cross-link data concatenation: For example, the procurement source of a batch of raw materials (such as supplier A), the equipment used in processing (such as fryer X-08), quality inspection results (such as microbiological qualification), packaging time (such as February 20, 2025 14:15) and other information are integrated into a complete production record through batch numbers.

[0039] Data classification storage: Structured data storage: Store standardized tabular data (such as raw material batches and processing temperatures) in the database for quick and easy query (such as retrieving all production parameters by batch number).

[0040] File-based data storage: Store quality inspection reports, equipment monitoring videos and other files separately, and create indexes by batch number (such as "Batch 20250427-03-001 corresponds to the quality inspection report PDF file").

[0041] In a preferred embodiment of the present invention, step 2, optimizing the field arrangement of the original data set based on a genetic algorithm, determining the optimal field arrangement and combination through dynamic iterative calculation, and concatenating the data elements according to the optimized field order to generate a long string with dynamic optimization characteristics, includes: Step S2.1 extracts a set of core fields to be sorted from the original dataset based on production process characteristics and establishes a dependency weight matrix between fields. This involves analyzing the production process of pre-prepared dishes and identifying fields critical to traceability and quality control. For example, in the raw material procurement process, core fields might include the raw material batch number and supplier name; in the processing process, the processing equipment number and processing time; in the quality inspection process, the quality inspection results and the quality inspector ID; and in the packaging process, the packaging date and packaging specifications. These core fields are extracted from the original dataset to form a set of core fields to be sorted.

[0042] Determine the inherent connections and mutual influence between fields. For example, there may be a correlation between the raw material batch number and the quality of the processed product, as different batches of raw materials may have different qualities, which in turn affects the final product. Based on the closeness of this correlation, assign corresponding weights to construct a dependency weight matrix between fields. If two fields are closely correlated, the weight is high; if the correlation is weak, the weight is low.

[0043] By focusing on core fields, we avoid processing large amounts of irrelevant data and improve the efficiency of subsequent calculations. At the same time, the dependency weight matrix provides an important reference for the subsequent optimization of the genetic algorithm, enabling the algorithm to more specifically find the optimal field combination and improve the accuracy of the optimization.

[0044] Step S2.2, calculating the fitness function value based on the field sensitivity factor and the data tampering risk coefficient; Step S2.3 randomly generates N sets of field permutations as the initial population, with each permutation corresponding to a chromosome encoding of the field sequence. A two-point crossover strategy is used to swap parent chromosome segments, and the offspring field sequence is locally reversed based on a preset mutation probability. When the fitness function value volatility falls below a threshold ε over K consecutive iterations, the final field permutation is output. This specifically involves randomly generating N sets of field permutations, each encoded as a chromosome, with each gene on the chromosome corresponding to a field sequence. For example, a chromosome encoding might be "production timestamp - raw material batch number - processing equipment number - operator ID."

[0045] Crossover: Using a two-point crossover strategy, two parent chromosomes are selected from the initial population. Two random crossover points are then randomly selected. The chromosome segments between these two crossover points are swapped to generate a daughter chromosome. For example, if parent chromosome A consists of "production timestamp - raw material batch number - processing equipment number - operator ID" and parent chromosome B consists of "processing equipment number - operator ID - production timestamp - raw material batch number", the crossover point is chosen between the second and third genes. After the swap, the resulting daughter chromosome consists of "production timestamp - operator ID - processing equipment number - raw material batch number".

[0046] Mutation operation: Based on the preset mutation probability, the order of the fields in the offspring chromosome is partially reversed. For example, if the offspring chromosome "production timestamp - operator ID - processing equipment number - raw material batch number" mutates, it may become "production timestamp - processing equipment number - operator ID - raw material batch number".

[0047] Termination condition judgment: In each iteration, the fitness function value of each chromosome is calculated. When the volatility of the fitness function value in K consecutive iterations is lower than the threshold ε, it means that the algorithm has converged, and the current final field combination is output.

[0048] The iterative optimization process of the genetic algorithm automatically searches for the optimal field permutation and combination. Through crossover and mutation operations, it increases population diversity and prevents the algorithm from falling into local optimal solutions. The resulting optimal field permutation and combination better adapts to production processes and data security requirements, improving data organization and management efficiency.

[0049] Step S2.4, based on the optimized field order, the data values corresponding to each field are standardized and spliced in the format of "field label: data value|", and a unique separator is inserted to generate a long string for hash calculation, wherein the field label order dynamically adapts to the optimal permutation and combination; the field permutation and combination includes the dynamic sequence configuration of the production timestamp, raw material batch number, processing equipment number, and operator ID, specifically including: according to the optimized field order, the data values corresponding to each field are spliced in the format of "field label: data value|". For example, the optimized field order is "production timestamp - raw material batch number - processing equipment number - operator ID", and the corresponding data values are "2025-04-27 10:00:00", "2025042701", "003", and "001". The concatenated string is "production timestamp: 2025-04-27 10:00:00 | raw material batch number: 2025042701 | processing equipment number: 003 | operator ID: 001 |". A unique separator is inserted in the concatenated string to facilitate subsequent hash calculation.

[0050] The generated long string features dynamic optimization, with the order of its field labels dynamically adapted based on the optimal permutation. This standardized concatenation method makes the data more standardized, facilitating subsequent hash digest operations while also facilitating data traceability and querying. By dynamically optimizing the field arrangement, the characteristics of the production process and the inherent relationships of the data are better reflected, improving data readability and maintainability.

[0051] In a preferred embodiment of the present invention, step S2.2, calculating the fitness function value based on the field sensitivity factor and the data tampering risk coefficient, includes: Step S2.2.1: Based on the historical food safety incident database, classify the incidents by field type and define a severity level for each type of incident, including three levels: minor anomaly, general defect, and serious hazard, and assign each level a severity weight value that increases step by step. For each historical event associated with the field, integrate the attenuation coefficient according to the time interval between the event occurrence time and the current production batch, so that the severity weight value of the recent event is higher than that of the earlier event, and accumulate the weighted severity sum of all events. Based on the real-time detection data of the current production batch, dynamically correct the frequency of historical events to obtain the corrected frequency value. Normalize the weighted accumulated severity sum and the corrected frequency value, map them to the preset sensitivity range, and generate a dynamic sensitivity factor, which specifically includes: Event classification and severity weight setting, calculation process: Classification example: Group historical events by the link to which the fields belong. For example, in the raw material procurement category, events related to the "raw material batch number" and "supplier qualification" fields can be grouped, such as "mixed raw material batches leading to the mixing of foreign matter" and "falsification of supplier quality inspection reports."

[0052] Processing process: Events associated with the "processing temperature" and "processing time" fields, such as "insufficient sterilization temperature leads to excessive microorganisms" and "frying time is too short, resulting in undercooked products."

[0053] Severity rating and weighting: Minor anomalies (such as label printing errors): The weight is set to low (for example, 1-3 points).

[0054] General defects (such as microorganisms close to exceeding the limit): the weight is set to medium (for example, 4-6 points).

[0055] Serious hazards (such as excessive heavy metals, positive pathogenic bacteria): The weight is set to high (for example, 7-10 points).

[0056] For example, the incident of "falsification of supplier qualifications" is a serious hazard and is weighted as 10 points; "missing processing temperature records" is a general defect and is weighted as 5 points.

[0057] Through classification and weight setting, the system can quickly identify the field types that have the greatest impact on food safety (for example, serious incidents involving raw materials have higher weights), preventing secondary fields from interfering with the optimization priority of core data.

[0058] The fusion attenuation coefficient is used to calculate the weighted severity sum. The calculation process is: Mapping of time interval and decay coefficient: Set a time window (such as the past year) and assign an attenuation coefficient based on the time between the event and the current batch. The principle is "the closer the time, the greater the impact."

[0059] example: Event occurs within 1 month: decay factor 0.9 (high impact).

[0060] Event occurred 3 months ago: Decrease coefficient 0.6 (medium impact).

[0061] Event occurred 1 year ago: Decrease factor 0.1 (low impact).

[0062] Weighted sum: For each historical event associated with a field, the weighted value of a single event is calculated using "event severity weight × attenuation coefficient", and then the weighted values of all events are accumulated to obtain the total weighted severity of the field.

[0063] Example: The field "Processing Temperature" is associated with two events: Event A (serious harm, weight 10 points, occurred 1 month ago): 10×0.9=9 points.

[0064] Event B (general defect, weight 5 points, occurred 6 months ago): 5 × 0.3 = 1.5 points.

[0065] Weighted total = 9 + 1.5 = 10.5 points.

[0066] Recent events have a higher reference value for current production (for example, the recent frequent abnormal processing temperatures require priority processing). The attenuation coefficient mechanism avoids the interference of outdated data on current risk assessment, making the weight calculation more in line with actual security threats.

[0067] Dynamically correct the frequency of historical events, calculation process: Real-time data-driven frequency adjustment: Extract real-time inspection data of the current production batch (such as the number of processing temperature fluctuations and raw material quality inspection failure rates collected by sensors) and compare it with the frequency of historical events.

[0068] If real-time data indicates an increasing trend in a certain type of problem (e.g., the number of processing temperature fluctuations is 30% higher than the historical average), the historical event frequency value associated with that field is increased proportionally.

[0069] For example, the field "Processing Temperature" has an average of 2 abnormal events per month. Real-time detection of the current batch shows that the number of fluctuations reaches 5 times / month. The corrected frequency value = 2×(5 / 2) = 5 times / month (i.e., the frequency increases by 2.5 times).

[0070] Real-time data reflects the latest risks at the production site (such as unstable temperature control due to aging equipment). Dynamic correction frequency avoids the lag of relying on "static historical data" and makes sensitivity assessment more closely aligned with current production status.

[0071] Normalization processing generates dynamic sensitivity factors. The calculation process is: Data range mapping: Scale the "weighted severity sum" and "corrected frequency value" of all fields to a preset range (such as 0-100) so that the sensitivity of different fields can be directly compared.

[0072] example: The weighted sum of the field "Raw Material Batch Number" is 15 points, the frequency is corrected to 4 times / month, and the normalized score is 90 (high sensitivity). The weighted sum of the field "Packaging Date" is 3 points, the frequency is corrected to 1 time / month, and the normalized score is 20 (low sensitivity). Finally, the dynamic sensitivity factor of each field is generated (such as raw material batch number: 90, processing temperature: 85, packaging date: 20).

[0073] Step S2.2.2 calculates the dynamic tampering risk coefficient based on the number of records where the field has been tampered within a preset time window and the time decay function of the tampering event occurrence time, specifically including: Preset time window and tampering statistics, calculation process: Set the time window: Based on the industry's data security management requirements, a time range (such as the past 3 months or the past 1 year) is preset to screen effective tampering incidents.

[0074] For example, a company sets the time window to the past 6 months and only counts tampering events that occurred between January 1, 2025 and the current date (April 27, 2025).

[0075] Field-level tampering record statistics: Extract tampering records for each field from the data audit log (such as manual modification of raw material batch numbers and deletion of abnormal processing temperature data) and count them by field classification.

[0076] example: The field "Raw Material Batch Number" was tampered with twice in the past six months, and the field "Processing Temperature" was tampered with five times in the past six months.

[0077] The time window filters out outdated tampering events (such as operations from one year ago) and focuses on recent data security threats, making risk assessment more in line with current system protection needs.

[0078] Introduce the time decay function to adjust the tampering effect. The calculation process is: Define the time decay rule: The time window is divided into multiple sub-intervals, each of which corresponds to a different attenuation factor. The principle is "the closer the time, the higher the factor."

[0079] example: In the past month: attenuation factor 0.9 (high impact); 1-3 months ago: attenuation factor 0.7 (medium impact); 3-6 months ago: attenuation factor 0.5 (low impact).

[0080] Calculation of the impact of a single event: For each tampering event, the "weighted tampering count" of the event is obtained by multiplying it by the corresponding attenuation factor according to the subinterval to which its occurrence time belongs.

[0081] Example: Distribution of 5 tampering events for the field "Processing Temperature": Event A (within the past month): 1 time × 0.9 = 0.9 weighted value.

[0082] Event B (2 months ago): 2 times × 0.7 = 1.4 times weighted value.

[0083] Event C (5 months ago): 2 times × 0.5 = 1.0 weighted value.

[0084] Total weighted tampering times = 0.9 + 1.4 + 1.0 = 3.3 times.

[0085] The attenuation function simulates the objective law that "the risk of data tampering decreases over time" (for example, recent tampering may reflect the current existence of vulnerabilities in the system), avoiding overestimation of current risks due to accidental events in the past.

[0086] Generate dynamic tampering risk coefficient, calculation process: Normalization processing: Map the "total weighted tampering times" of all fields to a preset risk range (such as 0-100), where a higher value indicates a higher risk.

[0087] example: The total weighted number of times for the field "Processing Temperature" is 3.3 times, and after normalization, it scores 85 points (high risk).

[0088] The total weighted number of times the field "Raw Material Batch Number" occurs is 2 times (assuming that all occurred in the past month, the weighted number = 2 × 0.9 = 1.8 times), and after normalization, it scores 60 points (medium risk).

[0089] Finally, the dynamic tampering risk coefficient of each field is obtained (such as processing temperature: 85, raw material batch number: 60).

[0090] Normalization eliminates the differences in the absolute values of the number of tampering times for different fields (for example, high-frequency operation fields may be tampered with more times), making the risk coefficient comparable across fields and facilitating the system's identification of key data that is "relatively easier to tamper with" (for example, processing temperature parameters involve the core of the process, and the risk of tampering is significantly higher than that of raw material batch numbers).

[0091] Recent tampering incidents contribute more to risk assessment, comply with the data security principle of "timely response", convert the abstract "possibility of tampering" into specific values, support genetic algorithms to sort fields by risk (such as high-risk fields are prioritized at the front of the hash string to enhance data verification priority), and through the abnormal increase in the risk factor of frequently tampered fields (such as processing temperature), quickly locate weak links in system protection (such as the lack of strict control over the equipment parameter modification permissions of a certain production line), assisting enterprises in strengthening data encryption or permission management in a targeted manner.

[0092] Step S2.2.3, weighting and summing the dynamic sensitivity factor and the dynamic tampering risk coefficient according to a preset security weight ratio. The result of the weighted summation specifically includes: the preset security weight ratio, the calculation process: Weight setting logic: Based on the company's emphasis on data security and traceability, weight ratios are assigned to the dynamic sensitivity factor (representing the impact of the field on food safety) and the dynamic tampering risk coefficient (representing the possibility of the field being tampered with).

[0093] Example 1: A company takes "food safety first" as its guideline and sets the sensitivity factor weight to 70% and the tampering risk factor weight to 30%.

[0094] Example 2: A company has recently experienced frequent data tampering incidents, so the sensitivity factor weight is adjusted to 50% and the tampering risk coefficient weight is adjusted to 50%.

[0095] The weight ratio can be flexibly adjusted to adapt to the management objectives of different stages (such as focusing on sensitivity during the regulatory compliance period and focusing on tampering risks during the system security reinforcement period), avoiding "one-size-fits-all" assessment bias.

[0096] Item product calculation, calculation process: Field-level weight assignment: For each field, its dynamic sensitivity factor is multiplied by the sensitivity weight, and the dynamic tampering risk coefficient is multiplied by the tampering risk weight. Through weight distribution, the abstract "importance" is converted into a calculable value, making the risks of different dimensions (impact degree vs. tampering probability) additive, which facilitates subsequent comprehensive evaluation.

[0097] The weighted summation is used to obtain the comprehensive value. The calculation process is: Field-level comprehensive evaluation: Add the products of the two sub-items of each field to obtain the weighted sum result (comprehensive value) of the field.

[0098] Example: The combined processing temperature value = 59.5 (sensitivity product) + 25.5 (tampering risk product) = 85.

[0099] The comprehensive value of the raw material batch number = 63 (sensitivity product) + 18 (tampering risk product) = 81.

[0100] Cross-field comparison: The higher the comprehensive value, the higher the priority of the field in the comprehensive dimension of "security importance + tampering risk".

[0101] Comprehensive numerical values avoid the one-sidedness of single-dimensional assessments (e.g., a field with high sensitivity but low tamper risk, or vice versa). For example, while "Processing Temperature" has both high sensitivity and high tamper risk (comprehensive score of 85), it should be prioritized. However, "Raw Material Batch Number" has higher sensitivity but lower tamper risk (comprehensive score of 81), so its priority is slightly lower, reflecting a balance between risk and impact.

[0102] The same field can be re-evaluated through weight adjustment at different times (such as changing suppliers or upgrading equipment) to ensure that the optimization strategy is iterated as business needs change, providing clear numerical optimization goals for subsequent steps (such as prioritizing fields with high comprehensive values at the front of long strings to improve the sensitivity of hash checks), and avoiding blind searches of the algorithm in invalid combinations.

[0103] Step S2.2.4, multiplying the weighted summation result by the Gaussian weight coefficient to output the fitness function value, specifically including: Definition and setting of Gaussian weight coefficient, calculation process: Gaussian weight coefficient meaning: The Gaussian weight coefficient is a manually adjustable value (usually in the range of 0.8-1.2). It acts like a "tuning knob" to enlarge or reduce the overall numerical range of the weighted summation result, so that the fitness function value is more in line with the algorithm optimization requirements.

[0104] For example, when you need to emphasize the difference in field importance, set it to 1.1 (magnify the numerical difference); when you need to balance the field priority, set it to 1.0 (maintain the original value); when you need to reduce the impact of extreme values, set it to 0.9 (narrow the numerical difference).

[0105] By presetting coefficients, the sensitivity of the fitness function can be flexibly controlled to avoid overly concentrated weighted summations (e.g., most fields have a combined value between 70 and 80), which can make it difficult for the genetic algorithm to distinguish between superior and inferior individuals. High-priority fields (e.g., processing temperature) have significantly higher fitness values than low-priority fields (e.g., packaging date), guiding the genetic algorithm to prioritize chromosomes containing permutations of high-value fields. Adjusting the coefficients in real time (e.g., from 1.0 to 1.1) based on the algorithm's operating status prevents regression into local optimal solutions and improves global search efficiency.

[0106] The fitness function value directly determines the "survival probability" of the chromosome (field combination): the higher the value, the easier it is to be selected as the parent to reproduce offspring; the lower the value, the more likely it is to be eliminated; for example: when selecting the parent, the combination of processing temperature (93.5) and raw material batch number (89.1) has a much higher probability of being selected than the combination of packaging date (22), thereby driving the population to evolve towards high fitness.

[0107] By fine-tuning the Gaussian coefficient, the fitness value can more accurately reflect the company's current optimization goals (such as "anti-tampering priority" or "traceability accuracy priority"), avoiding algorithm misjudgments due to numerical deviations, amplifying the fitness differences of high-priority fields, and reducing the number of algorithm iterations (for example, originally 100 generations of convergence are now only 60 generations after adjustment), thereby improving optimization efficiency. This is particularly suitable for the rapid response needs in real-time production environments.

[0108] In a preferred embodiment of the present invention, step 3 performs a hash digest operation on the long string generated in step 2, generates a fixed-length digital fingerprint using a preset one-way encryption algorithm, and forms a unique hash identification code for the production batch, including: Step 3.1: Based on the dynamic field arrangement characteristics of the long string generated in Step 2, extract the character distribution density of the preset sensitive fields and the offset position of the key fields in the string, and generate an auxiliary check code. Specifically, based on the field arrangement optimized in Step 2, determine the sensitive fields (such as raw material batch number, processing temperature) and key fields (such as production timestamp, quality inspection results).

[0109] For example, the long string is "Production timestamp: 2025-04-27 10:00:00 | Raw material batch number: 2025042701 | Processing temperature: 175°C | Operator ID: 001 |", where "Raw material batch number" and "Processing temperature" are sensitive fields.

[0110] Calculate character distribution density Count the types and frequencies of characters in sensitive fields (such as the proportion of numbers, letters, and symbols).

[0111] For example, the raw material batch number "2025042701" consists of 10 digits, and the character density is "digits 100%"; the processing temperature "175℃" contains digits and symbols, and the density is "digits 80%, symbols 20%".

[0112] Record key field offset position Extract the starting and ending positions of the key field in the long string (expressed as character index).

[0113] For example: the production timestamp starts from the 1st digit and ends at the 20th digit; the raw material batch number starts from the 21st digit and ends at the 31st digit.

[0114] Encoding auxiliary check code Convert density and offset position information into a short string (e.g., letters for density level and numbers for position).

[0115] For example, the raw material batch number density "digital 100%" is coded as "D10", and the offset position 21-31 is coded as "21-31", which is combined into the auxiliary check code "D10_21-31_T80_32-35" (assuming the processing temperature density is "digital 80%", position 32-35).

[0116] Data tampering detection: If a long string is tampered with, the character density or position of the sensitive field will change, and the auxiliary checksum will change accordingly, allowing for quick identification of anomalies.

[0117] Hash verification enhancement: Adds an additional verification dimension to subsequent hash operations to prevent covert tampering that only modifies non-sensitive fields.

[0118] Step 3.2, concatenate the long string with the auxiliary check code, and perform the first hash operation using a collision-resistant hash algorithm to generate an intermediate hash value, specifically including: Append the auxiliary check code to the end (or beginning) of the long string to form a new string to be hashed.

[0119] Example: Original long string + auxiliary check code = "Production timestamp: 2025-04-27 10:00:00 | Raw material batch number: 2025042701 | Processing temperature: 175°C | Operator ID: 001 | D10_21-31_T80_32-35".

[0120] Use a collision-resistant algorithm such as SHA-256 or MD5 to perform a hash operation on the concatenated strings to generate an intermediate hash value of a fixed length (such as a 32-byte hexadecimal string).

[0121] For example, the intermediate hash value might be "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2" (actually a more complex random string).

[0122] The anti-collision algorithm ensures that it is almost impossible for different inputs to generate the same hash value, prevents forged data from matching the original hash code, and converts long strings into fixed-length hash values for easy storage and transmission while retaining the uniqueness of the data.

[0123] Step 3.3: Dynamically generate a random salt value based on the environmental parameters of the current production batch, concatenate the intermediate hash value and the random salt value twice, and perform an iterative hash operation using a chained hash structure to generate the final hash digest, specifically including: Generate a random string as the salt value based on the environmental parameters of the current production batch (such as timestamp, device ID, and production line number).

[0124] Example: Timestamp "20250427100001" + device ID "P-03" generates the salt value "20250427100001P03".

[0125] Secondary concatenation and iterative hashing Concatenate the intermediate hash value and the salt value (for example, the salt value comes first, followed by the intermediate hash value), and perform multiple hash operations (for example, two or more iterations) using a chain structure. For example, the concatenated string is "20250427100001P03a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2", which is then hashed again to generate the final hash digest.

[0126] The random salt value makes the same long string generate a different hash value each time, preventing attackers from cracking it through pre-calculated rainbow tables. Multiple iterations increase the complexity of hash calculations. Even if the salt value is leaked, it is difficult to reversely deduce the original data.

[0127] Step 3.4: truncate the final hash digest and convert its characters to generate a fixed-length digital fingerprint that complies with the preset encoding rules as the unique hash identification code for the batch. Specifically, it includes: Extract a fixed-length substring (such as the first 64 bits) from the final hash digest and convert the binary or hexadecimal characters to a specified encoding (such as Base64 or pure numbers). Example: Extract the first 64 hexadecimal characters "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6" and convert them to Base64 encoding: "QTFCMkMzRDQ1RkY2c3g4STlKMFsxTDJNM040TzVQNlE3Ujg1VDBVMXYyVzNYNFlWNio=".

[0128] Ensure the final hash code has a uniform length (e.g., 64 characters) to facilitate system indexing and quick comparison. The hash code for each production batch is determined by a combination of dynamic fields, auxiliary checksums, and a random salt value, making duplication virtually impossible. The fixed length and standard encoding make the hash code adaptable to different systems (e.g., databases and blockchain nodes), improving traceability query efficiency.

[0129] In a preferred embodiment of the present invention, step 4, writing the hash identification code generated in step 3 to the distributed nodes of the blockchain database, constructing a storage time series record based on a timestamp chain structure, and establishing an index mapping relationship between the hash identification code and the original data set, includes: Step 4.1: Based on the generation timestamp of the hash identification code and the geographic location code of the production batch, a chain block header containing the time-space dual-dimensional identification is constructed, and the hash identification code is written into the main chain as the core data of the block body. Specifically, it includes: The timestamp information is extracted from the hash code generation process. This timestamp precisely records the moment the hash code was generated. Simultaneously, the geolocation code of the production batch is obtained. This code can be a specific code converted from longitude and latitude, or an administrative region code. The timestamp and geolocation code are combined to form a unique two-dimensional identifier. For example, if the timestamp is "2025-04-27 10:00:00" and the geolocation code is "CN-GD-SZ," the combined identifier might be "20250427100000-CN-GD-SZ."

[0130] Based on this two-dimensional identifier, a chained block header is constructed. The block header also includes the hash value of the previous block, forming a chained structure. For example, if the current block is the nth block, its block header will record the hash value of the n-1th block. The hash identifier is written into the main chain as the core data of the block body. Each block in the main chain is connected in chronological order, forming an immutable chain.

[0131] The dual-dimensional identification of time and space allows each block to have a clear location in time and space, facilitating subsequent query and tracing of production batch information at a specific time and place. By recording the hash value of the previous block, a chain structure is formed so that any modification of a block will cause the hash value of all subsequent blocks to change, making it easy to be discovered and ensuring the integrity and non-tamperability of the data.

[0132] Step 4.2: The original data set is encrypted and sharded according to the preset sharding rules. The sharded data address is associated with the hash identification code to generate a distributed index mapping table. The main chain only stores the hash summary of the index mapping table, and the sharded data is stored in the side chain or offline node linked to the main chain. Specifically, it includes: The original data set is split into multiple data fragments based on pre-set sharding rules. For example, sharding can be performed by data type (such as raw material information, processing information, quality inspection information, etc.) or time range. Each data fragment is encrypted using an encryption algorithm to ensure data security during storage. The encrypted sharded data is then stored on a sidechain or offline node linked to the main chain. Sidechains can provide additional processing power and storage capacity, while offline nodes can protect data privacy to a certain extent.

[0133] The storage address of each shard data is recorded and associated with a corresponding hash code. For example, if shard data 1 is stored at a specific location on sidechain node A, this location information is associated with a hash code. All associated information is organized into a distributed index mapping table. The main chain only stores the hash summary of this index mapping table, rather than the entire index mapping table, which reduces storage pressure on the main chain.

[0134] Encrypted shard storage protects the security and privacy of the original data. Even if part of the shard data is leaked, the attacker cannot obtain the complete information. Storing the shard data in the side chain or offline node reduces the storage burden of the main chain and improves the scalability of the system. The index mapping table establishes a connection between the hash identification code and the original data shard, which facilitates the subsequent rapid positioning and acquisition of the original data based on the hash code.

[0135] Step 4.3: Based on the cross-chain verification protocol, the block header hash of the main chain is bidirectionally anchored to the corresponding blocks of at least two heterogeneous blockchains to form a multi-chain interlocking tamper-proof structure, which specifically includes: Select at least two heterogeneous blockchains with different technical architectures, consensus mechanisms, or application scenarios. For example, one could be a public blockchain based on PoW (Proof of Work), while the other could be a consortium blockchain based on PBFT (Practical Byzantine Fault Tolerance).

[0136] Based on a cross-chain verification protocol, the block header hash of the main chain is bidirectionally anchored to the corresponding block on the heterogeneous blockchain. Specifically, the hash value of the corresponding block on the heterogeneous blockchain is recorded on the main chain, and the hash value of the main chain block is also recorded on the heterogeneous blockchain. This way, when a block on the main chain changes, the corresponding record on the heterogeneous blockchain will also show an anomaly, and vice versa. This multi-chain interlocking structure requires an attacker to tamper with corresponding blocks on multiple blockchains simultaneously to achieve data tampering, greatly increasing the difficulty and cost of the attack and improving data security.

[0137] In step 4.4, according to the preset access rights policy, the distribution logic of the dynamic decryption key is embedded in the index mapping table. When an external request is verified, the smart contract verifies the requester's permissions and triggers the key combination to restore the complete association between the shard data and the hash identification code. Specifically, it includes: Design the dynamic decryption key distribution logic based on the pre-set access rights policy. For example, different user roles (such as regulators, internal company personnel, and consumers) have different access rights and corresponding decryption keys. Embed this distribution logic into the index mapping table.

[0138] When an external authentication request is made, the smart contract verifies the requester's permissions. The requester must provide relevant identity information and permission credentials, and the smart contract determines whether they have access rights based on pre-set rules. If the requester's permissions are verified, the smart contract triggers a key combination, using the decryption key to restore the complete association between the sharded data and the hash identifier. This allows the requester to retrieve the original data corresponding to the hash code. Access rights policies and smart contract verification ensure that only authorized users can access the original data, protecting data privacy and security. Dynamic decryption key distribution logic allows data access rights to be adjusted based on actual conditions, improving system security and flexibility.

[0139] In a preferred embodiment of the present invention, in step 5, when a new production batch is added, the hash identification code in the blockchain is recursively matched to remove duplicates and a new block is created. A multi-dimensional traceability code containing an anti-counterfeiting mark is generated and laser-marked, bound to the pre-prepared meal packaging, and an association map is constructed. In response to a scanning request, the hash identification code is extracted for verification and a full-dimensional production chain data traceability query is implemented. Finally, an analysis report is generated for the multi-dimensional association analysis of the returned data, including: Step 5.1: When adding a new production batch, based on the hash identification code generated in step 3, a recursive traversal algorithm is used to perform a full chain match in the blockchain main chain and side chain nodes. If a duplicate hash identification code is detected, an alarm is triggered and the write permission of the current batch data is frozen. If no duplicate is detected, a new block containing a dynamic salt value and environmental parameters is created, including: For the hash identification codes generated for newly produced batches, a recursive traversal algorithm is used to check the core data (i.e., hash identification code) of each block, starting with the first block on the main blockchain. If no duplicates are found after traversing the main chain, the same recursive traversal is then performed on the side chain nodes; for example, the main chain's genesis block is checked first. If there is a mismatch, the subsequent blocks are recursively checked. This process continues until the main chain traversal is complete, at which point the same operation is repeated on each side chain.

[0140] Duplicate detection and handling: During the traversal process, if a block's hash identifier is found to be identical to the hash identifier of a newly added batch, an alert mechanism is immediately triggered, such as sending an alert message to the system administrator. At the same time, write permissions for the current batch of data are frozen to prevent duplicate data from entering the blockchain. If no duplicate hash identifiers are detected after traversing the entire blockchain (main chain and side chains), a new block is created.

[0141] New block creation: The new block contains a dynamic salt value and the environmental parameters of the current production batch. The dynamic salt value can be randomly generated based on the current time, equipment status, and other factors, and environmental parameters such as the temperature and humidity of the production workshop. This information is encapsulated in a new block along with the hash identifier of the newly added batch, and the new block is added to the blockchain.

[0142] Ensure that the hash identification code of each production batch in the blockchain is unique, avoid data duplication, ensure the accuracy and consistency of blockchain data, and promptly discover that duplicate hash identification codes may mean that the data has been tampered with or maliciously copied. Triggering alarms and freezing write permissions can effectively prevent potential security threats.

[0143] Step 5.2: Based on the hash identification code and the environmental dynamic parameters of the production batch, a multi-dimensional traceability code is generated, including a timestamp encryption segment, a geographic coordinate verification segment, and an anti-counterfeiting verification segment. This code is then irreversibly bound to the surface material of the pre-prepared meal packaging using laser marking technology. Microtexture features and invisible fluorescent codes are embedded during the marking process to create a physical-digital dual anti-counterfeiting label. Specifically, the following steps are included: Generate a multi-dimensional traceability code based on the hash identification code and the environmental dynamic parameters of the production batch.

[0144] Timestamp encryption segment: Encrypt the timestamp of the production batch, for example, by using a symmetric encryption algorithm to convert the timestamp into ciphertext as part of the encoding.

[0145] Geographic coordinate verification segment: The geographic coordinates of the production location are processed, which may include hash operations or other verification algorithms on the coordinates to generate a geographic coordinate verification segment.

[0146] Anti-counterfeiting verification segment: The anti-counterfeiting verification segment is generated by combining the hash identification code and some other random factors to verify the authenticity of the traceability code.

[0147] Laser marking and irreversible binding Laser marking technology is used to create a multi-dimensional traceability code on the surface of the pre-prepared meal packaging. During the laser marking process, the code undergoes a physical or chemical change with the packaging surface material, forming an irreversible bond.

[0148] Embedding microtexture features and invisible fluorescent codes During the laser marking process, both microtexture features and an invisible fluorescent code are embedded simultaneously. The microtexture features are unique microscopic textures formed on the packaging surface, while the invisible fluorescent code is visible only under specific lighting conditions. Together, they form a dual physical and digital anti-counterfeiting mark.

[0149] The multi-dimensional traceability code contains key information about the production batch, making it convenient for consumers and regulatory authorities to obtain relevant information about the production batch by scanning the code and achieve product traceability.

[0150] Step 5.3: In the blockchain association graph database, based on the original data addresses and cross-chain anchoring relationships stored in the shards, a dynamic association graph containing nodes of raw material suppliers, processing equipment, and quality inspectors is constructed, and the weights and abnormal status marks of the nodes in the graph are updated in real time. Specifically, In the blockchain association graph database, the nodes of the association graph are determined based on the original data addresses stored in the shards and the cross-chain anchoring relationship. Nodes include raw material suppliers, processing equipment, quality inspection personnel, etc.

[0151] Analyze the raw data and find out the relationship between each node. For example, the raw material supplier and the processing equipment are related through the raw material supply relationship, and the processing equipment and the quality inspectors are related through the product processing and inspection process. Update the weights of the nodes in the map in real time. The weights can be determined based on factors such as the importance and participation of the nodes in the production process. For example, the key raw material supplier nodes have higher weights; at the same time, mark the abnormal status of the nodes. If there are quality problems with the raw materials provided by a raw material supplier, or if a processing equipment fails, the corresponding node will be marked as abnormal. The dynamic association map can intuitively display the relationship between the various links and participants in the pre-prepared meal production process, making it convenient for managers to monitor and analyze the production process. By updating the node weights and abnormal status marks in real time, abnormal situations in the production process can be discovered in a timely manner, making it easier to take appropriate measures to deal with them and ensure product quality.

[0152] Step 5.4: In response to the user terminal scanning the laser-marked traceability code, the hash identification code is extracted and a verification request is initiated based on the smart contract. The shard data address in the associated map is decrypted using the dynamic key combination, the complete production chain data is restored, and the logical consistency of the timestamp and geographic coordinates is verified. Specifically, it includes: When a user terminal scans the laser-marked traceability code, the system extracts the hash code from the code. Based on the smart contract, the system initiates a verification request to the blockchain to verify the legitimacy of the hash code. The system then decrypts the shard data address in the associated graph using a dynamic key combination. The dynamic key combination is generated based on different access rights and request conditions, and only authorized requests can obtain the correct key combination.

[0153] According to the decrypted shard data address, the shard data is obtained from the side chain or offline node and combined to restore the complete production chain data. The logical consistency of the timestamp and geographic coordinates in the production chain data is verified. For example, the production time and transportation time are checked to see if they are reasonable, and the geographic coordinates of the production location and sales location are consistent with the actual transportation path. This ensures that the production chain data obtained by the user after scanning the traceability code is authentic, complete, and legal. This improves the credibility of the data and facilitates users to obtain full-dimensional production chain data of pre-prepared dishes by scanning the traceability code, enabling product traceability queries and enhancing consumer trust in the product.

[0154] Step 5.5: Perform multi-dimensional correlation analysis on the verified production chain data, including matching detection of raw material batches and processing parameters, abnormal propagation path analysis of process deviations, and root cause location of quality defects. A dynamic analysis report with a visual heat map, risk warning level, and improvement suggestions is generated, and recall instructions for high-risk batches are automatically triggered. Specifically, the report includes: Conduct multi-dimensional correlation analysis on verified production chain data, and detect the matching degree between raw material batches and processing parameters: analyze whether the processing parameters corresponding to different raw material batches are reasonably matched, for example, whether the characteristics of a certain raw material are compatible with the adopted processing parameters such as temperature and time, and find out how process deviations are propagated in various links during the production process, for example, how temperature anomalies in a certain processing link affect the quality of subsequent products. Through data analysis and correlation mining, determine the root cause of product quality defects, such as raw material problems, equipment failures or human operational errors.

[0155] Generate a dynamic analysis report based on the results of multi-dimensional correlation analysis. The report includes a visual heat map that directly displays the risk level of each link in the production process; a risk warning level that clearly indicates the risk level of the current production batch; and improvement suggestions that propose specific improvement measures for the problems found.

[0156] If the analysis results show that a production batch is high-risk, the system will automatically trigger a recall order and notify relevant departments and companies to recall the batch of products. Through multi-dimensional correlation analysis, we can gain an in-depth understanding of the problems and potential risks in the production process, provide companies with a basis for improving production processes and management, and improve product quality.

[0157] like Figure 2 As shown, an embodiment of the present invention further provides a system for tracing and analyzing production batches of prepared dishes, comprising: An acquisition module is used to acquire multi-dimensional production information generated during the production of pre-prepared dishes, and to structure and organize the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information; The calculation module is used to optimize the field arrangement of the original data set based on the genetic algorithm, determine the optimal field arrangement combination through dynamic iterative calculation, and splice each data element according to the optimized field order to generate a long string with dynamic optimization characteristics; A generation module is used to perform a hash digest operation on the generated long string and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch; Establish a module for writing the generated hash identification code into the distributed nodes of the blockchain database, constructing a storage time series record based on a timestamp chain structure, and establishing an index mapping relationship between the hash identification code and the original data set; The response module is used to recursively match the hash identification code in the blockchain to remove duplicates and create a new block when a new production batch is added, generate a multi-dimensional traceability code with an anti-counterfeiting mark, laser-mark it, bind it to the pre-prepared food packaging, and build an associated map, respond to scanning requests to extract the hash identification code for verification and realize full-dimensional production chain data traceability query, and finally generate an analysis report for the multi-dimensional association analysis of the returned data.

[0158] It should be noted that this system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0159] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A method for tracing the production batches of prepared dishes, characterized in that: include: Step 1: Acquire multi-dimensional production information generated during the pre-prepared meal production process, and structure the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information; Step 2: Optimize the field arrangement of the original data set based on a genetic algorithm, determine the optimal field arrangement and combination through dynamic iterative calculation, and concatenate each data element according to the optimized field order to generate a long string with dynamic optimization characteristics; Step 3: Perform a hash digest operation on the long string generated in step 2, and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch; Step 4: Write the hash identification code generated in step 3 into the distributed nodes of the blockchain database, construct a storage time series record based on the timestamp chain structure, and establish an index mapping relationship between the hash identification code and the original data set; Step 5: When a new production batch is added, the hash identification code in the blockchain is recursively matched to remove duplication and create a new block. A multi-dimensional traceability code containing an anti-counterfeiting mark is generated and laser-marked to bind it to the pre-prepared food packaging and build an associated map. In response to the scanning request, the hash identification code is extracted for verification and full-dimensional production chain data traceability query is implemented. Finally, an analysis report is generated for the multi-dimensional association analysis of the returned data.

2. The method for tracing the production batch of prepared dishes according to claim 1, characterized in that: Step 2: Optimize the field arrangement of the original data set based on a genetic algorithm. Determine the optimal field arrangement and combination through dynamic iterative calculation. Concatenate each data element according to the optimized field order to generate a long string with dynamic optimization features, including: Step S2.1, based on the production process characteristics, extract the core field set to be arranged from the original data set, and establish the dependency weight matrix between the fields; Step S2.2, calculating the fitness function value based on the field sensitivity factor and the data tampering risk coefficient; Step S2.3: Randomly generate N sets of field permutations as the initial population, with each set corresponding to the chromosome encoding of the field order. A two-point crossover strategy is used to exchange parent chromosome segments, and the offspring field order is locally reversed based on a preset mutation probability. When the fitness function value volatility is lower than the threshold ε for K consecutive iterations, the current final field permutation is output. In step S2.4, based on the optimized field order, the data values corresponding to each field are standardized and concatenated in the format of "field label: data value|", and a unique separator is inserted to generate a long string for hash calculation, where the field label order is dynamically adapted to the optimal permutation and combination.

3. The method for tracing the production batch of prepared dishes according to claim 2, characterized in that: The field arrangement and combination includes a dynamic sequential configuration of a production timestamp, a raw material batch number, a processing equipment number, and an operator ID.

4. The method for tracing the production batch of prepared dishes according to claim 3, characterized in that: Step S2.2, calculating the fitness function value based on the field sensitivity factor and the data tampering risk coefficient, including: Step S2.2.1: Based on the historical food safety incident database, classify the incidents by field type and define a severity level for each type of incident, including three levels: minor anomaly, general defect, and serious hazard, and assign each level a severity weight value that increases step by step; for each historical event associated with the field, fuse the attenuation coefficient according to the time interval between the event occurrence time and the current production batch, so that the severity weight value of the recent event is higher than that of the earlier event, and accumulate the weighted severity sum of all events; based on the real-time detection data of the current production batch, dynamically correct the frequency of historical events to obtain the corrected frequency value; normalize the weighted accumulated severity sum and the corrected frequency value, map them to the preset sensitivity range, and generate a dynamic sensitivity factor; Step S2.2.2, calculating the dynamic tampering risk coefficient based on the number of records where the field has been tampered within a preset time window and the time decay function of the tampering event occurrence time; Step S2.2.3, performing weighted summation of the dynamic sensitivity factor and the dynamic tampering risk coefficient according to a preset security weight ratio, and obtaining the result of the weighted summation; In step S2.2.4, the weighted summation result is multiplied by the Gaussian weight coefficient, and the fitness function value is output.

5. The method for tracing the production batch of prepared dishes according to claim 4, characterized in that: Step 3: Perform a hash digest operation on the long string generated in step 2, and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch, including: Step 3.1: Based on the dynamic field arrangement characteristics of the long string generated in step 2, extract the character distribution density of the preset sensitive fields and the offset position of the key fields in the string to generate an auxiliary check code; Step 3.2, concatenate the long string and the auxiliary check code, and perform a first hash operation using a collision-resistant hash algorithm to generate an intermediate hash value; Step 3.3: Dynamically generate a random salt value based on the environmental parameters of the current production batch, concatenate the intermediate hash value and the random salt value twice, and perform an iterative hash operation using a chained hash structure to generate a final hash digest; In step 3.4, the final hash summary is length-truncated and character-converted to generate a fixed-length digital fingerprint that complies with the preset encoding rules as the unique hash identification code for the batch.

6. The method for tracing the production batch of prepared dishes according to claim 5, characterized in that: Step 4: Write the hash identification code generated in step 3 to the distributed nodes of the blockchain database, construct a storage time series record based on the timestamp chain structure, and establish an index mapping relationship between the hash identification code and the original data set, including: Step 4.1: Based on the generation timestamp of the hash identification code and the geographic location code of the production batch, a chain block header containing the time-space dual-dimensional identification is constructed, and the hash identification code is written into the main chain as the core data of the block body; Step 4.2: The original data set is encrypted and sharded according to the preset sharding rules. The sharded data address is associated with the hash identification code to generate a distributed index mapping table. The main chain only stores the hash summary of the index mapping table, and the sharded data is stored in the side chain or offline node linked to the main chain. In step 4.3, based on the cross-chain verification protocol, the block header hash of the main chain is bidirectionally anchored to the corresponding blocks of at least two heterogeneous blockchains to form a multi-chain interlocking tamper-proof structure; In step 4.4, according to the preset access permission policy, the distribution logic of the dynamic decryption key is embedded in the index mapping table. When an external request is verified, the requester's authority is verified through the smart contract and the key combination is triggered to restore the complete association between the shard data and the hash identification code.

7. The method for tracing the production batch of prepared dishes according to claim 6, characterized in that: Step 5: When a new production batch is added, the hash identification code in the blockchain is recursively matched to remove duplicates and create a new block. A multi-dimensional traceability code with an anti-counterfeiting mark is generated and laser-marked, bound to the pre-prepared meal packaging, and an association map is constructed. In response to the scanning request, the hash identification code is extracted for verification and a full-dimensional production chain data traceability query is implemented. Finally, an analysis report is generated for the multi-dimensional association analysis of the returned data, including: Step 5.1: When adding a new production batch, based on the hash identification code generated in step 3, a recursive traversal algorithm is used to perform a full chain match in the blockchain main chain and side chain nodes. If a duplicate hash identification code is detected, an alarm is triggered and the write permission of the current batch data is frozen. If no duplicate is detected, a new block containing the dynamic salt value and environmental parameters is created; Step 5.2: Based on the hash identification code and the environmental dynamic parameters of the production batch, a multi-dimensional traceability code is generated, including a timestamp encryption segment, a geographic coordinate verification segment, and an anti-counterfeiting verification segment. This code is then irreversibly bound to the surface material of the pre-prepared meal packaging using laser marking technology. Microtexture features and an invisible fluorescent code are also embedded during the marking process, creating a physical-digital dual anti-counterfeiting mark. Step 5.3: In the blockchain association graph database, based on the original data addresses and cross-chain anchoring relationships stored in the shards, a dynamic association graph containing nodes of raw material suppliers, processing equipment, and quality inspectors is constructed, and the weights and abnormal status marks of the nodes in the graph are updated in real time; Step 5.4: In response to the user terminal scanning the laser-marked traceability code, the hash identification code is extracted and a verification request is initiated based on the smart contract. The shard data address in the associated map is decrypted using the dynamic key combination, the complete production chain data is restored, and the logical consistency of the timestamp and geographic coordinates is verified; In step 5.5, a multi-dimensional correlation analysis is performed on the verified production chain data, including matching detection between raw material batches and processing parameters, abnormal propagation path analysis of process deviations, and root cause location of quality defects. A dynamic analysis report is generated with a visual heat map, risk warning level, and improvement suggestions, and recall instructions for high-risk batches are automatically triggered.

8. A system for tracing and analyzing the production batches of prepared dishes, characterized in that: The system is used to perform the method according to any one of claims 1 to 7, comprising: An acquisition module is used to acquire multi-dimensional production information generated during the production of pre-prepared dishes, and to structure and organize the production information to generate an original data set containing raw material procurement data, processing parameters, quality inspection records, and packaging information; The calculation module is used to optimize the field arrangement of the original data set based on the genetic algorithm, determine the optimal field arrangement combination through dynamic iterative calculation, and splice each data element according to the optimized field order to generate a long string with dynamic optimization characteristics; A generation module is used to perform a hash digest operation on the generated long string and generate a fixed-length digital fingerprint using a preset one-way encryption algorithm to form a unique hash identification code for the production batch; Establish a module for writing the generated hash identification code into the distributed nodes of the blockchain database, constructing a storage time series record based on a timestamp chain structure, and establishing an index mapping relationship between the hash identification code and the original data set; The response module is used to recursively match the hash identification code in the blockchain to remove duplicates and create a new block when a new production batch is added, generate a multi-dimensional traceability code with an anti-counterfeiting mark, laser-mark it, bind it to the pre-prepared food packaging, and build an associated map, respond to scanning requests to extract the hash identification code for verification and realize full-dimensional production chain data traceability query, and finally generate an analysis report for the multi-dimensional association analysis of the returned data.

9. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, which, when executed by a processor, implements the method according to claims 1 to 7.

Citation Information

Cited By

  • Video job record tracing system and method based on order information association

    CN120807108A

  • Video job record tracing system and method based on order information association

    CN120807108B

  • Premade dish tracing method, system and equipment

    CN120851908A

  • Tracing method for smart phone maintenance process based on big data management

    CN121051802A

  • A method for tracing a smartphone repair process based on big data management

    CN121051802B