📄 main.pas
字号:
choose1[7]:=0;
readC[7]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第7路设备故障!';
exit;
end;
end else
begin
zhuangtai[7,1]:='0';
zhuangtai[7,2]:='0';
zhuangtai[7,3]:='0';
end;
if choose1[8]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[8]);
sleep(600);
if comm1.Input=':08OK' then
begin
if fasong[8]<>'000000' then led8.LedPlasticColor:=clgreen
else
begin
led8.LedPlasticColor:=clred;
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-3 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[8],5,2)='01' then
begin
led8_1.LedPlasticColor:=clgreen;
zhuangtai[8,1]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-3 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[8],5,2)='00' then
begin
led8_1.LedPlasticColor:=clred;
zhuangtai[8,1]:='0';
end;
if copy(send[8],7,2)='01' then
begin
led8_2.LedPlasticColor:=clgreen;
zhuangtai[8,2]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-3 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[8],7,2)='00' then
begin
led8_2.LedPlasticColor:=clred;
zhuangtai[8,2]:='0';
end;
if copy(send[8],9,2)='01' then
begin
led8_3.LedPlasticColor:=clgreen;
zhuangtai[8,3]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-3 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[8],9,2)='00' then
begin
led8_3.LedPlasticColor:=clred;
zhuangtai[8,3]:='0';
end;
choose1[8]:=0;
readC[8]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第8路设备故障!';
exit;
end;
end else
begin
zhuangtai[8,1]:='0';
zhuangtai[8,2]:='0';
zhuangtai[8,3]:='0';
end;
if choose1[9]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[9]);
sleep(600);
if comm1.Input=':09OK' then
begin
if fasong[9]<>'000000' then led9.LedPlasticColor:=clgreen
else
begin
led9.LedPlasticColor:=clred;
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-2 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[9],5,2)='01' then
begin
led9_1.LedPlasticColor:=clgreen;
zhuangtai[9,1]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-2 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[9],5,2)='00' then
begin
led9_1.LedPlasticColor:=clred;
zhuangtai[9,1]:='0';
end;
if copy(send[9],7,2)='01' then
begin
led9_2.LedPlasticColor:=clgreen;
zhuangtai[9,2]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-2 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[9],7,2)='00' then
begin
led9_2.LedPlasticColor:=clred;
zhuangtai[9,2]:='0';
end;
if copy(send[9],9,2)='01' then
begin
led9_3.LedPlasticColor:=clgreen;
zhuangtai[9,3]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-2 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[9],9,2)='00' then
begin
led9_3.LedPlasticColor:=clred;
zhuangtai[9,3]:='0';
end;
choose1[9]:=0;
readC[9]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第9路设备故障!';
exit;
end;
end else
begin
zhuangtai[9,1]:='0';
zhuangtai[9,2]:='0';
zhuangtai[9,3]:='0';
end;
if choose1[10]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[10]);
sleep(600);
if comm1.Input=':10OK' then
begin
if fasong[10]<>'000000' then led10.LedPlasticColor:=clgreen
else
begin
led10.LedPlasticColor:=clred;
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-1 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[10],5,2)='01' then
begin
led10_1.LedPlasticColor:=clgreen;
zhuangtai[10,1]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-1 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[10],5,2)='00' then
begin
led10_1.LedPlasticColor:=clred;
zhuangtai[10,1]:='0';
end;
if copy(send[10],7,2)='01' then
begin
led10_2.LedPlasticColor:=clgreen;
zhuangtai[10,2]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-1 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[10],7,2)='00' then
begin
led10_2.LedPlasticColor:=clred;
zhuangtai[10,2]:='0';
end;
if copy(send[10],9,2)='01' then
begin
led10_3.LedPlasticColor:=clgreen;
zhuangtai[10,3]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-3-1 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[10],9,2)='00' then
begin
led10_3.LedPlasticColor:=clred;
zhuangtai[10,3]:='0';
end;
choose1[10]:=0;
readC[10]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第10路设备故障!';
exit;
end;
end else
begin
zhuangtai[10,1]:='0';
zhuangtai[10,2]:='0';
zhuangtai[10,3]:='0';
end;
if choose1[11]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[11]);
sleep(600);
if comm1.Input=':11OK' then
begin
if fasong[11]<>'000000' then led11.LedPlasticColor:=clgreen
else
begin
led11.LedPlasticColor:=clred;
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-1 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[11],5,2)='01' then
begin
led11_1.LedPlasticColor:=clgreen;
zhuangtai[11,1]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-1 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[11],5,2)='00' then
begin
led11_1.LedPlasticColor:=clred;
zhuangtai[11,1]:='0';
end;
if copy(send[11],7,2)='01' then
begin
led11_2.LedPlasticColor:=clgreen;
zhuangtai[11,2]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-1 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[11],7,2)='00' then
begin
led11_2.LedPlasticColor:=clred;
zhuangtai[11,2]:='0';
end;
if copy(send[11],9,2)='01' then
begin
led11_3.LedPlasticColor:=clgreen;
zhuangtai[11,3]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='6-2-1 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[11],9,2)='00' then
begin
led11_3.LedPlasticColor:=clred;
zhuangtai[11,3]:='0';
end;
choose1[11]:=0;
readC[11]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第11路设备故障!';
exit;
end;
end else
begin
zhuangtai[11,1]:='0';
zhuangtai[11,2]:='0';
zhuangtai[11,3]:='0';
end;
if choose1[12]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[12]);
sleep(600);
if comm1.Input=':12OK' then
begin
if fasong[12]<>'000000' then led12.LedPlasticColor:=clgreen
else
begin
led12.LedPlasticColor:=clred;
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='12 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[12],5,2)='01' then
begin
led12_1.LedPlasticColor:=clgreen;
zhuangtai[12,1]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='12 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[12],5,2)='00' then
begin
led12_1.LedPlasticColor:=clred;
zhuangtai[12,1]:='0';
end;
if copy(send[12],7,2)='01' then
begin
led12_2.LedPlasticColor:=clgreen;
zhuangtai[12,2]:='1';
with dm.DataModule1.ADO_log do
begin
close;
sql.Clear;
SQL.Add('Insert Into log values(:a1,:a2,:a3)');
parameters.ParamByName('a1').Value:=FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);
Parameters.parambyname('a2').value:='12 2路开灯';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -