/// <summary> /// 电动读卡器吞卡 /// </summary> public static void swallowCard() { int handle = 0; try { string port = SysConfigHelper.readerNode("CRT310Port"); StringBuilder info = new StringBuilder(260); handle = CRT310.CommOpen("COM" + port); //读卡器状态 Byte atPosition = new byte(); Byte frontSetting = new byte(); Byte rearSetting = new byte(); //读取状态 int hasCard = CRT310.CRT310_GetStatus(handle, ref atPosition, ref frontSetting, ref rearSetting); if ((atPosition == 0x4b) || (atPosition == 0x4a)) { //进卡控制,不进卡 CRT310.CRT310_CardSetting(handle, 0x1, 0x1); //弹卡 CRT310.CRT310_Reset(handle, 2); SysBLL.isSwallowCard = "9999"; } } catch (Exception e) { throw new Exception("系统异常"); } finally { CRT310.CommClose(handle); } }
/// <summary> /// 电动读卡器退卡 /// </summary> public static void backCard() { int handle = 0; try { string port = SysConfigHelper.readerNode("CRT310Port"); StringBuilder info = new StringBuilder(1024); handle = CRT310.CommOpen("COM" + port); //进卡控制,不进卡 CRT310.CRT310_CardSetting(handle, 0x1, 0x1); //读卡器状态 Byte atPosition = new byte(); Byte frontSetting = new byte(); Byte rearSetting = new byte(); //读取状态 int hasCard = CRT310.CRT310_GetStatus(handle, ref atPosition, ref frontSetting, ref rearSetting); if ((atPosition == 0x4a) || (atPosition == 0x4b) || (atPosition == 0x4c) || (atPosition == 0x4d) || (atPosition == 0x46) || (atPosition == 0x47) || (atPosition == 0x48)) { //弹卡 CRT310.CRT310_Reset(handle, 1); SysBLL.Player("请保管好您的卡片.wav"); } //进卡控制,不进卡 CRT310.CRT310_CardSetting(handle, 0x1, 0x1); CRT310.TT_EjectCard(0, new StringBuilder()); } catch (ThreadAbortException ex) { log.Write("error:电动读卡器退卡:" + ex.Message); } catch (Exception e) { throw new Exception("系统异常"); } finally { CRT310.CommClose(handle); } }