|  |  | 
 |  |  |                     shuttleProtocol.setPakMk(true); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | //                if (shuttleProtocol.getProtocolStatusType() == null && shuttleProtocol.getDeviceStatus().intValue() == ShuttleDeviceStatusType.IDLE.id) { | 
 |  |  | //                    //小车空闲状态、小车任务状态为未知,认定曾离线过,需要复位成空闲 | 
 |  |  | //                    shuttleProtocol.setProtocolStatusType(ShuttleProtocolStatusType.IDLE); | 
 |  |  | //                } | 
 |  |  |                 if (shuttleProtocol.getProtocolStatusType() == null && shuttleProtocol.getDeviceStatus().intValue() == 3) { | 
 |  |  |                     //小车空闲状态、小车任务状态为未知,认定曾离线过,需要复位成空闲 | 
 |  |  |                     shuttleProtocol.setProtocolStatusType(ShuttleProtocolStatusType.IDLE); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (System.currentTimeMillis() - shuttleProtocol.getDeviceDataLog() > 1000 * 5) { | 
 |  |  |                     //采集时间超过5s,保存一次数据记录 | 
 |  |  | 
 |  |  |                     //更新采集时间 | 
 |  |  |                     shuttleProtocol.setDeviceDataLog(System.currentTimeMillis()); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //将四向穿梭车状态保存至数据库 | 
 |  |  |                 BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class); | 
 |  |  |                 BasShuttle basShuttle = shuttleService.getOne(new LambdaQueryWrapper<BasShuttle>() | 
 |  |  |                         .eq(BasShuttle::getShuttleNo, device.getDeviceNo()) | 
 |  |  |                         .eq(BasShuttle::getHostId, device.getHostId())); | 
 |  |  |                 if (basShuttle == null) { | 
 |  |  |                     basShuttle = new BasShuttle(); | 
 |  |  |                     //四向穿梭车号 | 
 |  |  |                     basShuttle.setShuttleNo(Integer.valueOf(device.getDeviceNo())); | 
 |  |  |                     basShuttle.setHostId(device.getHostId()); | 
 |  |  |                     shuttleService.save(basShuttle); | 
 |  |  |                 } | 
 |  |  |                 //任务号 | 
 |  |  |                 basShuttle.setTaskNo(shuttleProtocol.getTaskNo().intValue()); | 
 |  |  |                 //修改时间 | 
 |  |  |                 basShuttle.setUpdateTime(new Date()); | 
 |  |  |                 //设备状态 | 
 |  |  |                 basShuttle.setProtocol(JSON.toJSONString(shuttleProtocol)); | 
 |  |  |                 if (shuttleService.updateById(basShuttle)) { | 
 |  |  |                     OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), device.getDeviceNo())); | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】{1}读取四向穿梭车状态信息失败", DateUtils.convert(new Date()), device.getDeviceNo())); | 
 |  |  |                 throw new CoolException(MessageFormat.format("读取四向穿梭车状态信息失败 ===>> [id:{0}] [ip:{1}] [port:{2}]", device.getDeviceNo(), device.getIp(), device.getPort())); |