Skip to content

Fix HIBC parsing without batch field in $$8/9 notation#20

Merged
DacoTaco merged 2 commits intoDacoTaco:mainfrom
Uranium235:main
May 29, 2025
Merged

Fix HIBC parsing without batch field in $$8/9 notation#20
DacoTaco merged 2 commits intoDacoTaco:mainfrom
Uranium235:main

Conversation

@Uranium235
Copy link
Contributor

@Uranium235 Uranium235 commented May 20, 2025

The HIBC Parser in $$8 and $$9 notation fails when no date and no batch field follow the quantity.
In the <2.6 specs this is allowed. In that case no formatNumber, no date and no batch number follows the quantity before the end of the segment and an exception is thrown at segmentData.First().ToString() as segmentData.First() returns NULL.

In $$8 and $$9 notation parsing failed when no date and no batch field followed the quantity
@DacoTaco
Copy link
Owner

yup, just checked the specs, you are completely correct!

got a barcode you could put into the unit tests @Uranium235 ?
the specs has +$$848GQ but i think a real barcode would be better

@Uranium235
Copy link
Contributor Author

Uranium235 commented May 22, 2025

HIBC: +EHWD3551419/$$900100F
PC: 355141
LIC: EHWD
UoM: 9
Qty: 100

Not sure where you'd prefer to have that in the unit test and didn't want to make a separate pull request...

@DacoTaco
Copy link
Owner

fair enough!
normally hbic barcode/test cases are in the unit test : https://github.com/DacoTaco/BarcodeParserBuilder/blob/main/BarcodeParserBuilder.UnitTests/Barcodes/HIBC/HibcBarcodeParserBuilderTestFixture.cs#L283
adding it to this test will pass it through the hibc unit tests but also the full unit tests that test the entrypoint of the library ^^;

if the barcode you have can only be tested by parsing you'll have to add it to the parsing function, and for building its the building function.

if you need further help dont hesitate to poke me. if you can't find it, feel free to give me to actual barcode , if you can, where that info came from and ill do it myself ^^;

@Uranium235
Copy link
Contributor Author

Hi DacoTaco,
Full disclosure: I don't have a working development environment. I found the problem and the fix above with the help of our software partner, who in turn isn't familiar with GitHub. That's why I am a little hesitant to implement and suggest more than the couple of lines of code I was reasonably certain works.

The code is still used that way in the company I work for.
Your library is used in an Android App for our warehouse and replaced a custom HIBC parser (with a very specific subset of the standard) that was used before we needed to implement UDI compatibility (for other products) with GS1 and HIBC.
The "old" HIBC barcode is mainly used for warehouse logistics purposes because of the flexibility to encode variable quantities.

Here is the actual barcode.

HIBC 355141 vQty no LOT

I would really appreciate if you could implement the unit test (and builder?) as a back and forth with our software partner and myself to implement and test the code is, well, not very efficient... ;)

@DacoTaco
Copy link
Owner

no problem! ill take it over from here!

@DacoTaco DacoTaco merged commit 30cbb52 into DacoTaco:main May 29, 2025
1 check passed
@DacoTaco
Copy link
Owner

there we go, your fix is merged. thanks @Uranium235 !
ill make a new version in a bit!

@Uranium235
Copy link
Contributor Author

Uranium235 commented May 30, 2025

Thanks!
I tested the second unit test with the "/Q" you implemented and that seems to fail our verification tool (Elmicron ScanLink Verify) telling me that the secondary data structure is invalid.
If I'm reading the 2.6 specs for the secondary data structure (2.2.1: field descriptor R) correctly, only "$", "$+", "$$", "$$+" or a number is valid at the start of the secondary data structure. The "Additional Supplemental Data" fileds are probably what the name suggests to be taken literally: "additional" only. So I guess technically an empty Lot has to follow before we can encode the /Q field.

The code "+EHWD3551419/$/Q100X" would be valid though. At least to my verification tool.

@DacoTaco
Copy link
Owner

oh thats a good one!
the one i added was one that the code had spit out, so it seems there is another bug in there!

@DacoTaco
Copy link
Owner

hi @Uranium235,
i fixed the bug when building!
ill make another tag and push it ^^;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants