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

📄 smg_reportthread.~pas

📁 SPIG1.1.rar SPIG接口协议
💻 ~PAS
字号:
unit SMG_ReportThread;

interface

uses
  Classes, SP_SMG_DLL, SysUtils;

type
  TReport_Thread = class(TThread)
  private
    ReportBuf : ReportStr;
    procedure Report;
    { Private declarations }
  protected
    procedure Execute; override;
  public
    constructor Create(FReport: ReportStr; CreateSuspended: Boolean);
  end;

implementation

{ Important: Methods and properties of objects in VCL or CLX can only be used
  in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure TReport_Thread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TReport_Thread }
uses SPServer, SMG_DB;

procedure TReport_Thread.Execute;
begin
  { Place thread code here }
  FreeOnTerminate := True;
  Report;
end;

constructor TReport_Thread.Create(FReport : ReportStr; CreateSuspended: Boolean);
begin
 ReportBuf := FReport;
 FreeOnTerminate := True;
 inherited Create(CreateSuspended);
end;

procedure TReport_Thread.Report;
var
 pSeqNum1,pSeqNum2,pSeqNum3:LongInt;
 pSrcNo,pState,pErrCode:string;
begin
 with ReportBuf do
  begin
    pSeqNum1:=SequenceNumber1;
    pSeqNum1:=SequenceNumber2;
    pSeqNum1:=SequenceNumber3;
    pSrcNo:=UserNumber;
    pState:=State;
    pErrCode:=ErrCode;
  end;
 with frmSGIP do
  begin
    CurLogMsg(TRE,'序列号1:'+IntToStr(pSeqNum1));
    CurLogMsg(TRE,'序列号2:'+IntToStr(pSeqNum2));
    CurLogMsg(TRE,'序列号3:'+IntToStr(pSeqNum3));
    CurLogMsg(TRE,'用户号码:'+pSrcNo);
    CurLogMsg(TRE,'状态:'+pState);
    CurLogMsg(TRE,'错误代码:'+pErrorCode);
  end;
 with frmSMGDB.tblReport do
  begin
    Open;
    Insert;
    Fields[1].Value:=pSeqNum1;
    Fields[2].Value:=pSeqNum2;
    Fields[3].Value:=pSeqNum3;
    Fields[4].Value:=pSrcNo;
    Fields[5].Value:=pState;
    Fields[6].Value:=pErrCode;
    Post;
    Close;
  end;
end;

end.

⌨️ 快捷键说明

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