POS系统中如何通过Epson TM-U210A打印机,让钱箱自动弹出(100分)

  • 主题发起人 主题发起人 whsunbin
  • 开始时间 开始时间
W

whsunbin

Unregistered / Unconfirmed
GUEST, unregistred user!
如何通过Epson TM-U210A打印机,让钱箱自动弹出<br>我到Epson网站上查找后只有一个VB的例子<br>Print #1 chr(27)+chr(112)+chr(0)+chr(50)+chr(250)<br>请问如何转换为Delphi代码,结合打印小票的报表(报表我已做好)。<br>100分送上
 
看下面的贴子吧。<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=220763
 
var<br>itemfile:textfiel;<br>begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assignprn(itemfile);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printer.canvas.Font.Name := 'control';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rewrite(itemfile);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;write(itemfile, 'A'); //一旦接受到这条命令,钱柜便打开。<br>//reset to normal<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;write(itemfile, 'G');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;closefile(itemfile); <br>end;
 
To:Longdiao<br>&nbsp; &nbsp;用你的方法钱箱弹出时会自动切纸,然后再打印单据,这样好象不对。<br>
 
我们用的pos58 的指令是Chr(27)+'p'+chr(0)+chr(60)+chr(255)<br>要用到Aspcomm.pas<br>&nbsp;Comm1: Tcomm;<br>&nbsp;<br>function com_init1( baud:Dword):Boolean;Stdcall; &nbsp;//初始<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; with comm1 do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; CommName := 'COM1';<br>&nbsp; &nbsp; &nbsp; BaudRate := baud;<br>&nbsp; &nbsp; &nbsp; Parity := Space;<br>&nbsp; &nbsp; &nbsp; ParityCheck := True;<br>&nbsp; &nbsp; &nbsp; Outx_XonXoffFlow := False;<br>&nbsp; &nbsp; &nbsp; Inx_XonXoffFlow := False;<br>&nbsp; &nbsp; &nbsp; StartComm; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //打开<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; Result := True;<br>&nbsp; except<br>&nbsp; &nbsp; Result := False;<br>&nbsp; end;<br>end;<br><br>&nbsp; function com_rest1:Boolean;Stdcall; &nbsp; &nbsp;//关闭<br>&nbsp; begin<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; comm1.StopComm;<br>&nbsp; &nbsp; &nbsp; Result := true;<br>&nbsp; &nbsp; except<br>&nbsp; &nbsp; &nbsp; Result := False;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br><br>comm1.free; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //释放<br><br><br>function com_send2(buf:PChar; len:Word):Boolean;stdcall;<br>begin<br>&nbsp; Result := Comm2.WriteCommData(buf, len); &nbsp; &nbsp; &nbsp; &nbsp; //写com口<br>end;<br><br><br>var<br>&nbsp; buf: String;<br>begin<br>&nbsp; buf := (Chr(27)+'p'+chr(0)+chr(60)+chr(255));<br>&nbsp; Comm1.WriteCommData(Pchar(buf), len)<br>end;<br><br>你的Epson TM-U210A我不清楚是不是串口热敏打印机,如果是的话,那把buf改一下应该也可以了
 
我已解决此问题方法是在<br>QuickRep1StartPage事件中加入以下代码<br>&nbsp; FontN:=QuickRep1.Printer.Canvas.Font.Name;<br>&nbsp; QuickRep1.Printer.Canvas.Font.Name:='control';<br>&nbsp; QuickRep1.Printer.Canvas.TextOut(0,0,'A');<br>&nbsp; QuickRep1.Printer.Canvas.Font.Name:=FontN;<br>谢谢各位!
 
后退
顶部