自动化立体仓库 - WCS系统
#
tqs
2024-05-11 1a14854a59259a8dc95343c9e6aeac03939308df
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -185,6 +185,8 @@
                // 复位信号
                if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
                    News.error("-------------------------------------------第一步、[堆垛机号:{}, 工作号:{}, 载货台信号:{}]==>> 状态为10,等待确认!!",
                            slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "有物" : "无物");
                    if (resetFlag) {
                        if(crnProtocol.getTaskNo()==9999){
                            backHpFlag = false;
@@ -256,9 +258,9 @@
                        || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX())
                        || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ())
                ){
                    News.error("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
//                    News.error("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                } else {
                    News.info("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
//                    News.info("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                }
            }
        }catch (Exception e){
@@ -283,7 +285,7 @@
        boolean[] array2 = new boolean[1];
        array2[0] = command.isTraySize();
        OperateResult result = siemensNet.Write("DB100.0", array);
        OperateResult result2 = siemensNet.Write("DB100.20", array2);
        OperateResult result2 = siemensNet.Write("DB100.22", array2);
        News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array);
        if(!result.IsSuccess || !result2.IsSuccess){
@@ -297,7 +299,7 @@
        //堆垛机任务写入后,回读一次,看是否成功
        Thread.sleep(200);
        try{
            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20);
            OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 24);
            if (resultRead.IsSuccess) {
                CrnCommand one = new CrnCommand();
                one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2));
@@ -308,7 +310,7 @@
                one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12));
                one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14));
                one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16));
                one.setTraySize(siemensNet.getByteTransform().TransBool(resultRead.Content, 20));
                one.setTraySize(siemensNet.getByteTransform().TransBool(resultRead.Content, 22));
                if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode())
                        || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY())
                        || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX())
@@ -316,7 +318,7 @@
                        || !command.isTraySize() == one.isTraySize()
                ){
                    try{
                        News.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
//                        News.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                    }catch (Exception e){
                        try{
                            News.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSON(command),JSON.toJSON(resultRead));
@@ -330,7 +332,7 @@
                    readStatus();
                    return false;
                } else {
                    News.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
//                    News.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                }
            }
        }catch (Exception e){
@@ -358,7 +360,7 @@
                                News.error("堆垛机任务确认位"+commandFinish+"写入数据与回读数据不一致!"+"循环执行次数:"+writeCount2+"次");
                            }else{
                                //任务命令写入成功
                                News.info("堆垛机任务确认位"+commandFinish+"回读成功!"+"循环执行次数:"+writeCount2+"次");
//                                News.info("堆垛机任务确认位"+commandFinish+"回读成功!"+"循环执行次数:"+writeCount2+"次");
                                break;
                            }
                        }else {
@@ -371,13 +373,6 @@
            }
        }
//        if (command.getAckFinish() == 0) {
//            short commandFinish = 1;
//            Thread.sleep(200L);
//            result = siemensNet.Write("DB100.18", commandFinish);
//            log.info("堆垛机commandFinish下发[id:{}] >>>>> {}", slave.getId(), commandFinish);
////            result = siemensNet.Write("DB100.22", commandFinish);
//        }
        try {
            // 日志记录
@@ -405,7 +400,7 @@
        if (result != null && result.IsSuccess) {
            Thread.sleep(200);
            this.readStatus();
            News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
//            News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
            return true;
        } else {