Product tracing method based on flow code
By using product traceability methods based on flow codes in the food production and logistics links, the problem that traditional flow codes are difficult to achieve cargo traceability and path optimization is solved, and the full information tracking and management from production to sales is realized, logistics and production efficiency is improved, and supply chain stability is enhanced.
Patent Information
- Application Number
- CN202411970975.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-02
AI Technical Summary
Traditional flow codes are difficult to achieve cargo traceability, path optimization and real-time status monitoring, and cannot effectively correlate raw material sources, production processes and quality inspection information, making it difficult for enterprises to quickly trace the root causes of product quality problems.
A product traceability method based on flow code is adopted. By generating a unique child flow code on the production conveyor belt, recording the production date and assembly line position of the product, and printing the main flow code on the total outer packaging to record the outbound time and storage location. This method uses scanning equipment to read the flow code at each link, updates the product information in the central database, and realizes the full traceability from production to sales.
It realizes end-to-end visual management of goods, improves logistics efficiency and production efficiency, reduces transportation time and costs, reduces the risk of cargo loss and damage, and enhances supply chain stability and corporate core competitiveness.
Smart Images

Figure CN119919153A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of product tracing methods, and in particular to a product tracing method based on a serial code. Background Art
[0002] In the food industry, product quality and safety are of vital importance, and consumers are increasingly demanding transparency in the origin, production process, and distribution of food. With the rapid development of modern information technology, the demand for refined and intelligent data management in various industries is constantly increasing.
[0003] There are many limitations in the application of traditional serial codes in the food industry. They are usually only used as simple sequential numbers with relatively simple functions. In the logistics link, it is difficult to achieve multi-dimensional information management goals such as cargo traceability, route optimization, and real-time status monitoring by relying solely on traditional serial codes. For example, it is impossible to accurately grasp the location and status changes of food during transportation, it is impossible to optimize the transportation route in time to reduce losses, and it is difficult to quickly locate the source of goods when problems arise. In terms of production and manufacturing, traditional serial codes cannot effectively link key information such as the source of raw materials, production processes, and quality inspections. This makes it difficult for companies to quickly trace the root causes of product quality problems and take targeted measures in a timely manner, which increases food safety risks and is not conducive to the optimization and improvement of the production process. Summary of the invention
[0004] The main purpose of the present invention is to provide a product tracing method based on serial codes to solve the problem that traditional serial codes are difficult to achieve multi-dimensional information management goals such as cargo tracing, route optimization, and real-time status monitoring.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is: a product tracing method based on serial code, the method comprising: S1. Generate a unique sub-serial code for each product on the production conveyor belt, use a scanning device to read the sub-serial code on the product, record the production date and production line location of the product, and store this information in a central database; S2. Classify each product sub-serial code, carry out overall outer packaging according to the classified quantity, and print the main serial code on the overall outer packaging. Use a scanning device to read the serial code on the overall outer packaging of the product, record the delivery time and storage warehouse location of the overall packaged product, and update the product information in the central database; S3. Before the product is ready to be shipped out to retailers or customers, the scanning device is used again to read the mother serial code on the product's overall outer packaging, record the product's shipping time and delivery destination, and update the product information in the central database; S4. When selling products in retail stores, use the scanning equipment of the point-of-sale system to read the serial code on the product, record the time and location of sale, and send this information to the central database of the food manufacturer; S5. Consumers or businesses enter the serial code on the product through a specific platform to query. The query platform retrieves the product's production, logistics and sales information from the central database and displays the query results to the requester.
[0006] In the preferred solution, the coding based on multi-source information fusion generates the stream code.
[0007] In the preferred solution, step S1 generates a serial code with more information content and traceability by fusing multi-source information: S1.1 Sub-serial code generation and information collection: On the production conveyor, a unique sub-serial code is generated for each product; the generation of the sub-serial code is based on the following rules: Take the last 8 digits of the current system timestamp as the time code part, recorded as ; This part of the code can reflect the chronological order of product production, making it easier to trace the products in chronological order later; Generate a 3-digit production line code based on the production line number of the product, recorded as ; Assume that the factory has There are 100 production lines, numbered from 001 to ,but The value range is 001 to ; This code is used to quickly locate the production source of the product; Calculate a sequence code based on the position of the product on the production conveyor belt, denoted as P; assume that a sensor is set at a fixed distance on the production conveyor belt, and when the product passes the sensor, the sensor records its sequence number; suppose the total length of the production conveyor belt is meters, the product passes through the When a sensor ,in Indicates rounding down; this code can further distinguish the production sequence of products in the same batch; Combine the above three parts of the code into a sub-sequential code: ; At the same time, a QR code is attached to one side of the sub-serial code, and the sub-serial code information is stored in the QR code; Use a scanning device to read the sub-serial code on the product, trigger the information collection program, and record the production date and production line location of the product; S1.2. The coding based on multi-source information fusion generates a serial code, and its coding structure is as follows: First, the key attributes of the material are encoded; assuming that the material has There are key attributes, each of which has a different value range; Attribute, whose value is , the total number of attribute value categories is ; Encode it as a The digital code of the bit, , here we use base 34 for the same reason as described in the document. Base 34 can effectively avoid confusion and provide sufficient encoding capacity. The encoding formula is: ; The function of this formula is to convert material attribute values of different value ranges into a unified 34-hexadecimal code so that the material information can be accurately represented in the serial code; Next, encode the important parameters in the production process; for example, the operating parameters of the production equipment, assuming that there are An important parameter, The value of the parameter is , the total number of categories of parameter values is ; The same 34-base encoding is used, and the encoding length is , the encoding formula is ; This formula ensures that the production process parameters can be accurately integrated into the serial code, providing a basis for tracing the production process; Then, the sub-serial code generated previously As part of the serial number; Finally, a check digit is added; the calculation of the check digit is based on all the previously encoded information and a key , the key is a confidentiality parameter set within the enterprise; The value after combining all the previous coded information is , check digit ; The function of the check digit is to verify the accuracy of the serial code in the subsequent data processing and tracing process to prevent errors in data transmission or storage; Complete sub-sequential code ; S1.3. The production date of the product , Production line location , sub-serial code And the generated serial code The information is associated and stored in the central database; when storing, this information is inserted into the corresponding fields according to the table structure designed by the database to ensure the integrity and searchability of the data.
[0008] In the preferred solution, in the delivery process in step S2, the mother serial code on the outer packaging is scanned; After identifying the serial code, the current time is obtained as the delivery time, and the delivery location information, logistics point address and GPS positioning information of the transport vehicle are obtained through the logistics system to track the logistics status of the product.
[0009] In the preferred embodiment, the logistics tracking steps in step S2 are: S2.1. Sub-serial code classification and mother serial code generation: First, according to the type of product: products are divided into Type, use Indicates Types, ; Production batch is , ; And the quality level of the product in the production process is divided into Level, use Indicates class, , these three main factors are used to classify sub-sequential codes; Calculate the classification value corresponding to each sub-serial code , the formula is: ,in , , is a pre-set weight coefficient and satisfies ; These weighting factors can be adjusted according to the importance that the enterprise attaches to product type, production batch and quality grade; According to the calculated classification value , classify the sub-sequential codes; a dynamic grouping algorithm can be used, for example, to set a classification threshold , when the difference between the classification values of the two sub-serial codes is less than or equal to , classify them into the same category; For each type of sub-serial code, a mother serial code is generated; the generation rules of the mother serial code are as follows: Take the current date as the date part, recorded as ; Calculate the number of sub-serial codes of this type , convert it into a 4-bit 34-decimal number, recorded as ; The conversion formula is: Assume The 34-decimal representation is ,in is a 34-bit place value, then , , , , and so on, until we calculate ; This formula can accurately encode the number of sub-serial codes into the main serial code, making it easier to trace the quantity information of the products in the package later; Take the first 6 bits of the first sub-serial code in this class as the identification part, recorded as ; This part can represent the common characteristics of this type of products to a certain extent; Finally, add a check digit ; The check digit is calculated based on the previous date part, the quantity code part and the identification part and a random key , a key is randomly generated each time the mother serial number is generated; let the combined value of the first three parts be , concatenate the parts into a number in a predetermined order, then convert it into a decimal number, check digit The function of the check digit is to verify the accuracy of the mother serial number in the subsequent data processing and tracing process to prevent errors in data transmission or storage; Complete mother serial number ; S2.2, warehouse information recording and database update: Use a scanning device to read the mother serial number on the product's overall outer packaging to trigger the warehouse information recording program; Record the current time as the outbound time, recorded as ; Get the location information of the storage warehouse, including the warehouse number , Warehouse area and the shelf position is ; Combine these position information into a code, the coding formula is: , where each part can be distinguished by a specific separator to facilitate subsequent parsing; this code can accurately locate the storage location of the product in the warehouse, facilitating inventory management and traceability; Shipping time , Warehouse location code and mother serial number The product information in the central database is updated by associating the information with the parent serial number. The update operation can use the database UPDATE statement, and update the corresponding delivery time and warehouse location information to the corresponding record based on the parent serial number as the key field. S2.3, Shipping information record and logistics tracking: During the shipping process, scan the mother serial number on the outer packaging again; Get the current time as the delivery time, recorded as ; Obtain delivery location information through the logistics system, including the address of the logistics outlet. and the GPS positioning information of the transport vehicle is ; Encode the logistics point address, convert each character in the address into the corresponding ASCII code value, and then concatenate them to form a digital code, recorded as ; For GPS positioning information, you can directly use its latitude and longitude values as and ; Will be shipped on time , Logistics outlet address code , GPS location information and And the mother serial number The information is associated and stored in the logistics tracking database; When storing, this information is inserted into the corresponding fields according to the table structure designed by the database to ensure the integrity and retrievability of the data; At the same time, during the logistics transportation process, the GPS positioning information of the transportation vehicle can be updated regularly to track the logistics status of the product in real time.
[0010] In the preferred solution, in steps S3-S4, after receiving the data, the food manufacturer host inserts the serial number, sale date and sale supermarket location information into the sales information table.
[0011] In the preferred embodiment, the algorithm steps of steps S3-S4 are: S3.1 Recording and updating the database for outbound delivery information: When the product is about to be shipped out to retailers or customers, the scanning device is used again to read the mother serial number on the product's overall outer packaging; Accurately record the current time as the outbound time, recorded as ; High-precision recording of the outbound time helps to more accurately track the time nodes of the product in the logistics process. The formula is: , here the division by 1000 is to convert the timestamp from milliseconds to seconds, and rounding down ensures that the recorded outbound time is a whole number of seconds, which is convenient for subsequent time calculation and data processing; Get the delivery destination information, including the retailer name. , the retailer's address is and the customer name is set to ; To encode this information, first convert the retailer name and customer name into a character encoding sequence, using Unicode encoding. Suppose the Unicode encoding sequence of the retailer name is , the Unicode encoding sequence of the customer name is ; For the retailer address, convert each character in the address into the corresponding ASCII code value and concatenate them into a digital code, recorded as ; These codes are then combined into a delivery destination code , the formula is: , where “+” represents the concatenation operation of the coding sequence; the function of this formula is to uniformly encode different types of delivery destination information for easy storage and query, while retaining the integrity and identifiability of the information; Shipping time , Delivery destination code The product information in the central database is updated by associating it with the mother serial number and other information; the update operation is implemented through the UPDATE statement of the database, using the mother serial number as the primary key, and updating the delivery time and delivery destination code to the corresponding product record; S3.2. When a retail store sells a product, the scanning device reads the mother serial code or the sub-serial code on the product, and determines it according to the actual situation. If the product still retains the mother serial code in the retail link, the mother serial code is scanned; if it has been split into individual products for sale and only the sub-serial code is retained, the sub-serial code is scanned; At the same time, get the current accurate sales time, recorded as , the calculation method is the same as the delivery time ,Right now ; Get sales location information, including supermarket name 、The supermarket address is and cashier number is ; Similarly, these information are encoded, and the supermarket name and cashier number are converted into Unicode encoding sequences, which are recorded as and , the supermarket address is converted into a digital code consisting of ASCII code values, recorded as ; Sales location code The calculation formula is: ; Will sell time , Sales location code The information such as the mother serial number is transmitted to the food manufacturer's host through the network; during the transmission process, in order to ensure data security, an encryption algorithm is used to encrypt the data; assuming that an encryption algorithm based on a public key encryption system is used, the food manufacturer generates a pair of public and private keys, and the retail store uses the public key to encrypt the data before transmission; The encryption formula is: , where Encrypt represents the encryption function. This formula combines the sales time, sales location and mother serial number into a data block and encrypts it using the public key to prevent the data from being stolen or tampered with during transmission; After the food manufacturer's host receives the encrypted data, it uses the private key to decrypt it. The formula is: , where Decrypt represents the decryption function; after decryption, the original sales time, sales location code and mother serial number are obtained; The decrypted mother serial number and sales time and sales location code The information is inserted into the sales information table; the insertion operation is implemented through the INSERT INTO statement of the database, and the information is accurately inserted into the corresponding fields according to the structure of the sales information table to complete the recording of sales data.
[0012] In the preferred solution, in step S5, the enterprise uses the verified serial code to perform an associated query in the production information table, the warehousing information table, the logistics information table, and the sales information table. The specific steps are: S5.1. Consumers or businesses enter the serial number on the product through a specific platform, including a web query interface or a mobile application query portal; The platform verifies the format of the input serial code; first, check whether the length of the serial code meets the preset rules; set the standard length of the serial code to If the length of the input serial code is not equal to , it is judged as a format error and the user is prompted to re-enter; the formula is: , then "Format Error" is returned, where len represents a function for calculating the length of a string; Next, verify whether the characters in the serial code are within the allowed character set; assuming that the allowed character set for the serial code is , for each character in the serial code ( ), check whether it satisfies ; If there are characters that do not meet the requirements, it is considered to be a format error; this step can be judged by looping through each character of the serial code, and the formula is expressed as: for all ,like , it returns "Format Error"; If the serial code format verification passes, proceed to the next step of the query process; S5.2. Preparation for multi-table association query: According to the structure of the serial code, parse out the key information; obtain this information through string interception operation; set the function for obtaining the product type identifier to be ,but ; The function to obtain the production date is ,but ; The function to obtain the production batch number is ,but ; The parsed information will be used for subsequent precise queries in various tables; Establish database connection to ensure access to production information table, warehousing information table, logistics information table and sales information table; this step involves setting database connection configuration parameters, such as database server address, port number, user name, password, etc., which should be correctly configured according to the requirements of the specific database management system to establish a stable database connection; S5.3、Query result processing and display: Clean and organize the result set ResultSet$ obtained from the associated query; remove any redundant information that may exist, such as repeated fields or internal system fields that do not need to be displayed to the user; at the same time, format some data, such as formatting the date into a user-friendly display format, and appropriately splicing or converting the location information; According to the needs of users and the display design of the platform, the processed query results are displayed to the requester in an intuitive and easy-to-understand way; a variety of display forms can be used, such as tables to display detailed data, flowcharts to display the production, warehousing, logistics and sales processes of products, and maps to display the logistics tracks of products; The result is displayed in a table format, with each field in the result set as a column and each record as a row, clearly presented to the user.
[0013] In the preferred solution, full and incremental backups are performed regularly on the database to ensure data security; backup strategies can be formulated based on the importance and update frequency of the data, such as daily full backups and hourly incremental backups; When data is lost or damaged, backup data can be used to restore it in time to ensure the normal operation of the traceability system; Establish a data update mechanism to update relevant records in the database in a timely manner when product information changes; For incorrectly entered data, a data correction function is provided, which allows authorized personnel to correct the incorrect data through specific approval processes and operation permissions; Continuously monitor the performance of the traceability system, including indicators such as data query response time and system throughput; improve system performance by optimizing database indexes, adjusting system configurations, caching hot data, etc.; Establish a performance early warning mechanism. When system performance drops to a certain level, promptly notify the system administrator to perform optimization processing to ensure that the traceability system can quickly respond to user query requests.
[0014] In the preferred solution, encryption technology is used to encrypt and store sensitive data in the database to prevent data leakage; Encrypt the data transmission process to ensure the security of data transmission between the barcode scanning device and the server, and between the supermarket barcode scanning machine and the food manufacturer's host, and prevent the data from being stolen or tampered with during network transmission; use the HTTPS protocol for data transmission encryption; User rights management: Establish a user role and rights management system to distinguish the operating rights of different user types; enterprise administrators have comprehensive management rights over product information, including adding, modifying, deleting product information and tracing records; Ordinary employees only have the authority to query traceability information; External users can only query publicly available product traceability information; Implement user identity authentication mechanism, username / password login, fingerprint recognition, and digital certificate authentication to ensure that only authorized users can access the traceability system and prevent illegal users from obtaining product traceability data.
[0015] The present invention provides a product tracing method based on a serial code, which has many significant beneficial effects. In terms of logistics, end-to-end visual management of goods is realized. By acquiring and analyzing information in real time through serial codes, logistics efficiency can be greatly improved, transportation routes can be accurately optimized, transportation time and cost can be reduced, the risk of loss and damage of goods can be effectively reduced, and the stability of the supply chain can be enhanced, making logistics operations more efficient, reliable and transparent. In the production process, with the help of the complete record of the entire production process information by the serial code, the enterprise can accurately trace the production history of each product, quickly and accurately locate the root cause of quality problems, and adjust the production process and process in time, thereby improving product quality, reducing the defective rate, and improving production efficiency. It promotes the transformation and upgrading of enterprises to intelligent manufacturing and enhances the core competitiveness of enterprises. For the entire industry, this method provides a new solution for information management. With innovative coding methods and powerful functions, it effectively promotes the relevant industries to make significant progress in the process of digital and intelligent management, optimizes resource allocation, and improves the overall operation level of the industry. For enterprises, it can create greater value, such as improving operational efficiency, reducing costs, and enhancing product quality control capabilities. At the same time, it can also improve user experience, allow consumers to clearly understand the product's entire life cycle information, enhance consumer confidence, and thus generate good social and economic benefits, and promote the healthy and sustainable development of the industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The present invention will be further described below in conjunction with the accompanying drawings and embodiments: Figure 1 is a flow chart of the product tracing algorithm of the present invention; DETAILED DESCRIPTION Example 1 like Figure 1 As shown, a product tracing method based on serial code, the method comprises: S1. Generate a unique sub-serial code for each product on the production conveyor belt, use a scanning device to read the sub-serial code on the product, record the production date and production line location of the product, and store this information in a central database; S2. Classify each product sub-serial code, carry out overall outer packaging according to the classified quantity, and print the main serial code on the overall outer packaging. Use a scanning device to read the serial code on the overall outer packaging of the product, record the delivery time and storage warehouse location of the overall packaged product, and update the product information in the central database; S3. Before the product is ready to be shipped out to retailers or customers, the scanning device is used again to read the mother serial code on the product's overall outer packaging, record the product's shipping time and delivery destination, and update the product information in the central database; S4. When selling products in retail stores, use the scanning equipment of the point-of-sale system to read the serial code on the product, record the time and location of sale, and send this information to the central database of the food manufacturer; S5. Consumers or businesses enter the serial code on the product through a specific platform to query. The query platform retrieves the product's production, logistics and sales information from the central database and displays the query results to the requester.
[0017] Food product traceability process based on serial code: 1. Production 1. Sub-serial code generation and information collection 1. On the production conveyor belt of a food production plant, a unique sub-serial code is generated for each box of biscuit products that are about to be packaged. Take the current system time 20230920103025 (accurate to seconds) as an example, and take the last 8 digits "103025" as the time code part. The production line has a total of 5 assembly lines. The product is on the 3rd assembly line, so the assembly line code is "003". A sensor is set every 0.5 meters on the production conveyor belt. The total length of the conveyor belt is 20 meters. The product passes the 8th sensor, and the sequence code is calculated according to the formula: Combining these three parts, we get the sub-serial code "103025003321".
[0018] 2. Attach a QR code to one side of the sub-serial code, which stores the sub-serial code information. Use a high-precision scanning device to read the sub-serial code on the product, and record the production date of the product as 10:30:25 on September 20, 2023, and the production line position is the 5th station of the 3rd line.
[0019] 3. Store information such as the sub-serial code, production date, and production line location in the central database through a secure and stable data transmission link. For example, insert a record in the "production information table" of the database, including sub-serial code "103025003321", production date "2023 - 09 - 20 10:30:25", production line location "3 - 05" and other field information.
[0020] 2. Warehousing 1. Classification of sub-serial codes and generation of parent serial codes 1. Classify the sub-serial codes based on three factors: product type (melon seeds or peanuts belong to the baked food type, coded as 02), production batch (the second batch produced on the same day, coded as 02), and product quality level during the production process (first-class product, coded as 01). Pre-set weight coefficients , , , the classification value is calculated according to the formula: . Assume that the classification threshold , the sub-sequential codes with similar classification values are classified into one category through a dynamic grouping algorithm.
[0021] 2. Generate a mother serial code for each type of sub-serial code. Take the current date 20230920 as the date part. There are 20 sub-serial codes of this type. Convert them into a 4-digit 34-decimal number. The calculation process is as follows: (corresponding to the letter T in base 34), , so the quantity code part is "00T". Take the first 6 digits "103025" of the first sub-serial code "103025003321" in this class as the identification part. Generate a key randomly (Assumption), the value of the combination of the previous three parts (Convert to decimal number, assume it is 123456789), calculate the check digit: , the complete mother serial number is "2023092000T10302525".
[0022] 2. Outbound information recording and database update 1. Use a scanning device to read the mother serial code "2023092000T10302525" on the product's overall outer packaging, trigger the information recording program, and record the current time September 21, 2023 14:00:00 as the delivery time.
[0023] 2. Get the location information of the storage warehouse. Assume that the warehouse number is "001", the warehouse area is "Area A", and the shelf location is "05 - 03" (indicates the 3rd shelf in the 5th row). Combine the warehouse number, area, and shelf location information into a code: "001A0503".
[0024] 3. Associate the outbound time, warehouse location code, and mother serial number with other information, and update the product information in the central database through the database UPDATE statement. In the "Warehouse Information Table", update the outbound time of the product record corresponding to the mother serial number to "2023 - 09 - 21 14:00:00", and update the warehouse location to "001A0503".
[0025] 3. Distribution 1. Outbound delivery information recording and database update 1. Before the product is ready to be shipped out to retailers, scan the mother serial code "2023092000T10302525" on the outer packaging again. Record the current precise time of September 21, 2023 15:30:00 (accurate to seconds) as the shipping time, calculated as follows: , the current system timestamp is 1695301800000 milliseconds, and the calculated delivery time is 1695301800 seconds, that is, 2023 - 09 - 21 15:30:00.
[0026] 2. Get the delivery destination information. Assume that the retailer name is "Sunshine Supermarket", its Unicode encoding sequence is "73756E67616E6753686963616E67", the retailer address is "No. 10 XX Road, Chaoyang District, Beijing", and the digital encoding after conversion to ASCII code values is "42696A696E6720536869204368616F2051752031302048616F", and the customer name (if it is a direct delivery customer, it is assumed here to be the supermarket purchasing manager "Li Si"), and its Unicode encoding sequence is (assuming that after conversion it is) "4E2D56FD6C495349". 3. Associate the information such as the delivery time, delivery destination code and mother serial number, update the product information in the central database, and insert a record in the "Logistics Information Table" containing the mother serial number "2023092000T10302525", delivery time "2023 - 09 - 21 15:30:00", delivery destination code And other field information.
[0027] 2. Logistics tracking (assuming that vehicle location information is updated during the logistics process) 1. The transport vehicle is equipped with a GPS positioning system, which automatically sends the current location information (longitude and latitude) to the logistics system every 30 minutes. After receiving the location information, the logistics system associates it with the corresponding product transportation record through the mother serial number in the logistics information table and updates the GPS positioning information in the record. For example, the location of the vehicle at a certain moment in the transportation process is longitude 116.407394, latitude 39.904211, and this information is updated to the product transportation record corresponding to the mother serial number in the logistics information table.
[0028] 4. Sales 1. Sales information recording and data transmission 1. When the biscuit product is sold in Sunshine Supermarket, the scanning device of the point-of-sale system reads the mother serial code (or sub-serial code, if the product has been unpacked and sold in the supermarket and only the sub-serial code is retained, it is assumed here that the mother serial code is still retained) "2023092000T10302525" on the product, and obtains the current precise sales time of September 22, 2023 10:05:30 (calculated in the same way as the delivery time).
[0029] 2. Get the sales location information, the Unicode code sequence of the supermarket name "Sunshine Supermarket" (assumed) is "73756E67616E6753686963616E67", the converted ASCII code value of the supermarket address "No. 10, XX Road, Chaoyang District, Beijing" is concatenated with the digital code "42696A696E6720536869204368616F2051752031302048616F", and the cashier number is "005", and its Unicode code sequence (assumed) is "303035". Calculate the sales location code: Sl= “73756E67616E6753686963616E67” + “42696A696E6720536869204368616F2051752031302048616F” + “303035”.
[0030] 3. The sales time, sales location code and mother serial number are transmitted to the food manufacturer's host through the network. Before transmission, the food manufacturer generates a pair of public and private keys (public key and private key ), the supermarket uses the public key to encrypt the data, the encryption formula is: .
[0031] 2. Food manufacturers receiving and processing data 1. After the food manufacturer's host receives the encrypted data, it uses the private key to decrypt it. The formula is: .
[0032] 2. Insert the decrypted mother serial number, sales time and sales location code information into the sales information table. Insert a record into the "Sales Information Table" containing the mother serial number "2023092000T10302525", sales time "2023 -09 - 22 10:05:30", sales location code And other field information.
[0033] 5. Query stage 1. Query Request and Verification 1. Consumers or businesses enter the serial code on the product through a specific mobile application query platform provided by the food manufacturer.
[0034] 2. The platform first performs format verification on the input serial code. Check whether the serial code length is 20 digits (according to the set mother serial code length rule). If the length is not equal to 20, a "format error" prompt is returned. At the same time, verify whether the characters in the serial code are within the allowed character set range (for example, whether it contains numbers 0 - 9, specific letters, etc.). Check each character in the serial code one by one. If there are any unallowed characters, a "format error" prompt is also returned.
[0035] (II) Multi-table association query and result display 1. Assuming that the serial code format is "YYYYMMDDxxxxxxIDxxxxxxP" (where "YYYYMMDD" is the date part, "xxxxxx" is the other coding part, "ID" is the identification part, and "P" is the check digit), the key information is parsed through the string interception operation. Get the date part "20230920" for further precise query in each table.
[0036] 2. Establish a connection with the central database to ensure access to production information tables, warehousing information tables, logistics information tables, and sales information tables.
[0037] 3. Query relevant records in the production information table. The query statement is: , obtain production information such as product production date, production line location, etc.
[0038] 4. Query records in the warehouse information table: , get the product's delivery time, storage warehouse location and other storage information.
[0039] 5. Query in the logistics information table: , obtain logistics information such as product delivery time, delivery destination, GPS positioning information during the logistics process, etc.
[0040] 6. Query in the sales information table: , obtain sales information such as product sales time and sales location.
[0041] 7. Use the JOIN operation of the database to associate and integrate the query results in the above four tables. The query formula is: .
[0042] 8. Clean and organize the result set obtained from the associated query, remove redundant fields, and format the date into a user-friendly form, such as displaying "2023-09-20 10:30:25" as "2023 September 20, 10:30:25", and converting the warehouse location code "001A0503" to "Warehouse No. 001, Area A, Row 5, Shelf 3", etc.
[0043] 9. Display the processed query results to the requester in a visual manner, such as displaying detailed data in a table, including fields such as production information (production date, production line location), warehousing information (delivery time, storage warehouse location), logistics information (shipping time, delivery destination, logistics track), and sales information (sales time, sales location). At the same time, the logistics track of the product can be displayed in the form of a map (drawn according to the GPS positioning information in the logistics information), so that consumers or enterprises can clearly understand the entire process information of the product from production to sales.
[0044] Example 2 Further illustrate with reference to Example 1, Figure 1 The structure shown generates a pipeline code based on the encoding of multi-source information fusion.
[0045] In the preferred solution, step S1 generates a serial code with more information content and traceability by fusing multi-source information: S1.1 Sub-serial code generation and information collection: On the production conveyor, a unique sub-serial code is generated for each product; the generation of the sub-serial code is based on the following rules: Take the last 8 digits of the current system timestamp as the time code part, recorded as ; This part of the code can reflect the chronological order of product production, making it easier to trace the products in chronological order later; Generate a 3-digit production line code based on the production line number of the product, recorded as ; Assume that the factory has There are 100 production lines, numbered from 001 to ,but The value range is 001 to ; This code is used to quickly locate the production source of the product; Calculate a sequence code based on the position of the product on the production conveyor belt, denoted as P; assume that a sensor is set at a fixed distance on the production conveyor belt, and when the product passes the sensor, the sensor records its sequence number; suppose the total length of the production conveyor belt is meters, the product passes through the When a sensor ,in Indicates rounding down; this code can further distinguish the production sequence of products in the same batch; Combine the above three parts of the code into a sub-sequential code: ; At the same time, a QR code is attached to one side of the sub-serial code, and the sub-serial code information is stored in the QR code; Use a scanning device to read the sub-serial code on the product, trigger the information collection program, and record the production date and production line location of the product; S1.2. The coding based on multi-source information fusion generates a serial code, and its coding structure is as follows: First, the key attributes of the material are encoded; assuming that the material has There are key attributes, each of which has a different value range; Attribute, whose value is , the total number of attribute value categories is ; Encode it as a The digital code of the bit, , here we use base 34 for the same reason as described in the document. Base 34 can effectively avoid confusion and provide sufficient encoding capacity. The encoding formula is: ; The function of this formula is to convert material attribute values of different value ranges into a unified 34-hexadecimal code so that the material information can be accurately represented in the serial code; Next, encode the important parameters in the production process; for example, the operating parameters of the production equipment, assuming that there are An important parameter, The value of the parameter is , the total number of categories of parameter values is ; The same 34-base encoding is used, and the encoding length is , the encoding formula is ; This formula ensures that the production process parameters can be accurately integrated into the serial code, providing a basis for tracing the production process; Then, the sub-serial code generated previously As part of the serial number; Finally, a check digit is added; the calculation of the check digit is based on all the previously encoded information and a key , the key is a confidentiality parameter set within the enterprise; The value after combining all the previous coded information is , check digit ; The function of the check digit is to verify the accuracy of the serial code in the subsequent data processing and tracing process to prevent errors in data transmission or storage; Complete sub-sequential code ; S1.3. The production date of the product , Production line location , sub-serial code And the generated serial code The information is associated and stored in the central database; when storing, this information is inserted into the corresponding fields according to the table structure designed by the database to ensure the integrity and searchability of the data.
[0046] 1. Encoding in calculation order hour: The numerator iD represents the distance of the sensor location that the product passes relative to the start of the production conveyor.
[0047] Divide by Get the number of sensors that the product has passed (round down), and add 1 to get the order code of the product on the production conveyor. This formula can accurately generate the order code according to the layout of the sensor and the position of the product, and distinguish the production order of different products in the same batch of products.
[0048] 2. In the material attribute coding formula First of all, The attribute value According to its encoding length Scaling is performed so that the rounding operation is within the appropriate numerical range.
[0049] After rounding down, the result is an integer, which represents the high-order part of the attribute value in base 34.
[0050] at last It is a modulo operation to obtain the low-order part of the attribute value in base 34, thereby completing the conversion of the attribute value to base 34 encoding. This formula can uniformly encode material attributes of different types and value ranges into a serial code, making it easier to parse material information based on the serial code.
[0051] 3. Encoding formula in production parameters The principle is similar to the material attribute coding formula, which is to convert the production parameter value into a 34-hexadecimal code to ensure that the key parameters in the production process can be accurately recorded in the serial code, providing detailed data support for production process traceability.
[0052] 4. Calculating the check digit hour: It is to multiply the combined value of all the previous encoded information by the key to obtain a new value.
[0053] The modulo operation ensures that the check digit is within the range of 34 (0 - 33). The existence of the check digit can quickly detect whether there is an error in the serial code by recalculating the check digit and comparing it with the stored check digit during data processing, thereby improving the accuracy and reliability of the data.
[0054] Example 3 Further illustrate with reference to Example 1, Figure 1 In the structure shown in the figure, in the delivery link in step S2, the mother serial code on the outer packaging is scanned; After identifying the serial code, the current time is obtained as the delivery time, and the delivery location information, logistics point address and GPS positioning information of the transport vehicle are obtained through the logistics system to track the logistics status of the product.
[0055] In the preferred embodiment, the logistics tracking steps in step S2 are: S2.1. Sub-serial code classification and mother serial code generation: First, according to the type of product: products are divided into Type, use Indicates Types, ; Production batch is , ; And the quality level of the product in the production process is divided into Level, use Indicates class, , these three main factors are used to classify sub-sequential codes; Calculate the classification value corresponding to each sub-serial code , the formula is: ,in , , is a pre-set weight coefficient and satisfies ; These weighting factors can be adjusted according to the importance that the enterprise attaches to product type, production batch and quality grade; According to the calculated classification value , classify the sub-sequential codes; a dynamic grouping algorithm can be used, for example, to set a classification threshold , when the difference between the classification values of the two sub-serial codes is less than or equal to , classify them into the same category; For each type of sub-serial code, a mother serial code is generated; the generation rules of the mother serial code are as follows: Take the current date as the date part, recorded as ; Calculate the number of sub-serial codes of this type , convert it into a 4-bit 34-decimal number, recorded as ; The conversion formula is: Assume The 34-decimal representation is ,in is a 34-bit place value, then , , , , and so on, until we calculate ; This formula can accurately encode the number of sub-serial codes into the main serial code, making it easier to trace the quantity information of the products in the package later; Take the first 6 bits of the first sub-serial code in this class as the identification part, recorded as ; This part can represent the common characteristics of this type of products to a certain extent; Finally, add a check digit ; The check digit is calculated based on the previous date part, the quantity code part and the identification part and a random key , a key is randomly generated each time the mother serial number is generated; let the combined value of the first three parts be , concatenate the parts into a number in a predetermined order, then convert it into a decimal number, check digit The function of the check digit is to verify the accuracy of the mother serial number in the subsequent data processing and tracing process to prevent errors in data transmission or storage; Complete mother serial number ; S2.2, warehouse information recording and database update: Use a scanning device to read the mother serial number on the product's overall outer packaging to trigger the warehouse information recording program; Record the current time as the outbound time, recorded as ; Get the location information of the storage warehouse, including the warehouse number , Warehouse area and the shelf position is ; Combine these position information into a code, the coding formula is: , where each part can be distinguished by a specific separator to facilitate subsequent parsing; this code can accurately locate the storage location of the product in the warehouse, facilitating inventory management and traceability; Shipping time , Warehouse location code and mother serial number The product information in the central database is updated by associating the information with the parent serial number. The update operation can use the database UPDATE statement, and update the corresponding delivery time and warehouse location information to the corresponding record based on the parent serial number as the key field. S2.3, Shipping information record and logistics tracking: During the shipping process, scan the mother serial number on the outer packaging again; Get the current time as the delivery time, recorded as ; Obtain delivery location information through the logistics system, including the address of the logistics outlet. and the GPS positioning information of the transport vehicle is ; Encode the logistics point address, convert each character in the address into the corresponding ASCII code value, and then concatenate them to form a digital code, recorded as ; For GPS positioning information, you can directly use its latitude and longitude values as and ; Will be shipped on time , Logistics outlet address code , GPS location information and And the mother serial number The information is associated and stored in the logistics tracking database; When storing, this information is inserted into the corresponding fields according to the table structure designed by the database to ensure the integrity and retrievability of the data; At the same time, during the logistics transportation process, the GPS positioning information of the transportation vehicle can be updated regularly to track the logistics status of the product in real time.
[0056] 1. Calculate the sub-sequential code classification value hour: , , As the weight coefficient, multiply the corresponding values of product type, production batch and quality grade respectively, and then add them up to get the classification value. This formula can quantify the impact of different factors on product classification according to the weights set by the enterprise, so as to achieve more accurate classification. For example, if the enterprise believes that the impact of product type on classification is twice that of production batch and three times that of quality grade, then it can set , , .
[0057] 2. In the formula for converting the number of sub-serial codes to base 34: By continuously performing remainder and integer division operations, the decimal quantity value is converted into base 34. This formula can accurately encode the sub-serial code quantity into the mother serial code, and base 34 can provide sufficient encoding space to represent the quantity of products of different sizes, while avoiding confusion with commonly used numbers and letters (removing easily confused I and O).
[0058] 3. Calculate the check digit of the mother serial number hour: Multiply the main components of the mother serial number (date, quantity code, identifier) with the random key to get a new value. Then The modulo operation limits the result to the range of 34 (0 - 33). The existence of the check digit can quickly detect whether the mother serial code has errors during transmission or storage by recalculating the check digit and comparing it with the stored check digit during data reading and processing, thereby ensuring the accuracy and reliability of the data.
[0059] 4. When encoding the logistics point address, convert each character into an ASCII code value and concatenate them: This encoding method can convert text-based address information into digital form, which is convenient for storage and processing in the database. In the subsequent logistics tracking and query process, the digital code can be converted back to the original address information as needed, so that users can check the shipping location of the product. For example, if the address of the logistics point is "ABC Warehouse", the converted code may be 656667 (the ASCII code values of A, B, and C respectively). This encoding method is simple and direct, and can effectively digitize the address information while retaining the uniqueness and identifiability of the address.
[0060] Example 4 Further illustrate with reference to Example 1, Figure 1In the structure shown, in the preferred embodiment, in steps S3-S4, after the food manufacturer host receives the data, it inserts the serial number, sale date and sale supermarket location information into the sales information table.
[0061] The algorithm steps of steps S3-S4 are: S3.1 Recording and updating the database for outbound delivery information: When the product is about to be shipped out to retailers or customers, the scanning device is used again to read the mother serial number on the product's overall outer packaging; Accurately record the current time as the outbound time, recorded as ; High-precision recording of the outbound time helps to more accurately track the time nodes of the product in the logistics process. The formula is: , here the division by 1000 is to convert the timestamp from milliseconds to seconds, and rounding down ensures that the recorded outbound time is a whole number of seconds, which is convenient for subsequent time calculation and data processing; Get the delivery destination information, including the retailer name. , the retailer's address is and the customer name is set to ; To encode this information, first convert the retailer name and customer name into a character encoding sequence, using Unicode encoding. Suppose the Unicode encoding sequence of the retailer name is , the Unicode encoding sequence of the customer name is ; For the retailer address, convert each character in the address into the corresponding ASCII code value and concatenate them into a digital code, recorded as ; These codes are then combined into a delivery destination code , the formula is: , where “+” represents the concatenation operation of the coding sequence; the function of this formula is to uniformly encode different types of delivery destination information for easy storage and query, while retaining the integrity and identifiability of the information; Shipping time , Delivery destination code The product information in the central database is updated by associating it with the mother serial number and other information; the update operation is implemented through the UPDATE statement of the database, using the mother serial number as the primary key, and updating the delivery time and delivery destination code to the corresponding product record; S3.2. When a retail store sells a product, the scanning device reads the mother serial code or the sub-serial code on the product, and determines it according to the actual situation. If the product still retains the mother serial code in the retail link, the mother serial code is scanned; if it has been split into individual products for sale and only the sub-serial code is retained, the sub-serial code is scanned; At the same time, get the current accurate sales time, recorded as , the calculation method is the same as the delivery time ,Right now ; Get sales location information, including supermarket name 、The supermarket address is and cashier number is ; Similarly, these information are encoded, and the supermarket name and cashier number are converted into Unicode encoding sequences, which are recorded as and , the supermarket address is converted into a digital code consisting of ASCII code values, recorded as ; Sales location code The calculation formula is: ; Will sell time , Sales location code The information such as the mother serial number is transmitted to the food manufacturer's host through the network; during the transmission process, in order to ensure data security, an encryption algorithm is used to encrypt the data; assuming that an encryption algorithm based on a public key encryption system is used, the food manufacturer generates a pair of public and private keys, and the retail store uses the public key to encrypt the data before transmission; The encryption formula is: , where Encrypt represents the encryption function. This formula combines the sales time, sales location and mother serial number into a data block and encrypts it using the public key to prevent the data from being stolen or tampered with during transmission; After the food manufacturer's host receives the encrypted data, it uses the private key to decrypt it. The formula is: , where Decrypt represents the decryption function; after decryption, the original sales time, sales location code and mother serial number are obtained; The decrypted mother serial number and sales time and sales location code The information is inserted into the sales information table; the insertion operation is implemented through the INSERT INTO statement of the database, and the information is accurately inserted into the corresponding fields according to the structure of the sales information table to complete the recording of sales data.
[0062] 1. Calculate the delivery time and sales time hour: The current system timestamp (milliseconds) is the number of milliseconds from a specific start time (computer system startup time or a specific time reference point) to the current moment, which is a very accurate time measurement. Dividing by 1000 is because the time field in the database is usually stored in seconds, and rounding down ensures that the obtained time is a whole number of seconds, which is convenient for subsequent storage, calculation, and query operations in the database. For example, if the timestamp is 1693000000500 milliseconds, then the calculated outbound time (or sales time) is 1693000 seconds. This conversion method not only retains a high time accuracy, but also meets the general requirements of database storage and data processing.
[0063] 2. Generate a delivery destination code and sales location code hour: Unicode encoding is used to convert character information such as retailer names, customer names, supermarket names, and cashier numbers into digital sequences, with each character having a unique corresponding Unicode value. This encoding method can handle a variety of languages and character sets, ensuring the universality and accuracy of information. For example, the Unicode encoding of "ABC Supermarket" may be a series of numbers, and by splicing these digital sequences together, the name information can be fully represented.
[0064] For address information, converting each character into ASCII code value and then concatenating them into digital code is a simple and effective way to convert text addresses into digital form. For example, the address "123 Main St" may be converted into a specific digital string after being concatenated into ASCII code value, which makes it easier to store and process address information in the database. At the same time, the digital code can be restored to the original address information through reverse conversion when necessary, which is convenient for query and tracing.
[0065] 3. In the data encryption formula And the decryption formula middle: The public key encryption system is based on the mathematical asymmetric encryption principle. The public key can be used publicly to encrypt data, while the private key is only known to the data recipient (food manufacturer) and is used to decrypt the data. This encryption method ensures the confidentiality of the data during transmission. Even if the data is intercepted by a third party, it cannot be decrypted to obtain the original information due to the lack of the private key. Specific encryption and decryption algorithms (such as the RSA algorithm, etc.) are based on complex mathematical operations, involving concepts such as large prime number decomposition and modular operations in number theory. The core principle is to use the mathematical relationship between the public key and the private key so that only the party holding the private key can correctly decrypt the data encrypted by the public key, thereby ensuring the security and integrity of data transmission. In practical applications, this encryption method is widely used in network communications, e-commerce and other fields to protect sensitive information from being leaked.
[0066] Example 5 Further illustrate with reference to Example 1, Figure 1 In the structure shown, in step S5, the enterprise uses the verified serial code to perform an associated query in the production information table, the warehousing information table, the logistics information table, and the sales information table. The specific steps are: S5.1. Consumers or businesses enter the serial number on the product through a specific platform, including a web query interface or a mobile application query portal; The platform verifies the format of the input serial code; first, check whether the length of the serial code meets the preset rules; set the standard length of the serial code to If the length of the input serial code is not equal to , it is judged as a format error and the user is prompted to re-enter; the formula is: , then "Format Error" is returned, where len represents a function for calculating the length of a string; Next, verify whether the characters in the serial code are within the allowed character set; assuming that the allowed character set for the serial code is , for each character in the serial code ( ), check whether it satisfies ; If there are characters that do not meet the requirements, it is considered to be a format error; this step can be judged by looping through each character of the serial code, and the formula is expressed as: for all ,like , it returns "Format Error"; If the serial code format verification passes, proceed to the next step of the query process; S5.2. Preparation for multi-table association query: According to the structure of the serial code, parse out the key information; obtain this information through string interception operation; set the function for obtaining the product type identifier to be ,but ; The function to obtain the production date is ,but ; The function to obtain the production batch number is ,but ; The parsed information will be used for subsequent precise queries in various tables; Establish database connection to ensure access to production information table, warehousing information table, logistics information table and sales information table; this step involves setting database connection configuration parameters, such as database server address, port number, user name, password, etc., which should be correctly configured according to the requirements of the specific database management system to establish a stable database connection; S5.3、Query result processing and display: Clean and organize the result set ResultSet$ obtained from the associated query; remove any redundant information that may exist, such as repeated fields or internal system fields that do not need to be displayed to the user; at the same time, format some data, such as formatting the date into a user-friendly display format, and appropriately splicing or converting the location information; According to the needs of users and the display design of the platform, the processed query results are displayed to the requester in an intuitive and easy-to-understand way; a variety of display forms can be used, such as tables to display detailed data, flowcharts to display the production, warehousing, logistics and sales processes of products, and maps to display the logistics tracks of products; The result is displayed in a table format, with each field in the result set as a column and each record as a row, clearly presented to the user.
[0067] 1. In the query request reception and verification step: formula It is used to quickly determine whether the length of the input serial code meets the standard. If the comparison is not equal, the format error can be immediately determined, avoiding unnecessary subsequent processing and improving verification efficiency.
[0068] For the formula "For all ,like , then returns "Format Error". It checks whether each character of the serial code is within the allowed character set by traversing each character of the serial code. This character-by-character verification method can ensure that the character composition of the serial code complies with the regulations and prevent query errors or system abnormalities caused by illegal characters. The combination of these two formulas ensures the validity of the input serial code from the basic format level, providing a prerequisite for subsequent accurate queries.
[0069] 2. In the multi-table association query execution step: Conditional judgments in the query statements of each table (such as , , The conditional formulas ensure that accurate records related to the input serial number are retrieved from the database, avoiding mischecks or missed checks. By using the serial number and the parsed key information as query conditions, the information of the target product at each link can be accurately located, laying the foundation for building a complete traceability information chain.
[0070] The connection formula of the association query (using SQL's JOIN operation) integrates the data in different tables by specifying the association key (serial code). This formula utilizes the characteristics of the database relational model to organically combine the product production, warehousing, logistics and sales information scattered in multiple tables, realizes the association and integration of data, and enables the query results to fully and accurately reflect the entire life cycle trajectory of the product. In the actual execution process, the database management system will build a temporary data structure in memory according to this formula, match and connect the records in the related tables according to the association key, and finally generate a result set containing complete traceability information. This mathematical relationship-based connection operation is one of the core mechanisms for relational databases to realize complex data query and management, and can efficiently provide comprehensive product information query services in the product traceability system.
[0071] Example 6 Further illustrate with reference to Example 1, Figure 1 The structure shown in the figure regularly performs full and incremental backup of the database to ensure data security. The backup strategy can be formulated according to the importance and update frequency of the data, such as daily full backup and hourly incremental backup. When data is lost or damaged, backup data can be used to restore it in time to ensure the normal operation of the traceability system; Establish a data update mechanism to update relevant records in the database in a timely manner when product information changes; For incorrectly entered data, a data correction function is provided, which allows authorized personnel to correct the incorrect data through specific approval processes and operation permissions; Continuously monitor the performance of the traceability system, including indicators such as data query response time and system throughput; improve system performance by optimizing database indexes, adjusting system configurations, caching hot data, etc.; Establish a performance early warning mechanism. When system performance drops to a certain level, promptly notify the system administrator to perform optimization processing to ensure that the traceability system can quickly respond to user query requests.
[0072] In the preferred solution, encryption technology is used to encrypt and store sensitive data in the database to prevent data leakage; Encrypt the data transmission process to ensure the security of data transmission between the barcode scanning device and the server, and between the supermarket barcode scanning machine and the food manufacturer's host, and prevent the data from being stolen or tampered with during network transmission; use the HTTPS protocol for data transmission encryption; User rights management: Establish a user role and rights management system to distinguish the operating rights of different user types; enterprise administrators have comprehensive management rights over product information, including adding, modifying, deleting product information and tracing records; Ordinary employees only have the authority to query traceability information; External users can only query publicly available product traceability information; Implement user identity authentication mechanism, username / password login, fingerprint recognition, and digital certificate authentication to ensure that only authorized users can access the traceability system and prevent illegal users from obtaining product traceability data.
[0073] The above embodiments are only preferred technical solutions of the present invention and should not be regarded as limiting the present invention. The protection scope of the present invention shall be the technical solutions recorded in the claims, including equivalent replacement solutions of the technical features in the technical solutions recorded in the claims. That is, equivalent replacement improvements within this scope are also within the protection scope of the present invention.
Claims
1. A product tracing method based on serial code, characterized by: The method includes: S1. Generate a unique sub-serial code for each product on the production conveyor belt, use a scanning device to read the sub-serial code on the product, record the production date and production line location of the product, and store this information in a central database; S2. Classify each product sub-serial code, carry out overall outer packaging according to the classified quantity, and print the main serial code on the overall outer packaging. Use a scanning device to read the serial code on the overall outer packaging of the product, record the delivery time and storage warehouse location of the overall packaged product, and update the product information in the central database; S3. Before the product is ready to be shipped out to retailers or customers, the scanning device is used again to read the mother serial code on the product's overall outer packaging, record the product's shipping time and delivery destination, and update the product information in the central database; S4. When selling products in retail stores, use the scanning equipment of the point-of-sale system to read the serial code on the product, record the time and location of sale, and send this information to the central database of the food manufacturer; S5. Consumers or businesses enter the serial code on the product through a specific platform to query. The query platform retrieves the product's production, logistics and sales information from the central database and displays the query results to the requester.
2. According to claim 1, a product tracing method based on serial number is characterized by: Coding based on multi-source information fusion generates pipeline codes.
3. The product tracing method based on serial number according to claim 2 is characterized by: Step S1 generates a serial code with more information content and traceability by fusing multi-source information: S1.1 Sub-serial code generation and information collection: On the production conveyor, a unique sub-serial code is generated for each product; the generation of the sub-serial code is based on the following rules: Take the last 8 digits of the current system timestamp as the time code part, recorded as ; This part of the code can reflect the chronological order of product production, making it easier to trace the products in chronological order later; Generate a 3-digit production line code based on the production line number of the product, recorded as ; Assume that the factory has There are 100 production lines, numbered from 001 to ,but The value range is 001 to ; This code is used to quickly locate the production source of the product; Calculate a sequence code based on the position of the product on the production conveyor belt, denoted as P; assume that a sensor is set at a fixed distance on the production conveyor belt, and when the product passes the sensor, the sensor records its sequence number; suppose the total length of the production conveyor belt is meters, the product has passed the When a sensor ,in Indicates rounding down; this code can further distinguish the production sequence of products in the same batch; Combine the above three parts of the code into a sub-sequential code: ; At the same time, a QR code is attached to one side of the sub-serial code, and the sub-serial code information is stored in the QR code; Use a scanning device to read the sub-serial code on the product, trigger the information collection program, and record the production date and production line location of the product; S1.
2. The coding based on multi-source information fusion generates a serial code, and its coding structure is as follows: First, the key attributes of the material are encoded; assuming that the material has There are key attributes, each of which has a different value range; Attribute, whose value is , the total number of attribute value categories is ; Encode it as a The digital code of the bit, , here we use base 34 for the same reason as described in the document. Base 34 can effectively avoid confusion and provide sufficient encoding capacity. The encoding formula is: ; The function of this formula is to convert material attribute values of different value ranges into a unified 34-hexadecimal code so that the material information can be accurately represented in the serial code; Next, encode the important parameters in the production process; for example, the operating parameters of the production equipment, assuming that there are An important parameter, The value of the parameter is , the total number of categories of parameter values is ; The same 34-base encoding is used, and the encoding length is , the encoding formula is ; This formula ensures that the production process parameters can be accurately integrated into the serial code, providing a basis for tracing the production process; Then, the sub-serial code generated previously As part of the serial number; Finally, a check digit is added; the calculation of the check digit is based on all the previously encoded information and a key , the key is a confidentiality parameter set within the enterprise; The value after combining all the previous coded information is , check digit ; The function of the check digit is to verify the accuracy of the serial code in the subsequent data processing and tracing process to prevent errors in data transmission or storage; Complete sub-sequential code ; S1.
3. The production date of the product , Production line location , sub-serial code And the generated serial code The information is associated and stored in the central database; when storing, this information is inserted into the corresponding fields according to the table structure designed by the database to ensure the integrity and searchability of the data.
4. The product tracing method based on serial number according to claim 1 is characterized in that: In the delivery process of step S2, the mother serial number on the outer packaging is scanned; After identifying the serial code, the current time is obtained as the delivery time, and the delivery location information, logistics point address and GPS positioning information of the transport vehicle are obtained through the logistics system to track the logistics status of the product.
5. The product tracing method based on serial code according to claim 4 is characterized in that: The steps of logistics tracking in step S2 are: S2.
1. Sub-serial code classification and mother serial code generation: First, according to the type of product: products are divided into Type, use Indicates Types, ; Production batch is , ; And the quality level of the product in the production process is divided into Level, use Indicates class, , these three main factors are used to classify sub-sequential codes; Calculate the classification value corresponding to each sub-serial code , the formula is: ,in , , is a pre-set weight coefficient and satisfies ; These weighting factors can be adjusted according to the importance that the enterprise attaches to product type, production batch and quality grade; According to the calculated classification value , classify the sub-sequential codes; a dynamic grouping algorithm can be used, for example, to set a classification threshold , when the difference between the classification values of the two sub-serial codes is less than or equal to , classify them into the same category; For each type of sub-serial code, a mother serial code is generated; the generation rules of the mother serial code are as follows: Take the current date as the date part, recorded as ; Calculate the number of sub-serial codes of this type , convert it into a 4-bit 34-decimal number, recorded as ; The conversion formula is: Assume The 34-decimal representation is ,in is a 34-bit place value, then , , , , and so on, until we calculate ; This formula can accurately encode the number of sub-serial codes into the main serial code, making it easier to trace the quantity information of the products in the package later; Take the first 6 bits of the first sub-serial code in this class as the identification part, recorded as ; This part can represent the common characteristics of this type of products to a certain extent; Finally, add a check digit ; The check digit is calculated based on the previous date part, the quantity code part and the identification part and a random key , a key is randomly generated each time the mother serial number is generated; let the combined value of the first three parts be , concatenate the parts into a number in a predetermined order, then convert it into a decimal number, check digit The function of the check digit is to verify the accuracy of the mother serial number in the subsequent data processing and tracing process to prevent errors in data transmission or storage; Complete mother serial number ; S2.2, warehouse information recording and database update: Use a scanning device to read the mother serial number on the product's overall outer packaging to trigger the warehouse information recording program; Record the current time as the outbound time, recorded as ; Get the location information of the storage warehouse, including the warehouse number , Warehouse area and the shelf position is ; Combine these position information into a code, the coding formula is: , where each part can be distinguished by a specific separator to facilitate subsequent parsing; this code can accurately locate the storage location of the product in the warehouse, facilitating inventory management and traceability; Shipping time , warehouse location code and mother serial number The product information in the central database is updated by associating the information with the parent serial number. The update operation can use the database UPDATE statement, and update the corresponding delivery time and warehouse location information to the corresponding record based on the parent serial number as the key field. S2.3, Shipping information record and logistics tracking: During the shipping process, scan the mother serial number on the outer packaging again; Get the current time as the delivery time, recorded as ; Obtain delivery location information through the logistics system, including the address of the logistics outlet. and the GPS positioning information of the transport vehicle is ; Encode the logistics point address, convert each character in the address into the corresponding ASCII code value, and then concatenate them to form a digital code, recorded as ; For GPS positioning information, you can directly use its latitude and longitude values as and ; Will be shipped on time , Logistics outlet address code , GPS location information and And the mother serial number The information is associated and stored in the logistics tracking database; When storing, this information is inserted into the corresponding fields according to the table structure designed by the database to ensure the integrity and retrievability of the data; At the same time, during the logistics transportation process, the GPS positioning information of the transportation vehicle can be updated regularly to track the logistics status of the product in real time.
6. The product tracing method based on serial number according to claim 1 is characterized by: In steps S3-S4, after receiving the data, the food manufacturer host inserts the serial number, sale date and sale supermarket location information into the sales information table.
7. The product tracing method based on serial number according to claim 6 is characterized by: The algorithm steps of steps S3-S4 are: S3.1 Recording and updating the database for outbound delivery information: When the product is about to be shipped out to retailers or customers, the scanning device is used again to read the mother serial number on the product's overall outer packaging; Accurately record the current time as the outbound time, recorded as ; High-precision recording of the outbound time helps to more accurately track the time nodes of the product in the logistics process. The formula is: , here the division by 1000 is to convert the timestamp from milliseconds to seconds, and rounding down ensures that the recorded outbound time is a whole number of seconds, which is convenient for subsequent time calculation and data processing; Get the delivery destination information, including the retailer name. , the retailer's address is and the customer name is set to ; To encode this information, first convert the retailer name and customer name into a character encoding sequence, using Unicode encoding. Suppose the Unicode encoding sequence of the retailer name is , the Unicode encoding sequence of the customer name is ; For the retailer address, convert each character in the address into the corresponding ASCII code value and concatenate them into a digital code, recorded as ; These codes are then combined into a delivery destination code , the formula is: , where "+" represents the concatenation operation of the coding sequence; the function of this formula is to uniformly encode different types of delivery destination information for easy storage and query, while retaining the integrity and identifiability of the information; Shipping time , Delivery destination code The product information in the central database is updated by associating it with the mother serial number and other information; the update operation is implemented through the UPDATE statement of the database, using the mother serial number as the primary key, and updating the delivery time and delivery destination code to the corresponding product record; S3.
2. When a retail store sells a product, the scanning device reads the mother serial code or the sub-serial code on the product, and determines it according to the actual situation. If the product still retains the mother serial code in the retail link, the mother serial code is scanned; if it has been split into individual products for sale and only the sub-serial code is retained, the sub-serial code is scanned; At the same time, get the current accurate sales time, recorded as , the calculation method is the same as the delivery time ,Right now ; Get sales location information, including supermarket name 、The supermarket address is and cashier number is ; Similarly, the information is encoded, and the supermarket name and cashier number are converted into Unicode encoding sequences, which are recorded as and , the supermarket address is converted into a digital code consisting of ASCII code values, recorded as ; Sales location code The calculation formula is: ; Will sell time , Sales location code The information such as the mother serial number is transmitted to the food manufacturer's host through the network; during the transmission process, in order to ensure data security, an encryption algorithm is used to encrypt the data; assuming that an encryption algorithm based on a public key encryption system is used, the food manufacturer generates a pair of public and private keys, and the retail store uses the public key to encrypt the data before transmission; The encryption formula is: , where Encrypt represents the encryption function. This formula combines the sales time, sales location and mother serial number into a data block and encrypts it using the public key to prevent the data from being stolen or tampered with during transmission; After the food manufacturer's host receives the encrypted data, it uses the private key to decrypt it. The formula is: , where Decrypt represents the decryption function; after decryption, the original sales time, sales location code and mother serial number are obtained; The decrypted mother serial number and sales time and sales location code The information is inserted into the sales information table; The insert operation is implemented through the INSERT INTO statement of the database, which accurately inserts this information into the corresponding fields according to the structure of the sales information table to complete the recording of sales data.
8. The product tracing method based on serial number according to claim 1 is characterized by: In step S5, the enterprise uses the verified serial code to perform an associated query in the production information table, warehousing information table, logistics information table, and sales information table. The specific steps are: S5.
1. Consumers or businesses enter the serial number on the product through a specific platform, including a web query interface or a mobile application query portal; The platform verifies the format of the input serial code; first, check whether the length of the serial code meets the preset rules; set the standard length of the serial code to If the length of the input serial code is not equal to , it is judged as a format error and the user is prompted to re-enter; the formula is: , then "Format Error" is returned, where len represents a function for calculating the length of a string; Next, verify whether the characters in the serial code are within the allowed character set; assuming that the allowed character set for the serial code is , for each character in the serial code ( ), check whether it satisfies ; If there are characters that do not meet the requirements, it is considered to be a format error; This step can be judged by looping through each character of the serial code, and the formula is expressed as: ,like , it returns "Format Error"; If the serial code format verification passes, proceed to the next step of the query process; S5.
2. Preparation for multi-table association query: According to the structure of the serial code, parse out the key information; obtain this information through string interception operation; set the function for obtaining the product type identifier to be ,but ; The function to obtain the production date is ,but ; The function to obtain the production batch number is ,but ; The parsed information will be used for subsequent precise queries in various tables; Establish database connection to ensure access to production information table, warehousing information table, logistics information table and sales information table; this step involves setting database connection configuration parameters, such as database server address, port number, user name, password, etc., which should be correctly configured according to the requirements of the specific database management system to establish a stable database connection; S5.3、Query result processing and display: Clean and organize the result set ResultSet$ obtained from the associated query; remove any redundant information that may exist, such as repeated fields or internal system fields that do not need to be displayed to the user; at the same time, format some data, such as formatting the date into a user-friendly display format, and appropriately splicing or converting the location information; According to the needs of users and the display design of the platform, the processed query results are displayed to the requester in an intuitive and easy-to-understand way; a variety of display forms can be used, such as tables to display detailed data, flowcharts to display the production, warehousing, logistics and sales processes of products, and maps to display the logistics tracks of products; The result is displayed in a table format, with each field in the result set as a column and each record as a row, clearly presented to the user.
9. The product tracing method based on serial number according to claim 1 is characterized by: Regularly perform full and incremental backups of the database to ensure data security; backup strategies can be formulated based on the importance and update frequency of the data, such as daily full backups and hourly incremental backups; When data is lost or damaged, backup data can be used to restore it in time to ensure the normal operation of the traceability system; Establish a data update mechanism to update relevant records in the database in a timely manner when product information changes; For incorrectly entered data, a data correction function is provided, which allows authorized personnel to correct the incorrect data through specific approval processes and operation permissions; Continuously monitor the performance of the traceability system, including indicators such as data query response time and system throughput; Improve system performance by optimizing database indexes, adjusting system configuration, caching hot data, etc. Establish a performance early warning mechanism. When system performance drops to a certain level, promptly notify the system administrator to perform optimization processing to ensure that the traceability system can quickly respond to user query requests.
10. The product tracing method based on serial number according to claim 1 is characterized by: Use encryption technology to encrypt and store sensitive data in the database to prevent data leakage; Encrypt the data transmission process to ensure the security of data transmission between the barcode scanning device and the server, and between the supermarket barcode scanning machine and the food manufacturer's host, and prevent the data from being stolen or tampered with during network transmission; use the HTTPS protocol for data transmission encryption; User rights management: Establish a user role and rights management system to distinguish the operating rights of different user types; Enterprise administrators have full management rights over product information, including adding, modifying, deleting product information and tracing records; Ordinary employees only have the authority to query traceability information; External users can only query publicly available product traceability information; Implement user identity authentication mechanism, username / password login, fingerprint recognition, and digital certificate authentication to ensure that only authorized users can access the traceability system and prevent illegal users from obtaining product traceability data.
Citation Information
Cited By
Electronic material intelligent coding method and system based on dynamic parameter mapping
CN121093201A