3

I have a program for parsing GS1 Barcodes (with Zebra scanner), which worked just fine, atleast I thought it was OK... Until I came across one box with 2 GS1 barcodes.. one "linear" and one data matrix (UDI). For linear, it worked just fine, I successfully got out the GTIN and Serial. But datamatrix is different. For some reason, its content is a bit longer than linear code, it has some production date and something else at the end.

This is the Linear code: (01)00380652555852(17)260221(21)25146965079(30)1 This is data matrix: (01)00380652555852(17)260221(21)2514696507911210222240SA60AT225

I have problems with parsing out the Serial number - 25146965079. Serial number in GS1 has a length of 1-20 characters. This one has 11, but How can I make it stop after the 9 characters? How can I know that the serial ends there? I tried transforming each character to UDI, but it seems that there is no special separating character or anything.. so I honestly donjt know what to do. Does anyone have any idea?

This the code, if anyone wanna try anything https://prnt.sc/1x2sw8l

Those codes/products came right from the manufacturer, so there shouldnt be anything wrong with the code, I guess...

yeetyeet
  • 73
  • 1
  • 5

4 Answers4

3

If you verify the barcode with a scanner that is designed to interpret a GS1 structure, you will see that the generated barcode is in fact incorrect.

You are missing a GS after the serial number, these codes MUST end a variable-length field if it's not the last one. This is specified in GS1 general specifications section 7.8.5.2

Without this separator you can't know where the serial ends - or, a machine interpreting the code can't know.

Tell the manufacturer that they need to study the GS1 specs.

Edit: the "correct" version would be:

(01)00380652555852(17)260221(21)25146965079<GS>(11)210222(240)SA60AT225

The parentheses and group separator <GS> are not included literally in the code.

Since you have two variable-length identifiers (21) and (240) you need a GS no matter what you do. Only alternative would be to have some padding for serial number, then you could do without separator.

MyICQ
  • 987
  • 1
  • 9
  • 25
  • Yeah, I tested it with Zebra TC25 scanner, some android apps and some online decoders, and all gave me same results. Atleast now I know that there is nothing wrong with the, but its all about the code. Thanks for the detailed explanation! – yeetyeet Oct 22 '21 at 14:07
  • 1
    FNC1 separators (transmitted as GS characters by readers) are required at the end of any non-terminal AI that is not is a member of the predefined, immutable list of AIs that do not require such termination. Most "fixed-length" AIs actually require FNC1 termination. Where FNC1 termination is required it is included even when the field is maximally filled. The reason is to provide a stable tablebase for encoders/decoders that is independent of future changes to the GenSpecs. See the "*" entries here: https://github.com/bwipp/postscriptbarcode/blob/master/contrib/development/gs1-format-spec.txt – Terry Burton Oct 22 '21 at 20:39
0

According to the GS1 documentation (page 156 and forwards)

All the fields are correct

(01)00380652555852 --> GTIN

(17)260221 --> Expiration date

(21)25146965079 --> Serial Number

(11)210222 --> Production Date

(240)SA60AT225 --> Additional Product Identification

I tried scanning the image but the result was the same as yours.

So the problem is that the separators are not there. Which is a problem for you, and there is no way to know where the serial number ends without the separator.

Juan Sturla
  • 1,254
  • 1
  • 4
  • 18
  • remember that the (11) is defined to have exactly 6 digits, meaning that the following identifier would be (240) (additional item info) and not (22) (which btw is not even defined in the standards) – MyICQ Oct 22 '21 at 13:45
  • oh, you are right! There were too many "2". I will fix that. – Juan Sturla Oct 22 '21 at 18:18
  • Btw, (22) it is defined in the standards, it's "Consumer product variant" – Juan Sturla Oct 22 '21 at 18:20
0

store raw input in KeyPress event and then read the character for Letter Or Digit.

        if (e.KeyChar != 13)
        {
            int asci = Convert.ToInt32(e.KeyChar);
            if (asci > 31 && asci < 128) // numeric and chars only
                rawbcode += Convert.ToChar((int)(e.KeyChar & 0xffff));             
            else
            {
                if (asci == 29)
                {
                    rawbcode += "<GS>"; // GS1 Seperator    
                }
            }
        }
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 30 '22 at 21:50
0

I am sorry my English is not good The reason of this problem is group separetors are unreadable character for example if you focus on text box and press capslock button or shift button nothing appear in text box the same in gs To solve this problem Public l as integer And put the following code in keyup event

If textbox1.textlenght = l then
My.combuter.keybord.sendkeys({enter})
L= textbox1.textlenght
End if

This code will give space after each litter (because each litter combined with cabslock button) and five spaces in groub space