| | |
| | | import HslCommunication.ModBus.ModbusTcpNet; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.RadixTools; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasLift; |
| | |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LiftSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.*; |
| | |
| | | liftProtocol.setLiftLock(CommonUtils.shortToBoolean(modbusTcpNet.getByteTransform().TransInt16(content, 0))); |
| | | //位置到达反馈 |
| | | liftProtocol.setPositionArrivalFeedback(modbusTcpNet.getByteTransform().TransInt16(content,2)); |
| | | |
| | | |
| | | byte by = modbusTcpNet.getByteTransform().TransByte(content, 5); |
| | | int[] datas = CommonUtils.byteToBits(by); |
| | | //准备就绪 |
| | |
| | | array[29] = command.getLiftLockShortValue(); |
| | | } |
| | | |
| | | if (array[2] == 0) { |
| | | // 开始任务 |
| | | short[] tmp = new short[2]; |
| | | tmp[0] = array[0]; |
| | | tmp[1] = array[1]; |
| | | array = tmp; |
| | | } |
| | | |
| | | OperateResult result = modbusTcpNet.Write("41088", array);; |
| | | if (result != null && result.IsSuccess) { |
| | | News.info("提升机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | |
| | | News.info("提升机命令下发成功,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |
| | | liftProtocol.setWrkTime(new Date());//更新工作时间 |
| | | |
| | | try { |
| | | Thread.sleep(1000);//命令下发完成后休眠1s |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | //判断数据是否执行完成 |
| | | if (commandStep < size - 1) { |
| | | //更新redis数据 |
| | |
| | | command.setRun((short) 1);//升降 |
| | | Short position = LiftLevType.getRealLev(lev);//获取提升机实际楼层数值 |
| | | command.setDistPosition(position); |
| | | command.setSpeed((short) 200); |
| | | command.setHeight2((short) 180); |
| | | command.setHeight3((short) 1645); |
| | | command.setHeight4((short) (2 * 1645)); |
| | | command.setHeight5((short) (3 * 1645)); |
| | | // command.setSpeed((short) 200); |
| | | // command.setHeight2((short) 180); |
| | | // command.setHeight3((short) 1645); |
| | | // command.setHeight4((short) (2 * 1645)); |
| | | // command.setHeight5((short) (3 * 1645)); |
| | | return command; |
| | | } |
| | | |
| | |
| | | command.setLiftNo(liftNo);//提升机号 |
| | | command.setTaskNo(taskNo);//任务号 |
| | | command.setDistPosition(position);//目标楼层 |
| | | command.setSpeed((short) 200); |
| | | command.setHeight2((short) 180); |
| | | command.setHeight3((short) 1645); |
| | | command.setHeight4((short) 3290); |
| | | command.setHeight5((short) 4945); |
| | | // command.setSpeed((short) 200); |
| | | // command.setHeight2((short) 180); |
| | | // command.setHeight3((short) 1645); |
| | | // command.setHeight4((short) 3290); |
| | | // command.setHeight5((short) 4945); |
| | | return command; |
| | | } |
| | | |