/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException">Cannot load device</exception> public void Load() { if (this.DeviceType == DeviceTypes.None) { return; } if (this.DeviceType == DeviceTypes.OPOS) { NetTracer.Information("Peripheral [CashDrawer] - OPOS device loading: {0}", this.DeviceName ?? "<Undefined>"); oposCashDrawer = new OPOSCashDrawerClass(); // Open oposCashDrawer.Open(this.DeviceName); Peripherals.CheckResultCode(this, oposCashDrawer.ResultCode); // Claim oposCashDrawer.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposCashDrawer.ResultCode); // Enable oposCashDrawer.DeviceEnabled = true; oposCashDrawer.StatusUpdateEvent += new _IOPOSCashDrawerEvents_StatusUpdateEventEventHandler(posCashDrawer_StatusUpdateEvent); } IsActive = true; }
public OpenCashBox_QS() { string strIsNec = string.Empty; try { strIsNec = Utils.GetAppConfig("isNec"); } catch { } if (strIsNec == "2") { IsNec = 2; //有安称 LogTools.Info("最终判断此pos机品牌为有安称,如判断错误会影响后续打印功能。"); } else { try { string posType = string.Empty; int rst = OpenCashBox.OpenCashBox.posType(out posType); LogTools.Info(string.Format("调OpenCashBox.posType的结果:返回值:{0},posType:{1}。", rst.ToString(), posType)); if (posType.ToUpper() == "NEC") { cashDrawer1 = new OPOSCashDrawerClass(); IsNec = 1; } else { if (strIsNec == "1") { cashDrawer1 = new OPOSCashDrawerClass(); IsNec = 1; } } if (IsNec == 1) { LogTools.Info("最终判断此pos机品牌为NEC,如判断错误会影响后续打印功能。"); } else { LogTools.Info("最终判断此pos机品牌不是NEC。如判断错误,会影响后续打印功能,请检查配置文件是否正确"); } OpenCashBox.OpenCashBox.posNo(out PosNumInit); LogTools.Info(string.Format("初始化调OpenCashBox.posNo。出参:{0}。", PosNumInit)); } catch (Exception ex) { LogTools.Info("最终判断此pos机品牌不是NEC。如判断错误,会影响后续打印功能,请检查配置文件是否正确。弹钱箱初始化异常:" + ex.ToString()); } } try { cashBox_name = Utils.GetAppConfig("cashBox_name"); if (string.IsNullOrEmpty(cashBox_name)) { cashBox_name = "NEC.CDW.1"; } } catch { cashBox_name = "NEC.CDW.1"; } }