📄 clockoptions.~pas
字号:
dlgHints.Update;
FillChar(buf, length(buf), 0);
beginps:=StrToInt(edBeginPage.Text);
ps:=0;
SaveCaption:=btnTransFont.Caption;
btnTransFont.Caption:=SIO;
timebegin:=Now;
S:=SOyOUIAOOA;
msg.Caption:=S;
msg.Update;
if GetAcp=950 then S:=Big5ToGB(S);
ShowClockMessage(pclk.hPort, PChar(S), True, 1, 10);
S:=SCeIOO;
if GetAcp=950 then S:=Big5ToGB(S);
ShowClockMessage(pclk.hPort, PChar(S), False, 2, 10);
SaveCursor:=Screen.Cursor;
Screen.Cursor:=crHourGlass;
try
while ps<=StrToInt(edPageCount.Text)-1 do
begin
Application.ProcessMessages;
if not bRuning then Goto ERR;
FontStream.Position:=(ps+beginps)*$100;
if FontStream.Read(Buf[low(Buf)], $100)=$100 then
begin
if WriteFlashPageData(pclk.hPort, $0BF0+(ps+beginps), @Buf) then
begin
inc(ps);
edBeginPage.Text:=IntToStr(ps+beginps);
dlgHints.msg.Caption:=format(SOyOUIAOUDOOA, [ps]);
dlgHints.msg.Update;
end else
begin
dlgHints.msg.Caption:=SIAOOIaEU;
MessageBox(Screen.ActiveForm.Handle, PChar(dlgHints.msg.Caption), PChar(SIIo), MB_OK or MB_ICONERROR);
Windows.Beep(2500, 200);
Goto ERR;
end;
end else
Goto ERR;
end;
MsgBox(Handle, PChar(format(SIAOIeEDOOAOAES, [ps, formatdatetime(SHGEMOSAe, Now-timebegin)])), msg_infor, MB_ICONINFORMATION);
ERR:
btnTransFont.Caption:=SaveCaption;
Windows.Beep(2500, 100);
finally
bRuning:=False;
dlgHints.Close;
Screen.Cursor:=SaveCursor;
end;
end;
end;
procedure TdlgOptions.btnOkClick(Sender: TObject);
var
Code: Integer;
nInt, nLen: Integer;
d: Double;
RightTime,ErrorTime:integer;
begin
with pclk^ do
begin
if CheckHandle(pclk.hPort) then// and (tsClockMode.Tag<>0) then
begin
if GetClockSupports(hPort, fiChangeMode) then
begin
msg.Caption:='';
Mode:=0;
ExtraMode:=0;
SystemMode:=0;
if cbA0.Checked then Mode:=(Mode or 1);
if cbA1.Checked then Mode:=(Mode or 2);
if cbA2.Checked then Mode:=(Mode or (1 shl 2));
if cbA3.Checked then Mode:=(Mode or (1 shl 3));
if cbA450.Checked then Mode:=(Mode xor (0 shl 4));
if cbA4501.Checked then Mode:=(Mode xor (1 shl 4));
if cbA4510.Checked then Mode:=(Mode xor (2 shl 4));
if cbA4511.Checked then Mode:=(Mode xor (3 shl 4));
if cbA6.Checked then Mode:=(Mode or (1 shl 6));
if cbA7.Checked then Mode:=(Mode or (1 shl 7));
if cbB0.Checked then ExtraMode:=(ExtraMode or 1);
if cbB1.Checked then ExtraMode:=(ExtraMode or 2);
if cbB2.Checked then ExtraMode:=(ExtraMode or (1 shl 2));
if cbB3.Checked then ExtraMode:=(ExtraMode or (1 shl 3));
if cbB4.Checked then ExtraMode:=(ExtraMode or (1 shl 4));
if ( Pclk.model=690)and (Pclk.Fireware=2.0) then
begin
if cbPeriod.Checked then ExtraMode:=(ExtraMode or (1 shl 5));
if cbStarMac.Checked then ExtraMode:=(ExtraMode or (1 shl 7));
end else
begin
if cbB765000.Checked then ExtraMode:=(ExtraMode xor (0 shl 5));
if cbB765011.Checked then ExtraMode:=(ExtraMode xor (3 shl 5));
if cbB765100.Checked then ExtraMode:=(ExtraMode xor (4 shl 5));
if cbB765101.Checked then ExtraMode:=(ExtraMode xor (5 shl 5));
end;
if cbC4.Checked then SystemMode:=(SystemMode or (1 shl 4));
pclk.GroupCheck:=cbB3.Checked;
// if cbC7.Checked then SystemMode:=(SystemMode or (1 shl 7));
if not SetClockMode(pclk.hPort, Mode, Extramode, SystemMode) then
msg.Caption:=msg.Caption+SOEGGAEEeOAEU
end;
if ReadedExtProp then
begin
if GetClockSupports(hPort, fiChangeBlock) then
begin
Code:=0;
case cbCardType.ItemIndex of
-1,0:
begin
Code:=cbSector.Itemindex;
if Code<2 then Code:=Code+1
else
begin
Code:=((Code+1)div 3)*4 +((Code+1) mod 3);
end;
end;
1:
begin
Code:=(cbSector.ItemIndex+1)*2;
end;
end;
if cbPassword.ItemIndex>0 then
Code:=(Code or $40);//使用B密码第6位置1
if not SetClientCode(hPort, Code) then
msg.Caption:=msg.Caption+SIUAeEeOAEU;
end;
if GetClockSupports(hPort, fiCustomCardLen) then
begin
nLen:=StrToIntDef(edDispLen.Text, 16);
nInt:=StrToIntDef(edDataLen.Text, 16);
if not SetCardLength(pclk.hPort, nLen, nInt) then
msg.Caption:=msg.Caption+SAEEeOAEU
else
begin
pclk.CardLen:=nInt;
pclk.DispCardLen:=nLen;
end;
end;
if pclk.VerOrd>1 then
begin
if cbC4.Checked then nInt:=1 else nInt:=0;
if (pclk.Fireware>FW119) and(not SetDoorOpenTimeoutAlarmState(pclk.hPort, nInt)) then
msg.Caption:=msg.Caption+SAAEEeOAEU;
end;
if GetClockSupports(hPort, fiBrushSpace) then
begin
d:=StrToFloat(edBrushSpace.Text);
if not SetCardTimeInterval(pclk.hPort, d) then
msg.Caption:=msg.Caption+SOOEEAOEeOAEU;
end;
if GetClockSupports(hPort, fiRepeatSpace) then
begin
nInt:=StrToInt(edRepeatSpace.Text);
if not SetRepeatClockerTime(pclk.hPort, nInt) then
msg.Caption:=msg.Caption+SOEAOEeOAEU;
end;
if GetClockSupports(hPort, fiBrushPeriods) then
begin
if (not cbUseClockTime.Checked) and (lvClockTime.Items.Count=0) then
if not SetWholeTimeClock(pclk.hPort) then
msg.Caption:=msg.Caption+SEIiCUEeOAEU;
SaveClockerTimes;
end;
if GetClockSupports(hPort, fiRingTime) then
begin
SaveRingTimes;
if cbA450.Checked and (not ClearRing(pclk.hPort)) then
msg.Caption:=msg.Caption+SCaYOAaEAEU;
end;
if GetClockSupports(hPort, fiGroupCard) then
begin
if pclk.GroupCheck then
begin
pclk.GroupCheck:=cbB3.Checked;
if not WriteGroupByteStation(pclk.hPort, cbGroupStation.ItemIndex) then
msg.Caption:=msg.Caption+SEeOAOOeEGOUIOAEU
else
pclk.GroupStation:=cbGroupStation.ItemIndex;
if not WriteGroupByteChecks(pclk.hPort, PChar(edGroup.Text)) then
msg.Caption:=msg.Caption+SOOeIEyEeOAEU
else
begin
Fini.WriteString(format(SGroupCheckSec, [Port, clock_id]), 'GroupChecks', edGroup.Text);
end;
end;
end;
end;
if edFirstWinMsg.Tag<>0 then
begin
if SetFirstWindowDispString(hPort, PChar(TransToGB(edFirstWinMsg.Text))) then
FIni.WriteString(SetSec, SFirstWinMsg, edFirstWinMsg.Text);
edFirstWinMsg.Tag:=0;
end;
if edNormalMsg.Tag<>0 then
begin
if SetClockNormalMessage(hPort, PChar(TransToGB(edNormalMsg.Text))) then
FIni.WriteString(SetSec, SNormalMsg, edNormalMsg.Text);
edNormalMsg.Tag:=0;
end;
if edBrushMsg.Tag<>0 then
begin
if SetClockWelcomeMessage(hPort, PChar(TransToGB(edBrushMsg.Text))) then
FIni.WriteString(SetSec, SBrushMsg, edBrushMsg.Text);
edBrushMsg.Tag:=0;
end;
nLen:=StrToIntDef(meLockTime.Text, 0);
// if GetClockSupports(hPort, fiDoorGuard) then
if not SetLockOpenTimeLen(pclk.hPort, nLen) then
begin
msg.Caption:=msg.Caption+SCEOIEAEeOAEU;
end;
rightTime:=strtoIntDef(edRight.Text ,0);
ErrorTime:=strtoIntDef(edError.text,0);
if not SetStateLampTime(hPort,1,RightTime) then
msg.Caption:=RightCaption;
if not SetStateLampTime(hPort,2,ErrorTime) then
msg.Caption:=ErrorCaption;
tsClockMode.Tag:=0;
if msg.Caption='' then msg.Caption:=SUAEEeOAE;
Windows.Beep(2500, 100);
end;
end;
end;
procedure TdlgOptions.PageControl2Change(Sender: TObject);
begin
if PageControl2.ActivePage=tsDisplay then
begin
// edFirstWinMsg.Tag:=1;
// edNormalMsg.Tag:=1;
// edBrushMsg.Tag:=1;
end;
if PageControl2.ActivePage=tsFonts then
begin
case GetACP of
950: cbFontLib.ItemIndex:=1;
else
cbFontLib.ItemIndex:=0;
end;
cbFontLibChange(Sender);
end;
end;
procedure TdlgOptions.FormShow(Sender: TObject);
var
R: Boolean;
i: Integer;
AllowChange: Boolean;
buf: array[0..49]of char;
begin
with pclk^ do
begin
if ReadClockMode(hPort, Mode, ExtraMode, SystemMode) then
begin
msg.Caption:='';
cbA0.Checked:=(Mode and $1)<>0;
cbA1.Checked:=(Mode and $2)<>0;
cbA2.Checked:=(Mode and (1 shl 2))<>0;
cbA3.Checked:=(Mode and (1 shl 3))<>0;
cbA450.Checked:=(Mode and (3 shl 4))=0;
cbA4501.Checked:=(Mode and (3 shl 4))=(1 shl 4);
cbA4510.Checked:=(Mode and (3 shl 4))=(2 shl 4);
cbA4511.Checked:=(Mode and (3 shl 4))=(3 shl 4);
cbA6.Checked:=(Mode and (1 shl 6))<>0;
cbA7.Checked:=(Mode and (1 shl 7))<>0;
cbB0.Checked:=(ExtraMode and 1)<>0;
cbB1.Checked:=(ExtraMode and 2)<>0;
cbB2.Checked:=(ExtraMode and (1 shl 2))<>0;
cbB3.Checked:=(ExtraMode and (1 shl 3))<>0;
cbB4.Checked:=(ExtraMode and (1 shl 4))<>0;
if ( Pclk.model=690)and (Pclk.Fireware=2.0) then
begin
cbPeriod.Checked:=(ExtraMode or (1 shl 5))<>0;
cbStarMac.Checked:=(ExtraMode or (1 shl 7))<>0;
end else
begin
cbB765000.Checked:=(ExtraMode and (7 shl 5))=0;
cbB765011.Checked:=(ExtraMode and (7 shl 5))=(3 shl 5);
cbB765100.Checked:=(ExtraMode and (7 shl 5))=(4 shl 5);
cbB765101.Checked:=(ExtraMode and (7 shl 5))=(5 shl 5);
end;
cbUseClockTime.Checked:=(SystemMode and (1 shl 7))<>0;
cbC4.Checked:=(SystemMode and (1 shl 4))<>0;
pclk.GroupCheck:=(ExtraMode and (1 shl 3))<>0;
end;
cbA3.Enabled:=pclk.VerOrd>2;
cbb765101.Enabled:=pclk.VerOrd>2;
tsICCard.TabVisible:=(pclk.cls>0);
R:=GetClockSupports(pclk.hPort, fiICReader);
cbCardType.Enabled:=R;
cbSector.Enabled:=R;
cbPassword.Enabled:=R;
SetGroupControlState(tsClockMode, GetClockSupports(hPort, fiChangeMode));
cbUseClockTime.Enabled:=gbWorkMode.Enabled;
cbB3.Enabled:=gbWorkMode.Enabled;
ReadedExtProp:=False;
R:=ReadLockOpenTimeLen(hPort, i);
meLockTime.Enabled:=R;
if pclk.VerOrd>2 then
lbMsgUnit.Caption:=SDAY
else
lbMsgUnit.Caption:=SSECOND;
if R then
begin
meLockTime.Text:=IntToStr(i);
end;
R:=ReadStateLampTime(hPort, 1, i);
// edRight.Enabled:=R;
if R then
edRight.Text:=IntToStr(i);
R:=ReadStateLampTime(hPort,2, i);
// edError.Enabled:=R;
if R then
edError.Text:=IntToStr(i);
if PageControl2.ActivePageIndex<>0 then PageControl2Changing(PageControl2, AllowChange);
tsClockMode.Tag:=0;
{ if GetClockVersion(hPort, Buf) then
begin
y:=0;
for i:=0 to StrLen(Buf)-1 do//截断ER-980标志部分
if Buf[i]=',' then
if y<2 then
Inc(y)
else
Buf[i]:=#0;
msg.Caption:=format(SUAEGIAS, [Buf]);
end;}
if ReadClockSerialNo(hPort, Buf) then
begin
msg.Caption:={msg.Caption+#13#10+}format(SGoAGAS, [buf]);
end;
end;
end;
procedure TdlgOptions.edBrushSpaceExit(Sender: TObject);
begin
try
if StrToFloat(edBrushSpace.Text)>2.25 then
raise Exception.Create(SOOEOAOAUOiAe);
except
edBrushSpace.SetFocus;
raise;
end;
end;
procedure TdlgOptions.sbAddClockTimeClick(Sender: TObject);
begin
begin
if (pclk.hPort <> 0) then
begin
if dlgClockTime.Execute then
begin
if SetClockerTime(pclk.hPort, PChar(dlgClockTime.meBegin.Text), PChar(dlgClockTime.meEnd.Text)) then
begin
cbUseClockTime.Checked:=True;
msg.Caption:=SOK;
with lvClockTime.Items.Add do
begin
Caption:=dlgClockTime.meBegin.Text;
SubItems.Add(dlgClockTime.meEnd.Text);
end;
lvClockTime.AlphaSort;
end else
msg.Caption:=SERROR;
Windows.Beep(2500, 100);
end;
end;
end;
end;
procedure TdlgOptions.sbDelClockTimeClick(Sender: TObject);
var
i: Integer;
begin
if (lvClockTime.SelCount>0) and
(MessageBox(Screen.ActiveForm.Handle, PChar(SECNEYNOGACUEI), PChar(SAE1), MB_YESNO or MB_ICONQUESTION)=IDYES) then
for i:=lvClockTime.Items.Count-1 downto 0 do
if lvClockTime.Items[i].Selected then
begin
lvClockTime.Items.Delete(i);
end;
end;
procedure TdlgOptions.sbAddRingTimeClick(Sender: TObject);
var
Hour, Min, Sec, mSec: WORD;
Duration: Integer;
begin
begin
if (pclk.hPort <> 0) then
begin
if dlgRingTime.Execute then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -