我如何能够与条形码阅读器接口&使用C#读取货物的价格 [英] How Can I Be Able To Interface With A Barcode Reader & Read Prices Labled On Goods Using C#

查看:86
本文介绍了我如何能够与条形码阅读器接口&使用C#读取货物的价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我打算开发一个超市管理系统,但我打算整合一个条形码阅读器,以便阅读商品的价格和其他细节,但我需要有关如何获得的建议条形码读取器读取条形码信息到我的应用程序中。

我打算使用C#,Sql server或mysql或者提前访问

Thanx

Hello there,
I am planning to develop a supermarket management system but i intend to integrate a barcode reader so as to read prices & other details on the goods but i need advice on how to get barcode information read by the barcode reader into my application.
I intend to use C#, Sql server or mysql or access
Thanx in advance

推荐答案

您没有。

条形码不包含定价信息(或至少包含产品(消费者单位)或纸箱产品类型(交易单位)它们所包含的只是一个商品编号 - 一个全球唯一的编号,用于标识特定产品和该产品的尺寸 - 因此200克包装的生姜坚果饼干将有一个不同的商品编号,来自400克包装的饼干。同一个供应商。



您的代码使用商品编号索引到库存数据库并检索商品描述,每单位当前价格,spe cial offer以及你需要的任何其他信息。

唯一的例外是熟食切割物品,它有特殊类型的条形码,返回公司特定的数字类型,表示个人购买,以及在为您剪切和包装产品时即时创建。



为此,大多数条形码扫描仪都用于模拟键盘,而产品编号是输入您的应用程序数据输入流,就好像它已在键盘上输入一样。因此,如果你的应用程序有一个文本框或类似的数据将在那里输入,你读取它,清除文本框并开始数据库检查。

但是它们可以配置为给出前缀和/或后缀字符,以便您可以区分扫描仪输入和真正的用户输入。如何配置它们取决于各个制造商(实际上是模型)
You don't.
A barcode doesn't contain pricing information (or at least the type used on products (consumer units) or cartons of products (traded units) don't. All they contain is an Article Number - a globally unique number which identifies a specific product and the size of that product - so a 200g pack of ginger nut biscuits will have a different Article Number to a 400g pack of biscuits from the same supplier.

Your code uses the Article Number to index into a stock database and retrieve the item description, current price per unit, special offers, and any other information you need.
The only exception to this is for Deli cut items which have a special type of barcode which returns a company specific number type which indicates an individual purchase, and which is created on the fly when the product is cut and packed for you.

To do this, most barcode scanners are shipped to emulate a keyboard, and the Article Number is fed into your application data input stream as if it had been typed on the keyboard. So provided your app has a textbox or similar the data will be entered there, you read it, clear the textbox and start your database checks.
However they can be configured to give a prefix and / or suffix character so that you can differentiate scanner input from genuine user input. How you configure them is down to the individual manufacturers (and indeed models)


添加到OriginalGriff在他的解决方案中写的内容:



从文本框中读取条形码的缺点是你必须确保文本框始终具有输入焦点。



我知道有两种选择:



根据制造商和条形码扫描仪的类型,可以使用制造商提供的SDK,可以通过您的某种专用事件接收扫描的条形码应用。我只是从阅读中了解到这一点,我无法确定哪种制造商和类型的条形码扫描仪可供选择;您将不得不询问制造商或分销商。



另一种替代方案是通用的,适用于任何带键盘仿真的条形码扫描仪。它通过读取原始键盘输入(通常由CLR抽象出来)来工作,这允许识别发送的关键事件的单个设备;即使没有文本框。通过在使用键盘仿真连接条形码扫描仪之前和之后枚举键盘设备,您可以找出条形码扫描仪的设备ID,然后让您的应用程序过滤掉其关键事件并将其作为扫描条形码处理。这个Codeproject文章提供了一种方法:

使用C#的原始输入来处理多个键盘 [ ^ ]
Adding to what OriginalGriff wrote in his solution:

Reading barcodes from a textbox has the disadvantage that you have to ensure that the textbox always has the input focus.

There are two alternatives that I know of:

Depending on the manufacturer and type of barcode scanner there can be a manufacturer-provided SDK which could be used to receive the scanned barcodes via some kind of "dedicated" event in your application. I only know this from reading about it, I can't tell for which manufacturers and types of barcode scanners this would be an option; you would have to ask the manufacturers or distributors.

The other alternative is a generic one which should work for any barcode scanner with keyboard emulation. It works by reading the raw keyboard input (which is normally abstracted away by the CLR), which allows to identify the individual device from which key events where sent; even without a textbox. By enumerating the keyboard-devices before and after connecting a barcode scanner with keyboard emulation you can figure out the device-ID of the barcode scanner and then let your application filter out its key events and process them as a scanned barcode. This Codeproject-article presents a way to do this:
Using Raw Input from C# to handle multiple keyboards[^]


这篇关于我如何能够与条形码阅读器接口&使用C#读取货物的价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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