| | |
| | | package com.zy.core.thread.impl; |
| | | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasRgv; |
| | | import com.zy.asrs.entity.BasRgvOpt; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.entity.DeviceDataLog; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.service.BasRgvOptService; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | @Override |
| | | public synchronized CommandResponse sendCommand(RgvCommand command) { |
| | | rgvProtocol.setLastCommandTime(System.currentTimeMillis()); |
| | | return zyRgvConnectDriver.sendCommand(command); |
| | | CommandResponse response = null; |
| | | try { |
| | | response = zyRgvConnectDriver.sendCommand(command); |
| | | return response; |
| | | } finally { |
| | | BasRgvOptService bean = SpringUtils.getBean(BasRgvOptService.class); |
| | | ZyRgvStatusEntity statusEntity = zyRgvConnectDriver.getStatus(); |
| | | BasRgvOpt basRgvOpt = new BasRgvOpt( |
| | | command.getTaskNo(), |
| | | command.getRgvNo(), |
| | | new Date(), |
| | | String.valueOf(command.getTaskMode()), |
| | | String.valueOf(command.getSourcePos()), |
| | | String.valueOf(command.getTargetPos()), |
| | | null, |
| | | null, |
| | | null, |
| | | JSON.toJSONString(command), |
| | | JSON.toJSONString(statusEntity), |
| | | 1, |
| | | JSON.toJSONString(response) |
| | | ); |
| | | if (bean != null) { |
| | | bean.insert(basRgvOpt); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |