📄 acc.~pas
字号:
unit ACC;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls;
type
TfrmACC = class(TForm)
lbl1: TLabel;
grp1: TGroupBox;
cbbRunLine: TComboBox;
lbl2: TLabel;
rgACCRun: TRadioGroup;
rbStop: TRadioButton;
rbRun: TRadioButton;
rbsxqd: TRadioButton;
grpFilter: TGroupBox;
btnRun: TButton;
lbl3: TLabel;
cbbFilterLine: TComboBox;
btnFilter: TButton;
grpRunModel: TGroupBox;
lbl4: TLabel;
cbbRunModel: TComboBox;
rgRunModel: TRadioGroup;
rbSend: TRadioButton;
rbhot: TRadioButton;
rbcold: TRadioButton;
RBAuto: TRadioButton;
rbHQQJ: TRadioButton;
rbchushi: TRadioButton;
btnRunModel: TButton;
grpVAV: TGroupBox;
lbl5: TLabel;
cbbVAV: TComboBox;
lbl6: TLabel;
lbl7: TLabel;
lbl8: TLabel;
lbl9: TLabel;
cbbF1Cold: TComboBox;
cbbF2Cold: TComboBox;
cbbF1hot: TComboBox;
cbbF2Hot: TComboBox;
btnVAV: TButton;
lbl10: TLabel;
lbl11: TLabel;
lbl12: TLabel;
lbl13: TLabel;
lbl14: TLabel;
lbl15: TLabel;
lbl16: TLabel;
grpSetTemp: TGroupBox;
lbl17: TLabel;
cbbSetTemp: TComboBox;
lbl18: TLabel;
lbl19: TLabel;
cbbSetColdTemp: TComboBox;
cbbSetHotTemp: TComboBox;
btnSetTemp: TButton;
lbl20: TLabel;
grpDataInit: TGroupBox;
btnDataInit: TButton;
statACC: TStatusBar;
procedure btnRunClick(Sender: TObject);
procedure btnFilterClick(Sender: TObject);
procedure btnRunModelClick(Sender: TObject);
procedure btnVAVClick(Sender: TObject);
procedure btnSetTempClick(Sender: TObject);
procedure btnDataInitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmACC: TfrmACC;
implementation
{$R *.dfm}
uses
SU,Main;
procedure TfrmACC.btnRunClick(Sender: TObject);
var
strLineNo,
strState:string;
strSendComm:string;
SUSend:TSU;
begin
strLineNo := cbbRunLine.Text;
if rbStop.Checked then
strState :='0'
else
if rbRun.Checked then
strState := '1'
else
if rbsxqd.Checked then
strState := '3';
// ShowMessage(strLineNo );
// ShowMessage(strState );
SUSend := TSU.Create;
try
SUSend.ACCTRun(strLineNo,strState);
if SUSend.GetErrorInfo <> '命令正确' then
begin
statACC.SimpleText := SUSend.GetErrorInfo;
Exit;
end;
strSendComm := SUSend.GetCOmmand;
//ShowMessage(SUSend.GetErrorInfo);
try
if not main.frmain.Spcomm1.PortOpen then
main.frmain.Spcomm1.StartComm;
main.frmain.Spcomm1.WriteCommData( PChar(strSendComm),Length(strSendComm));
except
ShowMessage('命令发送失败!');
end;
finally
SUSend.Free;
end;
end;
procedure TfrmACC.btnFilterClick(Sender: TObject);
var
strTemp:string;
strSendComm:string;
SUSend:TSU;
begin
strTemp := cbbFilterLine.Text ;
SUSend := TSU.Create;
try
SUSend.ACCTCleaning(strTemp);
strSendComm := SUSend.GetCOmmand;
//ShowMessage(SUSend.GetErrorInfo);
try
if not main.frmain.Spcomm1.PortOpen then
main.frmain.Spcomm1.StartComm;
main.frmain.Spcomm1.WriteCommData( PChar(strSendComm),Length(strSendComm));
except
ShowMessage('命令发送失败!');
end;
finally
SUSend.Free;
end;
end;
procedure TfrmACC.btnRunModelClick(Sender: TObject);
var
strLineNo,
strModel:string;
strSendComm:string;
SUSend:TSU;
begin
strLineNo := cbbRunModel.Text ;
if rbSend.Checked then
strModel :='0'
else
if rbhot.Checked then
strModel :='1'
else
if rbcold.Checked then
strModel :='2'
else
if RBAuto.Checked then
strModel :='3'
else
if rbHQQJ.Checked then
strModel :='4'
else
if rbchushi.Checked then
strModel :='7'
else strModel :='3';
SUSend := TSU.Create;
try
SUSend.ACCTRunModel(strLineNo,strModel );
strSendComm := SUSend.GetCOmmand;
//ShowMessage(SUSend.GetErrorInfo);
try
if not main.frmain.Spcomm1.PortOpen then
main.frmain.Spcomm1.StartComm;
main.frmain.Spcomm1.WriteCommData( PChar(strSendComm),Length(strSendComm));
except
ShowMessage('命令发送失败!');
end;
finally
SUSend.Free;
end;
end;
procedure TfrmACC.btnVAVClick(Sender: TObject);
var
strLineNo,
strVAV:string;
strSendComm:string;
SUSend:TSU;
begin
strLineNo := cbbVAV.Text ;
strVAV := cbbF1Cold.Text + cbbF2Cold.Text + cbbF1hot.Text + cbbF2hot.Text;
strLineNo := strLineNo + strVAV ;
SUSend := TSU.Create;
try
SUSend.ACCTVAV(strLineNo );
strSendComm := SUSend.GetCOmmand;
//ShowMessage(SUSend.GetErrorInfo);
try
if not main.frmain.Spcomm1.PortOpen then
main.frmain.Spcomm1.StartComm;
main.frmain.Spcomm1.WriteCommData( PChar(strSendComm),Length(strSendComm));
except
ShowMessage('命令发送失败!');
end;
finally
SUSend.Free;
end;
end;
procedure TfrmACC.btnSetTempClick(Sender: TObject);
var
strLineNo,
strHot,
strCold:string;
strSendComm:string;
SUSend:TSU;
begin
strLineNo := cbbSetTemp.Text ;
strHot := cbbSetHotTemp.Text;
strCold := cbbSetColdTemp.Text;
if Length(strHot) = 0 then
strHot :='000'
else
if Length(strHot) = 1 then
strHot :='00'+ strHot
else
if Length(strHot) = 2 then
strHot :='0'+ strHot;
if Length(strCold) = 0 then
strCold :='000'
else
if Length(strCold) = 1 then
strCold :='00'+ strCold
else
if Length(strCold) = 2 then
strCold :='0'+ strCold;
SUSend := TSU.Create;
try
SUSend.ACCTSetTemp(strLineNo,strCold,strHot);
strSendComm := SUSend.GetCOmmand;
//ShowMessage(SUSend.GetErrorInfo);
try
if not main.frmain.Spcomm1.PortOpen then
main.frmain.Spcomm1.StartComm;
main.frmain.Spcomm1.WriteCommData( PChar(strSendComm),Length(strSendComm));
except
ShowMessage('命令发送失败!');
end;
finally
SUSend.Free;
end;
end;
procedure TfrmACC.btnDataInitClick(Sender: TObject);
var
//strTemp:string;
strSendComm:string;
SUSend:TSU;
begin
SUSend := TSU.Create;
try
SUSend.ACDataInit;
strSendComm := SUSend.GetCOmmand;
//ShowMessage(SUSend.GetErrorInfo);
try
if not main.frmain.Spcomm1.PortOpen then
main.frmain.Spcomm1.StartComm;
main.frmain.Spcomm1.WriteCommData( PChar(strSendComm),Length(strSendComm));
except
ShowMessage('命令发送失败!');
end;
finally
SUSend.Free;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -