/// <summary> /// LTP并口打印 /// </summary> public void SendToLTP(string ltpName) { PrintLPTUtility PrintLPT = new PrintLPTUtility(); if (PrintLPT.Open(ltpName)) { try { PrintLPT.PrintText("【" + Port + "】 --打印测试"); PrintLPT.PrintText("--------------------------"); PrintLPT.PrintText("清晰程度-字体大小-打印测试"); PrintLPT.PrintText("--------------------------"); PrintLPT.PrintText(System.DateTime.Now.ToString()); PrintLPT.Feed(3); } catch (Exception exception) { MessageBox.Show(exception.Message, "系统提示"); LoggerHelper.Log("MsmkLogger", "API打印报错:" + exception.Message, LogEnum.SysLog); } //关闭端口 PrintLPT.Close(); } else { MessageBox.Show(Gattr.PortType + "端口打印机无效!", Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", Gattr.PortType + "端口打印机无效!", LogEnum.SysLog); } }
/// <summary> /// LTP并口打印 /// </summary> public static void SendToLTP() { PrintLPTUtility PrintLPT = new PrintLPTUtility(); if (PrintLPT.Open(Gattr.PortName)) { if (((_listWinPrtStr != null) && (_listWinPrtStr.Count != 0))) { try { //开钱箱 bool res = PrintLPT.OpenMbox(); if (!res) { MessageBox.Show("LTP开钱箱失败!指令调用返回值:" + res.ToString(), "系统提示"); LoggerHelper.Log("MsmkLogger", "LTP开钱箱失败!指令调用返回值:" + res.ToString(), LogEnum.SysLog); } //PrintLPT.SetLeft(1); //PrintLPT.SetFontSizeB(); foreach (t_pos_printer_out _out in _listWinPrtStr) { PrintLPT.PrintText(_out.Text.TrimEnd()); } _listWinPrtStr.Clear(); //进纸 PrintLPT.Feed(3); } catch (Exception exception) { PrintLPT.Close(); MessageBox.Show(exception.Message, "系统提示"); LoggerHelper.Log("MsmkLogger", "LTP打印报错:" + exception.Message, LogEnum.SysLog); } } //关闭端口 PrintLPT.Close(); } else { MessageBox.Show(Gattr.PortType + "端口打印机无效!LPT" + Gattr.PortName, Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", Gattr.PortType + "端口打印机无效!LTP", LogEnum.SysLog); } }
public bool SendMoneyBox(string ltpName) { PrintLPTUtility PrintLPT = new PrintLPTUtility(); if (PrintLPT.Open(ltpName)) { try { if (PrintLPT.OpenMbox()) { LoggerHelper.Log("MsmkLogger", Gattr.OperId + "通过测试LPT开钱箱!", LogEnum.SysLog); //关闭端口 PrintLPT.Close(); return(true); } else { //关闭端口 PrintLPT.Close(); return(false); } } catch (Exception exception) { //关闭端口 PrintLPT.Close(); MessageBox.Show(exception.Message, "系统提示"); LoggerHelper.Log("MsmkLogger", "LPT开钱箱错误:" + exception.Message, LogEnum.SysLog); return(false); } } else { MessageBox.Show(Gattr.PortType + "端口打印机无效!", Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", Gattr.PortType + "端口打印机无效!", LogEnum.SysLog); return(false); } }