A food traceability system and a food traceability method

By attaching a receiving timestamp to the handover evidence and performing unified time processing at the edge IoT gateway of the food handover point, a handover credential is generated, which solves the problem of conflicting handover evidence under edge IoT conditions, realizes the verifiability of handover evidence and the determination of responsibility boundaries, and improves the reliability of the food traceability system.

CN122434546APending Publication Date: 2026-07-21NAILI (LIAONING) BIOTECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NAILI (LIAONING) BIOTECHNOLOGY CO LTD
Filing Date
2026-04-14
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Under edge IoT conditions, conflicting evidence at food handover points makes verification difficult, leading to difficulties in determining the boundaries of responsibility. Existing technologies cannot complete rapid handover of multiple batches and pallets within short-stop loading and unloading windows, and inconsistent temperature control recording time bases result in conflicting evidence provided by various parties after an accident, making verification impossible.

Method used

By attaching a receiving timestamp to the multi-source handover evidence at the handover point by the edge IoT gateway and performing unified time processing, a handover credential containing an object consistency marker and a passage completion marker is generated and uploaded to the central traceability platform to output a handover success or failure indicator.

Benefits of technology

It provides verifiable handover evidence, eliminates conflicts in handover interfaces, improves the determinability of responsibility boundaries, reduces evidence alignment errors caused by inconsistent time bases, suppresses object enumeration disputes caused by missed scans, supplementary scans, and substitute scans, improves the consistency of handover completion determination, and enhances retrieval and verification efficiency in disputed scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122434546A_ABST
    Figure CN122434546A_ABST
Patent Text Reader

Abstract

The application discloses a kind of food traceability system and food traceability method, specifically related to food traceability and edge data processing field of thing connection, including in handover start, obtain target object identification set in delivery order and target quantity field, and by handover point edge thing internet gateway record starting time stamp and end time stamp of handover window, output handover window data;In handover window, at least two kinds of independent edge thing connection acquisition source are collected respectively, and handover evidence is collected, wherein the first acquisition source outputs object identification set and corresponding acquisition time stamp sequence, and the second acquisition source outputs passage state value sequence and corresponding acquisition time stamp sequence.Interchange evidence chain is formed with handover window data, original evidence data, uniform time evidence and handover voucher, and establishment determination value is formed with object consistent mark and passage completion mark, so that whether handover is established has reviewable basis, to relatively alleviate handover interface conflict and improve responsibility boundary determinability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of food traceability and edge IoT data processing technology, and more specifically, to a food traceability system and a food traceability method. Background Technology

[0002] In the field of food traceability, the mainstream practice in the industry is to solve the problems of batch traceability and accountability in the production, storage and distribution of food. This is usually done by scanning barcodes or RFID at nodes such as warehousing, outbound, loading and delivery, and summarizing data such as temperature records, inbound and outbound documents and transportation trajectory to a central platform to form a traceability chain. Taking the handover scenario of loading vehicles from cold chain warehouses and transferring them to stores as an example, the on-site handover of multiple batches and multiple pallets often has to be completed within a short-stop loading and unloading window. At the same time, it is subject to hard constraints such as unstable edge IoT network, temporary replacement of loading and unloading personnel, incomplete reading due to the obstruction caused by the stacking of boxes, and inconsistent time base of temperature control records between vehicles and warehouses. Under this constraint, mainstream practices will consistently expose the bottleneck of conflicting handover evidence, namely, the difficulty in completely enumerating missed scans, subsequent scans, substitute scans, mixed batches, and other observable phenomena within the same handover window, as well as the inability to align temperature control curves with the handover time. This leads to all parties being able to provide seemingly complete but contradictory self-evidence materials after an accident, making it impossible for third parties to make a verifiable ruling on whether the handover was valid and whether responsibility was transferred. The technical problem this application aims to solve is: under the conditions of edge IoT, how to form verifiable and adjudicable handover evidence at the handover point to eliminate conflicts in handover standards and ensure that the boundaries of responsibility are determinable. Summary of the Invention

[0003] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a food traceability system and a food traceability method. By attaching a receiving timestamp to multi-source handover evidence at the handover point and performing unified time processing, a handover credential containing an object consistency mark and a passage completion mark is generated within the handover window and uploaded to the central traceability platform to output a handover establishment mark or a handover failure mark, thereby solving the problems mentioned in the background art.

[0004] To achieve the above objectives, the present invention provides the following technical solution: a food traceability method, comprising: S1. At the start of the handover, obtain the target object identifier set and target quantity field from the outbound order, and have the start and end timestamps of the handover window recorded by the edge IoT gateway at the handover point, and output the handover window data. S2. Within the handover window, handover evidence is collected by at least two independent edge IoT collection sources. The first collection source outputs a set of object identifiers and the corresponding collection timestamp sequence, and the second collection source outputs a sequence of passage status values ​​and the corresponding collection timestamp sequence. The edge IoT gateway adds its receiving timestamp to each collection record and outputs the original evidence data. S3. Perform unified time processing on the original evidence data. Specifically, for each collection source, take the difference between the receiving timestamp and the collection timestamp of its first collection record to obtain the time offset of the collection source, and use the time offset to shift all the collection timestamps of the collection source one by one to obtain a unified timestamp, and output unified time evidence. S4. Generate a handover credential based on unified time evidence. Extract the set of object identifiers of the first collection source from the records whose unified timestamps fall into the handover window and compare them item by item with the set of target object identifiers. Write an object consistency flag when the two are completely consistent. Extract the sequence of passage status values ​​of the second collection source from the records whose unified timestamps fall into the handover window and check whether the allowed passage status and the completed passage status appear in chronological order. Write a passage completion flag when they appear in chronological order. Write the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window into the handover credential and output the handover credential. S5. When both the object consistency mark and the passage completion mark are valid, the handover credential is written to the central traceability platform and the handover is valid is output. When either the object consistency mark or the passage completion mark is invalid, the handover credential along with the unified time evidence is written to the central traceability platform and the handover is invalid is output.

[0005] In a preferred embodiment, S1 includes: S1-1. At the start of the handover, the IoT gateway at the handover point reads the target object identifier set and target quantity field from the outbound order, performs deduplication of the identifier set, sorts it in ascending order of identifier value, and outputs the target object sequence. S1-2. The edge IoT gateway at the handover point records the start and end timestamps in the handover window. After counting each item in the target object sequence to obtain the object count value, the object count value is compared with the target quantity field for equality. If they are equal, a quantity consistency mark is generated and written into the handover window data along with the start and end timestamps.

[0006] In a preferred embodiment, S2 includes: S2-1. Within the handover window, the edge IoT gateway receives the object identifier set and collection timestamp sequence output by the first collection source, as well as the passage status value sequence and collection timestamp sequence output by the second collection source, and writes a collection timestamp to each received record, outputting a collection record set with the collection timestamp. S2-2. Group the collection record set with the receiving timestamp according to the collection source identifier and the receiving order, and generate a sequence number field starting from the beginning of each group, along with the corresponding collection timestamp and receiving timestamp, and write it into the group record to output the evidence of group order. S2-3. Calculate the reception delay value for each group of ordered evidence as the difference between the reception timestamp and the corresponding collection timestamp, write the reception delay value into the corresponding record, and output the original evidence data.

[0007] In a preferred embodiment, S3 includes: S3-1. Extract the collection timestamp and receipt timestamp of the first collection record from the original evidence data according to the collection source; The initial time offset of the acquisition source is obtained by subtracting the acquisition timestamp from the receiving timestamp, and the initial offset set is output.

[0008] In a preferred embodiment, S3 further includes: S3-2. Extract the reception delay values ​​of all acquisition records from the original evidence data of the acquisition source and form a delay sequence according to the reception order. Calculate the first quartile, median and third quartile based on the delay sequence, generate the interquartile range, and remove delay values ​​that exceed the median plus or minus one interquartile range. Then, calculate the average of the remaining delay values ​​to obtain the steady-state delay value of the acquisition source. Replace the initial time offset with the steady-state delay value to obtain the time offset of the acquisition source, and output the time offset set. S3-3. For each collection record in the original evidence data, shift the collection timestamp one by one according to the time offset corresponding to the collection source to obtain a unified timestamp, and output the unified time evidence after replacing the collection timestamp with the unified timestamp.

[0009] In a preferred embodiment, S4 includes: S4-1. Based on the unified time evidence, filter the first collection source record that falls into the handover window with the unified timestamp and extract the object identifier set. After deduplication by identifier value, sort in ascending order to form the first object sequence. Perform the same deduplication and ascending order sorting on the target object identifier set to form the target object sequence. Output the object alignment sequence. S4-2. Perform item-by-item equality checks on the object alignment sequence and count the number of unequal items. Write an object consistency flag when the number of unequal items is zero, and write an object inconsistency flag when the number of unequal items is not zero. Output the object comparison results.

[0010] In a preferred embodiment, S4 further includes: S4-3. Based on the unified time evidence, filter the second collection source records that fall into the handover window with the unified timestamp and extract the passage status value sequence. After sorting them in ascending order by the unified timestamp, generate a status index sequence. Search the status index sequence for the minimum index of the allowed passage status and the minimum index of the completed passage status, and limit the minimum index of the completed passage status to be greater than the minimum index of the allowed passage status. Write a passage completion flag when the limit is met, and write a passage incomplete flag when the limit is not met. Output the passage check result. S4-4. Write the object matching mark or object inconsistency mark in the object comparison result, the passage completion mark or passage incomplete mark in the passage check result, and the start and end timestamps of the handover window into the handover credential, and output the handover credential.

[0011] In a preferred embodiment, S5 includes: S5-1. Read the object consistency flag and passage completion flag from the handover document, perform a logical AND operation on the object consistency flag and passage completion flag to generate a validity judgment value, and output the judgment result; S5-2. When the establishment judgment value is established, the handover voucher is written into the central traceability platform and a handover establishment mark is generated; when the establishment judgment value is not established, the handover voucher and the unified time evidence are written into the central traceability platform and a handover failure mark is generated, and the handover judgment output is output.

[0012] In a preferred embodiment, S5 further includes: S5-3. Generate an associated index for the handover voucher, unified time evidence, and handover establishment or non-establishment flag. The associated index shall include at least the start timestamp of the handover window, the end timestamp of the handover window, the hash digest of the target object identifier set, and the hash digest of the object identifier set of the first collection source. Write the associated index into the central traceability platform to support retrieval and verification by handover window and output the index record.

[0013] A food traceability system, comprising: The handover window module is used to obtain the target object identifier set and target quantity field from the outbound order at the start of the handover, and the start and end timestamps of the handover window are recorded by the edge IoT gateway at the handover point, and the handover window data is output. The evidence collection module is used to collect handover evidence by at least two independent edge IoT collection sources within the handover window. The first collection source outputs a set of object identifiers and the corresponding collection timestamp sequence, the second collection source outputs a sequence of passage status values ​​and the corresponding collection timestamp sequence, and the edge IoT gateway adds its receiving timestamp to each collection record to output the original evidence data. The time unification module is used to perform unified time processing on the original evidence data. Specifically, it takes the difference between the receiving timestamp and the collection timestamp of the first collection record of each collection source to obtain the time offset of the collection source, and uses the time offset to shift all the collection timestamps of the collection source one by one to obtain the unified timestamp, and outputs unified time evidence. The credential generation module is used to generate handover credentials based on unified time evidence. It extracts the object identifier set of the first collection source from records whose unified timestamps fall within the handover window and compares them item by item with the target object identifier set. When both are completely identical, an object consistency flag is written. It also extracts the passage status value sequence of the second collection source from records whose unified timestamps fall within the handover window and checks whether the allowed passage status and completed passage status appear sequentially in chronological order. When they appear sequentially, a passage completion flag is written. Finally, it writes the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window into the handover credential and outputs the handover credential. The data entry adjudication module is used to write the handover credentials into the central traceability platform and output a handover establishment flag when both the object consistency flag and the passage completion flag are established simultaneously; and to write the handover credentials along with the unified time evidence into the central traceability platform and output a handover failure flag when either the object consistency flag or the passage completion flag is not established.

[0014] The technical effects and advantages of this invention are as follows: The handover evidence chain is composed of handover window data, original evidence data, unified time evidence and handover vouchers, and the establishment judgment value is formed by the object consistency mark and the passage completion mark, so that the establishment of the handover has a verifiable basis, thereby relatively alleviating the conflict of handover standards and improving the determination of responsibility boundaries; By attaching a receiving timestamp to the records of the two types of acquisition sources and calculating the receiving delay value, and then generating a time offset to shift the acquisition timestamp to obtain a unified timestamp, the multi-source data can be filtered and sorted under the same time caliber, thereby relatively reducing the evidence alignment error caused by inconsistent time references. After deduplication and ascending sorting of the target object identifier set and the first source object identifier set, each item is compared and the number of unequal items is counted. This ensures that the object range verification has a repeatable calculation path, thereby relatively suppressing object enumeration disputes caused by missed scans, supplementary scans, and substitute scans. The second data collection source's passage status values ​​are used to generate a status index sequence in ascending order of a unified timestamp, and the sequential relationship between the allowed passage status and the completed passage status is retrieved, so that the passage process verification has sequential constraints, thereby relatively improving the consistency of handover completion judgment under the condition of short stop and go. When the determination value is not valid, the handover certificate and unified time evidence are written simultaneously, and an associated index containing the start and end timestamps of the handover window and the hash digest of the object sets on both sides is generated. This allows the review to quickly locate and trace the source of the difference according to the window, thereby relatively improving the retrieval and review efficiency in dispute scenarios. Attached Figure Description

[0015] Fig. 1 This is a flowchart of the method steps of the present invention.

[0016] Fig. 2 This is a schematic diagram of the system modules of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Refer to the instruction manual appendix Figs. 1-2 The present invention provides a food traceability method, comprising: S1. At the start of the handover, obtain the target object identifier set and target quantity field from the outbound order, and have the start and end timestamps of the handover window recorded by the edge IoT gateway at the handover point, and output the handover window data. This implementation focuses on the process of generating handover window data at the edge IoT gateway of the handover point at the beginning of the handover. The aim is to transform the target object identifier set and target quantity field in the outbound order into a verifiable target object sequence, and simultaneously solidify the start and end timestamps of the handover window. This ensures that subsequent original evidence data screening, unified time evidence generation, and handover credential generation all use the same handover window data as the entry point. The implementation process includes the following steps: First, S1-1 is used to form a unique and ordered sequence of target objects at the start of the handover, so as to eliminate the comparison ambiguity caused by duplicate identifiers and unordered sets in the outbound order; the input is the outbound order data read by the edge IoT gateway at the handover point at the start of the handover, and the outbound order data contains at least the target object identifier set and the target quantity field; the processing actions include: the edge IoT gateway at the handover point parses the target object identifier set from the outbound order, checks each identifier value in the target object identifier set to see if it is empty and whether it meets the format requirements of the object identifier field, and handles identifier values ​​that do not meet the requirements. Records are marked as invalid and skipped; the remaining identifier values ​​are deduplicated according to their identifier values, and only the first occurrence of the identifier value is retained; the deduplication results are then sorted in ascending order according to their identifier values ​​to obtain the target object sequence; the output is the target object sequence, and the edge IoT gateway at the handover point writes the target object sequence into the handover window data for S1-2 to read; missing data handling includes: when the outbound order is missing a set of target object identifiers, the edge IoT gateway at the handover point sets the target object sequence to an empty sequence and writes a missing object set marker into the handover window data, and subsequent steps keep the object consistency marker invalid based on this; Subsequently, S1-2 is used to determine the start and end timestamps of the handover window and generate a quantity consistency marker. All three are written into the handover window data for subsequent filtering of unified time evidence by window. Inputs include the local time source of the handover point edge IoT gateway, the target object sequence written into the handover window data in S1-1, and the target quantity field in the outbound order. Processing actions include: the handover point edge IoT gateway using the local timestamp of completing the outbound order reading and writing to the target object sequence as the start timestamp to write into the handover window data; the handover point edge IoT gateway continuously receives the passage status value sequence and corresponding collection timestamp sequence from the second collection source within the handover window, and when it receives the collection record corresponding to the completed passage status, it takes the receiving timestamp of that collection record as the end timestamp to write into the handover window data; the handover point edge IoT gateway counts each item in the target object sequence. The system obtains the object count value and compares it with the target quantity field. If they are equal, a quantity consistency flag is generated; otherwise, a quantity inconsistency flag is generated. The quantity consistency flag, along with the start and end timestamps, is written into the handover window data for subsequent reading. Missing data handling includes: when the target quantity field is missing or cannot be parsed into a number, the handover point edge IoT gateway generates a quantity inconsistency flag and writes it into the quantity field missing flag; when the handover point edge IoT gateway does not receive the corresponding collection record for the completed passage status within the handover window, the end timestamp is taken as the receiving timestamp of the last time the handover point edge IoT gateway received the collection record from the second collection source within the handover window, to ensure that the handover window data can still be used for subsequent unified time evidence screening, and a completed passage missing flag is written into the handover window data so that subsequent passage completion flags remain invalid. Through the above processing, the handover window data simultaneously solidifies the target object sequence, quantity consistency marker, and the start and end timestamps of the handover window. This enables subsequent steps to perform unified time processing and consistency checks on the first collection source object identifier set and the second collection source passage status value sequence within the same time window, reducing handover disputes caused by window boundary drift, disordered object sets, and inconsistent quantity definitions. In practical applications, taking warehouse loading handover as an example, the edge IoT gateway at the handover point reads the target object identifier set and target quantity field of the outbound order at the start of the handover. It filters invalid identifiers, removes duplicates, and sorts the identifiers in ascending order before writing them into the handover window data, while recording the start timestamp. After loading is completed, the second collection source sends the corresponding collection record for the completed passage status. The edge IoT gateway at the handover point takes the receiving timestamp of this collection record and writes it into the end timestamp. After counting the target object sequence, it determines that it is equal to the target quantity field and generates a quantity consistency marker, thus providing a verifiable object range and time boundary for subsequent unified time evidence generation and handover voucher generation.

[0019] S2. Within the handover window, handover evidence is collected by at least two independent edge IoT collection sources. The first collection source outputs a set of object identifiers and the corresponding collection timestamp sequence, and the second collection source outputs a sequence of passage status values ​​and the corresponding collection timestamp sequence. The edge IoT gateway adds its receiving timestamp to each collection record and outputs the original evidence data. This implementation focuses on the process of a junction point edge IoT gateway collecting handover evidence from two types of edge IoT data sources within a handover window and forming raw evidence data. The aim is to solidify the data transmitted from the first and second data sources into a collection record set with a receiving timestamp using a unified record structure. Based on this, verifiable, grouped, and ordered evidence is formed according to the data source identifier and receiving order. Furthermore, verifiable receiving delay values ​​are calculated for each record, enabling subsequent unified time processing to obtain a stable unified timestamp using the receiving delay value and the collection timestamp as input. This implementation process includes the following steps: Firstly, S2-1 is used to receive and encapsulate handover evidence within the handover window. Its mechanism involves using the receiving timestamp of the edge IoT gateway as a unified anchor point to solidify the data transmitted from the two types of collection sources into traceable records. The input quantities are the object identifier set and collection timestamp sequence transmitted by the first collection source within the handover window, and the passage status value sequence and collection timestamp sequence transmitted by the second collection source. The processing actions include: the edge IoT gateway listens to the data access channels of the first and second collection sources respectively within the handover window, parses each received data packet to obtain the corresponding object identifier set or passage status value and its collection timestamp, and writes the receiving timestamp when the data packet enters the edge IoT gateway's receiving queue. The receiving timestamp is taken from the same clock signal of the edge IoT gateway. The local timestamp of the time source uses the same time unit as the start and end timestamps; the output is a collection record set with received timestamps. Each record in the collection record set contains at least the collection source identifier, collection timestamp, received timestamp, and object identifier set or passage status value, and is written to the local cache for S2-2 to read; missing data handling includes: when the first or second collection source does not send data within the handover window, the edge IoT gateway still outputs a collection record set with received timestamps, but the corresponding collection source group is empty, and a collection source missing flag is written to the collection record set; when the collection timestamp is missing or cannot be parsed, the edge IoT gateway sets the collection timestamp to empty and writes a timestamp missing flag, so that the subsequent calculation of the received delay value remains invalid; Secondly, S2-2 is used to convert the collection record set with receiving timestamps into grouped ordered evidence. Its mechanism involves isolating the records from the two types of collection sources according to the collection source identifier and solidifying them according to the receiving order, so that the arrival order of the records can be reproduced when calculating the receiving delay value and the unified time offset. The input is the collection record set with receiving timestamps output by S2-1. The processing actions include: the edge IoT gateway groups the collection record set with receiving timestamps according to the collection source identifier to obtain a first collection source record group and a second collection source record group, and arranges them in ascending order of receiving timestamps within each collection source record group to determine the receiving order. When the receiving timestamps are the same, they are arranged according to the enqueue order written by the edge IoT gateway; subsequently, the edge IoT gateway performs processing on each collection... Within each source record group, a sequence number field is generated starting from the beginning. The sequence number field increments sequentially according to the receiving order, and the sequence number field, along with the corresponding acquisition timestamp and receiving timestamp, is written to each record. The output is grouped ordered evidence, which includes the first and second acquisition source record groups and their sequence number fields, and is written to the local cache for S2-3 to read. Missing record handling includes: when a certain acquisition source record group is empty, the edge IoT gateway still generates the corresponding empty record group and retains the acquisition source identifier to ensure that the handling of missing acquisition sources is consistent in subsequent steps; when the acquisition timestamp in a record is empty, the edge IoT gateway still retains the sequence number field and receiving timestamp, but marks the record as an uncalculated delay record so that S2-3 can skip delay calculation. Third, S2-3 is used to generate individual reception delay values ​​in the grouped ordered evidence and form the original evidence data. Its mechanism is to quantify the uplink latency by the difference between the reception timestamp and the acquisition timestamp, thus providing a statistically significant delay sequence for subsequent unified time processing. The input is the grouped ordered evidence output by S2-2. The processing actions include: the edge IoT gateway iterates through each collection source record group in the grouped ordered evidence, calculates the reception delay value for each record that has both an acquisition timestamp and a reception timestamp (the reception delay value is the reception timestamp minus the acquisition timestamp), and writes the reception delay value to the corresponding record; records with empty acquisition timestamps or empty reception timestamps are not calculated for reception delay values ​​and are marked with a delay missing flag. The output is the original evidence data, which is the grouped ordered evidence after the reception delay value has been written, and is written to local storage for subsequent unified time evidence generation and retrieval. Missing data handling includes: when all records in a certain collection source record group cannot have their reception delay values ​​calculated, the edge IoT gateway writes a delay unavailable flag to the original evidence data, enabling subsequent unified time processing to proceed according to the initial offset or rollback rules. Through the above processing, the edge IoT gateway solidifies the handover evidence from the two types of collection sources into a collection record set with receiving timestamps within the handover window. This further forms grouped and ordered evidence that can be verified according to the collection source identifier and receiving order. Simultaneously, it generates individual receiving delay values ​​to form original evidence data, thus providing stable input for unified time processing and reducing time alignment ambiguities caused by network jitter, out-of-order uploads, and missing records. In practical applications: taking warehouse loading handover as an example, the first collection source continuously uploads the box-level object identifier and corresponding collection timestamp within the handover window. The second collection source uploads the gate's allowed passage status and completed passage status, along with corresponding collection timestamps, within the same handover window. The edge IoT gateway writes a receiving timestamp for each reception, forming a collection record set with receiving timestamps. It then groups the data according to the collection source identifier and generates a sequence number field according to the receiving order to form grouped and ordered evidence. Finally, it calculates the receiving delay value for each record and writes it to form original evidence data. Subsequent steps use this data to generate unified time evidence and complete the handover credential writing to the central traceability platform to support handover window retrieval and verification.

[0020] S3. Perform unified time processing on the original evidence data. Specifically, for each collection source, take the difference between the receiving timestamp and the collection timestamp of its first collection record to obtain the time offset of the collection source, and use the time offset to shift all the collection timestamps of the collection source one by one to obtain a unified timestamp, and output unified time evidence. This implementation focuses on the unified time processing of original evidence data. Its purpose is to align the collection timestamps of different collection sources to the time reference of the edge IoT gateway within the handover window. This ensures that subsequent handover window filtering, object consistency marker generation, and passage completion marker generation based on the unified timestamp are unaffected by local clock drift of the collection source, uplink jitter, and out-of-order arrival. The basic principle of unified time processing is to first determine a time offset for each collection source, then use the time offset to shift each collection timestamp to generate a unified timestamp, and finally write the unified timestamp into the unified time evidence for direct reading in subsequent steps. This implementation process includes the following steps: First, S3-1 is used to generate a rollbackable initial time offset for each acquisition source. Its mechanism is to establish an initial time alignment relationship between the acquisition source and the edge IoT gateway based on the difference between the receiving timestamp and the acquisition timestamp of the same acquisition record. The input is raw evidence data, which at least includes the acquisition source identifier, acquisition timestamp, and receiving timestamp. The processing actions include: grouping the raw evidence data by acquisition source identifier; selecting the first acquisition record in the corresponding record group for each acquisition source according to the receiving order; reading the acquisition timestamp and receiving timestamp of the first acquisition record; and... The initial time offset is obtained by subtracting the acquisition timestamp from the received timestamp. The output is an initial offset set, which records the corresponding initial time offset with the acquisition source identifier as the key and writes it to the local cache for S3-2 to read. Missing data handling includes: when a certain acquisition source record group is empty, the initial time offset of that acquisition source is not written to the initial offset set, but an acquisition source missing flag is written; when the first acquisition record is missing an acquisition timestamp or a received timestamp, an offset missing flag is written to the initial offset set for that acquisition source, so that subsequent time offset calculations enter the backtracking path. Secondly, S3-2 is used to generate anti-jitter time offsets. Its mechanism involves replacing the initial time offset with the steady-state statistical value of the delay sequence, reducing the amplification effect of abnormal delays in a single record on a unified timestamp. The input consists of the original evidence data and the initial offset set. The processing includes: extracting the reception delay value from the original evidence data for each acquisition source and assembling a delay sequence according to the reception order; the reception delay value is taken from the reception delay value already written to the corresponding record in the original evidence data; when the number of records in the delay sequence is no less than four, calculating the first quartile, median, and third quartile of the delay sequence; generating the interquartile range by subtracting the first quartile from the third quartile; and using the median plus one quartile and the median minus one quartile as elimination boundaries to remove delay values ​​exceeding the elimination boundaries. The average of the remaining delay values ​​is then used to obtain the steady-state delay value. When the number of records in the delay sequence is less than four, the average of the delay sequence is directly used to obtain the steady-state delay value. When the delay sequence is empty or all records are unavailable, the steady-state delay value is taken as the initial time offset of the corresponding acquisition source in the initial offset set. Then, the initial time offset is replaced with the steady-state delay value to obtain the time offset. The output is a time offset set, which records the corresponding time offset with the acquisition source identifier as the key and writes it to the local cache for S3-3 to read. Missing data handling includes: when the corresponding offset of the acquisition source in the initial offset set is missing and the delay sequence is empty, a missing offset mark is written to the time offset set for that acquisition source, so that the subsequent unified timestamp generation remains invalid and the reason for the missing data is retained in the unified time evidence. Secondly, S3-3 is used to generate unified time evidence. Its mechanism involves shifting the collection timestamp of each collection record according to the time offset corresponding to the collection source to obtain a unified timestamp, and then writing the unified timestamp into the collection record for subsequent filtering according to the handover window. The input consists of the original evidence data and the time offset set. The processing actions include: traversing the original evidence data record by record, reading the collection source identifier of the collection record and searching for the corresponding time offset in the time offset set; when the collection record has a collection timestamp and the time offset is available, shifting the collection timestamp record by record according to the time offset to obtain a unified timestamp; to ensure repeatability of the review, the unified timestamp... The interim evidence retains both the collection timestamp field and the unified timestamp field, and uses the unified timestamp as the time caliber for subsequent handover window filtering, sorting, and index retrieval; the output is unified time evidence, which is a set of collection records with the unified timestamp written, and is written to local storage for subsequent reading when generating handover credentials; missing data handling includes: when a collection record is missing a collection timestamp or the corresponding time offset is missing in the time offset set, the unified timestamp of the collection record is not generated and a unified timestamp missing mark is written, and the collection record is automatically excluded when the unified timestamp falls into the handover window in subsequent steps; Through the above processing, the original evidence data forms a time offset set at the collection source dimension, and the collection timestamps of the collection records are aligned to a unified timestamp and written into the unified time evidence. This reduces the impact of local clock drift and uplink jitter of the collection source on the handover window filtering and order determination, and provides a verifiable unified time reference for the generation of object consistency marking and passage completion marking. In practical applications: taking warehouse loading handover as an example, the first collection source continuously sends the box-level object identification set and collection timestamp, and the second collection source sends the allowed passage status and completed passage status and collection timestamp. After retaining the receiving timestamp and receiving delay value of each record in the original evidence data, the edge IoT gateway calculates the initial time offset for the first collection source and the second collection source respectively, and obtains the steady-state delay value as the time offset after removing abnormal delays based on the interquartile range of the delay sequence. Then, the collection timestamps of the two types of collection records are shifted one by one to generate a unified timestamp and written into the unified time evidence. Subsequent steps filter the records in the handover window according to the unified timestamp and complete the generation of handover voucher and output of handover establishment mark.

[0021] S4. Generate a handover credential based on unified time evidence. Extract the set of object identifiers of the first collection source from the records whose unified timestamps fall into the handover window and compare them item by item with the set of target object identifiers. Write an object consistency flag when the two are completely consistent. Extract the sequence of passage status values ​​of the second collection source from the records whose unified timestamps fall into the handover window and check whether the allowed passage status and the completed passage status appear in chronological order. Write a passage completion flag when they appear in chronological order. Write the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window into the handover credential and output the handover credential. This implementation method revolves around the generation of handover credentials. Its purpose is to complete object scope verification and passage process verification within the handover window based on unified time evidence. The object consistency marker and passage completion marker, along with the start and end timestamps of the handover window, are written into the handover credentials, enabling the central traceability platform to directly output a handover success or failure flag based on the credentials. The formation of the handover credentials follows a process of filtering records using the same time caliber, aligning objects using the same serialization rules, and checking passage status using the same indexing rules, ensuring that handover point evidence can still be verified even under conditions of weak network conditions and inconsistent multi-source clocks. This implementation process includes the following steps: First, S4-1 is used to align object scopes within the handover window. Its mechanism involves aggregating the first source records into a first object sequence and converting the target object identifier set in the outbound order into a target object sequence according to the same rules, ensuring a unified representation that allows for item-by-item comparison between the two sequences. The inputs are unified time evidence, the start and end timestamps in the handover window data, and the target object identifier set in the outbound order. The processing actions include: filtering the first source records whose unified timestamps fall within the handover window based on the unified time evidence, with the filtering rule being that the unified timestamp is no earlier than the start timestamp and no later than the end timestamp; extracting the object identifier set from each of the filtered first source records and performing aggregation, the aggregation method being to extract the identifier values ​​from the object identifier set item by item. Add to the aggregate set; deduplicate the aggregate set by identifier value and sort it in ascending order by identifier value to form the first object sequence; simultaneously, perform the same deduplication and ascending sorting on the target object identifier set to form the target object sequence; the output is an object alignment sequence, which consists of the first object sequence and the target object sequence, and is written to the local cache for S4-2 to read; missing data handling includes: when there is no first acquisition source record with a unified timestamp falling within the handover window in the unified time evidence, the first object sequence is set to an empty sequence and a first acquisition source missing flag is written into the object alignment sequence; when the target object identifier set is missing, the target object sequence is set to an empty sequence and a target object missing flag is written into the object alignment sequence, and the subsequent object consistency flag remains invalid; Secondly, S4-2 is used to form object consistency markers. Its mechanism involves using item-by-item equality checks and inequality counts to provide a verifiable object consistency conclusion. The input is the object alignment sequence output by S4-1. The processing includes: reading the first object sequence and the target object sequence from the object alignment sequence; comparing the lengths of the first and target object sequences; setting the inequality count to the absolute value of the length difference and writing it into the object consistency marker when the lengths are unequal; performing item-by-item equality checks on the first and target object sequences and accumulating the inequality count when the inequality count is zero; and writing it into the object consistency marker when the inequality count is zero. Note that when the number of unequal items is not zero, an object inconsistency flag is written; the output is the object comparison result, which includes at least the number of unequal items and the object consistency flag or object inconsistency flag, and is written to the local cache for S4-4 to read; missing data handling includes: when the first object sequence or the target object sequence is an empty sequence and the other sequence is not empty, an object inconsistency flag is directly written and the number of unequal items is set to the length of the non-empty sequence; when both the first object sequence and the target object sequence are empty sequences, the object consistency flag is kept false and an empty sequence resulting in an undeterminable flag is written into the object comparison result to avoid misjudging missing data as consistency; Secondly, S4-3 is used to form a passage completion marker. Its mechanism involves reconstructing the order of passage status occurrences within the handover window using a unified timestamp, and verifying through index relationships that an allowed passage status occurs before a completed passage status. The inputs are unified time evidence and the start and end timestamps from the handover window data. The processing actions include: filtering second-source records whose unified timestamps fall within the handover window based on the unified time evidence, with the filtering rule being that the unified timestamp is neither earlier than the start timestamp nor later than the end timestamp; extracting passage status values ​​from each of the filtered second-source records and sorting them in ascending order by unified timestamp to obtain a passage status value sequence, while simultaneously generating an incrementing state index sequence for the passage status value sequence; searching the state index sequence for the minimum index of the allowed passage status and the minimum index of the completed passage status, with the search rule being that the minimum index of the allowed passage status is taken from the first occurrence of the allowed passage status in the passage status value sequence, and the minimum index of the completed passage status is taken from the first occurrence of the allowed passage status in the passage status value sequence. The first index corresponding to the completed passage state appears after the minimum index of the line status. When the minimum index of the completed passage state exists and is greater than the minimum index of the allowed passage state, a passage completion flag is written; otherwise, a passage incomplete flag is written. The output is the passage check result, which includes at least the minimum index of the allowed passage state, the minimum index of the completed passage state, and either the passage completion flag or the passage incomplete flag, and is written to the local cache for S4-4 to read. Missing records are handled as follows: when the second collection source record is empty, the passage check result is written with the passage incomplete flag and the second collection source missing flag; when no allowed passage state appears in the passage status value sequence, the minimum index of the allowed passage state is set to empty and the passage incomplete flag is written; when a completed passage state appears in the passage status value sequence but no allowed passage state appears, the minimum index of the completed passage state is not included in the limitation and the passage incomplete flag is still written to ensure that the passage completion flag must be supported by the allowed passage state occurring first. Finally, S4-4 is used to generate a transferable handover credential. Its mechanism involves embedding the object consistency marker, the passage completion marker, and the handover window boundary into the same record structure, allowing the central traceability platform to directly adjudicate. The inputs are the object comparison results, the passage check results, and the start and end timestamps from the handover window data. Processing actions include: reading the object consistency marker or object inconsistency marker from the object comparison results, reading the passage completion marker or passage incomplete marker from the passage check results, and reading the start and end timestamps of the handover window. These fields are then written into the handover credential, generating a record identifier for the handover credential. The record identifier is the concatenation of the start and end timestamps to support retrieval by handover window. The output is the handover credential, which is written to local storage and can be read by the central traceability platform in subsequent steps. Missing marker handling includes: when there are missing markers in the object comparison results or the passage check results, the handover credential still writes the corresponding missing marker, enabling the central traceability platform to provide a verifiable reason when outputting a handover failure flag. Through the above processing, the unified time evidence is used for object alignment and passage order reconstruction within the handover window. Object consistency markers and passage completion markers are formed based on the number of unequal items and index relationships. Finally, these, along with the start and end timestamps, are written into the handover credential, giving the handover point evidence a basis for repeatable calculation and verifiable adjudication. In practical applications: taking warehouse loading handover as an example, the edge IoT gateway filters and aggregates the first collection source records within the handover window to obtain the first object sequence. Then, it generates an object alignment sequence by obtaining the target object sequence from the outbound order target object identifier set according to the same rules. Subsequently, the two sequences are compared item by item for equality. The system determines and counts the number of unequal items and writes them into the object consistency flag or object inconsistency flag. The edge IoT gateway simultaneously filters the records from the second data collection source and sorts them in ascending order according to a unified timestamp to obtain a sequence of passage status values. It searches for the minimum index of the allowed passage status and the minimum index of the completed passage status and limits the order of the indices, writing them into the passage completion flag or passage incomplete flag. Finally, the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window are written into the handover credential and written into the central traceability platform. The central traceability platform outputs a handover success flag or a handover failure flag based on this and supports retrieval and verification by handover window.

[0022] S5. When both the object consistency mark and the passage completion mark are valid, the handover voucher is written to the central traceability platform and the handover is valid is output; when either the object consistency mark or the passage completion mark is invalid, the handover voucher along with the unified time evidence is written to the central traceability platform and the handover is invalid is output. This implementation focuses on the writing and adjudication output of the central traceability platform. Its purpose is to generate an establishment judgment value based on the object consistency marker and passage completion marker in the handover document, and then select to write the handover document or simultaneously write the handover document and unified time evidence based on the establishment judgment value. Furthermore, it forms an associated index on the central traceability platform that can be retrieved and verified according to the handover window, making the generation process of the handover establishment mark or handover failure mark repeatable and traceable to the target object identifier set and the first collection source object identifier set. This implementation process includes the following steps: First, S5-1 is used to merge the two flags in the handover credential into a single valid judgment value. Its mechanism is to use a logical AND operation to make the simultaneous validity of the object consistency flag and the passage completion flag a necessary condition for the handover to be valid. The input is the handover credential, which contains at least an object consistency flag and a passage completion flag. The processing actions include: reading the object consistency flag and the passage completion flag from the handover credential, mapping the object consistency flag value to a Boolean value, and mapping the passage completion flag value to a Boolean value, where the mapping is true when the object consistency flag is valid, and true when the object consistency flag is valid. If the condition is not met, it is mapped to false; if the completion mark is met, it is mapped to true; if the completion mark is not met, it is mapped to false. A logical AND operation is performed on two Boolean values, and the result of the logical AND operation is the conditional value. The output is the conditional result, which includes the conditional value and is written to the local cache for S5-2 to read. Missing information handling includes: when the handover document is missing the consistency mark or the completion mark is missing, the Boolean value corresponding to the missing mark is treated as false, and the reason for the missing information is written into the conditional result so that it can be written to the central traceability platform when a handover failure mark is generated later. Subsequently, S5-2 is used to write and generate a handover establishment flag or a handover failure flag to the central traceability platform. Its mechanism involves selecting the range of content to be written based on the establishment judgment value, allowing the handover establishment flag to be directly verified by the handover documents, and the handover failure flag to be jointly verified by the handover documents and the unified time evidence. The inputs are the judgment result, the handover documents, and the unified time evidence. The processing actions include: when the establishment judgment value is established, writing the handover documents to the central traceability platform and generating a handover establishment flag on the platform; the handover establishment flag is written to the handover record status field of the central traceability platform and returned as a handover judgment output; when the establishment judgment value is invalid, writing the handover documents and the unified time evidence to the central traceability platform and generating a handover failure flag on the platform. A handover success flag and a handover failure flag are written to the handover record status field of the central traceability platform and returned as the handover judgment output. To ensure that repeated writes are verifiable, the central traceability platform uses the concatenation of the start and end timestamps of the handover window as the handover record key. Writes to the same handover record key are overridden or idempotent, ensuring that only one handover record corresponds to the same handover window. The output is the handover judgment output, which includes at least a handover success flag or a handover failure flag and the corresponding handover record key. Missing records are handled as follows: when the central traceability platform fails to write, the edge IoT gateway at the handover point retains the handover credentials and unified time evidence and records the number of failures. When the network is available, the handover record key is pressed again to retry writing, so as to avoid generating multiple handover records. Finally, S5-3 is used to form a searchable and verifiable associated index on the central traceability platform. Its mechanism involves solidifying the handover window boundary and the summary of the object sets on both sides into index fields, enabling reviewers to locate handover records according to the handover window and verify the consistency between the target object identifier set and the first source object identifier set. Inputs include handover documents, unified time evidence, and handover establishment or failure flags. Processing actions include: reading the handover window start and end timestamps from the handover documents; reading the target object identifier set from the handover documents or handover window data; filtering the first source records whose unified timestamps fall within the handover window from the unified time evidence and extracting the object identifier set; performing identifier value deduplication and ascending sorting on the target object identifier set, concatenating them by delimiter to obtain the target object serialized string, and then using a fixed... The system calculates the hash digest of the target object identifier set using a fixed character encoding; it then performs identifier value deduplication and sorts the identifier values ​​in ascending order on the first source object identifier set, concatenating them by a delimiter to obtain the serialized string of the first object, and calculates the hash digest of the first source object identifier set using the same character encoding; it generates an associated index and writes the handover window start timestamp, handover window end timestamp, hash digest of the target object identifier set, hash digest of the first source object identifier set, and handover success or failure flags into the central traceability platform, outputting the index record; missing data handling includes: when the first source record of the unified time evidence is missing, causing the first source object identifier set to be unavailable, the hash digest of the first source object identifier set is set to empty and a missing flag is written, so that the index record can still be used for retrieval by handover window and the reason for the missing data can be clearly identified; Through the above processing, the central traceability platform generates an establishment judgment value based on the object consistency mark and the passage completion mark, and selects to write the handover voucher or simultaneously write the handover voucher and the unified time evidence according to the establishment judgment value. This allows the verification of the handover establishment mark to directly rely on the handover voucher, and the verification of the handover failure mark to be traced back to the unified time evidence. Simultaneously, the associated index uses the hash digest of the object sets on both sides of the handover window boundary to solidify the verification entry point, supporting retrieval by handover window and quickly locating the source of conflicting standards. In practical applications: taking warehouse loading handover as an example, after the IoT gateway at the handover point generates the handover voucher, the central traceability platform reads the object consistency from the handover voucher. The marking and passage completion process involves performing a logical AND operation to obtain a validity judgment value. If the validity judgment value is valid, only the handover voucher is written and a handover validity flag is generated. If the validity judgment value is invalid, the handover voucher and unified time evidence are written and a handover invalidity flag is generated. Subsequently, the central traceability platform locates the handover record using the start and end timestamps of the handover window and generates an association index using the hash digest of the target object identifier set and the hash digest of the object identifier set of the first collection source. Reviewers can quickly retrieve the same handover window and recalculate the consistency of the object set based on the association index, thereby forming a reviewable basis for adjudication in multi-entity handover dispute scenarios.

[0023] Furthermore, it also includes a food traceability system, the system comprising: The handover window module is used to obtain the target object identifier set and target quantity field from the outbound order at the start of the handover, and the start and end timestamps of the handover window are recorded by the edge IoT gateway at the handover point, and the handover window data is output. The evidence collection module is used to collect handover evidence by at least two independent edge IoT collection sources within the handover window. The first collection source outputs a set of object identifiers and the corresponding collection timestamp sequence, the second collection source outputs a sequence of passage status values ​​and the corresponding collection timestamp sequence, and the edge IoT gateway adds its receiving timestamp to each collection record to output the original evidence data. The time unification module is used to perform unified time processing on the original evidence data. Specifically, it takes the difference between the receiving timestamp and the collection timestamp of the first collection record of each collection source to obtain the time offset of the collection source, and uses the time offset to shift all the collection timestamps of the collection source one by one to obtain the unified timestamp, and outputs unified time evidence. The credential generation module is used to generate handover credentials based on unified time evidence. It extracts the object identifier set of the first collection source from records whose unified timestamps fall within the handover window and compares them item by item with the target object identifier set. When both are completely identical, an object consistency flag is written. It also extracts the passage status value sequence of the second collection source from records whose unified timestamps fall within the handover window and checks whether the allowed passage status and completed passage status appear sequentially in chronological order. When they appear sequentially, a passage completion flag is written. Finally, it writes the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window into the handover credential and outputs the handover credential. The data entry adjudication module is used to write the handover credentials into the central traceability platform and output a handover establishment flag when both the object consistency flag and the passage completion flag are established simultaneously; and to write the handover credentials along with the unified time evidence into the central traceability platform and output a handover failure flag when either the object consistency flag or the passage completion flag is not established.

[0024] Working Principle: This solution uses the edge IoT gateway at the handover point as its core, solidifying a handover process into verifiable handover window data, original evidence data, unified time evidence, and handover vouchers, and outputting a handover success or failure flag accordingly. At the start of the handover, the edge IoT gateway obtains the target object identifier set and target quantity field from the outbound order, deduplicates and sorts the target object identifier set to form a target object sequence, and simultaneously records the start and end timestamps of the handover window and writes them into the handover window data. Within the handover window, two independent collection sources respectively send the object identifier set and passage status value. The edge IoT gateway adds a receiving timestamp to each record, groups them by collection source and generates a sequence number field, and then calculates the receiving delay value to form the original evidence data. Subsequently, the edge IoT gateway calculates the time offset based on the delay sequence and sets the collection timestamp... The process involves sequentially shifting records to obtain a unified timestamp, forming unified time evidence. On this unified time evidence, the edge IoT gateway filters records according to the handover window, aggregates the first source object identifier set, and compares it item by item with the target object sequence to generate an object consistency marker. Simultaneously, it sorts the passage status values ​​according to the unified timestamp and retrieves the sequential relationship between allowed and completed passage statuses to generate a passage completion marker. Finally, the object consistency marker, passage completion marker, start timestamp, and end timestamp are written into the handover credential. The central traceability platform performs a logical AND operation on the object consistency marker and passage completion marker to generate a validity judgment value. If valid, it writes the value into the handover credential and generates a handover validity flag; if invalid, it writes the value into the handover credential and unified time evidence and generates a handover invalidity flag. Simultaneously, it generates an associated index containing the start and end timestamps of the handover window and hash digests of the object sets on both sides to support retrieval and verification. Taking cold chain warehouse loading and handover as an example, the warehouse outbound slip lists the box codes and quantities to be delivered during this loading. At the start of loading, the edge IoT gateway at the handover point reads this box code list and quantity, deduplicates and sorts them to obtain the target object sequence, and records the start timestamp. During loading, the first data source continuously uploads the scanned box codes and their timestamps, while the second data source uploads the gate or access control's allowed and completed passage status and its timestamp. The edge IoT gateway writes a receiving timestamp for each uploaded record and calculates the receiving delay value. Then, it uniformly shifts the timestamps from both sources to the same time caliber to obtain unified time evidence. After loading, the edge IoT gateway filters the unified time evidence according to the handover window. On one hand, it aggregates the scanned box codes within the handover window and compares them item by item with the target object sequence to generate object consistency markers; on the other hand… The system sorts the passage status within the handover window by a unified timestamp, confirms that the allowed passage status appears first and the completed passage status appears later, and generates a passage completion marker. Then, it writes the two markers and the start and end timestamps of the handover window into the handover voucher and uploads it to the central traceability platform. If the box code is missed or other box codes are mixed in, resulting in the object consistency marker not being valid, or if the gate does not show the completed passage status, resulting in the passage completion marker not being valid, the central traceability platform will write the handover voucher and unified time evidence and output a handover failure marker. The reviewer can directly retrieve the associated index by the start and end timestamps of the handover window, verify the hash digest of the target object identifier set and the hash digest of the first source object identifier set, and further review the unified time evidence to locate whether the problem occurred on the scanning side or the passage side. Thus, even under conditions of weak network, personnel change, or disputes among multiple parties, a verifiable handover decision can still be formed.

[0025] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A food traceability method, characterized in that, include: S1. At the start of the handover, obtain the target object identifier set and target quantity field from the outbound order, and have the start and end timestamps of the handover window recorded by the edge IoT gateway at the handover point, and output the handover window data. S2. Within the handover window, handover evidence is collected by at least two independent edge IoT collection sources. The first collection source outputs a set of object identifiers and the corresponding collection timestamp sequence, and the second collection source outputs a sequence of passage status values ​​and the corresponding collection timestamp sequence. The edge IoT gateway adds its receiving timestamp to each collection record and outputs the original evidence data. S3. Perform unified time processing on the original evidence data. Specifically, for each collection source, take the difference between the receiving timestamp and the collection timestamp of its first collection record to obtain the time offset of the collection source, and use the time offset to shift all the collection timestamps of the collection source one by one to obtain a unified timestamp, and output unified time evidence. S4. Generate a handover credential based on unified time evidence. Extract the set of object identifiers of the first collection source from the records whose unified timestamps fall into the handover window and compare them item by item with the set of target object identifiers. Write an object consistency flag when the two are completely consistent. Extract the sequence of passage status values ​​of the second collection source from the records whose unified timestamps fall into the handover window and check whether the allowed passage status and the completed passage status appear in chronological order. Write a passage completion flag when they appear in chronological order. Write the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window into the handover credential and output the handover credential. S5. When both the object consistency mark and the passage completion mark are valid, the handover credential is written to the central traceability platform and the handover is valid is output. When either the object consistency mark or the passage completion mark is invalid, the handover credential along with the unified time evidence is written to the central traceability platform and the handover is invalid is output.

2. The food traceability method according to claim 1, characterized in that: S1 includes: S1-1. At the start of the handover, the IoT gateway at the handover point reads the target object identifier set and target quantity field from the outbound order, performs deduplication of the identifier set, sorts it in ascending order of identifier value, and outputs the target object sequence. S1-2. The edge IoT gateway at the handover point records the start and end timestamps in the handover window. After counting each item in the target object sequence to obtain the object count value, the object count value is compared with the target quantity field for equality. If they are equal, a quantity consistency mark is generated and written into the handover window data along with the start and end timestamps.

3. The food traceability method according to claim 2, characterized in that: S2 includes: S2-1. Within the handover window, the edge IoT gateway receives the object identifier set and collection timestamp sequence output by the first collection source, as well as the passage status value sequence and collection timestamp sequence output by the second collection source, and writes a collection timestamp to each received record, outputting a collection record set with the collection timestamp. S2-2. Group the collection record set with the receiving timestamp according to the collection source identifier and the receiving order, and generate a sequence number field starting from the beginning of each group, along with the corresponding collection timestamp and receiving timestamp, and write it into the group record to output the evidence of group order. S2-3. Calculate the reception delay value for each group of ordered evidence as the difference between the reception timestamp and the corresponding collection timestamp, write the reception delay value into the corresponding record, and output the original evidence data.

4. The food traceability method according to claim 3, characterized in that: S3 includes: S3-1. Extract the collection timestamp and receipt timestamp of the first collection record from the original evidence data according to the collection source; The initial time offset of the acquisition source is obtained by subtracting the acquisition timestamp from the receiving timestamp, and the initial offset set is output.

5. A food traceability method according to claim 4, characterized in that: S3 further includes: S3-2. Extract the reception delay values ​​of all acquisition records from the original evidence data of the acquisition source and form a delay sequence according to the reception order. Calculate the first quartile, median and third quartile based on the delay sequence, generate the interquartile range, and remove delay values ​​that exceed the median plus or minus one interquartile range. Then, calculate the average of the remaining delay values ​​to obtain the steady-state delay value of the acquisition source. Replace the initial time offset with the steady-state delay value to obtain the time offset of the acquisition source, and output the time offset set. S3-3. For each collection record in the original evidence data, shift the collection timestamp one by one according to the time offset corresponding to the collection source to obtain a unified timestamp, and output the unified time evidence after replacing the collection timestamp with the unified timestamp.

6. A food traceability method according to claim 5, characterized in that: S4 includes: S4-1. Based on the unified time evidence, filter the first collection source record that falls into the handover window with the unified timestamp and extract the object identifier set. After deduplication by identifier value, sort in ascending order to form the first object sequence. Perform the same deduplication and ascending order sorting on the target object identifier set to form the target object sequence. Output the object alignment sequence. S4-2. Perform item-by-item equality checks on the object alignment sequence and count the number of unequal items. Write an object consistency flag when the number of unequal items is zero, and write an object inconsistency flag when the number of unequal items is not zero. Output the object comparison results.

7. A food traceability method according to claim 6, characterized in that: S4 further includes: S4-3. Based on the unified time evidence, filter the second collection source records that fall into the handover window with the unified timestamp and extract the passage status value sequence. After sorting them in ascending order by the unified timestamp, generate a status index sequence. Search the status index sequence for the minimum index of the allowed passage status and the minimum index of the completed passage status, and limit the minimum index of the completed passage status to be greater than the minimum index of the allowed passage status. Write a passage completion flag when the limit is met, and write a passage incomplete flag when the limit is not met. Output the passage check result. S4-4. Write the object matching mark or object inconsistency mark in the object comparison result, the passage completion mark or passage incomplete mark in the passage check result, and the start and end timestamps of the handover window into the handover credential, and output the handover credential.

8. A food traceability method according to claim 7, characterized in that: S5 includes: S5-1. Read the object consistency flag and passage completion flag from the handover document, perform a logical AND operation on the object consistency flag and passage completion flag to generate a validity judgment value, and output the judgment result; S5-2. When the establishment judgment value is established, the handover voucher is written into the central traceability platform and a handover establishment mark is generated; when the establishment judgment value is not established, the handover voucher and the unified time evidence are written into the central traceability platform and a handover failure mark is generated, and the handover judgment output is output.

9. A food traceability method according to claim 8, characterized in that: The S5 also includes: S5-3. Generate an associated index for the handover voucher, unified time evidence, and handover establishment or non-establishment flag. The associated index shall include at least the start timestamp of the handover window, the end timestamp of the handover window, the hash digest of the target object identifier set, and the hash digest of the object identifier set of the first collection source. Write the associated index into the central traceability platform to support retrieval and verification by handover window and output the index record.

10. A food traceability system for implementing the food traceability method according to any one of claims 1-9, characterized in that, include: The handover window module is used to obtain the target object identifier set and target quantity field from the outbound order at the start of the handover, and the start and end timestamps of the handover window are recorded by the edge IoT gateway at the handover point, and the handover window data is output. The evidence collection module is used to collect handover evidence by at least two independent edge IoT collection sources within the handover window. The first collection source outputs a set of object identifiers and the corresponding collection timestamp sequence, the second collection source outputs a sequence of passage status values ​​and the corresponding collection timestamp sequence, and the edge IoT gateway adds its receiving timestamp to each collection record to output the original evidence data. The time unification module is used to perform unified time processing on the original evidence data. Specifically, it takes the difference between the receiving timestamp and the collection timestamp of the first collection record of each collection source to obtain the time offset of the collection source, and uses the time offset to shift all the collection timestamps of the collection source one by one to obtain the unified timestamp, and outputs unified time evidence. The credential generation module is used to generate handover credentials based on unified time evidence. It extracts the object identifier set of the first collection source from records whose unified timestamps fall within the handover window and compares them item by item with the target object identifier set. When both are completely identical, an object consistency flag is written. It also extracts the passage status value sequence of the second collection source from records whose unified timestamps fall within the handover window and checks whether the allowed passage status and completed passage status appear sequentially in chronological order. When they appear sequentially, a passage completion flag is written. Finally, it writes the object consistency flag, the passage completion flag, and the start and end timestamps of the handover window into the handover credential and outputs the handover credential. The data entry adjudication module is used to write the handover credentials into the central traceability platform and output a handover establishment flag when both the object consistency flag and the passage completion flag are established simultaneously; and to write the handover credentials along with the unified time evidence into the central traceability platform and output a handover failure flag when either the object consistency flag or the passage completion flag is not established.