#
lsh
2024-06-05 d7a12bb5eced2a629594d980715b3645b1ac0415
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -38,6 +38,7 @@
    private CrnSlave slave;
    private CrnProtocol crnProtocol;
    private boolean resetFlag = false;
    private boolean resetFlagTwo = false;
    public Long sign = System.currentTimeMillis();
@@ -204,12 +205,16 @@
                crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52));
                //工位2数据  无则无需例会
                crnProtocol.setTaskNoTwo(siemensNet.getByteTransform().TransInt16(result.Content, 56));
                crnProtocol.setStatusTwo(siemensNet.getByteTransform().TransInt16(result.Content, 56));
                crnProtocol.setForkPosTwo(siemensNet.getByteTransform().TransInt16(result.Content, 58));
                crnProtocol.setLiftPosTwo(siemensNet.getByteTransform().TransInt16(result.Content, 60));
                crnProtocol.setLoadedTwo(siemensNet.getByteTransform().TransInt16(result.Content, 64));
                //工位2数据  无则无需理会
                try{
                    crnProtocol.setTaskNoTwo(siemensNet.getByteTransform().TransInt16(result.Content, 56));
                    crnProtocol.setStatusTwo(siemensNet.getByteTransform().TransInt16(result.Content, 56));
                    crnProtocol.setForkPosTwo(siemensNet.getByteTransform().TransInt16(result.Content, 58));
                    crnProtocol.setLiftPosTwo(siemensNet.getByteTransform().TransInt16(result.Content, 60));
                    crnProtocol.setLoadedTwo(siemensNet.getByteTransform().TransInt16(result.Content, 64));
                }catch (Exception e){
                }
                OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
@@ -224,6 +229,16 @@
                        CrnCommand crnCommand = new CrnCommand();
                        crnCommand.setAckFinish((short)1);
                        if (write(crnCommand)) {
                            resetFlag = false;
                        }
                    }
                    if (resetFlagTwo) {
                        if(crnProtocol.getTaskNo()==9999){
                            backHpFlag = false;
                        }
                        CrnCommand crnCommand = new CrnCommand();
                        crnCommand.setAckFinish((short)1);
                        if (write5(crnCommand)) {
                            resetFlag = false;
                        }
                    }
@@ -285,12 +300,29 @@
//        array[9] = command.getSourceStaNo();
//        array[10] = command.getDestinationStaNo();
        array[9] = command.getCommand();
        OperateResult result18 = siemensNet.Write("DB100.18", (short)0);
        OperateResult result = siemensNet.Write("DB100.0", array);
        if (command.getAckFinish() == 0) {
            short commandFinish = 1;
            Thread.sleep(100L);
            result = siemensNet.Write("DB100.18", commandFinish);
            int signFinish = 1;
            while (signFinish<5){
                OperateResultExOne<byte[]> result10018 = siemensNet.Read("DB100.18", (short) 2);
                short transInt16 = siemensNet.getByteTransform().TransInt16(result10018.Content, 0);
                if (transInt16 != commandFinish){
                    log.info("下发DB100.18  回读失败" + "commandFinish:"+commandFinish);
                    log.info("下发DB100.18  回读失败" + "array:"+ JSON.toJSONString(array));
                    result = siemensNet.Write("DB100.18", commandFinish);
                    signFinish++;
                }else {
                    log.info("下发DB100.18" + "commandFinish:"+commandFinish);
                    log.info("下发DB100.18" + "array:"+ JSON.toJSONString(array));
                    break;
                }
            }
        }
        try {