Method for First Positioning Code of Two-dimensional Code Information Strip of Cigarette Carton with Repair Function
By reading and repairing unidentified QR code information in the tobacco packaging machine, the bar removal problem caused by failure of reading is solved, and the yield rate and data reading accuracy are improved.
Patent Information
- Application Number
- CN202111557364.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-19
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2041-12-19
AI Technical Summary
During the QR code reading process of existing tobacco packaging machines, the information association failure caused by the failure to read, resulting in the removal of the strip and reducing the yield rate.
By reading and verifying the positioning code before the packaging machine forms the small box 25 flat pack, it attempts to repair the QR code information that cannot be read, ensuring that the data with unidentified barcodes in the box code queue can be repaired or inferred in subsequent operations, reducing the bar removal caused by failed reading.
It improves the yield rate of tobacco packaging machines, reduces the failure of information relating due to failed reading, and improves the accuracy of data reading and the degree of automation of equipment.
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method for positioning the first code of the two-dimensional code information of cigarette box strips with a repair function. Background Art
[0002] The auxiliary machine of the tobacco packaging machine is responsible for processes such as adding small transparencies to small boxes, packing small boxes into strips, and adding strip transparencies to strip boxes. The equipment has a high degree of automation and good integration. Currently, the State Tobacco Monopoly Administration is organizing technical forces to track tobacco products by adding two-dimensional codes to tobacco product packaging. Therefore, it is necessary to transform the existing tobacco packaging machines to achieve the reading of two-dimensional codes on the production line. Due to the limitations of the existing equipment and working conditions on the production line, in addition to installing barcode readers, a series of data recovery and verification are also required to improve the data reading rate and ensure accuracy.
[0003] The positioning codes (two codes for two boxes in a stack) returned by the existing box code verification station are only used to pull the box codes of 10 boxes in the strip from the box code queue, and it is required that there are no unrecognized box codes in the box code queue. Otherwise, the strip will be rejected due to the failure of the strip information association. Chinese Patent Document CN2021106475822 discloses a method and device for associating two-dimensional code information of cigarette box strips with a verification function, which is different in the verification position, the data recovery method, and the method of pulling the small box data corresponding to the carton.
[0004] The present invention provides a method for positioning the first code of the two-dimensional code information of cigarette box strips with a repair function, which reduces the rejection of strips caused by the failure of the strip information association due to the existence of unreadable records in the box code queue and the failure of the box code verification station to read the code, and increases the yield. Summary of the Invention
[0005] The purpose of the present invention is to provide a method for positioning the first code of the two-dimensional code information of cigarette box strips with a repair function, which reduces the rejection of strips caused by the failure of the strip information association due to the existence of unreadable records in the box code queue and the failure of the box code verification station to read the code, and increases the yield.
[0006] To achieve the above technical purpose and reach the above technical effect, the present invention discloses a method for positioning the first code of the two-dimensional code information of cigarette box strips with a repair function. Before the two-five flat package of small boxes is formed on the packaging machine, the barcode information of the small boxes has been read and a "box code queue" has been formed, which may contain unrecognizable small box information. By reading the two-dimensional codes (hereinafter referred to as positioning codes) of the first stack of two small boxes when or after the two-five flat package is established, the small box two-dimensional code information is pulled from the queue, and the two-dimensional code information that fails to be read in the box code queue and is exactly located at the position of the positioning code is verified and attempted to be repaired. The specific implementation process is as follows:
[0007] S1. Input the box code queue from the outside. The box code queue is allowed to have unrecognized barcode elements, which need to meet the format requirements of the algorithm;
[0008] S2. Obtain the barcodes of the first stack (the 1st / 2nd package) of the 25-piece flat package from the box code verification station, that is, the positioning codes. In addition to the normal recognition of two barcodes, it is also allowed to recognize one barcode and the situation of unrecognized barcodes;
[0009] S3. The algorithm processes the box code queue through the positioning code and packs the box codes of all 10 small boxes in this strip for subsequent operations. The following two situations may occur when processing the box code queue:
[0010] First, when two barcodes are normally recognized for the positioning code, repair the barcode data that can be repaired in the box code queue and complete the box code packing operation;
[0011] Second, when one barcode or no barcode is recognized for the positioning code, try to complete the box code packing operation;
[0012] S4. For the verification status (success, failure, pending) of the completed packing mark, where success means that the box barcodes in this package have passed the verification; failure indicates that the box barcodes in this package have failed the verification and need to be excluded in subsequent operations; pending means that the verification status of the box barcodes in this strip cannot be determined temporarily, and the algorithm will modify it later;
[0013] In particular, since only the first two packages of the strip are verified (only the previous strip and the first stack of this strip may be determined to be correct), any just-completed packing cannot be verified as successful, but only the verification result will be set to failure or pending. After the next strip enters the verification process and meets certain conditions, the verification status of the previous strip can be determined as successful, failed, or still pending waiting for the verification update of the subsequent strip.
[0014] The present invention has the following beneficial effects: 1. If only one code is read for the positioning code, the function can also be realized; 2. If the positioning code is successfully read and there is a missing barcode at the corresponding position in the box code queue, repair can be realized; 3. If the positioning code fails to read, information inference can be allowed to pass within a certain continuous quantity, and the inferred information can be confirmed by subsequent positioning codes. Detailed implementation method
[0015] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with embodiments.
[0016] The present invention discloses a method for positioning the first code of the two-dimensional code information strip of a cigarette carton strip with a repair function. Before the 25-pack flat package of the small carton is formed on the packaging machine, the barcode information of the small carton has been read and a "carton code queue" has been formed, which may contain unrecognizable small carton information. By reading the two-dimensional codes (hereinafter referred to as positioning codes) of two small cartons in the first stack when or after the 25-pack flat package is established, the small carton barcode information is pulled from the queue, and the two-dimensional code information that cannot be read in the carton code queue and is just located at the positioning code position is verified and attempted to be repaired. The specific implementation process is as follows:
[0017] S1. Input the carton code queue from the outside. Unrecognized barcode elements are allowed to exist in the carton code queue, and the format requirements of the algorithm need to be met;
[0018] S2. Obtain the barcode of the first stack (the 1st / 2nd pack) of the 25-pack flat package from the carton code verification station, that is, the positioning code. In addition to normally recognizing two barcodes, it is also allowed to recognize one barcode and the situation of unrecognized barcodes;
[0019] S3. The algorithm processes the carton code queue through the positioning code and packs the carton codes of all 10 small cartons in this strip for subsequent operations. The following two situations may occur when processing the carton code queue:
[0020] First, when two barcodes of the positioning code are normally recognized, repair the barcode data that can be repaired in the carton code queue and complete the carton code packing operation;
[0021] Second, when one or no barcode of the positioning code is recognized, try to complete the carton code packing operation as much as possible;
[0022] S4. For the verification status (success, failure, pending) of the completed packing mark, where success means that the carton barcodes of 10 small cartons in this pack have passed the verification; failure indicates that the carton barcodes of the small cartons in this pack have failed the verification and need to be excluded in subsequent operations; pending means that the verification status of the carton barcodes of this strip cannot be determined temporarily, and the algorithm will modify it later;
[0023] In particular, since only the first two packs of the strip are verified (only the correctness of the previous strip and the first stack of this strip can be determined), any just-completed packing cannot be verified as successful, but only the verification result will be set as failure or pending. After the next strip enters the verification process and meets certain conditions, the verification status of the previous strip can be determined as successful, failure, or still remain pending waiting for the verification update of the subsequent strip.
[0024] During specific operations, Item elements are allowed to exist in the carton code queue, where:
[0025] When a single barcode is successfully read: Save it in the Item element;
[0026] When a single barcode is read failed: Save it in the Item element;
[0027] When double - pack barcodes (two small boxes are read simultaneously, the same below) are successfully read: Save them in two Item elements in the pack order;
[0028] For a double - pack where one barcode is successfully read but the position of the successfully read barcode is determined: Save them in two Item elements in the pack order. For the one with a successfully read barcode, set State.Decoded and save the recognized barcode in BarCode; for the one with a failed read, do not set State.Decoded;
[0029] For a double - pack where one barcode is successfully read but the position of the successfully read barcode is not determined: Save it in an ItemWithMissingPair element (where State.Decoded is set and BarCode saves the recognized barcode);
[0030] For a double - pack where no barcode is recognized: Save it in an ItemWithMissingPair element (where State.Decoded is not set); or in two Item elements (where State.Decoded is not set).
[0031] After the box - code verification station reads the barcode information of the first stack (the 1st / 2nd pack) of the 25 - flat pack, call the Validate method of the CTPackerWithFirstTwoPositionsValidation object, passing in the read barcode information to implement verification and packing. This method will save the packed data in the Result property queue.
[0032] The allowed parameters for the Validate method are: 1. When both packs are successfully read: Pass in two BarCodeWithLocation entities, set State.Decoded, BarCode is the read barcode, and Location is set to 1 and 2 respectively; 2. When one pack is read: Pass in one BarCodeWithLocation entity, set State.Decoded, BarCode is the read barcode, and Location does not need to be set; 3. When neither is read: Pass in an empty array.
[0033] Since the positioning code is at the beginning of the bar, it is impossible to confirm whether the subsequent small boxes of the current bar are correct. Therefore, the Validated property of the Package generated when the Validation call is completed is either Pending or False. It is only possible to confirm the verification status of the previous bar of cigarettes when the next bar of cigarettes passes through the box - code verification station for reading.
[0034] Enumerations used:
[0035] BarCodeStates: byte;
[0036] Undefined = 0, Requested = 1, ScanningSucceeded = 7, ScanningFailed = 11, EjectRequested = 15;
[0037] Bit sequence (from low to high):;
[0038] Requested: Scanning has been requested;
[0039] Scanned: Scanning has been triggered;
[0040] Decoded: Decoding has been received;
[0041] ToBeEjected: Rejection due to other reasons;
[0042] 0: Not used in the present invention;
[0043] 0: Not used in the present invention;
[0044] 0: Not used in the present invention;
[0045] 0: Not used in the present invention;
[0046] Note: Only cartons with the status of ScanningSucceeded (bit sequence 00000100) will not be ejected;
[0047] PackageValidation: byte;
[0048] True: Validation succeeded;
[0049] False: Confirmation failed;
[0050] Pending: To be confirmed; It means that it cannot be confirmed whether this package is successfully validated or failed at this moment;
[0051] Undefined: Undefined
[0052] Entities used:
[0053] Entity Class:;
[0054] StreamAbstractItem;
[0055] int Length;
[0056] bool Validated = false;
[0057] StatefulItem;
[0058] BarCodeStates State;
[0059] Item: StatefulItem;
[0060] string BarCode;
[0061] int Length = 1;
[0062] bool Validated = State == ScanningSucceeded;
[0063] ItemWithMissingPair: Item indicates that for two Items in a stack, at most one barcode has been read, and it is impossible to confirm which one is missing (if the State is abnormal, both are missing);
[0064] int Length = 2;
[0065] bool Validated = false;
[0066] PlaceHolder: StatefulItem represents a placeholder;
[0067] int Length = 1;
[0068] BarCodeStates State = 8 (ToBeEjected);
[0069] Package;
[0070] PackageValidation Validated;
[0071] Nullable <guid>StorageId;
[0072] Item[] Items;
[0073] BarCodeWithLocation: Item;
[0074] int Location;
[0075] Abstract classes used:
[0076] PackerBase (abstract);
[0077] Packing abstract class:
[0078] Constructor: Queue <streamabstractitem>source, int length;
[0079] Method: void AddPendingPackage(Package package);
[0080] Method: void RemovePendingPackage(Package package);
[0081] Method: void ChangePackagesValidated();
[0082] Method: void ChangePackagesNotValidated();
[0083] Read-only property: Queue <package>Result;
[0084] Private-level variable: HashTable <package>Pendings;
[0085] Protected variable: int PackageLength;
[0086] Constructor: Pass in the child element queue and the packaging length. In the box strip association, the box code queue and 10 are passed in;
[0087] Pendings: For all Packages that have been added to Result and whose Package.Validated is Pending, they are saved separately in a hash table (Pendings);
[0088] PackageLength: Obtained from the length value of the constructor;
[0089] AddPendingPackage(Package package): Add the package to the Pendings hash table;
[0090] RemovePendingPackage(Package package): Remove the package from the Pendings hash table;
[0091] ChangePackagesValidated: Called when the Package is confirmed;
[0092] For each Package in Pendings (if any):
[0093] Set Package.Validated to True;
[0094] If Package.StorageId has a value, the storage system needs to be notified to change its status to trusted;
[0095] Empty Pendings;
[0096] ChangePackagesNotValidated: Called when the Package is confirmed as incorrect;
[0097] For each Package in Pendings (if any):
[0098] Set Package.Validated to True;
[0099] If Package.StorageId has a value, the storage system needs to be notified to change its status to untrusted (it needs to be removed from storage);
[0100] Empty Pendings.
[0101] For the Package newly added to Result, check Package.Validated:
[0102] True;
[0103] Call ChangePackagesValidated;
[0104] False;
[0105] Call ChangePackagesNotValidated;
[0106] Pending;
[0107] Call AddPendingPackage, passing in Package;
[0108] PackerWithValidationBase: PackerBase (abstract).
[0109] Verify the packing class;
[0110] Constructor: Queue <streamabstractitem>source, int length: base(source,length);
[0111] Method: void Validate(BarCodeWithLocation[] barCodes);
[0112] Validate: Pass in one or more location-verified barcodes. According to the specific algorithm, take a certain number of elements from source as Items, construct a Package (with StorageId empty), and after setting its Validated value, add it to Result.
[0113] Location code processing method:
[0114] CTPackerWithFirstTwoPositionsValidation: PackerWithValidationBase;
[0115] A 10-element packing class verified by the 1st and 2nd elements. Note: Only applicable to the case of stacked package reading;
[0116] Constructor: Queue <streamabstractitem>source: base(source, 10);
[0117] Private-level variable: int sourceOffset = 0;
[0118] source only contains Items, including ItemWithMissingPair;
[0119] Validate: Pass in the barcode information of the first and second elements;
[0120] If two elements are passed in (when both are read successfully):
[0121] If the two elements passed in are not both Items, or Item.State is not ScanningSucceeded, or Location does not have one element each at positions 1 and 2, report an error (algorithm error);
[0122] Search for element item1 and its corresponding index1 in source in ascending order. It is required that item1 is of type Item, item1.State.Decoded, and item1.BarCode is the same as the barcode of the element at the first position;
[0123] If item1 is found:
[0124] Judge whether there are other Items before item1 in source:
[0125] Yes: Call ChangePendingNotValidated;
[0126] No: Call ChangePendingValidated;
[0127] If item1 is ItemWithMissingPair (1 / 2 stack packing, so the missing one must be 2):
[0128] Pack a newly created item (type Item, BarCode and State the same as item1), a newly created item (type Item, BarCode the same as the barcode of the element at the second position, State is ScanningSucceeded), 8 items after item1 (excluding item1, calculated by summing item.Length, can be less but not exceeding), and construct them as Items to form a Package. The Validated value is the result of AND calculation of the Validated values of all elements in Items (Pending or False. Only the start is verified, so True is changed to Pending);
[0129] Remove all elements from source before the last Item (inclusive) of the above processing;
[0130] Set sourceOffset = 0;
[0131] Add Package to Result;
[0132] End the method.
[0133] Get the element item2 corresponding to index1 + 1 in source;
[0134] If item2 cannot be obtained: Report an error (insufficient queue data);
[0135] If the type of item2 is Item and not ItemWithMissingPair (item2 is 2):
[0136] Pack the 9 items (calculated by summing item.Length, can be less but not exceeding) after item1 and item2 (inclusive of item2) as Items, construct a Package, and the Validated value is the result of AND calculation of all elements' Validated in Items (Pending or False. Only the start is verified, so change True to Pending);
[0137] Remove all elements from source before the last Item (inclusive) of the above processing;
[0138] Set sourceOffset = 0;
[0139] Add Package to Result;
[0140] End the method;
[0141] (Elements after item2, and 2 is missing)
[0142] Alarm (queue data lost);
[0143] Pack item1 as Items, construct a Package, and the Validated value is False;
[0144] Remove all elements from source before item1 (inclusive);
[0145] Set sourceOffset = 0;
[0146] Add Package to Result;
[0147] End method;
[0148] (item1 not found);
[0149] Search for element item2 and its corresponding index2 in ascending order from source. It is required that the type of item2 is Item, item2.State.Decoded, and the BarCode of item2 is the same as the bar code of the element in the second position;
[0150] If item2 is found:
[0151] If item2 is ItemWithMissingPair (1 / 2 stack packing, so the missing one must be 1):
[0152] Pack a newly created item (type Item, BarCode the same as the bar code of the element in the first position, State is ScanningSucceeded), a newly created item (type Item, BarCode and State the same as item2), and 8 items after item2 (excluding item2, calculated by summing item.Length, can be less but not more) as Items, construct a Package, and the Validated value is the result of AND calculation of the Validated values of all elements in Items (Pending or False; only the start has been verified, so True is changed to Pending);
[0153] Remove all elements before the last Item (including) in the above processing from source;
[0154] Set sourceOffset = 0;
[0155] Add the Package to Result;
[0156] End method.
[0157] If item2 is the first element of source (data before the first package is missing):
[0158] Call ChangePendingNotValidated;
[0159] Construct a Package with item2 as Items, and the Validated value is False;
[0160] Remove the first element from source;
[0161] Set sourceOffset = 0;
[0162] Add Package to Result;
[0163] End method;
[0164] Get the element item1 corresponding to the index 2 - 1 in source;
[0165] If the type of item1 is not Item, or is ItemWithMissingPair (when the second package is confirmed, the first package cannot be ItemWithMissingPair, so item1 is missing), or item1.Decoded does not exist (the type of item1 is Item and not ItemWithMissingPair, item1 is 1, but not scanned):
[0166] Package a newly created item (type: Item, BarCode is the same as the barcode of the first - position element, State is ScanningSucceeded), and the 9 items after item2 (including item2) (calculated by summing item.Length, can be less but not more) as Items, construct a Package, and the value of Validated is the result of AND - calculating the Validated of all elements in Items (Pending or False; only the start is verified, so True is changed to Pending);
[0167] Remove all elements before the last Item (including) of the above - mentioned processing from source;
[0168] Set sourceOffset = 0;
[0169] Add Package to Result;
[0170] End method;
[0171] (The type of item1 is Item and not ItemWithMissingPair and decoding is successful, it may be that the barcode of the first package is missing);
[0172] Alarm (data loss in the queue);
[0173] Pack a newly created item (type is Item, BarCode is the same as the barcode of the first position element, State is ScanningSucceeded), and the 9 items after item2 (including item2) (calculated by summing item.Length, can be less but not exceeding) as Items, construct a Package, and the value of Validated is the result of AND calculation of the Validated of all elements in Items (Pending or False; only the start is verified, so True is changed to Pending);
[0174] Remove all elements before the last Item (including) in the above processing from source;
[0175] Set sourceOffset = 0;
[0176] Add the Package to Result;
[0177] End the method.
[0178] (Neither item1 nor item2 is found);
[0179] Construct a Package with empty information as Items, and Validated is False;
[0180] Set sourceOffset = 0;
[0181] Add the Package to Result;
[0182] End the method.
[0183] If what is passed in is a single element and Location is not set (one is read successfully):
[0184] Search for the element item1 and the corresponding index1 in source in ascending order, requiring that item1 is of type Item, item1.State.Decoded, and item1.BarCode is the same as the passed-in barcode;
[0185] If there is no other Item before item1 in source: Call ChangePendingValidated;
[0186] (Process as if not read successfully);
[0187] (Both are not read successfully);
[0188] Package the 10 items starting from sourceOffset in source (calculated by the sum of item.Length, which can be less but not more) as Items and construct them into Package. The value of Validated is the result of ANDing the Validated of all elements in Items (Pending or False. The end is not confirmed, so True is changed to Pending).
[0189] (Do not delete elements from source);
[0190] Set sourceOffset += Package.Items.Length; (number of elements);
[0191] In particular, to prevent the accumulated queue from being too long and affecting the rejection of cigarettes, a value can be set. When sourceOffset exceeds this value, Validated is judged to be False and ChangePendingNotValidated is called;
[0192] Add Package to Result;
[0193] End method.
[0194] The beneficial effects of the present invention are as follows: 1. If only one code is read in the positioning code, the function can also be realized; 2. If the positioning code is read successfully, but a code is missing in the corresponding position in the box code queue, it can be repaired; 3. If the positioning code fails to be read, the inferred information can be allowed to be released within a certain continuous number, and the inferred information can be confirmed by the subsequent positioning code.
[0195] The above description is only a preferred specific 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 thought of by any technician familiar with this technical field within the technical scope disclosed by the present invention should be covered by the scope of protection of the present invention.< / streamabstractitem> < / streamabstractitem> < / package> < / package> < / streamabstractitem> < / guid>
Claims
1. A method for repairing two-dimensional barcode information of cigarette cartons and strips, characterized in that: Before the flat package of 25 small boxes is formed by the packaging machine, the 2D barcode information of the small boxes has been read and a "box code queue" has been formed, which contains unrecognized 2D barcode information of the small boxes. By reading the 2D barcodes of the first stack of two small boxes when or after the flat package of 25 is established, that is, the positioning codes, the 2D barcode information of the small boxes is pulled from the queue, and the 2D barcode information that fails to be read in the box code queue and is just located at the positioning code position is verified and tried to be repaired. The specific implementation process is as follows: S1. Input the box code queue from the outside. The box code queue is allowed to contain unrecognized 2D barcode elements, which need to meet the format requirements of the algorithm. The box code queue is allowed to contain Item elements, where: When a single 2D barcode is successfully read: it is saved in the Item element; When a single 2D barcode fails to be read: it is saved in the Item element; When the double 2D barcodes of stacked boxes are successfully read: they are saved in two Item elements in the stacking order; For stacked boxes, when one 2D barcode is successfully read but the position of the successfully read 2D barcode is determined: they are saved in two Item elements in the stacking order. For the successfully read one, State.Decoded is set and BarCode saves the recognized 2D barcode; for the one that fails to be read, State.Decoded is not set; For stacked boxes, when one 2D barcode is successfully read and the position of the successfully read 2D barcode is not determined: it is saved in an ItemWithMissingPair element, where State.Decoded is set and BarCode saves the recognized 2D barcode; For stacked boxes, when no 2D barcode is recognized: it is saved in an ItemWithMissingPair element, where State.Decoded is not set; or it is saved in two Item elements, where State.Decoded is not set; S2. Obtain the 2D barcodes of the first stack of the flat package of 25, that is, the positioning codes, from the box code verification station. The first stack includes the first box and the second box. In addition to the normal recognition of two 2D barcodes, the situation of recognizing one 2D barcode and not recognizing a 2D barcode is also allowed; S3. The algorithm processes the box code queue through the positioning codes and packs the box codes of all 10 small boxes in this strip for subsequent operations. The following two situations may occur when processing the box code queue: First, when two 2D barcodes are normally recognized for the positioning codes, the 2D barcode data that can be repaired in the box code queue is repaired and the box code packing operation is completed; Second, when one or no 2D barcode is recognized for the positioning codes, the box code packing operation is completed as much as possible; S4. For the verification status of the completed packing mark, the verification status includes success, failure, and pending. Success means that the 2D barcodes of the 10 small boxes in this strip have passed the verification; failure indicates that the 2D barcodes of the small boxes in this strip have failed the verification and need to be excluded in subsequent operations; pending means that the verification status of the 2D barcodes of the small boxes in this strip cannot be determined temporarily, and the algorithm will modify it later; Since only the first two boxes of a strip are verified, it can only determine whether the previous strip is correct or whether the first stack of this strip is correct. Any just-completed packing cannot be verified as successful, but only the verification result will be set as failed or pending. After the next strip enters the verification process and meets certain conditions, the verification status of the previous strip can be determined as successful, failed, or still remain pending waiting for the verification update of subsequent strips.
Citation Information
Patent Citations
Method for increasing correlation efficiency of cigarette box strip two-dimensional code by adding front reading code
CN112001192A
Cigarette packet right side surface two-dimensional code-based packet strip two-dimensional code association device for tobacco packaging machine
CN112699983A