public static void reset() { int ret = iTranseDevStop(handle, 30); int ret2 = iTranseDevReset(handle, 30); Zebra7 z7 = Zebra7.GetDev(); z7.Reset(); }
private static void PrinterFeed(object obj) { Zebra7 z7 = Zebra7.GetDev(); if (z7.PositionCard() != 0) { z7.Reject(); } }
private static void PrinterReject(object obj) { Zebra7 z7 = Zebra7.GetDev(); z7.Reject(); }
/// <summary> /// 制卡流程 /// </summary> /// <param name="name"></param> /// <param name="persionid"></param> /// <param name="sseid">社保卡号</param> /// <param name="birth_year">出生日期-年</param> /// <param name="birth_bmonth">出生日期-月</param> /// <param name="pic">照片信息</param> /// <param name="bankno">银行编号</param> /// <returns></returns> public static string makeCar(string name, string persionid, string sseid, string pic, string date) { printdatas.Clear(); //int index = pic.IndexOf("base64,"); //if (index != -1) //{ // pic = pic.Substring(index + 7, pic.Length - index - 7); //} string[] hopperNos = new string[] { "1", "2", "3", "4", "5", "6" }; int ret = 0; Log.AddLog(log, "停止+复位"); Loading.updateTip("正在重置硬件状态..."); reset(); //1.料盒发卡 Log.AddLog(log, "准备从料盒发卡"); Loading.updateTip("准备从料盒发卡"); for (int i = 0; i < hopperNos.Length; i++) { Log.AddLog(log, "尝试从料盒" + hopperNos[i] + "发卡"); ret = iTranseDevputCardIn(handle, int.Parse(hopperNos[i]), 60); Log.AddLog(log, "尝试结果:" + ret); if (ret == 0) { break; } } if (ret != 0) { return("准备从料盒发卡失败:" + getNowError()); } //2.准备平印 Loading.updateTip("准备平印"); Log.AddLog(log, "准备平印"); ret = iTranseDevCarPrint(handle, 1); Log.AddLog(log, "ret:" + ret); if (ret != 0) { return("准备平印失败:" + getNowError()); } //3.设置打印信息 string year = System.DateTime.Now.Year.ToString("D4"); string month = System.DateTime.Now.Month.ToString("D2"); Loading.updateTip("设置打印信息"); Log.AddLog(log, "设置打印信息"); Log.AddLog(log, "入参:"); Log.AddLog(log, "姓名:" + name); Log.AddLog(log, "社会保障号码:" + persionid); Log.AddLog(log, "社会保障卡号:" + sseid); Log.AddLog(log, "发卡日期:" + date); Log.AddLog(log, "照片:" + pic); printdatas.Clear(); printdatas.Add("============================"); printdatas.Add("****************************"); printdatas.Add("制卡凭条"); printdatas.Add("姓名:" + name); printdatas.Add("社会保障号码:" + persionid); printdatas.Add("社会保障卡号:" + sseid); printdatas.Add("发卡日期(非卡面):" + year + month); printdatas.Add("****************************"); printdatas.Add("============================"); //Log.AddLog(log, "重新获取句柄"); //string error = open2(); //if(error != null) //{ // return error; //} if (Config.dic("IgnorePrintCar") == "1") { return(null); //System.DateTime.Now.ToString("yyyy年MM月dd日") } string[] info = { "姓名 " + name, "社会保障号码 " + persionid, "社会保障卡号 " + sseid, "发卡日期 " + date, "" }; Zebra7 z7 = Zebra7.GetDev(); z7.PrintFomat(info, pic); //将卡片送到平印位置 Log.AddLog(log, "ret:将卡片送到平印位置"); ret = iTranseDevCarPrint(handle, 1); if (0 != ret) { Log.AddLog(log, "移到打印失败" + ret); return("移到打印失败" + ret); } //将卡片从小车送到平印 Log.AddLog(log, "将卡片从小车送到平印"); ThreadPool.QueueUserWorkItem(PrinterFeed);//打印机和小车同时运行 Thread.Sleep(3000); ret = iTranseDevCarPrint(handle, 2); if (0 != ret) { Log.AddLog(log, "移到打印失败" + ret); return("移到打印失败" + ret); } if (z7.Print() == 0) { ThreadPool.QueueUserWorkItem(PrinterReject);//打印机和小车同时运行 ret = iTranseDevCarPrint(handle, 3); if (0 != ret) { return("移出打印失败" + ret); } } else { Log.AddLog(log, "打印失败:" + z7.Msg); ThreadPool.QueueUserWorkItem(PrinterReject);//打印机和小车同时运行 ret = iTranseDevCarPrint(handle, 3); return("打印失败:" + z7.Msg); } Loading.updateTip("打印流程执行完毕"); Log.AddLog(log, "打印流程执行完毕"); return(null); }