A method for reading and repairing a two-dimensional code for a tobacco packaging machine
By repairing the main read queue using the pre-read queue, the problems of missed reads and equipment malfunctions in the QR code reading of tobacco packaging machines were resolved, the reading ratio and accuracy were improved, and errors caused by equipment failures were reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-19
- Publication Date
- 2026-03-31
AI Technical Summary
Existing tobacco packaging machines suffer from problems such as missed readings, equipment malfunctions, and misaligned information timing when reading QR codes, resulting in a low reading rate and an inability to accurately locate the specific position of missing codes.
The main read queue is repaired by pre-reading queue, the barcode queue read by the box code inspection station is used to recover the missed barcodes, and potential equipment failures are verified when the box code reading station is reading normally, so as to identify and mitigate occasional errors.
This increased the rate of QR code reading, reduced errors caused by equipment malfunctions, and ensured the accuracy and completeness of barcode reading.
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method for reading and repairing QR codes used in tobacco packaging machines. Background Technology
[0002] The auxiliary equipment of the tobacco packaging machine is responsible for processes such as adding small-sized inserts to small boxes, packing small cartons with barcodes, and adding barcode inserts to carton boxes. The equipment has a high degree of automation and good integration. Currently, the State Tobacco Monopoly Administration is organizing technical forces to add QR codes to tobacco product packaging to enable the tracking of tobacco products. Therefore, it is necessary to modify the existing tobacco packaging machines to enable the reading of QR codes on the production line. Due to the limitations of the existing equipment and operating conditions on the production line, industrial cameras may not be able to achieve a sufficiently high reading ratio. If the data streams from multiple cameras are reused to repair missed barcode information, a higher reading ratio can be achieved.
[0003] Chinese patent document CN2021106475822 discloses a method and device for associating QR code information on cigarette packs with verification function. The document explicitly includes instructions for repairing empty spaces. However, in actual use, the following problems arise:
[0004] 1. Empty slots may not only originate from unrecognized barcodes, but may also come from other non-barcode reasons upstream on the assembly line (such as failing external inspection).
[0005] 2. When reading the box code sequence, if the stacking of packages has been completed, the reading can only be done in units of stacks (two packages). Therefore, when a code cannot be identified, the specific location (top or bottom) of the missing code cannot be determined, and the gap cannot be simply compared and repaired.
[0006] 3. Due to human intervention, equipment malfunction, or abnormal program communication, the equipment may occasionally misread information reading timing.
[0007] This invention provides a QR code reading and repair method for tobacco packaging machines. It repairs the main reading queue as much as possible through a pre-reading queue and verifies the verifiable barcodes in the main queue to identify and mitigate errors caused by occasional problems. Summary of the Invention
[0008] The purpose of this invention is to provide a QR code reading and repair method for tobacco packaging machines, which repairs the main reading queue as much as possible through a pre-reading queue and verifies the verifiable barcodes in the main queue, so as to identify and mitigate errors caused by occasional problems.
[0009] To achieve the aforementioned technical objectives and effects, this invention discloses a QR code reading and repair method for tobacco packaging machines. This method uses the barcode queue read from the box code inspection station to recover missed barcodes from the box code reading station. Under normal reading conditions at the box code reading station, the method re-verifies the barcodes against the barcode queue read from the box code inspection station to identify potential equipment malfunctions. The specific implementation process is as follows:
[0010] S1, the read queue (pre-read queue) of the box code inspection station is passed in. The pre-read queue is allowed to contain unrecognized barcode elements, which must meet the format requirements of the algorithm;
[0011] S2, After a failed inspection item is removed, the information should not be deleted from the pre-read queue. When a small box is removed before the box code reading station for other reasons, the status of the corresponding element in the pre-read queue should also be changed to "removed".
[0012] S3, the reading queue (main reading queue) of the box code reading station is passed in. The main reading queue supports stacked reading and allows unrecognized barcode elements in the main reading queue. It must meet the format requirements of the algorithm. When stacked packages are read, if both packages are read successfully, the QR code reading device will return the two barcodes in the prescribed order. However, when only one barcode is read, the QR code reading device cannot tell which package's barcode is missing. Therefore, when recovering data, it is necessary to consider adapting to this situation.
[0013] S4, the algorithm will attempt to use data from the pre-read queue to repair barcodes that were not read in the main read queue; and will verify the normal barcodes in the main read queue to identify possible operational anomalies;
[0014] The main queue supports stacked reading. Regardless of whether it successfully reads two barcodes, reads one barcode, or fails to read any barcodes, this algorithm can perform barcode repair as much as possible and verify the barcodes as much as possible.
[0015] The present invention has the following beneficial effects: it repairs the main read queue as much as possible through the pre-read queue and verifies the barcodes that can be verified in the main queue, so as to identify and mitigate errors caused by occasional problems. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments.
[0017] This invention discloses a QR code reading and repair method for tobacco packaging machines. It uses the barcode queue read from the box code inspection station to recover missed barcodes from the box code reading station. Under normal reading conditions at the box code reading station, it re-verifies the barcodes against the barcode queue read from the box code inspection station as much as possible to identify potential equipment malfunctions. The specific implementation process is as follows:
[0018] S1, the read queue (pre-read queue) of the box code inspection station is passed in. The pre-read queue is allowed to contain unrecognized barcode elements, which must meet the format requirements of the algorithm;
[0019] S2, After a failed inspection item is removed, the information should not be deleted from the pre-read queue. When a small box is removed before the box code reading station for other reasons, the status of the corresponding element in the pre-read queue should also be changed to "removed".
[0020] S3, the reading queue (main reading queue) of the box code reading station is passed in. The main reading queue supports stacked reading and allows unrecognized barcode elements in the main reading queue. It must meet the format requirements of the algorithm. When stacked packages are read, if both packages are read successfully, the QR code reading device will return the two barcodes in the prescribed order. However, when only one barcode is read, the QR code reading device cannot tell which package's barcode is missing. Therefore, when recovering data, it is necessary to consider adapting to this situation.
[0021] S4, the algorithm will attempt to use data from the pre-read queue to repair barcodes that were not read in the main read queue; and will verify the normal barcodes in the main read queue to identify possible operational anomalies;
[0022] The main queue supports stacked reading. Regardless of whether it successfully reads two barcodes, reads one barcode, or fails to read any barcodes, this algorithm can perform barcode repair as much as possible and verify the barcodes as much as possible.
[0023] Typically, before the box code reading station, the packaging machine has a box code inspection station. The box code inspection station is usually located before the small box is wrapped with a small transparent part. It is used to verify the quality of the QR code and reject the box if it fails to read. Since the small box at the box code inspection station is not wrapped with a small transparent part and is read one box at a time, the working conditions are better than those at the barcode reading station, and its recognition rate is also significantly higher. Small boxes after being read at the box code inspection station may be rejected because the QR code cannot be read or for other reasons (failure to pass the appearance inspection, hot start). The empty space created by the rejection will be filled by the machine body through the repacking device before the barcode reading station.
[0024] The algorithm implementation is described as follows:
[0025] The enumerations used:
[0026] BarCodeStates: byte,
[0027] Constants: Undefined=0, Requested=1, ScanningSucceeded=7, ScanningFailed=11, EjectRequested=15
[0028] Bit sequence (from low to high):
[0029] Requested: Scanning has been requested;
[0030] Scanned: Scanning has been triggered;
[0031] Decoded: Decoding received;
[0032] ToBeEjected: Rejected due to other reasons;
[0033] 0: Not used in this invention;
[0034] 0: Not used in this invention;
[0035] 0: Not used in this invention;
[0036] 0: Not used in this invention;
[0037] Note: Boxes in the ScanningSucceeded state (bit sequence 00000100) will not be removed;
[0038] Entities used:
[0039] Entity Class:;
[0040] StreamAbstractItem;
[0041] int Length;
[0042] bool Validated = false;
[0043] StatefulItem;
[0044] BarCodeStates State;
[0045] Item: StatefulItem;
[0046] tring BarCode;
[0047] int Length = 1;
[0048] bool Validated = State== ScanningSucceeded;
[0049] ItemWithMissingPair: Item indicates that at most one barcode was read from the two stacked items, and it is impossible to determine which one is missing (if the State is abnormal, both are missing).
[0050] int Length = 2;
[0051] boolValidated = false;
[0052] PlaceHolder: StatefulItem represents a placeholder;
[0053] o int Length = 1;
[0054] BarCodeStates State = 8 (ToBeEjected);
[0055] Splitter: StreamAbstractItem represents a delimiter. In this invention, it is used to segment cigarette data.
[0056] intLength = 0;
[0057] Data repair method using GDX2 as an example:
[0058] GDX2FlowFixer;
[0059] Constructor: Queue <item>[] sources;
[0060] Method: intProcess(int count);
[0061] Read-only property: Queue <item>[] Sources;
[0062] Read-only property: Queue <item>Result;
[0063] The constructor takes two queues as input:
[0064] 1. Pre-scanning queue: This queue's data comes from the box code inspection station's barcode reader and only contains StatefulItems (including Item and PlaceHolder), but does not allow ItemWithMissingPair. The length has been pre-filled to the position in the main scanning queue (i.e., if both scans are successful, the first two data points of preScanning and mainScanning should be completely consistent). Small boxes that need to be rejected after scanning at the box code inspection station will be rejected before entering the main scanning station, but the corresponding data will not be removed after the cigarette pack rejection action is completed. If a small box is rejected after scanning at the box code inspection station due to reasons other than our own (such as equipment appearance detection failure, overheating, etc.), the ToBeEjected value of the corresponding small box's data should be set to 1.
[0065] 2. Main Scanning queue: This queue contains data from the barcode reader at the box code reading station. It includes only Items (ItemWithMissingPair is allowed, and Items that are not with MissingPair must appear in pairs; when a barcode cannot be read, two Items or one ItemWithMissingPair should be inserted) and Splitters (inserted when the barcode is split, must be included, and inserted according to phase or station). The return order of the main scan should be consistent with the pre-scan, that is, the reading order is consistent with the packing order.
[0066] The output Result contains Item (which may include ItemWithMissingPair) and Splitter.
[0067] The count parameter of Process must be a positive even number;
[0068] Ctor: The length of sources must be 2, otherwise an error will occur;
[0069] Process:
[0070] Set intresult = 0;
[0071] Loop begins (when count > result):
[0072] Get the element mainItem1 from mainScanning (and remove it);
[0073] If mainItem1 cannot be retrieved (mainScanning is empty);
[0074] Return result;
[0075] If mainItem1 is a Splitter;
[0076] Add mainItem1 to the Result;
[0077] Begin the next loop;
[0078] Get elements preItem1 and preItem2 from preScanning (and remove them);
[0079] If preItem1 and preItem2 cannot be retrieved:
[0080] Error (Insufficient data in the pre-scan queue);
[0081] Determine the category of mainItem1:
[0082] For ItemWithMissingPair:
[0083] Judgment NOT(preItem1.State.Decoded AND preItem2.State.Decoded) ORpreItem1.State.ToBeEjected R preItem2.State.ToBeEjected:
[0084] True:
[0085] (This should be a replacement package that has been removed and cannot be repaired);
[0086] Alarm: Code reading failed and cannot be repaired;
[0087] Add mainItem1 to the Result;
[0088] (Optional process for debugging);
[0089] If mainItem1.State.Decoded exists:
[0090] (Identify a code);
[0091] For example, if preItem1.State.Decoded and mainItem1.BarCode is preItem1.BarCode:
[0092] Error message (not correctly removed);
[0093] If preItem2.State.Decoded and mainItem1.BarCode is preItem2.BarCode:
[0094] Error message (not correctly removed);
[0095] otherwise:
[0096] (No removal is required; repair can be attempted.)
[0097] Alarm: Code reading failed, use PreScanning to repair;
[0098] Determine mainItem1.State.Decoded:
[0099] Existence (identifying a code):
[0100] judge;
[0101] If preItem1.BarCode is mainItem1.BarCode: Add a newly created item (type Item, BarCode is mainItem1.BarCode, State is ScanningSucceeded) and preItem2 to the Result;
[0102] Alternatively, if preItem2.BarCode is mainItem1.BarCode: add preItem1 and a newly created item (type Item, BarCode is mainItem1.BarCode, State is ScanningSucceeded) to the Result;
[0103] Alternatively (optional process for debugging):
[0104] Error (Queue label data inconsistency error);
[0105] Not found (unrecognized):
[0106] Add preItem1 and preItem2 to the Result;
[0107] Otherwise (for Item and not ItemWithMissingPair):
[0108] Get the element mainItem2 from mainScanning (and remove it);
[0109] If mainItem2 cannot be retrieved:
[0110] Error (Insufficient paired data in the main queue);
[0111] (Optional process for debugging);
[0112] If mainItem2 is ItemWithMissingPair or Splitter:
[0113] Error (Incorrect data position in main queue);
[0114] Determine mainItem1.State.Decoded, mainItem2.State.Decoded:
[0115] All exist:
[0116] (Optional process for debugging) Determine (preItem1.State.Decoded AND preItem2.State.Decoded) AND NOT preItem1.State.ToBeEjected AND NOT preItem2.State.ToBeEjected:
[0117] True: If preItem1.BarCode is not equal to mainItem1.BarCode, or preItem2.BarCode is not equal to preItem2.BarCode:
[0118] Error (Queue label data inconsistency error);
[0119] Add mainItem1 and mainItem2 to the Result;
[0120] otherwise:
[0121] Judgment NOT(preItem1.State.Decoded AND preItem2.State.Decoded) ORpreItem1.State.ToBeEjected OR preItem2.State.ToBeEjected:
[0122] True:
[0123] (This should be a replacement package that has been removed and cannot be repaired);
[0124] Alarm: Code reading failed and cannot be repaired.
[0125] (Optional process for debugging);
[0126] If mainItem1.State.Decoded AND (preItem1.State.Decoded ORpreItem1.State.ToBeEjected):
[0127] If mainItem1.BarCode is preItem1.BarCode:
[0128] Error message (not correctly removed).
[0129] If mainItem2.State.Decoded AND (preItem2.State.Decoded ORpreItem2.State.ToBeEjected):
[0130] If mainItem2.BarCode is preItem2.BarCode:
[0131] Error message (not correctly removed);
[0132] Add mainItem1 and mainItem2 to the Result;
[0133] otherwise:
[0134] (No removal is required; repair can be attempted.)
[0135] Alarm: Code reading failed, use PreScanning to repair;
[0136] Determine mainItem1.State.Decoded:
[0137] exist:
[0138] Add mainItem1 to the Result;
[0139] (Optional process for debugging);
[0140] If mainItem1.BarCode is preItem1.BarCode:
[0141] Error message (not correctly removed);
[0142] Does not exist:
[0143] Add preItem1 to the Result;
[0144] Check mainItem2.State.Decoded:
[0145] exist:
[0146] Add mainItem2 to the Result;
[0147] (Optional process for debugging);
[0148] If mainItem2.BarCode is preItem2.BarCode:
[0149] Error message (not correctly removed).
[0150] Does not exist:
[0151] Add preItem2 to Result;
[0152] Set result += 2;
[0153] Returns the result.
[0154] The present invention has the following beneficial effects: it repairs the main read queue as much as possible through the pre-read queue and verifies the barcodes that can be verified in the main queue, so as to identify and mitigate errors caused by occasional problems.
[0155] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.< / item> < / item> < / item>
Claims
1. A method for repairing reading of a two-dimensional code for a tobacco packaging machine, characterized by: Using the barcode queue read out by the box code inspection station, the missed barcodes of the box code reading station are recovered, and in the case of normal reading of the box code reading station, the barcode queue read out by the box code inspection station is re-verified to identify potential equipment failures. The specific implementation process is as follows: S1, the pre-reading queue of the box code inspection station is transmitted, and the unrecognized barcode elements in the pre-reading queue need to meet the format requirements of the algorithm; S2, after the failed barcodes are rejected, the information should not be deleted from the pre-reading queue, and when the small box is rejected in the box code reading station due to other reasons, the state of the corresponding element in the pre-reading queue should also be modified to rejected; S3, the main reading queue of the box code reading station is transmitted, and the main reading queue supports stack reading. The unrecognized barcode elements in the main reading queue need to meet the format requirements of the algorithm. When stack reading, if both packages are read successfully, the two-dimensional code reading device will return two barcodes in the specified order. But when only one barcode is read, the two-dimensional code reading device cannot tell which package the missing barcode is from, so when the data is recovered, this situation needs to be marked; S4, the algorithm will use the data in the pre-reading queue to repair the unreadable barcodes in the main reading queue; and verify the normal barcodes in the main reading queue to identify abnormal operation; Among them, the main queue supports stack reading, whether it successfully reads two barcodes, reads one barcode, or does not read a barcode, the algorithm can perform barcode repair and barcode verification.
Citation Information
Patent Citations
Bar code printer
JP2011173278A
Identifying one- or two-dimensional bar codes via weighted image data combination
US20160098585A1