| | |
| | | */ |
| | | 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); |
| | |
| | | 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++; |
| | |
| | | || !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{ |
| | |
| | | }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; |
| | | } |
| | | } |
| | |
| | | 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())); |
| | |
| | | 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++; |
| | |
| | | || !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{ |
| | |
| | | }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; |
| | | } |
| | | } |
| | |
| | | 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())); |