📄 main.~pas
字号:
end;
if copy(send[3],5,2)='01' then
begin
led3_1.LedPlasticColor:=clgreen;
zhuangtai[3,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:='5-9-1 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[3],5,2)='00' then
begin
led3_1.LedPlasticColor:=clred;
zhuangtai[3,1]:='0';
end;
if copy(send[3],7,2)='01' then
begin
led3_2.LedPlasticColor:=clgreen;
zhuangtai[3,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:='5-9-1 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[3],7,2)='00' then
begin
led3_2.LedPlasticColor:=clred;
zhuangtai[3,2]:='0';
end;
if copy(send[3],9,2)='01' then
begin
led3_3.LedPlasticColor:=clgreen;
zhuangtai[3,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:='5-9-1 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[3],9,2)='00' then
begin
led3_3.LedPlasticColor:=clred;
zhuangtai[3,3]:='0';
end;
choose1[3]:=0;
readC[3]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第3路设备故障!';
exit;
end;
end else
begin
zhuangtai[3,1]:='0';
zhuangtai[3,2]:='0';
zhuangtai[3,3]:='0';
end;
if choose1[4]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[4]);
sleep(600);
if comm1.Input=':04OK' then
begin
if fasong[4]<>'000000' then led4.LedPlasticColor:=clgreen
else
begin
led4.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:='5-9-2 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[4],5,2)='01' then
begin
led4_1.LedPlasticColor:=clgreen;
zhuangtai[4,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:='5-9-2 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[4],5,2)='00' then
begin
led4_1.LedPlasticColor:=clred;
zhuangtai[4,1]:='0';
end;
if copy(send[4],7,2)='01' then
begin
led4_2.LedPlasticColor:=clgreen;
zhuangtai[4,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:='5-9-2 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[4],7,2)='00' then
begin
led4_2.LedPlasticColor:=clred;
zhuangtai[4,2]:='0';
end;
if copy(send[4],9,2)='01' then
begin
led4_3.LedPlasticColor:=clgreen;
zhuangtai[4,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:='5-9-2 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[4],9,2)='00' then
begin
led4_3.LedPlasticColor:=clred;
zhuangtai[4,3]:='0';
end;
choose1[4]:=0;
readC[4]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第4路设备故障!';
exit;
end;
end else
begin
zhuangtai[4,1]:='0';
zhuangtai[4,2]:='0';
zhuangtai[4,3]:='0';
end;
if choose1[5]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[5]);
sleep(600);
if comm1.Input=':05OK' then
begin
if fasong[5]<>'000000' then led5.LedPlasticColor:=clgreen
else
begin
led5.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:='5-11-5 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[5],5,2)='01' then
begin
led5_1.LedPlasticColor:=clgreen;
zhuangtai[5,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:='5-11-5 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[5],5,2)='00' then
begin
led5_1.LedPlasticColor:=clred;
zhuangtai[5,1]:='0';
end;
if copy(send[5],7,2)='01' then
begin
led5_2.LedPlasticColor:=clgreen;
zhuangtai[5,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:='5-11-5 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[5],7,2)='00' then
begin
led5_2.LedPlasticColor:=clred;
zhuangtai[5,2]:='0';
end;
if copy(send[5],9,2)='01' then
begin
led5_3.LedPlasticColor:=clgreen;
zhuangtai[5,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:='5-11-5 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[5],9,2)='00' then
begin
led5_3.LedPlasticColor:=clred;
zhuangtai[5,3]:='0';
end;
choose1[5]:=0;
readC[5]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第5路设备故障!';
exit;
end;
end else
begin
zhuangtai[5,1]:='0';
zhuangtai[5,2]:='0';
zhuangtai[5,3]:='0';
end;
if choose1[6]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[6]);
sleep(600);
if comm1.Input=':06OK' then
begin
if fasong[6]<>'000000' then led6.LedPlasticColor:=clgreen
else
begin
led6.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:='5-11-6 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[6],5,2)='01' then
begin
led6_1.LedPlasticColor:=clgreen;
zhuangtai[6,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:='5-11-6 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end ;
if copy(send[6],5,2)='00' then
begin
led6_1.LedPlasticColor:=clred;
zhuangtai[6,1]:='0';
end;
if copy(send[6],7,2)='01' then
begin
led6_2.LedPlasticColor:=clgreen;
zhuangtai[6,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:='5-11-6 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[6],7,2)='00' then
begin
led6_2.LedPlasticColor:=clred;
zhuangtai[6,2]:='0';
end;
if copy(send[6],9,2)='01' then
begin
led6_3.LedPlasticColor:=clgreen;
zhuangtai[6,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:='5-11-6 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[6],9,2)='00' then
begin
led6_3.LedPlasticColor:=clred;
zhuangtai[6,3]:='0';
end;
choose1[6]:=0;
readC[6]:=1;
exit;
end else
begin
statusbar1.Panels[2].Text:='第6路设备故障!';
exit;
end;
end else
begin
zhuangtai[6,1]:='0';
zhuangtai[6,2]:='0';
zhuangtai[6,3]:='0';
end;
if choose1[7]=1 then
begin
comm1.DataCount:=0;
comm1.OutputString(send[7]);
sleep(600);
if comm1.Input=':07OK' then
begin
if fasong[7]<>'000000' then led7.LedPlasticColor:=clgreen
else
begin
led7.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-4 关灯';
Parameters.parambyname('a3').value:='无 ';
execsql;
end;
end;
if copy(send[7],5,2)='01' then
begin
led7_1.LedPlasticColor:=clgreen;
zhuangtai[7,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-4 1路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[7],5,2)='00' then
begin
led7_1.LedPlasticColor:=clred;
zhuangtai[7,1]:='0';
end;
if copy(send[7],7,2)='01' then
begin
led7_2.LedPlasticColor:=clgreen;
zhuangtai[7,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-4 2路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[7],7,2)='00' then
begin
led7_2.LedPlasticColor:=clred;
zhuangtai[7,2]:='0';
end;
if copy(send[7],9,2)='01' then
begin
led7_3.LedPlasticColor:=clgreen;
zhuangtai[7,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-4 3路开灯';
Parameters.parambyname('a3').value:='无';
execsql;
end;
end;
if copy(send[7],9,2)='00' then
begin
led7_3.LedPlasticColor:=clred;
zhuangtai[7,3]:='0';
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -