⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 custchk.pas

📁 计量功能 事件记录 购电提醒 欠费报警 负荷控制 自检功能 显示功能 用户插卡错误信息显示
💻 PAS
字号:
unit CustChk;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, ConstDef, DBClient, MConnect, ExtCtrls;

type
  TFrmCustChk = class(TForm)
    Panel1: TPanel;
    PageControl1: TPageControl;
    TabSheetECard: TTabSheet;
    LabCardECard: TLabel;
    LabCardCustNo: TLabel;
    LabCardERemind: TLabel;
    LabCardEWarn: TLabel;
    LabCardTotalNum: TLabel;
    Panel2: TPanel;
    PageControl2: TPageControl;
    TabSheetEData: TTabSheet;
    LabCardEConsum: TLabel;
    LabCardERemain: TLabel;
    LabCardEBuy: TLabel;
    LabDBCustNo: TLabel;
    LabCardESum: TLabel;
    LabDBERemind: TLabel;
    LabDBEWarn: TLabel;
    LabDBENo: TLabel;
    LabDBEBuyNum: TLabel;
    LabDBESum: TLabel;
    LabDBEDate: TLabel;
    LabDBEDegree: TLabel;
    BtnPrint: TButton;
    BtnCancel: TButton;
    BtnRead: TButton;
    procedure PrdFrmCustChkIni(Sender: TObject);
    procedure PrdDispCardData(Sender: TObject);
    procedure PrdDispCustData(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure BtnReadClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    EnterMode: EnterModeType;
  end;

var
  FrmCustChk: TFrmCustChk;

  CustRW,ReadCD{Read Card Data}: RecRWCustDataType;
  ReadCK{Read Card Kind}: RecWriteCardKindType;

Function  sFunAddStrToStr(sStrIn:string; sStrAdd:string):WideString;
   export;far;external 'NIMStrans.dll';

implementation

uses ClntMain, Open, RWCard;

{$R *.DFM}

procedure TFrmCustChk.FormShow(Sender: TObject);
begin
  PrdFrmCustChkIni(Sender);
end;

procedure TFrmCustChk.PrdFrmCustChkIni(Sender: TObject);
begin
  if EnterMode=ReadCardMode then begin
     Panel2.Enabled:=False; Panel2.Visible:=False;
     FrmCustChk.Left:=FrmCustChk.Left*3 div 2;
   end
  else if EnterMode=CheckDataMode then begin
     Panel2.Enabled:=True; Panel2.Visible:=True;
   end;
end;

procedure TFrmCustChk.PrdDispCardData(Sender: TObject);
var
  sCardKind: string;
begin
   case ReadCK.ECK of //显示卡型
      NewCustCard: sCardKind:='开户卡';
      ForBuyCard, BuyCard: sCardKind:='申购卡';
      PatchForBuyCard, PatchBuyCard: sCardKind:='申购(补)卡';
      ChkedCard:   sCardKind:='检查卡';
      UnBuyCard:   sCardKind:='结算卡';
      CloseCard:   sCardKind:='销户卡';
      else
        if ReadCK.ECK=EmptyCard then sCardKind:='空白卡'
        else if ReadCK.ECK=ForChkCard then sCardKind:='检查卡(未用)'
        else sCardKind:='未知卡型';
        LabCardECard.Caption:=LabCardECard.Caption+sCardKind;
        Exit;
    end; //end case
   LabCardECard.Caption:='电卡类型: '+sCardKind;
   LabCardCustNo.Caption:='用户编号: '+inttostr(ReadCD.iCustNo);
   LabCardERemind.Caption:='提醒电量: '+inttostr(ReadCD.EM.iERemind);
   LabCardEWarn.Caption:='报警电量: '+inttostr(ReadCD.EM.iEWarn);
   LabCardEBuy.Caption:='申购电量: '+inttostr(ReadCD.Buy.iECurBuy);
   LabCardTotalNum.Caption:='申购次数: '+inttostr(ReadCD.EM.iTotalNum);
   LabCardESum.Caption:='已购电量: '+inttostr(ReadCD.EM.iESum);
   LabCardERemain.Caption:='剩余电量: '+inttostr(ReadCD.EM.iERemain);
   LabCardEConsum.Caption:='已用电量: '+inttostr(ReadCD.EM.iEConsume);
end;

procedure TFrmCustChk.PrdDispCustData(Sender: TObject);
begin
   LabDBCustNo.Caption:='用户编号: '+inttostr(CustRW.iCustNo);
   LabDBENo.Caption:='电表编号: '+CustRW.EM.sENo;
   LabDBEDate.Caption:='开户日期: '+sFunGetStrByDate(CustRW.EM.dtEDate);
   LabDBEDegree.Caption:='码盘度数: '+inttostr(CustRW.EM.iEDegree);
   LabDBEBuyNum.Caption:='申购次数: '+inttostr(CustRW.EM.iTotalNum);
   LabDBESum.Caption:='累计购电量: '+inttostr(CustRW.EM.iESum);
   LabDBERemind.Caption:='提醒电量: '+inttostr(CustRW.EM.iERemind);
   LabDBEWarn.Caption:='报警电量: '+inttostr(CustRW.EM.iEWarn);
end;

procedure TFrmCustChk.BtnReadClick(Sender: TObject);
var
  FrmOpen: TFrmOpen;
begin
  if not FrmRWCard.bFunReadCardCustData(ReadCD,ReadCK) then
    begin //读卡内数据
      wFunShowError('读卡失败!',[mbOK]); Exit;
    end;
  if EnterMode=ReadCardMode then begin
     PrdDispCardData(Sender);
    end
  else if EnterMode=CheckDataMode then begin
     if ReadCK.ECK<>ChkedCard then begin
        wFunShowError('卡内无用户检查信息!',[mbOK]); Exit;
      end;
     FrmOpen:=TFrmOpen.Create(Self);
     CustRW.iCustNo:=ReadCD.iCustNo;
     if not FrmOpen.bFunGetCustDBData(CustRW) then
       begin //读用户数据
         wFunShowError('读用户数据失败!',[mbOK]); Exit;
       end;
     if not FrmOpen.bFunCmpCustDB_CardData(CustRW,ReadCD,ReadCK)
       then begin
         wFunShowError('卡内数据不正常!',[mbOK]); Exit;
       end; FrmOpen.Free;
     PrdDispCardData(Sender);
     PrdDispCustData(Sender);
    end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -