VFP中如何开启钱箱

*!* 不同的型号/不同的接法有不同的处理
*!* 1.如果钱箱是接在 LPT 并口上的
Set Printer On
?? Chr(27) + Chr(112) + Chr(48) + Chr(50) + Chr(53)
*!* ?? Chr(27) + Chr(112) + Chr(10) + Chr(20) && 具体 ESC 代码查询有关资料
*!* ?? Chr(27) + Chr(112) + Chr(0) + Chr(50) + Chr(250)
Set Printer Off
Set Printer To Default
*!*
*!*
*!* 2.如果钱箱是接在 COM1 串口上的
Set Printer To Com1, 9600, N, 8, 1
Set Printer On
ncount = 1
?? ' ' + Chr(nCount)
Set Printer Off
Set Printer To Default
*!*
*!*
*!* 3.如果钱箱是接在 COM2 串口上的
Set Printer To Com2, 9600, N, 8, 1
??? Chr(27) + Chr(112) + Chr(48) + Chr(25) + Chr(250)
Set Printer To Default
*!*
*!*
*!* 4.直接发送控制码到钱箱
*!* 首先创建一个打开钱箱控制码的文件
Set Device To File O_drawer.Prn
@ 00,00 Say Chr(27) + Chr(112) + Chr(00) + Chr(50) + Chr(100)
Set Device To Screen
*!* 然后在你需要打开钱箱的时候,发布下列命令即可
Copy File O_drawer.Prn To LPT1.DOS
*!*
*!*
*!* 5.采用 MSComm 控件开钱箱
*!* 在命令按钮上写下面事件代码
Thisform.olecontrol1.portopen = .T.
Thisform.olecontrol1.Output = "0000000000"
Thisform.olecontrol1.portopen = .F.
*!* MSCom 的 CommPort : 1 = COM1, 2 = COM2
*!*
*!*
*!* 6.采用 EPSON 的 OPOS ADK/SDK 开钱箱
_Screen.oFinApp.oCashDrawer.OpenDrawer()
This method waits until the Drawer Is closed
Local llDrawOpen As Boolean
Local lnTimeStart As Number
Local lnTimeNow As Number
*!*
*!* ---------------------
*!* Initialise Variables
*!* ---------------------
llDrawOpen = _Screen.oFinapp.oCashDraw.DrawerOpened
lnTimeStart = Val(Sys(2))
Do While _Screen.oFinApp.oPosPrinter.State = OPOS_S_BUSY
Inkey(0.01)
Enddo
_Screen.oFinapp.oCashDraw.StatusUpdateEvent()
Do While llDrawOpen
lnTimeNow = Val(Sys(2))
lnSecondsGone = lnTimeNow - lnTimeStart
Do Case
Case lnSecondsGone < 2
Wait Clear
Thisform.lblWarning.Visible = .T.
Case Between(lnSecondsGone, 2, 3)
Thisform.lblWarning.Visible = .F.
Case lnSecondsGone > 3
lnTimeStart = Seconds()
Endcase
llDrawOpen = _Screen.oFinapp.oCashDraw.DrawerOpened
Enddo
Thisform.lblWarning.Visible = .F.
Return .T.
*!*
*!*
*!* 7.如果钱箱是接在 USB 上的
*!* 或者采用打印共享的映射方式
*!* 或者采用特别动态库
*!*
*!*
*!* 8.网上有开钱箱的共享软件

你可能感兴趣的:(File,variables)