private int OpenPrinter() { string printer = Properties.Settings.Default.PrinterName.Length > 0 ? Properties.Settings.Default.PrinterName : "TSC TTP - 247"; int ret = TSCLIB_DLL.openport(printer); if (ret == 0) { MessageBox.Show(string.Format("標籤印表機 {0} 無法連線. \r\n請檢查標籤印表機狀態.", Properties.Settings.Default.PrinterName), "訊息", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(ret); }
public void PrintNG(DateTime TestTime) { if (OpenPrinter() == 0) { return; } TSCLIB_DLL.setup("18", "12", "2", "12", "1", "3", "0"); TSCLIB_DLL.clearbuffer(); TSCLIB_DLL.windowsfont(40, 3, 40, 0, 2, 0, "新細明體", "NG"); TSCLIB_DLL.windowsfont(15, 40, 30, 0, 0, 0, "新細明體", TestTime.ToString("yy/MM/dd")); TSCLIB_DLL.printlabel("1", "1"); TSCLIB_DLL.closeport(); }
public void PrintLabel(string Serial, DaoMachine Machine, DaoPartNumber PN, string Result, DateTime TestTime) { if (OpenPrinter() == 0) { return; } string ResultSerial = string.Format("{0}{1}{2}", Machine.機台代碼, PN.簡碼, Serial); TSCLIB_DLL.setup("18", "12", "2", "12", "1", "3", "0"); TSCLIB_DLL.clearbuffer(); TSCLIB_DLL.sendcommand(string.Format("QRCODE 12,8,L,2,A,0,M2,S7,\"UCC,{0},{1}\"", ResultSerial, TestTime.ToString("yyyy/MM/dd"))); TSCLIB_DLL.windowsfont(76, 11, 30, 0, 2, 0, "新細明體", Result); TSCLIB_DLL.windowsfont(66, 40, 20, 0, 0, 0, "新細明體", TestTime.ToString("yy/MM/dd")); TSCLIB_DLL.windowsfont(5, 62, 20, 0, 0, 0, "新細明體", PN.車型); TSCLIB_DLL.printlabel("1", "1"); TSCLIB_DLL.closeport(); }