条形码结束字符 [英] Barcode end charactor

查看:405
本文介绍了条形码结束字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#,我想为pos开发条形码阅读应用程序。

我无法识别最后一个字符。任何人都可以帮我提供示例代码



我尝试过:



现在它处理文本更改事件。问题是

假设1条形码像12345678和第二项条形码是12345

当我扫描第一项时,它读取第二项时它达到5个字母的条形码

解决方案

条形码不是固定长度 - 有几种不同的类型可以编码不同数量的数字(实际上,有些类型可以包含不仅仅是数字的整数:如果需要,EAN128可以包含大量信息)和五位数字是有效条形码编号(ish,它应该是前导零填充到最少8位数,加上最后的校验和数字)



我假设您使用的是标准条形码扫描仪而不是制作自己的硬件?在这种情况下,数据几乎肯定会从键盘输入,这意味着TextChanged事件将在数字到达时重复出现 - 它们不会像魔术那样立刻出现,而不是它们如果你真的输入了文章编号!



我要做的是查看扫描仪上的文档(或与制造商联系)并找出如何添加引导和将代码发送到它发送的条形码数据 - 这样你就可以正确地检查传入的数据并识别条形码的开始和停止位置使用KeyPress事件,而不是依靠TextChanged来检测某些东西。

Quote:

我无法识别最后一个字符。



可能是因为大多数条形码都是可变长度的,你必须知道你正在读什么条形码。

引用:

now它合作文本改变了事件。



希望你不要使用扫描仪作为键盘输入,这是最糟糕的事情,因为光标错误的位置足以弄乱输入。

通常的用法是将条形码配置为串行通信,让代码处理该部分而不会弄乱GUI。只有在您知道完成后才会将条形码发送给GUI。

引用:

任何人都可以帮助我示例代码



扫描仪的制造商应该有一些示例代码


I am using c# and i want to develop barcode reading application for pos.
I am not able able identify last character. Can anyone help me with sample code

What I have tried:

now it working with text changed event. The problem is
suppose 1 barcode like 12345678 and second item barcode is 12345
when i am scanning first item , it read second item when it reach 5 letter of barcode

解决方案

Barcodes are not a "fixed length" - there are several different types which encode a different number of digits (in fact, some can contain a whole load more than just digits: EAN128 can contain heaps of information if needed) and five digits is a "valid" barcode number (ish, it's supposed to be leading zero padded to a minimum of 8 digits, plus a checksum digit at the end)

I'm assuming that you are using a "standard" barcode scanner instead of making your own hardware? In which case, the data is almost certainly arriving as if it was entered from a keyboard, and that means that the TextChanged event will occur repeatedly as digits arrive - they don't all appear at once as if by magic, any more than they would if you actually typed the article number!

What I would do is check the documentation on your scanner (or talk to the manufacturer) and find out how to add "lead in" and "tail out" codes to the barcode data it sends - that way you can positively check the incoming data and identify where a barcode starts and stops using the KeyPress event, instead of relying on TextChanged to detect something.


Quote:

I am not able able identify last character.


Probably because most barcodes are variable length, you have to know what barcode you are reading.

Quote:

now it working with text changed event.


Hope you don't use the scanner as keyboard entry, it is the worst thing to do because cursor wrong position is enough to mess the input.
Usual usage is to configure the barcode as serial communication and have your code handling that part without messing with GUI. And one send the barcode to GUI only once you know it is complete.

Quote:

Can anyone help me with sample code


The maker of scanner should have some sample code


这篇关于条形码结束字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆