自动化立体仓库 - WCS系统
#
lsh
2024-07-12 6db4a007c34ece48ffac0a2b6c2f700d7b15c6e5
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -194,9 +194,6 @@
     */
    private void readStatus(){
        try {
            if (true){
                return;
            }
            OperateResultExOne<byte[]> result = new OperateResultExOne<byte[]>();
            if (slave.getId()>2 && slave.getId()<6){
                result = siemensNet.Read("DB101.0", (short) 66);
@@ -360,7 +357,7 @@
        do {
            try{
                if(!result.IsSuccess){
                    log.error("写入堆垛机plc数据失败,重新下发任务  写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount);
                    log.error("写入堆垛机plc数据失败,重新下发任务  写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command),writeCount);
                    result = siemensNet.Write("DB100.0", array);
                    Thread.sleep(100);
                    writeCount++;
@@ -383,12 +380,12 @@
                            || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ())
                    ){
                        try{
                            log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                            log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command),JSON.toJSONString(one));
                        }catch (Exception e){
                            try{
                                log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSON(command),JSON.toJSON(resultRead));
                                log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSONString(command),JSON.toJSONString(resultRead));
                            }catch (Exception e1){
                                log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSON(command));
                                log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSONString(command));
                            }
                        }
                        try{
@@ -396,12 +393,12 @@
                        }catch (Exception e){
                        }
                        log.error("写入堆垛机plc数据失败,重新下发任务  回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount);
                        log.error("写入堆垛机plc数据失败,重新下发任务  回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command),writeCount);
                        result = siemensNet.Write("DB100.0", array);
                        writeCount++;
                        continue;
                    } else {
                        log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                        log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command),JSON.toJSONString(one));
                        break;
                    }
                }
@@ -458,8 +455,8 @@
        if (result != null && result.IsSuccess) {
            Thread.sleep(200);
            this.readStatus();
            log.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)));
            log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSONString(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSONString(command)));
            return true;
        } else {
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
@@ -501,7 +498,7 @@
        do {
            try{
                if(!result.IsSuccess){
                    log.error("写入堆垛机plc数据失败,重新下发任务  写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount);
                    log.error("写入堆垛机plc数据失败,重新下发任务  写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command),writeCount);
                    result = siemensNet.Write("DB100.20", array);
                    Thread.sleep(100);
                    writeCount++;
@@ -524,12 +521,12 @@
                            || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ())
                    ){
                        try{
                            log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                            log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command),JSON.toJSONString(one));
                        }catch (Exception e){
                            try{
                                log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSON(command),JSON.toJSON(resultRead));
                                log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSONString(command),JSON.toJSONString(resultRead));
                            }catch (Exception e1){
                                log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSON(command));
                                log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSONString(command));
                            }
                        }
                        try{
@@ -537,12 +534,12 @@
                        }catch (Exception e){
                        }
                        log.error("写入堆垛机plc数据失败,重新下发任务  回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount);
                        log.error("写入堆垛机plc数据失败,重新下发任务  回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command),writeCount);
                        result = siemensNet.Write("DB100.20", array);
                        writeCount++;
                        continue;
                    } else {
                        log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one));
                        log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command),JSON.toJSONString(one));
                        break;
                    }
                }
@@ -599,8 +596,8 @@
        if (result != null && result.IsSuccess) {
            Thread.sleep(200);
            this.readStatus();
            log.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)));
            log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSONString(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSONString(command)));
            return true;
        } else {
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));