DacoTaco / BarcodeParserBuilder

BarcodeParserBuilder is a .Net ( standard 2.0 & 2.1 ) nuget package to help parse & build barcode strings
https://www.nuget.org/packages/BarcodeParserBuilder
GNU Lesser General Public License v2.1
11 stars 4 forks source link

Is it possible to add Application Identifier 310-369 as FixedLengthGS1Field<double?> #10

Closed pejoh-eg closed 10 months ago

pejoh-eg commented 10 months ago

I like your parser for GS1 barcodes but I run into trouble with one barcode with prefix 311 (Length in m). When I looked in the source code I notified that today only Application Identifier (AI) 310 (Weight in KG) and 320(Weight in Lb) are included dimensions. There are a lot of more prefix (310-369) that describe dimensions and have exactly same logic as these two field (310/320). All these prefix describe the items dimensions like size, weight, area in different units.

Would it be possible to change GS1Barcode.cs to handle this? I attach a proposal for new version of GS1Barcode GS1Barcode.txt

I added those prefix as FixedLength and remove duplicates prefix It would be nice if this is possible. I'd rather it be include in your version than make my own local version for handling this.

DacoTaco commented 10 months ago

nice, you reported this while i am off work haha.

lets see, parsing doubles is already in the GS1 barcode, which would be the biggest part so thats good.

so from what i gather, you just want to expose the Application Identifiers as GS1Barcode properties?

EDIT : just to note what i found from the official specs ( https://www.gs1.org/standards/barcodes/application-identifiers ) : 310x -> Weight In KG 311x -> Length in Meters 312x -> Width In Meters 313x -> Depth In Meters 314x -> Volume in Square Meters

pejoh-eg commented 10 months ago

Exactly. For example AI 311 is now stored as a separate field but as a "String". The logic for handle this as a double with first number as a decimal place is now handle by me in the code. It would be nice to have this logic in the nugets just like prefix 310 so I can get the "Value" in double direct for all these field. I just needed 311 but why not fix it for all :-)

DacoTaco commented 10 months ago

didn't notice the PR, ill take a look at it and compare it with the specs to make sure there are no mistakes!

pejoh-eg commented 10 months ago

Here are the spec. I looked into. https://ref.gs1.org/standards/genspecs/

See chapter 3 and 3.2 for complete list of AI

DacoTaco commented 10 months ago

PR merged. want me to make a preview version for nuget or is this a change you aren't waiting for? (there is no changes waiting for the library, so i can make a version when i can atm)

pejoh-eg commented 10 months ago

If it's possible to make a nuget packages with this changes I will be happy. I working with this problem right now.

DacoTaco commented 10 months ago

i have pushed a 0.1.3-preview1 to validate the changes with. it seems to have been validated and listed on nuget ! :)

pejoh-eg commented 10 months ago

Thanks, have a good day. If I found more I'm pleased to help you out.

DacoTaco commented 10 months ago

no problem! changes like this can benefit everyone !