摩托罗拉、Intermec 和 Psion 条码扫描





0/5 (0投票)
Resco 提供创建通用接口的类,该接口可以访问各种设备的条码扫描仪。这意味着一个应用程序将能够扫描来自不同设备的条码。
在过去,物流和仓储比今天简单得多。每件商品都是手工挑选并移动到另一个位置。人们使用标准的收银机或仅仅使用笔和纸来记录库存清单。那些日子已经过去了!
如今,一切都需要快速完成。客户下订单,商品需要几乎立即发货。货物到达仓库,仓库经理需要知道将它们放置在哪里。他还需将它们添加到库存中。条码可以迅速加快公司的物流速度。您只需扫描一个代码,即可访问您做出决策所需的各种信息。
直到现在,开发人员需要为每个设备创建单独的应用程序。现在,Resco 提供创建通用接口的类,该接口可以访问各种设备的条码扫描仪。这意味着一个应用程序将能够扫描来自不同设备的条码。我们支持
- Symbol - 摩托罗拉
- Intermec
- Psion
您需要做的就是下载设备制造商的 SDK。您可以在这里找到它们
- 摩托罗拉企业 (Symbol): http://support.symbol.com/support/product/softwaredownloads.do
- Intermec: http://www.intermec.com/support/downloads/listing.aspx
- Psion: http://community.psion.com/downloads/developer_sdkhdk/m/mobile_devices_sdk/
这里是示例代码,可以帮助您处理任何类型的设备上的条码扫描
private TagReader m_tagReader = null;
//new TagReader instance for current DeviceType
m_tagReader = BarcodeMgr.CreateInstance();
//this event triggered when a barcode is read
m_tagReader.TagRead += new EventHandler<TagEventArgs>(m_tagReader_TagRead);
private void m_tagReader_TagRead(object sender, TagEventArgs e)
{
//statement to call if the HandleBarCode method is in the same thread
if (this.InvokeRequired)
this.Invoke(new Action(m_tagReader_TagRead), sender, e);
else
HandleBarCode(e.Text);
}
private void HandleBarCode(string code)
{
//TO DO: Here you can add a code for the barcode handling
uiTextBoxProductID.Text = code;
}
如何添加其他杂项扫描设备
如果您需要添加尚未由我们的条码扫描接口支持的另一种设备,您可以简单地按照以下步骤操作(请注意,仅作为示例,我们演示了如何添加 Opticon 设备)
- 打开
BarCodeMgr
类。 - 在
BarCodeReaderDeviceType enum
中添加新的 "Opticon" 选项。 - 将新的 Opticon deviceType 添加到
CreateInstance
方法中。它应该如下所示
/// <summary>
/// Creates and initializes a new <see cref="TagReader"/> instance.
/// </summary>
public static TagReader CreateInstance()
{
BarCodeReaderDeviceType deviceType = BarCodeReaderDeviceType.None;
if (BarCodeUtil.IsSymbolDevice())
deviceType = BarCodeReaderDeviceType.Symbol;
else if (BarCodeUtil.IsIngenicoDevice())
deviceType = BarCodeReaderDeviceType.Ingenico;
else if (BarCodeUtil.IsPsionDevice())
deviceType = BarCodeReaderDeviceType.Psion;
// ******************** START Custom Code
else if (BarCodeUtil.IsOpticonDevice())
deviceType = BarCodeReaderDeviceType.Opticon;
// ******************** END Custom Code
else
deviceType = BarCodeReaderDeviceType.Intermec;
string className = null;
switch(deviceType)
{
// ******************** START Custom Code
case BarCodeReaderDeviceType.Opticon:
className = "UIOptionView.BarCodeReaderOpticon";
break;
// ******************** END Custom Code
case BarCodeReaderDeviceType.Symbol:
className = "UIOptionView.BarCodeReaderSymbol";
break;
case BarCodeReaderDeviceType.Intermec:
className = "UIOptionView.BarCodeReaderIntermec";
break;
case BarCodeReaderDeviceType.Ingenico:
className = "UIOptionView.BarCodeReaderIngenico";
break;
case BarCodeReaderDeviceType.Psion:
className = "UIOptionView.BarCodeReaderPsion";
break;
default:
case BarCodeReaderDeviceType.None:
break;
}
// if no device detected return null
if (string.IsNullOrEmpty(className))
return null; //throw new NotSupportedException("BarCode Reader not supported on that device");
// get device bar code reader
#if DEBUG
TagReader reader;
try
{
reader = (TagReader)Activator.CreateInstance(Type.GetType(className));
}
catch
{
reader = new BarCodeReaderDebug();
}
reader.IsEnabled = true;
#else
var reader = (TagReader)Activator.CreateInstance(Type.GetType(className));
reader.IsEnabled = true;
#endif
return reader;
}
- 将新的
IsOpticonDevice
方法添加到BarCodeUtil
类中,以获取设备是否为 Opticon。 - 现在,您需要创建自己的
BarCodeReaderOpticon
类。这个新类继承自TagReader
对象。 - 在这个类中,您需要重写 IsEnabled 属性以获取或设置是否启用条码读取。
- 例如,查看 BarCodeReaderPsion.cs,您可以在其中找到如何操作。
- 在设备读取条码时触发的事件中,调用
OnTagRead
方法。 - 例如,查看 BarCodeReaderPsion.cs,您可以在其中找到如何操作。
条码扫描仪示例仅供拥有有效订阅的用户使用。