| | |
| | | //如果穿梭车在提升机内,移动时需要先下发出提升机命令 |
| | | if (liftProtocol.getBarcode().intValue() == shuttleProtocol.getCurrentCode().intValue()) { |
| | | //穿梭车出提升机 |
| | | Short liftLev = liftProtocol.getPositionArrivalFeedback();//提升机位置 |
| | | String liftSiteLocNo = Utils.levToOutInStaLocNo(liftLev.intValue()); |
| | | Short liftArrival = liftProtocol.getPositionArrivalFeedback();//提升机位置反馈 |
| | | String liftSiteLocNo = Utils.liftArrivalToOutInStaLocNo(liftArrival); |
| | | LocMast locMast1 = locMastService.selectById(liftSiteLocNo); |
| | | ShuttleCommand moveCommand = getMoveCommand(liftProtocol.getBarcode(), Short.parseShort(locMast1.getQrCodeValue()), 1400, ShuttleRunDirection.BOTTOM.id, liftProtocol.getBarcode(), 1400, runSpeed); |
| | | commands.add(moveCommand); |
| | |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1); |
| | | LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | | |
| | | |
| | | //判断小车当前二维码是否为提升机二维码 |
| | | if (shuttleProtocol.getCurrentCode().intValue() == liftProtocol.getBarcode().intValue()) { |
| | | //小车当前命令起始位置就是提升机二维码,说明小车需要向提升机外移动,则需要判断状态是否满足 |
| | | if (command.getStartCodeNum().intValue() == liftProtocol.getBarcode().intValue()){ |
| | | //提升机是否空闲,提升机是否到达目标楼层,目标楼层是否给出提升机到位信号位 |
| | | if (!liftProtocol.isIdle()) { |
| | | return false;//提升机忙,禁止下发命令 |
| | | } |
| | | |
| | | Short distCodeNum = command.getDistCodeNum();//目标二维码 |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | BasDevp basDevp = basDevpService.queryByQrCode(distCodeNum.intValue());//目标站点 |
| | | if (basDevp == null) { |
| | | return false;//找不到目标站,禁止下发命令 |
| | | } |
| | | |
| | | int lev = Utils.getLev(basDevp.getLocNo());//目标二维码所在楼层 |
| | | int liftLev = liftProtocol.getLev().intValue();//提升机所在楼层 |
| | | if (liftLev != lev) { |
| | | return false;//提升机不在目标楼层,禁止下发命令 |
| | | } |
| | | |
| | | //获取目标站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo()); |
| | | if (staProtocol == null) { |
| | | return false;//站点信息不存在,禁止下发命令 |
| | | } |
| | | if (!staProtocol.isLiftArrival()) { |
| | | return false;//站点提升机到位信号false,禁止下发命令 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //下发命令 |
| | | if (!write(command)) { |
| | | News.error("四向穿梭车命令下发失败,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command)); |
| | | return false; |
| | | } else { |
| | | News.info("四向穿梭车命令下发成功,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command)); |
| | | |
| | | try { |
| | | Thread.sleep(1000);//命令下发完后休眠1s |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | //判断数据是否执行完成 |
| | | if (commandStep < size - 1) { |
| | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo();//二维码对应库位号 |
| | | Integer shuttleLocNoLev = shuttleLocNo == null ? 0 : Utils.getLev(shuttleLocNo);//库位号对应层高 |
| | | |
| | | //判断提升机是否在目标楼层 |
| | | //判断穿梭车和提升机是否在目标楼层 |
| | | if (shuttleLocNoLev >= 2) { |
| | | shuttleLocNoLev++; |
| | | } |
| | |
| | | SiemensDevpThread siemensDevpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = siemensDevpThread.getStation().get(siteNo); |
| | | if (staProtocol.isLiftArrival() |
| | | && liftProtocol.getPositionArrivalFeedback().intValue() == shuttleLocNoLev) { |
| | | && liftProtocol.getPositionArrivalFeedback$() == shuttleLocNoLev) { |
| | | //输送线反馈提升机到位且提升机楼层反馈为同一层,直接放行 |
| | | return true; |
| | | } |