| | |
| | | import HslCommunication.Core.Types.OperateResultExOne; |
| | | import HslCommunication.Profinet.Melsec.MelsecMcNet; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.BasExt; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.BasExtService; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | // extProtocol.setMode(melsecMcNet.getByteTransform().TransInt16(result.Content, 0)); |
| | | // extProtocol.setTaskNo(melsecMcNet.getByteTransform().TransInt16(result.Content, 2)); |
| | | |
| | | OutputQueue.Ext.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | |
| | | // 根据实时信息更新数据库 |
| | | BasExtService extService = SpringUtils.getBean(BasExtService.class); |
| | | BasExt basExt = new BasExt(); |
| | | basExt.setExtNo(slave.getId()); |
| | | basExt.setExtTask(extProtocol.isTake()?"Y":"N"); |
| | | basExt.setExtPut(extProtocol.isPut()?"Y":"N"); |
| | | if (!extService.updateById(basExt)){ |
| | | log.error("MelsecExt"+" - 4"+" - 机械臂plc数据库更新失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | }else { |
| | | OutputQueue.Ext.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | } |
| | | } else { |
| | | BasExtService extService = SpringUtils.getBean(BasExtService.class); |
| | | BasExt basExt = new BasExt(); |
| | | basExt.setExtNo(slave.getId()); |
| | | basExt.setExtTask("N"); |
| | | basExt.setExtPut("N"); |
| | | extService.updateById(basExt); |
| | | OutputQueue.Ext.offer(MessageFormat.format("【{0}】{1}机械臂plc状态信息失败",DateUtils.convert(new Date()), slave.getId())); |
| | | throw new CoolException(MessageFormat.format( "机械臂plc状态信息失败 ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort())); |
| | | } |