⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 power.pas

📁 Monitor.dfm Meter.dpr pasMain.pas
💻 PAS
📖 第 1 页 / 共 2 页
字号:
                        if I> 3 then
                        begin
                                StatusLab.simpletext  := '断电操作不成功,请检查线路。' ;
                                label5.Caption:='断电操作不成功';
                                image1.Picture:=image4.Picture;
                                activecommand:=false;
                                exit;
                        end;
                        for I := 1  to 3 do
                        begin

                                if PutTXD('S'+uno_e.text+'5680'+CHR(13), 22, rStr, 2500) and (Copy(rStr, 1, 4) = _OK) AND (Copy(rStr, 5, 10)='0000000000') AND (Copy(rStr, 21, 2) = _CRLF) then break;
                        end;
                        if I> 3 then
                        begin
                                StatusLab.simpletext  := '断电操作不成功,请检查线路。';
                                activecommand:=false;
                                label5.Caption:='断电操作不成功';
                                frmpower.BitBtn3Click(Sender);
                                image1.Picture:=image4.Picture;

                                exit;
                        end
                        else
                        begin
                                StatusLab.simpletext  := '断电操作成功。';
                                label5.Caption:='已经断电';
                                image1.Picture:=image3.Picture;
                                activecommand:=false;

                        end;
                end;
        end;
        if delaystatu='1' then
        begin
                for I := 1  to 3 do
                begin
                        if PutTXD('R' +delayuno1+ Chr(13), 159, rStr, 1500)  and UnLockFlag=true then break;
                        if not UnLockFlag then
                        begin
                                frmPromot.Hide;
                                frmPromot.Promot.Caption := '请先通过集中器口令检测。';
                                frmPromot.ShowModal;
                                BreakRead := true;

                                exit;
                        end;
                end;
                if i>3 then
                begin
                        frmPromot.Hide;
                        frmPromot.Promot.Caption := '请检查集中器中是否有此表号。';
                        frmPromot.ShowModal;
                        BreakRead := true;

                        exit;
                end;
                delaydeep:=copy(rstr,14,1);
                phase:= copy(rstr,95,1);
                if delaydeep='0' then
                begin
                     sBuf := 'H' + Phase + _CR;
                     if PutTXD(sBuf, 4, rStr,2500) and (Copy(rStr, 1, 4) = _OK) then
                     begin
                        for i:=1 to 3 do
                        begin
                                sBuf := 'S' +Delayuno1+'8001'  + _CR;
                                StatusLab.simpletext  := '正在设置中继表号......';
                                if PutTXD(sBuf, 18, rStr,3000) and (Copy(rStr, 1, 12) = 'SetupSuccess') then continue
                        end;
                        for I := 1  to 3 do
                        begin

                                if PutTXD('S'+uno_e.text+'6671'+CHR(13), 22, rStr, 4000) and (Copy(rStr, 1, 4) = _OK) AND (Copy(rStr, 5, 10)='0000000000') AND (Copy(rStr, 21, 2) = _CRLF) then break;
                        end;


                        if I> 3 then
                        begin
                                StatusLab.simpletext  := '断电操作不成功,请检查线路。' ;
                                label5.Caption:='断电操作不成功';
                                frmpower.BitBtn3Click(Sender);
                                image1.Picture:=image4.Picture;
                                activecommand:=false;
                                exit;
                        end;
                        for I := 1  to 3 do
                        begin

                                if PutTXD('S'+uno_e.text+'6681'+CHR(13), 22, rStr, 4000) and (Copy(rStr, 1, 4) = _OK) AND (Copy(rStr, 5, 10)='0000000000') AND (Copy(rStr, 21, 2) = _CRLF) then break;
                        end;
                        if I> 3 then
                        begin
                                StatusLab.simpletext  := '断电操作不成功,请检查线路。';
                                activecommand:=false;
                                label5.Caption:='断电操作不成功';
                                frmpower.BitBtn3Click(Sender);
                                image1.Picture:=image4.Picture;
                                exit;
                        end
                        else
                        begin
                                StatusLab.simpletext  := '断电操作成功。';
                                label5.Caption:='已经断电';
                                image1.Picture:=image3.Picture;
                                activecommand:=false;

                        end;
                     end;
                end;
        end;





end;

procedure Tfrmpower.BitBtn3Click(Sender: TObject);
var
    I: integer;
    sBuf, rStr: string;
     delaystatu,delayuno1,delayuno2,delayuno3,phase,delaydeep:string;
begin

    if UNO_E.Text = '' then
    BEGIN
        statusLab.simpletext  := '表号为空,请输入。';
        exit;
    end;
    sbuf := ConvertID(UNO_E.Text);
    activecommand:=true;
    StatusLab.simpletext  := '';


    BreakRead:=false;


    for I := 1  to 3 do
    begin
        if PutTXD('R' +Uno_E.text+ Chr(13), 159, rStr, 1500)  and UnLockFlag=true then break;
        if not UnLockFlag then
        begin
                frmPromot.Hide;
                frmPromot.Promot.Caption := '请先通过集中器口令检测。';
                frmPromot.ShowModal;
                BreakRead := true;

                exit;
        end;
    end;
    if i>3 then
    begin
                frmPromot.Hide;
                frmPromot.Promot.Caption := '请检查集中器中是否有此表号。';
                frmPromot.ShowModal;
                BreakRead := true;

                exit;
    end;
    delaystatu:=copy(rstr,14,1);
    phase:=copy(rstr,95,1);
    delaydeep:=copy(rstr,97,1);
    delayuno1:=copy(rstr,99,12);
    delayuno2:=copy(rstr,112,12);
    delayuno3:=copy(rstr,125,12);
    //Read SCALE and CONSTANT

    if BreakRead then
        begin

            activecommand:=false;
            exit;
        end;
    if delaystatu='0' then
        begin
                sBuf := 'H' + Phase + _CR;
                if PutTXD(sBuf, 4, rStr,2500) and (Copy(rStr, 1, 4) = _OK) then
                begin
                        for I := 1  to 3 do
                        begin

                        if PutTXD('S'+uno_e.text+'5800'+CHR(13), 22, rStr, 2500) and (Copy(rStr, 1, 4) = _OK) AND  (Copy(rStr, 21, 2) = _CRLF) and (Copy(rStr, 17, 4) = _YES)then break;
                        end;

                        StatusLab.simpletext := '';
                        if I> 3 then
                        begin
                                StatusLab.simpletext  := '读取电表状态不成功,请检查线路。' ;
                                activecommand:=false;
                                label5.Caption:='读取状态不成功';
                                image1.Picture:=image4.Picture;
                                exit;
                        end
                        else
                        begin
                                if copy(rstr,5,2)='11' then
                                begin
                                        Frmpower.StatusLab.simpletext  := '电表当前状态为:(正常通电).';
                                        label5.Caption:='正常通电';
                                        image1.Picture:=image2.Picture;
                                end;
                                if copy(rstr,5,2)='01' then
                                begin
                                        Frmpower.StatusLab.simpletext  := '电表当前状态为:(已经停电).';
                                        label5.Caption:='已经停电';
                                        image1.Picture:=image3.Picture;
                                end;

                        end;
                        activecommand:=false;
                end;
        end;
        if delaystatu='1' then
        begin
                for I := 1  to 3 do
                begin
                        if PutTXD('R' +delayuno1+ Chr(13), 159, rStr, 1500)  and UnLockFlag=true then break;
                        if not UnLockFlag then
                        begin
                                frmPromot.Hide;
                                frmPromot.Promot.Caption := '请先通过集中器口令检测。';
                                frmPromot.ShowModal;
                                BreakRead := true;

                                exit;
                        end;
                end;
                if i>3 then
                begin
                        frmPromot.Hide;
                        frmPromot.Promot.Caption := '请检查集中器中是否有此表号。';
                        frmPromot.ShowModal;
                        BreakRead := true;

                        exit;
                end;
                delaydeep:=copy(rstr,14,1);
                phase:= copy(rstr,95,1);
                if delaydeep='0' then
                begin
                     sBuf := 'H' + Phase + _CR;
                     if PutTXD(sBuf, 4, rStr,2500) and (Copy(rStr, 1, 4) = _OK) then
                     begin
                        for i:=1 to 3 do
                        begin
                                sBuf := 'S' +Delayuno1+'8001'  + _CR;
                                StatusLab.simpletext  := '正在设置中继表号......';
                                if PutTXD(sBuf, 18, rStr,4000) and (Copy(rStr, 1, 12) = 'SetupSuccess') then continue;
                        end;
                        for I := 1  to 3 do
                        begin

                                if PutTXD('S'+uno_e.text+'6801'+CHR(13), 22, rStr, 4000) and (Copy(rStr, 1, 4) = _OK) AND  (Copy(rStr, 21, 2) = _CRLF) and (Copy(rStr, 17, 4) = _YES)then break;
                        end;

                        StatusLab.simpletext := '';
                        if I> 3 then
                        begin
                                StatusLab.simpletext  := '读取电表状态不成功,请检查线路。' ;
                                activecommand:=false;
                                label5.Caption:='读取状态不成功';
                                image1.Picture:=image4.Picture;
                                exit;
                        end
                        else
                        begin
                                if copy(rstr,5,2)='11' then
                                begin
                                        Frmpower.StatusLab.simpletext  := '电表当前状态为:(正常通电).';
                                        label5.Caption:='正常通电';
                                        image1.Picture:=image2.Picture;
                                end;
                                if copy(rstr,5,2)='01' then
                                begin
                                        Frmpower.StatusLab.simpletext  := '电表当前状态为:(已经停电).';
                                        label5.Caption:='已经停电';
                                        image1.Picture:=image3.Picture;
                                end;

                        end;
                        activecommand:=false;
                end;
        end;
    end;
end;

procedure Tfrmpower.Button1Click(Sender: TObject);
begin
        BreakRead:=true;
        CLOSE;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -