Weighing Scale Barcode Reader C#

829 views Asked by At

how can I convert an EAN-13 or Code-128 barcode generated from a weighing scale machine back to a user-defined object?

Class Product
{
  string name = "Apples";
  deciaml qty = "0.5";
  double value = "5";
}

I already found libraries but all decodes barcode provided as an image. in my case, I have a barcode reader which will be reading the barcode label and input it as numbers something like (2032156478954).

what library or how can I decode those barcode numbers back to my object?

assume that I know from the user manual of the weighing scale which part is the product name, qty, and value

just like those label barcode we see in hypermarkets where you buy fruits and veggies in KG or Gram, it prints a barcode label, then the barcode label on POS is converted back to product object.

I am totally new when it comes to handling barcodes in .NET, any help, suggestion, or advice will be appreciated.

Example of Weighing Scale Barcode

2

There are 2 answers

0
San04 On BEST ANSWER

Currently, I have solved it by implementing my own solution.

assume the barcode is 2 53647 2 5262 9 (EAN-13)

from the left-hand side, 2 tells the POS this is a barcode from the weighing scale machine, 53647 will be the ID of the item in the database. 2 tells the POS next 5 digits are the price of the item (52.62) the last digit always discarded

the downside of this method is you will have to change either the settings of your weighing machine for every new setup you make to match your function. or you will change your code to match how the machine is printing barcodes since there is no one international standard.

I was hoping for a library that would have built-in functionality to recognize and decode those barcodes based on leading numbers and other check numbers. I might start building my own after looking at the most used formats.

0
Alex On

If you already have a the string, as others pointed out you theoretically just nid to split the barcode and fill you class.

If you have a look here: https://www.codeproject.com/Articles/10162/Creating-EAN-13-Barcodes-with-C

It shows you what the single numbers mean.

However: If you want to figure out the values behind the numbers, then thats a little bit tricky. I expect the manufacturer code, if internationally standardized is something that will change over time. Because someone registers a new manufacturer and therefore gets a new code. This would imply your programm needs access to the internet resp. to this database where they are registered.

Before putting to much effort in it, ask you self: Do I really need to have this informations that well prepared, for the project am I'm doing or would it be completely fine if you just split the strings and have as manufacturer for example "50603" without knowing whats behind.

I just give you this sample for the EAN code, but I would say you can apply this to other codes as well.