| | |
| | | liftProtocol.setHasTray(data.getInteger("hasTray") == 1); |
| | | //有小车 |
| | | liftProtocol.setHasCar(data.getInteger("hasCar") == 1); |
| | | //出入库模式 |
| | | liftProtocol.setIOMode(data.getInteger("iOMode")); |
| | | //故障码 |
| | | liftProtocol.setErrorCode(data.getInteger("errorCode")); |
| | | //当前层 |
| | |
| | | } |
| | | |
| | | @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.setIOMode(type); |
| | | return response; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | InnerLiftExtend extend = (InnerLiftExtend) this.liftProtocol.getExtend(); |
| | | |
| | | boolean res = this.liftProtocol.getProtocolStatus() == LiftProtocolStatusType.IDLE.id |
| | | // && this.liftProtocol.getPlcTaskNo() == 0 |
| | | && this.liftProtocol.getTaskNo() == 0 |
| | | && this.liftProtocol.getModel() == 2 |
| | | && this.liftProtocol.getDeviceStatus() == LiftDeviceStatusType.IDLE.id |
| | | && this.liftProtocol.getErrorCode() == 0 |
| | | && !extend.getFrontOverrun() |
| | | && !extend.getBackOverrun() |
| | | && !extend.getLeftOverrun() |
| | | && !extend.getRightOverrun() |
| | | && !extend.getOverHeight() |
| | | && !extend.getOverWeight() |
| | | ; |
| | | return res; |
| | | if (this.liftProtocol.getProtocolStatus() != LiftProtocolStatusType.IDLE.id) { |
| | | return false;//任务不空闲 |
| | | } |
| | | |
| | | if (this.liftProtocol.getTaskNo() != 0) { |
| | | return false;//有任务号 |
| | | } |
| | | |
| | | if (this.liftProtocol.getModel() != 2) { |
| | | return false;//非自动 |
| | | } |
| | | |
| | | if (this.liftProtocol.getDeviceStatus() != LiftDeviceStatusType.IDLE.id) { |
| | | return false;//非空闲 |
| | | } |
| | | |
| | | if (this.liftProtocol.getErrorCode() != 0) { |
| | | return false;//有故障 |
| | | } |
| | | |
| | | if (extend.getFrontOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getBackOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getLeftOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getRightOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getOverHeight()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getOverWeight()) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.liftProtocol.getProtocolStatus() == null |
| | | || this.liftProtocol.getModel() == null |
| | | if (this.liftProtocol.getModel() == null |
| | | || this.liftProtocol.getDeviceStatus() == null |
| | | || this.liftProtocol.getErrorCode() == null |
| | | || this.liftProtocol.getExtend() == null |
| | |
| | | |
| | | InnerLiftExtend extend = (InnerLiftExtend) this.liftProtocol.getExtend(); |
| | | |
| | | boolean res = this.liftProtocol.getProtocolStatus() == LiftProtocolStatusType.IDLE.id |
| | | && this.liftProtocol.getModel() == 2 |
| | | && this.liftProtocol.getDeviceStatus() == LiftDeviceStatusType.IDLE.id |
| | | && this.liftProtocol.getErrorCode() == 0 |
| | | && !extend.getFrontOverrun() |
| | | && !extend.getBackOverrun() |
| | | && !extend.getLeftOverrun() |
| | | && !extend.getRightOverrun() |
| | | && !extend.getOverHeight() |
| | | && !extend.getOverWeight() |
| | | ; |
| | | return res; |
| | | if (this.liftProtocol.getModel() != 2) { |
| | | return false;//非自动 |
| | | } |
| | | |
| | | if (this.liftProtocol.getDeviceStatus() != LiftDeviceStatusType.IDLE.id) { |
| | | return false;//非空闲 |
| | | } |
| | | |
| | | if (this.liftProtocol.getErrorCode() != 0) { |
| | | return false;//有故障 |
| | | } |
| | | |
| | | if (extend.getFrontOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getBackOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getLeftOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getRightOverrun()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getOverHeight()) { |
| | | return false; |
| | | } |
| | | |
| | | if (extend.getOverWeight()) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |