?? walker.prg
字號:
**** WALKER.PRG 廣州北區供電局 93.09.09 93.09.15 ****
**** WALKER.PRG 廣州北區供電局 Update at 00.10.31 ****
set color to
set help to HelpHdl
set exact off
set numwidth to 8
set decimal to 1
KEY_ENTER = 13
KEY_F1 = 28
KEY_F10 = -9
KEY_DEL = 7
KEY_BS = 8
KEY_UP = 5
KEY_DOWN = 24
KEY_LEFT = 19
KEY_RIGHT = 4
KEY_ASTERISK = 42
KEY_SLANT = 47
KEY_PLUS = 43
KEY_MINUS = 45
rKEY_ESC = 12
KEY_ESC = 27
ib_swith = .t.
PointOfHM = 1
helpContext = 0
Httype = _GETMACHCODE()
if Httype = 6
do _LcdWinSet with 0,0, 127, 127, 8, 32
else
do _LcdWinSet with 0,0, 63, 127, 4, 32
endif
do _HideCursor
clear
if Httype = 6
@1,0 say ' 廣州北區供電局'
@2,0 say ' HTBase抄表程序'
@5,0 say ' HTOS V2.0'
@6,0 say ' 2000.10.31'
else
@0,0 say ' 廣州北區供電局'
@1,0 say ' HTBase抄表程序'
@3,0 say ' 93.09.15'
endif
passWord = GetPassword('密碼:')
do while password <> GetPassword('確認:')
password = GetPassword('密碼:')
enddo
clear
dimension readingFlagName(3), flagBZ(2), flagXZ(3)
*異常碼定義
readingFlagName(1)='未抄'
readingFlagName(2)='已抄'
readingFlagName(3)='換表'
flagBZ(1)='母表'
flagBZ(2)='子表'
flagXZ(1)='力'
flagXZ(2)='燈'
flagXZ(3)='燈'
Percent = 50
exitBrowse = .F.
redraw = .T.
locMode = 1
scanNeeded = .T.
chargeBH=' '
do MeterReading
return
DATABASE 'CBDATA.DBF'
% heap 12288
% code 1024
% stack 4096
procedure GetPassword
parameters prmt
if Httype = 6
do _LcdWinOpen with 54,16, 76,111, 2,12
else
do _LcdWinOpen with 32,17,53,111,2,16
endif
psw = ' '
@0,0 say prmt
set color to n/n
@0, 5 get psw
do _ShowCursor
read
set color to w/n
do _LcdWinClose
return psw
procedure HelpHdl
colsave=_color(7)
do case
case helpContext = 1
if Httype = 6
do _LcdWinOpen with 0,0, 127,127, 16,16
do _LcdPullMode with 0
set color to n/w
? ' 幫 助 '
set color to w/n
? 'SHIFT+箭頭瀏覽'
else
do _LcdWinOpen with 0,0, 64,128, 16, 16
do _LcdPullMode with 0
? ' 幫助'
? '用SHIFT+箭頭瀏覽'
endif
? 'MODE -- 主菜單 '
? '空格 -- 第二屏 '
? 'ENT -- 輸表底 '
? 'DEL -- 設換表 '
? 'BS -- 移動戶名 '
? '↑ -- 上一記錄 '
? '← 未抄首記錄 '
? '↓ -- 下一記錄 '
? '→ 下一未抄記錄'
? ' + 按編號查詢 '
? ' - 按表號查詢 '
? ' * -- 首記錄 '
? ' / -- 末記錄 '
? ' % 按戶名查詢 '
do while inkey(0) # KEY_ESC
enddo
do _LcdWinClose
case helpContext = 2
if Httype = 6
do Show2LnBox with ' 請輸入 ', '本月表底', 0, 0
else
do Show2LnBox with '請輸入本月', ' 表底', 0, 0
endif
endcase
do _color with colsave
return
procedure Show2LnBox
parameters fstLine, sndLine, k1, k2
i =Len(fstLine)
j =Len(sndLine)
m = iif(i>j, i, j)
j = Int((128-(m*8))/2)
i = (m*8)+j
if Httype = 6
do _LcdWinOpen with 44,j-3, 81,i+3, 2,16
else
do _LcdWinOpen with 12, j-3, 49, i+3, 2,16
endif
@0,0 say fstLine
@1,0 say sndLine
k0 = -1
do while .not. ((k0=k1) .or. (k0=k2))
k0 = InKey(0)
if (k1=0) .or. (k2=0)
do _LcdWinClose
return k0
endif
enddo
do _LcdWinClose
return k0
procedure NextRecord
skip
if eof()
go bottom
k = Show2LnBox(' 已到末尾 ', '任一鍵繼續', 0, 0)
else
redraw = .T.
scanNeeded = .T.
endif
return
procedure LastRecord
skip -1
if bof()
go top
k = Show2LnBox(' 已到開頭 ', '任一鍵繼續', 0, 0)
else
redraw = .T.
scanNeeded = .T.
endif
return
procedure Readpc
parameters fx,dl
if Httype = 6
do _LcdWinOPen with 34,0, 88,127, 3,15
else
do _LcdWinOPen with 3,0, 57,127, 3,15
endif
@0,0 say '上月:'
@0,5 say cs1 pict '999999.9'
@1,0 say '本月:'
@1,5 say dl pict '999999.9'
if fx = 0
@2,0 say '偏大'
else
@2,0 say '偏小'
endif
@2,4 say '+繼續 -取消'
k0=0
do while .not. ((k0=key_Plus) .or. (k0=key_minus))
k0 = InKey(0)
enddo
do _LcdWinClose
return k0
procedure ReadThis
if Httype = 6
do _LcdWinOPen with 42,4, 80,122, 2,16
else
do _LcdWinOPen with 3,4, 57,122, 3,16
endif
do _LcdPullMode with 0
redraw = .F.
Badcomf = .F.
comfirm = .F.
t = BYG1
do while .not. comfirm
do _ShowCursor
@0,0 say '上月:'
@0,5 say SYG1 picture '999999.9'
@1,0 say '本月:'
@1,5 get t picture '999999.9'
helpContext = 2
read
helpContext = 0
do _HideCursor
v2=t
if updated() .or. Badcomf
redraw = .T.
comfirm = .T.
if (t<SYG1) .and. (.not. Badcomf)
do _Beep with 1
ks = Show2LnBox(' 電表回零?','+繼續 -取消', asc('+'), asc('-'))
if ks = asc('-')
comfirm = .F.
endif
endif
if comfirm
if t<SYG1
do case
case SYG1 < 1000
v2=v2+1000
case SYG1 < 10000
v2=v2+10000
otherwise
v2=v2+100000
endcase
endif
endif
if comfirm .and. (.not. Badcomf)
if ((v2-SYG1)*BL) >= (CS1*(1+Percent/100))
do _Beep with 1
ks=ReadPC(0,(V2-SYG1)*BL)
if ks = key_minus
comfirm =.F.
endif
else
if ((v2-SYG1)*BL) <= (CS1*(1-Percent/100))
do _Beep with 1
ks=ReadPC(1,(V2-SYG1)*BL)
if ks = key_minus
comfirm =.F.
endif
endif
endif
endif
if comfirm
if Badcomf
replace BYG1 with 0
else
replace XZM1 with 0
replace XBL with 0
replace BYG1 with t
replace CBBZ with 1
endif
replace RQ with date()
set numwidth to 8
set decimal to 0
do _HideCursor
@2,0 say '電量:'
if Badcomf
@2,5 say t picture '999999.9'
else
@2,5 say (V2-SYG1)*BL picture '999999.9'
endif
ks = inkey(0)
if ks=KEY_ESC
comfirm = .F.
exit
endif
if Badcomf
* replace YC with str(m,1), ti with time()
* replace PJ with t
endif
set numwidth to 8
set decimal to 1
skip
if eof()
go bottom
endif
endif
else
comfirm = .F.
exit
endif
enddo
do _LcdWinClose
return
procedure MainMenu
if Httype = 6
do _LcdWinOpen with 14,19,115,104, 6,10
else
do _LcdWinOpen with 0,19,63,104, 6,10
endif
do _ShowCursor
do _LcdPullMode with 2
@0,0 prompt '1.密碼保護'
@1,0 prompt '2.統計信息'
@2,0 prompt '3.數據通信'
@3,0 prompt '4.報 警 率'
@4,0 prompt '5.電池容量'
if ib_swith
@5,0 prompt '6.不能切換'
else
@5,0 prompt '6.允許切換'
endif
menu to m
do _LcdWinClose
return m
procedure ShowBatt
batt = _GetBattery()
if Batt > 100
batt1 = int(batt /256)
batt1 = batt1 + (batt - batt1 * 256) / 100
if Httype = 6
set color to n/w
@6,0 say batt1 pict '9.99'
@6,4 say 'V'
set color to w/n
else
if Httype = 5
@0,11 say batt1 pict '9.99'
@0,15 say 'V'
else
@0,15 say batt1 pict '9.99'
@0,19 say 'V'
endif
endif
else
do _LCDDrawBox with 6,83,10,104,1
do _LCDDrawBox with 7,104,9,105,1
if batt >= 100
batt1 = 20
else
batt1 = int(batt/5)
endif
do _LCDDrawBox with 7,83,8,83+batt1,1
do _LCDDrawLn with 9,83,9,83+batt1,1
do _LCDRefresh
endif
if _BackupBatt()
if Httype = 6
* do _LcdRevArea with 18, 88, 30, 127
else
do _LcdRevArea with 2, 88, 12, 127
endif
else
do _LcdRevArea with 9, 88, 12, 127
do _Beep with 2
ks = Show2lnBox(' 備電不足 ', ' 請速更換 ',0,0)
endif
return
procedure BadMeter
if Httype = 6
do _LcdWinOPen with 34,4, 88,122, 3,16
else
do _LcdWinOPen with 3,4, 57,122, 3,16
endif
do _LcdPullMode with 0
redraw = .F.
t1 = XZM1
t2 = XBL
do _ShowCursor
@0,4 say '換新表'
@1,0 say '行度:'
@1,5 get t1 picture '999999.9'
@2,0 say '倍率:'
@2,5 get t2 picture '9.9999'
helpContext = 2
read
helpContext = 0
do _HideCursor
if updated()
redraw = .T.
repl XZM1 with t1
repl XBL with t2
repl BYG1 with 0
repl CBBZ with 2
endif
do _LcdWinClose
return
procedure DispThis28
if redraw
clear
do ShowBatt
set color to n/w
@0,0 say ' 廣州北區供電局 '
set color to w/n
@2,0 say '編 號:'+BH
@3,0 say '用戶名:'+HM
@4,0 say '儀表號:'+YBH
@4,13 say 'X'
?? ltrim(rtrim(str(BL,6)))
@5,0 say flagXZ(val(XZ))
?? ' '
set numwidth to 6
set decimal to 4
?? DJ
?? ' '
set color to n/w
if SUBSTR(BH,8,1)='W'
@6,8 say '無功'
endif
@6,12 say readingFlagName(CBBZ+1)
PointOfHM = 1
set color to w/n
set numwidth to 8
set decimal to 1
redraw = .F.
endif
return
procedure DispThis18
if redraw
set color to w/n
clear
do ShowBatt
@0,0 say BH
@1,0 say HM
@2,0 say YBH
@2,9 say 'X'
?? ltrim(rtrim(str(BL,6)))
@3,0 say flagXZ(val(XZ))
?? ' '
set numwidth to 6
set decimal to 4
?? DJ
set color to n/w
if SUBSTR(BH,8,1)='W'
@0,14 say '無功'
endif
@3,12 say readingFlagName(CBBZ+1)
PointOfHM = 1
set color to w/n
set numwidth to 8
set decimal to 1
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -