📄 dunthread.pas
字号:
{*******************************************************}
{ }
{ Callout }
{ }
{ Copyright (C)Sjteksoft 2006 Company }
{ }
{*******************************************************}
unit DunThread;
interface
uses
Classes, DB, ADODB;
type
TDundetailsThread = class(TThread)
private
QryDun: TADOQuery;
FmeterID, Fdhhm, FdunStatus: string;
FdunCount: Integer;
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean); overload;
destructor Destroy; override;
procedure SetConnection(Acon: TADOConnection);
property MeterID: string read FmeterID write FmeterID;
property Dhhm: string read Fdhhm write Fdhhm;
property DunCount: Integer read FdunCount write FdunCount default 1;
property DunStatus: string read FdunStatus write FdunStatus;
end;
TDunlogThread = class(TThread)
private
Qrydun: TADOQuery;
FChannel: Integer;
FChanneltype, FAction, FDescription, FResult: string;
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean); overload;
destructor Destroy; override;
procedure SetConnection(Acon: TADOConnection);
property Channel: Integer read FChannel write FChannel;
property Channeltype: string read FChanneltype write FChanneltype;
property Action: string read FAction write FAction;
property Description: string read FDescription write FDescription;
property ActionResult: string read FResult write FResult;
end;
implementation
{ DunThread }
constructor TDundetailsThread.Create(CreateSuspended: Boolean);
begin
inherited;
FreeOnTerminate := True;
QryDun := TADOQuery.Create(nil);
end;
destructor TDundetailsThread.Destroy;
begin
QryDun.Connection := nil;
QryDun.Free;
inherited;
end;
procedure TDundetailsThread.Execute;
begin
with QryDun do
try
Close;
SQL.Clear;
SQL.Add('exec uspDun_Insert :MeterID, :Dhhm, :DunCount, :DunStatus');
Parameters.ParamByName('MeterID').Value := FmeterID;
Parameters.ParamByName('Dhhm').Value := Fdhhm;
Parameters.ParamByName('Duncount').Value := FdunCount;
Parameters.ParamByName('Dunstatus').Value := FdunStatus;
try
ExecSQL;
except end;
finally
Close;
end;
end;
procedure TDundetailsThread.SetConnection(Acon: TADOConnection);
begin
QryDun.Connection := Acon;
end;
{ TDunlogThread }
constructor TDunlogThread.Create(CreateSuspended: Boolean);
begin
inherited;
FreeOnTerminate := True;
Qrydun := TADOQuery.Create(nil);
end;
destructor TDunlogThread.Destroy;
begin
Qrydun.Connection := nil;
Qrydun.Free;
inherited;
end;
procedure TDunlogThread.Execute;
begin
with Qrydun do
try
Close;
SQL.Clear;
SQL.Add('exec uspDunlog_Insert :Channel, :Channeltype, :Action, :Description, :Result');
Parameters.ParamByName('Channel').Value := FChannel;
Parameters.ParamByName('Channeltype').Value := FChanneltype;
Parameters.ParamByName('Action').Value := FAction;
Parameters.ParamByName('Description').Value := FDescription;
Parameters.ParamByName('Result').Value := FResult;
try
ExecSQL;
except end;
finally
Close;
end;
end;
procedure TDunlogThread.SetConnection(Acon: TADOConnection);
begin
Qrydun.Connection := Acon;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -