| | |
| | | liftProtocol.setHasCar(siemensS7Net.getByteTransform().TransInt16(result1.Content, 6) == 1); |
| | | //当前楼层 |
| | | liftProtocol.setLev((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 8)); |
| | | //工作号 |
| | | liftProtocol.setTaskNo(siemensS7Net.getByteTransform().TransInt32(result1.Content, 12)); |
| | | // //工作号 |
| | | // liftProtocol.setTaskNo(siemensS7Net.getByteTransform().TransInt32(result1.Content, 12)); |
| | | //设备故障 |
| | | liftProtocol.setError(siemensS7Net.getByteTransform().TransInt16(result1.Content, 16) == 1); |
| | | //故障码 |
| | |
| | | return false; |
| | | } |
| | | |
| | | List<Short> shorts = JSON.parseArray(command.getBody(), Short.class); |
| | | short[] array = new short[shorts.size()];//获取命令报文 |
| | | for (int i = 0; i < shorts.size(); i++) { |
| | | array[i] = shorts.get(i); |
| | | List<Integer> list = JSON.parseArray(command.getBody(), Integer.class); |
| | | int[] array = new int[list.size()];//获取命令报文 |
| | | for (int i = 0; i < list.size(); i++) { |
| | | array[i] = list.get(i); |
| | | } |
| | | |
| | | OperateResult result = null; |
| | | if (command.getMode() == LiftCommandModeType.MOVE.id) { |
| | | //移动 |
| | | result = siemensS7Net.Write("DB101.2", array); |
| | | result = siemensS7Net.Write("DB101.2", (short) array[0]); |
| | | result = siemensS7Net.Write("DB101.4", (int) array[1]); |
| | | } else if (command.getMode() == LiftCommandModeType.PALLET_INOUT.id) { |
| | | //托盘出入 |
| | | result = siemensS7Net.Write("DB101.8", array); |
| | | } else if (command.getMode() == LiftCommandModeType.LOCK.id || command.getMode() == LiftCommandModeType.UNLOCK.id) { |
| | | //提升机锁定/解锁 |
| | | result = siemensS7Net.Write("DB101.0", array); |
| | | result = siemensS7Net.Write("DB101.0", (short) array[0]); |
| | | } |
| | | |
| | | if (result != null && result.IsSuccess) { |
| | |
| | | |
| | | @Override |
| | | public boolean lock(LiftCommand command) { |
| | | return true; |
| | | return write(command); |
| | | } |
| | | |
| | | @Override |
| | | public boolean unlock(LiftCommand command) { |
| | | return true; |
| | | return write(command); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public boolean isLock(ExecuteSupport support) { |
| | | if (support != null) { |
| | | return support.judgement(); |
| | | } |
| | | return true; |
| | | InnerLiftExtend extend = (InnerLiftExtend) this.liftProtocol.getExtend(); |
| | | return extend.getLock(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<LiftCommand> getPalletInOutCommand(Integer taskNo, Integer sourceLev, Integer targetLev, Integer originSta, Integer targetSta, LiftCommandModeType mode) { |
| | | // 开始任务 |
| | | short[] array = new short[2]; |
| | | short[] array = new short[3]; |
| | | array[0] = originSta.shortValue();//起始站 |
| | | array[1] = targetSta.shortValue();//目标站 |
| | | array[2] = taskNo.shortValue();//工作号 |
| | |
| | | command.setLiftNo(Integer.valueOf(this.device.getDeviceNo())); |
| | | command.setTaskNo(taskNo); |
| | | command.setBody(JSON.toJSONString(array)); |
| | | command.setMode(LiftCommandModeType.PALLET_INOUT.id); |
| | | command.setMode(lock ? LiftCommandModeType.LOCK.id : LiftCommandModeType.UNLOCK.id); |
| | | |
| | | ArrayList<LiftCommand> list = new ArrayList<>(); |
| | | list.add(command); |