?? smg_sendthread.pas
字號:
unit SMG_SendThread;
interface
uses
Windows, Forms, SysUtils, Classes, Registry, Math, Gauges, ComCtrls,
SP_SMG_DLL, SMG_DB;
type
Send_Thread = class(TThread)
private
procedure SendBuffer;
{ Private declarations }
protected
procedure Execute; override;
public
constructor Create(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 SendThread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ SendThread }
uses SPServer, DLL_Exports;
procedure Send_Thread.Execute;
begin
{ Place thread code here }
FreeOnTerminate := True;
SendBuffer;
end;
constructor Send_Thread.Create(CreateSuspended: Boolean);
begin
FreeOnTerminate := True;
inherited Create(CreateSuspended);
end;
procedure Send_Thread.SendBuffer;
var
SendBuffer:PSendBuffer;
Re,Count,Len:Integer;
SeqNum1,SeqNum2,SeqNum3: LongInt;
SPNum,ChargeNum,UserNum,CorpID,SvcType:PChar;
FeeType:Char;
FeeValue,GivenValue:PChar;
AgentFlag,MoFlag,Priorit:Char;
ExpireTime,ScheduleTime:PChar;
ReportFlag,Pid,UDhi,MsgCoding,MsgType:Char;
MsgContent,Reserve:PChar;
begin
Inc(RI);
New(SendBuffer);
SendBuffer := BufferList[0];
with SendBuffer^ do
begin
SPNum:=SPNumber;
ChargeNum:=ChargeNumber;
Count:=UserCount;
UserNum:=UserPhone;
CorpID:=CorpID;
SvcType:=SvcType;
FeeType:=FeeType;
FeeValue:=FeeValue;
GivenValue:=GivenValue;
AgentFlag:=AgentFlag;
MoFlag:=MoFlag;
Priorit:=Priority;
ExpireTime:=ExpireTime;
ScheduleTime:=ScheduleTime;
ReportFlag:=ReportFlag;
Pid:=Tppid;
Udhi:=Tpudhi;
MsgCoding:=MsgCoding;
MsgType:=MsgType;
Len:=MsgLen;
MsgContent:=MsgContent;
Reserve:=Reserve;
end;
Re:=Submit(SPNum,ChargeNum,Count,UserNum,CorpID,SvcType,FeeType,
FeeValue,GivenValue,AgentFlag,MoFlag,Priorit,ExpireTime,
ScheduleTime,ReportFlag,Pid,Udhi,MsgCoding,MsgType,Len,
MsgContent,#0,SeqNum1,SeqNum2,SeqNum3);
case Re of
1:begin
with frmSGIP do
begin
CurLogMsg(TRE,'序列號1:'+IntToStr(SeqNum1));
CurLogMsg(TRE,'序列號2:'+IntToStr(SeqNum2));
CurLogMsg(TRE,'序列號3:'+IntToStr(SeqNum3));
CurLogMsg(TRE,'手機號碼:'+UserNum);
CurLogMsg(TRE,'付費號碼:'+ChargeNum);
CurLogMsg(TRE,'服務類型:'+SvcType);
CurLogMsg(TRE,'計費類型:'+FeeType);
CurLogMsg(TRE,'收費值:'+FeeValue);
CurLogMsg(TRE,'信息內容:'+MsgContent);
CurLogMsg(TRE,'已成功加入服務器隊列!');
end;
with frmSMGDB.tblSubmit do
begin
Open;
Insert;
Fields[1].Text:= SPNum;
Fields[2].Text:= ChargeNum;
Fields[3].Value:= Count;
Fields[4].Text:= UserNum;
Fields[5].Text:= SPCode;
Fields[6].Text:= SvcType;
Fields[7].Text:= FeeType;
Fields[8].Text:= FeeValue;
Fields[9].Text:= GivenValue;
Fields[10].Text:= AgentFlag;
Fields[11].Value:= MoFlag;
Fields[12].Value:= Priorit;
Fields[13].Text:= ExpireTime;
Fields[14].Text:= ScheduleTime;
Fields[15].Value:= ReportFlag;
Fields[16].Text:= Pid;
Fields[17].Value:= Udhi;
Fields[18].Value:= MsgCoding;
Fields[19].Value:= MsgType;
Fields[20].Value:= Len;
Fields[21].Text:= MsgContent;
Fields[22].Text:= Reserve;
Fields[23].Value:= SeqNum1;
Fields[24].Value:= SeqNum2;
Fields[25].Value:= SeqNum3;
Post;
Close;
end;
if BufferList.Count>0 then BufferList.Delete(0);
Dec(RunCount);
end;
0:CurLogMsg(frmSGIP.TRE,'服務器隊列已滿!!');
-1:CurLogMsg(frmSGIP.TRE,'插入服務器隊列失敗!');
end;
Dec(RI);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -