| | |
| | | liftProtocol.setHasTray(data.getInteger("hasTray") == 1); |
| | | //有小车 |
| | | liftProtocol.setHasCar(data.getInteger("hasCar") == 1); |
| | | //出入库模式 |
| | | liftProtocol.setIOMode(data.getInteger("iOMode")); |
| | | //故障码 |
| | | liftProtocol.setErrorCode(data.getInteger("errorCode")); |
| | | //当前层 |
| | |
| | | |
| | | this.realtimeOriginData = JSON.toJSONString(data); |
| | | |
| | | if (System.currentTimeMillis() - liftProtocol.getDeviceDataLog() > 1000 * 5) { |
| | | if (System.currentTimeMillis() - liftProtocol.getDeviceDataLog() > 1000 * 2) { |
| | | //采集时间超过5s,保存一次数据记录 |
| | | //保存数据记录 |
| | | DeviceDataLogService deviceDataLogService = SpringUtils.getBean(DeviceDataLogService.class); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse switchIOMode(LiftCommand command) { |
| | | CommandResponse response = new CommandResponse(false); |
| | | try { |
| | | //发出请求 |
| | | String resultKey = requestCommand(command); |
| | | //查询请求结果 |
| | | JSONObject result = queryCommandStatus(resultKey); |
| | | if (result == null) { |
| | | return response;//请求失败 |
| | | } |
| | | if(!result.getString("result").equals("success")) { |
| | | return response;//请求失败 |
| | | } |
| | | |
| | | this.liftProtocol.setSendTime(System.currentTimeMillis());//指令下发时间 |
| | | response.setMessage(JSON.toJSONString(result)); |
| | | response.setResult(true); |
| | | return response; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | response.setMessage(e.getMessage()); |
| | | return response; |
| | | } |
| | | public CommandResponse switchIOMode(LiftIoModeType type) { |
| | | CommandResponse response = new CommandResponse(true); |
| | | liftProtocol.setIOModeType(type); |
| | | return response; |
| | | } |
| | | |
| | | @Override |