|  |  | 
 |  |  |         if(connect.IsSuccess){ | 
 |  |  |             result = true; | 
 |  |  |             OutputQueue.CRN.offer(MessageFormat.format( "【{0}】堆垛机plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
 |  |  |             News.info("堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             News.info("MelsecCrn"+" - 1"+" - 堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |         } else { | 
 |  |  |             OutputQueue.CRN.offer(MessageFormat.format("【{0}】堆垛机plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
 |  |  |             News.error("堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             News.error("MelsecCrn"+" - 2"+" - 堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             initCrn(); | 
 |  |  |         } | 
 |  |  | //        melsecMcNet.ConnectClose(); | 
 |  |  | 
 |  |  |  | 
 |  |  |                 // 复位信号 | 
 |  |  |                 if (crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { | 
 |  |  |                     News.error("-------------------------------------------第一步、[堆垛机号:{}][工作号:{}]==>> 状态为90,等待确认!!",slave.getId(),crnProtocol.getTaskNo()); | 
 |  |  |                     News.error("MelsecCrn"+" - 3"+" ---------第一步、[堆垛机号:{}][工作号:{}]==>> 状态为90,等待确认!!",slave.getId(),crnProtocol.getTaskNo()); | 
 |  |  |                     if (resetFlag) { | 
 |  |  |                         if(crnProtocol.getTaskNo()==9999){ | 
 |  |  |                             backHpFlag = false; | 
 |  |  | 
 |  |  |                 basCrnp.setCrnNo(slave.getId()); | 
 |  |  |                 basCrnp.setCrnSts((int)crnProtocol.getMode()); | 
 |  |  |                 if (!basCrnpService.updateById(crnProtocol.toSqlModel(basCrnp))){ | 
 |  |  |                     News.error("堆垛机plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |                     News.error("MelsecCrn"+" - 4"+" - 堆垛机plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } else { | 
 |  |  | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
 |  |  |             News.error("读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             News.error("MelsecCrn"+" - 5"+" - 读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             initCrn(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     private boolean write(CrnCommand command){ | 
 |  |  |         if (null == command) { | 
 |  |  |             News.error("堆垛机写入命令为空"); | 
 |  |  |             News.error("MelsecCrn"+" - 6"+" - 堆垛机写入命令为空"); | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         } catch (Exception ignore) {} | 
 |  |  |  | 
 |  |  |         if (result != null && result.IsSuccess) { | 
 |  |  |             News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); | 
 |  |  |             News.info("MelsecCrn"+" - 7"+" - 堆垛机命令下发[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 { | 
 |  |  |             OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
 |  |  |             News.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             News.error("MelsecCrn"+" - 8"+" - 写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | 
 |  |  | //        OperateResult write9 = melsecMcNet.Write("D1009", (short) 0); | 
 |  |  | //        OperateResult write10 = melsecMcNet.Write("D1010", (short) 0); | 
 |  |  |         if (!write.IsSuccess) { | 
 |  |  |             News.error("堆垛机plc心跳通讯失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |             News.error("MelsecCrn"+" - 9"+" - 堆垛机plc心跳通讯失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  |