📄 frm_c_fixcardpas.pas
字号:
unit frm_c_fixcardpas;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ModalForm, Menus, StdCtrls, ExtCtrls, ComCtrls, YLabelButton,
ChangeImage, UErrDisplay;
type
Tfrm_c_fixcard = class(TMyModalForm)
GroupBox3: TGroupBox;
Label1: TLabel;
cb1: TCheckBox;
cb2: TCheckBox;
cb4: TCheckBox;
cb3: TCheckBox;
cb6: TCheckBox;
cb5: TCheckBox;
cb8: TCheckBox;
cb7: TCheckBox;
dtp: TDateTimePicker;
Label2: TLabel;
edttrack: TEdit;
GroupBox1: TGroupBox;
Label3: TLabel;
lblyhbh: TLabel;
Label4: TLabel;
lblyhxm: TLabel;
Label7: TLabel;
lblCardsn: TLabel;
Label5: TLabel;
lblCardye: TLabel;
Label6: TLabel;
lblczcs: TLabel;
Label8: TLabel;
lblbmmc: TLabel;
stb: TStatusBar;
Label9: TLabel;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
BtnNew: TChangeImg;
LbtnNew: TLabelB;
LBtnEdit: TLabelB;
BtnEdit: TChangeImg;
LBtnDelete: TLabelB;
BtnRefresh: TChangeImg;
LBtnRefresh: TLabelB;
BtnHelp: TChangeImg;
LBtnHelp: TLabelB;
ChangeImg1: TChangeImg;
ChangeImg2: TChangeImg;
LabelB3: TLabelB;
Label10: TLabel;
lblCardSta: TLabel;
procedure FormCreate(Sender: TObject);
procedure BtnEditClick(Sender: TObject);
procedure ChangeImg2Click(Sender: TObject);
procedure BtnNewClick(Sender: TObject);
procedure cb2Click(Sender: TObject);
procedure ChangeImg1Click(Sender: TObject);
procedure BtnRefreshClick(Sender: TObject);
procedure BtnHelpClick(Sender: TObject);
procedure edttrackClick(Sender: TObject);
private
{ Private declarations }
procedure IniForm;
public
{ Public declarations }
end;
var
frm_c_fixcard: Tfrm_c_fixcard;
implementation
uses UTcard, UTYhxx, UGeneralFunc, UGlobal, DM_DataModal, frm_c_getyhzhpas;
var
yhcard: Tcard;
yhxx: Tyhxx;
iCardType: byte;
sTrack2: string;
sTrack3: string;
{$R *.dfm}
{ Tfrm_c_fixcard }
procedure Tfrm_c_fixcard.IniForm;
begin
lblyhbh.Caption := '';
lblyhxm.Caption := '';
lblcardsn.Caption := '';
lblcardye.Caption := '';
lblczcs.Caption := '';
lblCardSta.Caption := '';
lblbmmc.Caption := '';
dtp.DateTime := now;
edttrack.Text := '';
cb1.Checked := False;
cb2.Checked := False;
cb3.Checked := False;
cb4.Checked := False;
cb5.Checked := False;
cb6.Checked := False;
cb7.Checked := False;
cb8.Checked := False;
iCardType := 0;
stb.Panels[1].Text := '请将IC卡放在读卡器上后点击[读卡]';
end;
procedure Tfrm_c_fixcard.FormCreate(Sender: TObject);
begin
inherited;
with WindData.PublicQuery do
begin
close;
sql.Clear;
sql.Add(' select * from zx_s_cardtype');
open;
if not eof then
begin
cb1.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
begin
cb2.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
begin
cb3.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
begin
cb4.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
begin
cb5.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
begin
cb6.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
begin
cb7.Caption := fieldbyname('klmc').asstring;
next;
end;
if not eof then
cb8.Caption := fieldbyname('klmc').asstring;
end;
yhxx := Tyhxx.create;
yhcard := Tcard.Create;
IniForm;
end;
procedure Tfrm_c_fixcard.BtnEditClick(Sender: TObject);
var
sStr: string;
begin
inherited;
yhcard.yhdk(True);
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
if trim(yhcard.Yhbh) <> '' then
begin
if yhxx.GetYhxx(yhcard.Yhbh) then
begin
lblyhbh.Caption := yhcard.Yhbh;
lblyhxm.Caption := yhxx.Yhxm;
lblcardsn.Caption := inttostr(yhcard.CardSN);
lblcardye.Caption := trim(format('%12.2f', [yhcard.cardye]));
lblczcs.Caption := inttostr(yhcard.CardTimes);
lblCardSta.Caption := inttostr(yhcard.CardSta);
lblbmmc.Caption := yhxx.Bjmc;
dtp.DateTime := yhcard.DateLimit;
edttrack.Text := yhcard.Track1;
iCardType := yhcard.CardType;
sStr := InttoBstr(yhcard.CardType, 8);
cb1.Checked := sStr[1] = '1';
cb2.Checked := sStr[2] = '1';
cb3.Checked := sStr[3] = '1';
cb4.Checked := sStr[4] = '1';
cb5.Checked := sStr[5] = '1';
cb6.Checked := sStr[6] = '1';
cb7.Checked := sStr[7] = '1';
cb8.Checked := sStr[8] = '1';
end
else
stb.Panels[1].Text := '[' + inttostr(yhxx.RetVal) + ']' + yhxx.RetMsg;
end
else
IniForm;
end;
procedure Tfrm_c_fixcard.ChangeImg2Click(Sender: TObject);
begin
inherited;
if lblyhbh.Caption = '' then
begin
stb.Panels[1].Text := '请先读卡....';
exit;
end;
yhcard.SetCardPWD(strtoint(sCsPassWord));
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
end;
procedure Tfrm_c_fixcard.BtnNewClick(Sender: TObject);
var
tmp: boolean;
begin
inherited;
if lblyhbh.Caption = '' then
begin
stb.Panels[1].Text := '请先读卡....';
exit;
end;
yhcard.yhdk(True);
if yhcard.RetVal = -1 then
begin
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
exit;
end;
if inttostr(yhcard.CardSN) <> lblcardsn.Caption then
begin
stb.Panels[1].Text := '卡信息不符合,请先读卡';
exit;
end;
tmp := False;
if edttrack.Text <> yhcard.Track1 then
begin
if not yhcard.FixCard(3, yhcard.CardType, yhcard.mon1, yhcard.mon2,
yhxx.Track2, yhxx.Track3, yhcard.DateLimit,
yhcard.CardSta, yhcard.CardTimes, '修改二三磁道信息') then
begin
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
exit;
end;
tmp := True;
end;
if yhcard.CardType <> iCardType then
begin
if not yhcard.FixCard(1, iCardType, yhcard.mon1, yhcard.mon2,
yhcard.Track2, yhcard.Track3, yhcard.DateLimit,
yhcard.CardSta, yhcard.CardTimes, '修改卡类') then
begin
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
exit;
end;
tmp := True;
end;
if dtp.DateTime <> yhcard.DateLimit then
begin
if not yhcard.FixCard(4, yhcard.CardType, yhcard.mon1, yhcard.mon2,
yhcard.Track2, yhcard.Track3, dtp.DateTime,
yhcard.CardSta, yhcard.CardTimes, '修改使用年限') then
begin
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
exit;
end;
tmp := True;
end;
if not tmp then
stb.Panels[1].Text := '无卡数据需修正'
else
stb.Panels[1].Text := '卡数据修正成功'
end;
procedure Tfrm_c_fixcard.cb2Click(Sender: TObject);
var
sStr: string;
begin
inherited;
if cb1.Checked then
sStr := '1'
else
sStr := '0';
if cb2.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
if cb3.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
if cb4.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
if cb5.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
if cb6.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
if cb7.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
if cb8.Checked then
sStr := sStr + '1'
else
sStr := sStr + '0';
iCardType := BstrtoInt(sStr);
end;
procedure Tfrm_c_fixcard.ChangeImg1Click(Sender: TObject);
begin
inherited;
if lblyhbh.Caption = '' then
begin
stb.Panels[1].Text := '请先读卡....';
exit;
end;
if yhcard.Unlock then lblcardsta.Caption := '0';
stb.Panels[1].Text := '[' + inttostr(yhcard.RetVal) + ']' + yhcard.RetMsg;
end;
procedure Tfrm_c_fixcard.BtnRefreshClick(Sender: TObject);
begin
inherited;
IniForm;
end;
procedure Tfrm_c_fixcard.BtnHelpClick(Sender: TObject);
begin
inherited;
HtmlHelp(Handle, gtSyscs.sHelpFileName, $0001, DWORD(PChar('Introduction.htm')));
end;
procedure Tfrm_c_fixcard.edttrackClick(Sender: TObject);
begin
inherited;
if (lblyhbh.Caption <> '') and (edttrack.Text = '') then
begin
frm_c_getyhzh := Tfrm_c_getyhzh.Create(application);
frm_c_getyhzh.Yhxx := Yhxx;
frm_c_getyhzh.ShowModal;
frm_c_getyhzh.Free;
edttrack.Text := yhxx.Track1;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -