键盘条码扫描器
我们在应用程序中使用条形码扫描仪来扫描条形码。一般来说,扫描ISBN条码时,扫描ISBN时会返回以下一堆按键: 97887021006268
- LeftCtrl
- B
- LeftShift
- M
- D9
- D7
- D8
- D8
- D7
- D0
- D2
- D1
- D0
- D6
- D2
- D6
- D8
- LeftCtrl
- C
LeftCtrl+B 组合是前言,告诉我们我们开始读取识别号码。 LeftCtrl+C 组合是后序部分,告诉我们正在完成识别号码的读取。 LeftShift+M 组合告诉我们读取条形码类型。 根据这些信息,扫描条形码后我可以自动搜索具有相关 ISBN 的书籍。我们使用自己的条形码阅读器库,可以识别 ISBN、Code39 和 I2Of5。
现在,我们的客户使用了两种新的条形码扫描仪,即键盘扫描仪。扫描同一个ISBN后,我们可以看到它不包含前导码和后导码,以及返回条形码类型的代码。相反,我们最后只得到了数字和Return键:
- D9
- D7
- D8
- D8
- D7
- D0
- D2
- D1
- D0
- D6
- D2
- D6
- D8
- Return
在这种情况下,我无法自动识别条形码的类型,甚至无法识别是否扫描了条形码 - 例如,我无法自动搜索 为了解决问题,我正在考虑用户控件,其中用户使用:
- TextBox 将识别扫描的号码
- RadioButton 与选项(ISBN、Code39、 I2Of5)
- 按钮负责根据选定的RadioButton选项进一步处理TextBox中的值,
我想问是否还有其他(更好)的解决方案。
We are using bar code scanners in our application to scan bar codes. Generally, when the ISBN bar code is scanned it return the following bunch of keys when scanning ISBN: 97887021006268
- LeftCtrl
- B
- LeftShift
- M
- D9
- D7
- D8
- D8
- D7
- D0
- D2
- D1
- D0
- D6
- D2
- D6
- D8
- LeftCtrl
- C
LeftCtrl+B combination is the preamble and tells us that it we are starting to read identifying number.
LeftCtrl+C combination is the postamble and tells us that we are finishing to read identifying number.
LeftShift+M combination tells us that we read barcode type.
Based on that information, after scanning bar code I can automatically search for book with the related ISBN. We are using our own bar code reader library where we can recognize ISBN, Code39 and I2Of5.
Now, our client both new bar code scanners that are the keyboard scanners. After scanning the same ISBN, we can see that it does not contains, preamble, and postamble, as good as code for returning barcode type. Instead we got only numbers and Return key at the end:
- D9
- D7
- D8
- D8
- D7
- D0
- D2
- D1
- D0
- D6
- D2
- D6
- D8
- Return
In such case I cannot automatically recognize what is the type of bar code and even recognize whether it was bar code scanned - for instance I cannot automatically search for To resolve the problem I am thinking about the user control where user with:
- TextBox to which will be identifying number scanned
- RadioButton with options (ISBN, Code39, I2Of5)
- Button responsible for further processing based on selected RadioButton option an value in TextBox and
I would like to ask whether there is other (better) solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以根据一些提示进行编码。如果您扫描一本真正的书籍,您将获得 EAN13+5 Bookland EAN 代码。如果您使用不同的代码类型(如您的示例),您将仅获得 13 位数字。检查长度 == 13 或长度 == 18。
ISBN 以 978(或最终为 979)开头,以 MOD 10 校验和结束。因此您可以检查美国定价书籍的扫描价值
。价格前的最后一位数字是校验和。这应该可以很好地表明您正在使用 ISBN。
我发现最好将其编码到服务器中,然后依赖用户的正确输入。
There's several hints you can code for. If you are scanning a real book, you'll get an EAN13+5 Bookland EAN code. If you're using a different code type (like your example) you'll get just the 13 digits. Check the length == 13 or length == 18.
ISBNs start with 978 (or 979, eventually) and end with a MOD 10 checksum. So you could check the scan value
for US priced books. The last digit before the price is the checksum. That should give you a good indication that you're working with an ISBN.
I've found it's better to code that into the server then depend on the user for correct input.
您应该能够从两个非常大的按钮“扫描书籍”和“扫描订单”中获取您缺少的信息,以便用户单击其中一个非常大的按钮,您就知道要查找什么。
它是这样的:
you should be able to get the info you're missing from two very big buttons "scan book" and "scan order" so the user clicks one of the very big buttons and you know what to look for.
it goes like this: