| | |
| | | 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); |
| | | //准备就绪 |
| | | liftProtocol.setReady(CommonUtils.intToBoolean(datas[0])); |
| | | //运行中 |
| | | liftProtocol.setRunning(CommonUtils.intToBoolean(datas[1])); |
| | | //联机/单机 |
| | | liftProtocol.setMode(CommonUtils.intToBoolean(datas[2])); |
| | | //输送线前端光电有货 |
| | | liftProtocol.setLineFrontHasStock(CommonUtils.intToBoolean(datas[3])); |
| | | //输送线正转反馈 |
| | | liftProtocol.setForwardRotationFeedback(CommonUtils.intToBoolean(datas[4])); |
| | | //输送线反转反馈 |
| | | liftProtocol.setReverseFeedback(CommonUtils.intToBoolean(datas[5])); |
| | | //输送线电机过载 |
| | | liftProtocol.setMotorOverload(CommonUtils.intToBoolean(datas[6])); |
| | | //输送线末端光电有货 |
| | | liftProtocol.setLineEndHasStock(CommonUtils.intToBoolean(datas[7])); |
| | | //进输送线卡托盘报警 |
| | | liftProtocol.setInConveyLineCardTrayAlarm(CommonUtils.intToBoolean(datas[8])); |
| | | //出输送线卡托盘报警 |
| | | liftProtocol.setOutConveyLineCardTrayAlarm(CommonUtils.intToBoolean(datas[9])); |
| | | //平台位置偏差报警 |
| | | liftProtocol.setPlatPositionDeviationAlarm(CommonUtils.intToBoolean(datas[10])); |
| | | //平台扭矩偏差报警 |
| | | liftProtocol.setPlatTorqueDeviationAlarm(CommonUtils.intToBoolean(datas[11])); |
| | | //平台四向车检测 |
| | | liftProtocol.setPlatShuttleCheck(CommonUtils.intToBoolean(datas[12])); |
| | | |
| | | |
| | | byte b1 = modbusTcpNet.getByteTransform().TransByte(content, 5); |
| | | byte b2 = modbusTcpNet.getByteTransform().TransByte(content, 4); |
| | | int[] datas1 = CommonUtils.byteToBits(b1); |
| | | int[] datas2 = CommonUtils.byteToBits(b2); |
| | | //准备就绪 |
| | | liftProtocol.setReady(CommonUtils.intToBoolean(datas1[0])); |
| | | //运行中 |
| | | liftProtocol.setRunning(CommonUtils.intToBoolean(datas1[1])); |
| | | //联机/单机 |
| | | liftProtocol.setMode(CommonUtils.intToBoolean(datas1[2])); |
| | | //输送线前端光电有货 |
| | | liftProtocol.setLineFrontHasStock(CommonUtils.intToBoolean(datas1[3])); |
| | | //输送线正转反馈 |
| | | liftProtocol.setForwardRotationFeedback(CommonUtils.intToBoolean(datas1[4])); |
| | | //输送线反转反馈 |
| | | liftProtocol.setReverseFeedback(CommonUtils.intToBoolean(datas1[5])); |
| | | //输送线电机过载 |
| | | liftProtocol.setMotorOverload(CommonUtils.intToBoolean(datas1[6])); |
| | | //输送线末端光电有货 |
| | | liftProtocol.setLineEndHasStock(CommonUtils.intToBoolean(datas1[7])); |
| | | //进输送线卡托盘报警 |
| | | liftProtocol.setInConveyLineCardTrayAlarm(CommonUtils.intToBoolean(datas2[0])); |
| | | //出输送线卡托盘报警 |
| | | liftProtocol.setOutConveyLineCardTrayAlarm(CommonUtils.intToBoolean(datas2[1])); |
| | | //平台位置偏差报警 |
| | | liftProtocol.setPlatPositionDeviationAlarm(CommonUtils.intToBoolean(datas2[2])); |
| | | //平台扭矩偏差报警 |
| | | liftProtocol.setPlatTorqueDeviationAlarm(CommonUtils.intToBoolean(datas2[3])); |
| | | //平台四向车检测 |
| | | liftProtocol.setPlatShuttleCheck(CommonUtils.intToBoolean(datas2[4])); |
| | | |
| | | //未就绪状态 |
| | | liftProtocol.setNotReady(modbusTcpNet.getByteTransform().TransInt16(content,6)); |
| | |
| | | return false; |
| | | } |
| | | |
| | | //将标记置为false(防止重发) |
| | | liftProtocol.setPakMk(false); |
| | | |
| | | Object o = redisUtil.get("lift_wrk_no_" + wrkNo); |
| | | if (o == null) { |
| | | return false; |
| | |
| | | //总步序 |
| | | int size = commands.size(); |
| | | LiftAssignCommand assignCommand = redisCommand.getAssignCommand(); |
| | | |
| | | if (commandStep != 0) { |
| | | //判断上一条指令是否完成 |
| | | LiftCommand command = commands.get(commandStep - 1); |
| | | if (command.getRun().intValue() == 1) { |
| | | //提升机升降命令 |
| | | if (command.getDistPosition().intValue() == liftProtocol.getPositionArrivalFeedback().intValue()) { |
| | | //提升机目标楼层和实际楼层相同,则认定命令完成 |
| | | command.setComplete(true); |
| | | } |
| | | } else if (command.getRun().intValue() == 2 || command.getRun().intValue() == 3) { |
| | | //无货正转,有货正转 |
| | | if (!liftProtocol.getForwardRotationFeedback()) { |
| | | //输送线正转反馈不在运行中,认定命令完成 |
| | | command.setComplete(true); |
| | | } |
| | | } else if (command.getRun().intValue() == 6 || command.getRun().intValue() == 7) { |
| | | //有货反转,无货反转 |
| | | if (!liftProtocol.getReverseFeedback()) { |
| | | //输送线反转反馈不在运行中,认定命令完成 |
| | | command.setComplete(true); |
| | | } |
| | | } else if (command.getRun().intValue() == 4) { |
| | | //输送线停止 |
| | | if (!liftProtocol.getForwardRotationFeedback() && !liftProtocol.getReverseFeedback()) { |
| | | //输送线正转反转都不在运行中,认定命令完成 |
| | | command.setComplete(true); |
| | | } |
| | | } |
| | | //任务数据保存到redis |
| | | redisUtil.set("lift_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand)); |
| | | |
| | | if (!command.getComplete()) { |
| | | //上一条任务未完成,禁止下发命令 |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //取出命令 |
| | | LiftCommand command = commands.get(commandStep); |
| | |
| | | News.info("提升机命令下发成功,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |
| | | liftProtocol.setWrkTime(new Date());//更新工作时间 |
| | | |
| | | //将标记置为false(防止重发) |
| | | liftProtocol.setPakMk(false); |
| | | |
| | | //保存数据到数据库做流水 |
| | | BasLiftOptService liftOptService = SpringUtils.getBean(BasLiftOptService.class); |
| | | if (liftOptService != null) { |
| | |
| | | |
| | | //对主线程抛出等待确认状态waiting |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING); |
| | | News.info("提升机任务执行完成等待确认中,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |
| | | |
| | | News.info("提升机任务执行下发完成等待执行结束,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |
| | | } |
| | | } |
| | | |