| | |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasRgv; |
| | | import com.zy.asrs.entity.BasRgvOpt; |
| | | import com.zy.asrs.entity.DeviceDataLog; |
| | | import com.zy.asrs.service.BasRgvOptService; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.service.DeviceDataLogService; |
| | | import com.zy.common.utils.News; |
| | | import com.zy.core.RgvThread2; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.Base64; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | if (System.currentTimeMillis() - rgvProtocol.getDeviceDataLog() > 1000 * 5) { |
| | | //采集时间超过5s,保存一次数据记录 |
| | | //保存数据记录 |
| | | DeviceDataLogService deviceDataLogService = SpringUtils.getBean(DeviceDataLogService.class); |
| | | DeviceDataLog deviceDataLog = new DeviceDataLog(); |
| | | deviceDataLog.setOriginData(Base64.getEncoder().encodeToString(result.Content)); |
| | | deviceDataLog.setWcsData(JSON.toJSONString(rgvProtocol)); |
| | | deviceDataLog.setType("rgv"); |
| | | deviceDataLog.setDeviceNo(rgvProtocol.getRgvNo()); |
| | | deviceDataLog.setCreateTime(new Date()); |
| | | deviceDataLogService.insert(deviceDataLog); |
| | | |
| | | //更新采集时间 |
| | | rgvProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | | |
| | | try { |
| | | // 根据实时信息更新数据库 |
| | | BasRgvService basRgvService = SpringUtils.getBean(BasRgvService.class); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 工位1、2同时写入数据 |
| | | * 工位1同时写入数据 |
| | | */ |
| | | private boolean write(RgvCommand command) throws InterruptedException { |
| | | if (null == command) { |
| | |
| | | } |
| | | // convertRow(command); |
| | | command.setRgvNo(slave.getId()); |
| | | short[] array = new short[11]; |
| | | short[] array = new short[5]; |
| | | array[0] = command.getAckFinish1(); |
| | | array[1] = command.getTaskNo1(); |
| | | array[2] = command.getTaskMode1(); |