| | |
| | | * 入库 ===>> 四向穿梭车入库作业下发 |
| | | */ |
| | | public synchronized void shuttleInExecute() { |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectInStep4(); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | //获取源站 |
| | | BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo()); |
| | | if (sourceBasDevp == null) { |
| | | continue;//站点不存在 |
| | | } |
| | | |
| | | //获取目标站 |
| | | LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(sourceBasDevp.getLiftNo(), Utils.getLev(wrkMast.getLocNo())); |
| | | if (liftStaProtocol == null) { |
| | | continue;//站点不存在 |
| | | } |
| | | |
| | | // 判断是否满足入库条件,自动、空闲、有物 |
| | | if (!(liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && liftStaProtocol.getHasTray())) { |
| | | continue; |
| | | } |
| | | |
| | | boolean step1 = this.shuttleInExecuteStep1(wrkMast, liftStaProtocol);//小车搬入库中 |
| | | if (!step1) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库站 |
| | |
| | | continue; |
| | | } |
| | | |
| | | WrkMast wrkMast = wrkMastMapper.selectRackInStep4(workNo, staProtocol.getSiteId()); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | |
| | | boolean step1 = this.shuttleInExecuteStep1(wrkMast, basDevp);//小车搬入库中 |
| | | if (!step1) { |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // /** |
| | | // * 入库 ===>> 四向穿梭车入库作业下发 |
| | | // */ |
| | | // public synchronized void shuttleInExecute() { |
| | | // // 根据输送线plc遍历 |
| | | // for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // // 遍历入库站 |
| | | // for (DevpSlave.StaRack staRack : devp.getRackInStn()) { |
| | | // // 获取入库站信息 |
| | | // DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | // StaProtocol staProtocol = devpThread.getStation().get(staRack.getStaNo()); |
| | | // if (staProtocol == null) { |
| | | // continue; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // Short workNo = staProtocol.getWorkNo(); |
| | | // BasDevp basDevp = basDevpService.selectById(staProtocol.getSiteId()); |
| | | // if (basDevp == null) { |
| | | // continue;//站点信息不存在 |
| | | // } |
| | | // |
| | | // // 判断是否满足入库条件,自动、有物、四向穿梭车可取信号 |
| | | // if (!(staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isShuttleTakeEnable())) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // WrkMast wrkMast = wrkMastMapper.selectRackInStep4(workNo, staProtocol.getSiteId()); |
| | | // if (wrkMast == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // boolean step1 = this.shuttleInExecuteStep1(wrkMast, basDevp);//小车搬入库中 |
| | | // if (!step1) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | /** |
| | | * 入库-小车搬入库中 |
| | | * 如需主方法执行continue,请返回false |
| | | * ps:返回值true并不代表该方法执行成功,返回值仅做标记用于主方法是否执行continue |
| | | */ |
| | | public boolean shuttleInExecuteStep1(WrkMast wrkMast, BasDevp basDevp) { |
| | | public boolean shuttleInExecuteStep1(WrkMast wrkMast, LiftStaProtocol liftStaProtocol) { |
| | | if (wrkMast.getWrkSts() == 4) { |
| | | if (wrkMast.getShuttleNo() == null) {//没有绑定小车,进行调度 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), basDevp.getLocNo());//调度小车到货物所在输送站点进行取货 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), liftStaProtocol.getLocNo());//调度小车到货物所在输送站点进行取货 |
| | | return false; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //判断小车是否到达输送站点库位 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(basDevp.getLocNo())) { |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) { |
| | | //小车不在输送站点位置 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), basDevp.getLocNo(), wrkMast.getShuttleNo());//调度小车到货物所在输送站点进行取货 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), liftStaProtocol.getLocNo(), wrkMast.getShuttleNo());//调度小车到货物所在输送站点进行取货 |
| | | return false; |
| | | } |
| | | |
| | | //小车已抵达输送站点位置,进行搬运货物 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), basDevp.getLocNo(), wrkMast.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo()); |
| | | if (result == null) {//路径计算失败 |
| | | return false; |
| | | } |
| | |
| | | return false;//出库站点不可出 |
| | | } |
| | | |
| | | //判断各楼层内部输送站点是否空闲无物 |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo()); |
| | | if (liftThread == null) { |
| | | return false; |
| | | } |
| | | //获取提升机站点list |
| | | List<LiftStaProtocol> liftStaProtocols = liftThread.getLiftStaProtocols(); |
| | | if (liftStaProtocols.isEmpty()) { |
| | | return false; |
| | | //获取源站 |
| | | LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(basDevp.getLiftNo(), Utils.getLev(wrkMast.getSourceLocNo())); |
| | | if (liftStaProtocol == null) { |
| | | return false;//找不到站点 |
| | | } |
| | | |
| | | for (LiftStaProtocol liftStaProtocol : liftStaProtocols) { |
| | | //判断当前出库任务对应楼层的提升机站点状态 |
| | | if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getSourceLocNo())) { |
| | | if (liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && !liftStaProtocol.getHasTray()) { |
| | | return false;//站点必须自动、空闲、没有托盘 |
| | | } |
| | | } |
| | | if (liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && !liftStaProtocol.getHasTray()) { |
| | | return false;//站点必须自动、空闲、没有托盘 |
| | | } |
| | | |
| | | |
| | | if (wrkMast.getShuttleNo() == null) {//没有绑定小车,进行调度 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo());//调度小车到货物所在库位进行取货 |
| | |
| | | //判断小车是否到达货物库位 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(wrkMast.getSourceLocNo())) { |
| | | //小车不在输送站点位置 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getShuttleNo());//调度小车到货物所在输送站点进行取货 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getShuttleNo());//调度小车到货物所在库位进行取货 |
| | | return false; |
| | | } |
| | | |
| | | //小车已抵达货物位置,进行搬运货物 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), null); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), liftStaProtocol.getLocNo());//将货物搬运至提升机输送站点 |
| | | if (result == null) {//出库路径计算失败 |
| | | return false; |
| | | } |
| | |
| | | |
| | | //2.设备上走 ==> 3.提升机搬运中 |
| | | if (wrkMast.getWrkSts() == 2) { |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast.getLiftNo()); |
| | | //获取源站 |
| | | BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo()); |
| | | if (sourceBasDevp == null) { |
| | | return false;//找不到站点 |
| | | } |
| | | |
| | | if (!sourceBasDevp.getInEnable().equals("Y")) { |
| | | return false;//站点不可入 |
| | | } |
| | | |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, sourceBasDevp.getLiftNo()); |
| | | if (liftThread == null) { |
| | | return false; |
| | | } |
| | |
| | | if (liftProtocol == null) { |
| | | return false; |
| | | } |
| | | if (!liftProtocol.isIdle(wrkMast.getWrkNo().shortValue())) { |
| | | if (!liftProtocol.isIdle()) { |
| | | return false; |
| | | } |
| | | //判断提升机令牌是否未被占领 |
| | | if (liftProtocol.getToken() != 0) { |
| | | return false;//提升机已被独占,禁止再派发任务 |
| | | } |
| | | |
| | | //判断提升机内是否有小车 |
| | | if (liftProtocol.getHasCar()) { |
| | | return false;//有小车,禁止派发 |
| | | } |
| | | |
| | | //判断提升机内是否有托盘 |
| | | if (liftProtocol.getHasTray()) { |
| | | return false;//有托盘,禁止派发 |
| | | } |
| | | |
| | | //判断提升机是否有其他任务 |
| | | WrkMast liftWrkMast = wrkMastMapper.selectLiftWrkMast(liftThread.getSlave().getId()); |
| | | if (liftWrkMast != null) { |
| | | return false;//当前提升机存在未完成任务,等待下一次轮询 |
| | | } |
| | | |
| | | //获取源站对应的输送站点 |
| | | BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo()); |
| | | if (sourceBasDevp == null) { |
| | | return false;//站点不存在 |
| | | } |
| | | //获取源站对应的牛眼提升机站点编号(起点编号) |
| | | Integer startSta = Integer.parseInt(sourceBasDevp.getQrCodeValue()); |
| | | Integer targetSta = null; |
| | | //获取牛眼提升机站点编号(目标编号) |
| | | for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { |
| | | if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getLocNo())) { |
| | | targetSta = liftStaProtocol.getStaNo(); |
| | | } |
| | | //获取提升机站点 |
| | | LiftStaProtocol targetStaProtocol = NyLiftUtils.getLiftStaByLev(liftThread.getSlave().getId(), Utils.getLev(wrkMast.getLocNo())); |
| | | if (targetStaProtocol == null) { |
| | | return false;//站点不存在 |
| | | } |
| | | |
| | | if (targetSta == null) { |
| | | return false;//站点编号不存在 |
| | | } |
| | | Integer targetSta = targetStaProtocol.getStaNo(); |
| | | |
| | | //获取提升机命令 |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | |
| | | |
| | | //23.小车搬运完成 ==> 24.提升机搬运中 |
| | | if (wrkMast.getWrkSts() == 23) { |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast.getLiftNo()); |
| | | //获取出库站点(目标站) |
| | | BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo()); |
| | | if (basDevp == null) { |
| | | return false;//出库站点不存在 |
| | | } |
| | | |
| | | if (!basDevp.getOutEnable().equals("Y")) { |
| | | return false;//出库站点不可出 |
| | | } |
| | | |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo()); |
| | | if (liftThread == null) { |
| | | return false; |
| | | } |
| | |
| | | if (liftProtocol == null) { |
| | | return false; |
| | | } |
| | | if (!liftProtocol.isIdle(wrkMast.getWrkNo().shortValue())) { |
| | | if (!liftProtocol.isIdle()) { |
| | | return false; |
| | | } |
| | | //判断提升机令牌是否未被占领 |
| | |
| | | } |
| | | |
| | | //获取源站对应的牛眼提升机站点编号(起点编号) |
| | | Integer startSta = null; |
| | | for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { |
| | | if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getLocNo())) { |
| | | startSta = liftStaProtocol.getStaNo(); |
| | | } |
| | | LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(liftThread.getSlave().getId(), Utils.getLev(wrkMast.getSourceLocNo())); |
| | | if (liftStaProtocol == null) { |
| | | return false;//找不到站点 |
| | | } |
| | | |
| | | if (startSta == null) { |
| | | return false;//站点编号不存在 |
| | | } |
| | | Integer startSta = liftStaProtocol.getStaNo(); |
| | | |
| | | //获目标站源站对应的输送站点 |
| | | BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo()); |
| | |
| | | Integer targetSta = Integer.parseInt(targetBasDevp.getQrCodeValue()); |
| | | |
| | | //获取提升机命令 |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftThread.getSlave().getId(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | | |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
| | | commands.add(liftCommand); |
| | |
| | | } |
| | | |
| | | //小车已抵达源库位,进行搬运货物 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), wrkMast.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getLocNo()); |
| | | if (result == null) {//路径计算失败 |
| | | return false; |
| | | } |
| | |
| | | Integer staNo = liftSta.getLiftNo() * 100 + Utils.getLev(wrkMast.getLocNo());//目标站 |
| | | |
| | | //小车已抵达源库位,将货物搬运到输送站点 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), liftSta.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), liftSta.getLocNo()); |
| | | if (result == null) {//路径计算失败 |
| | | return false; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 跨楼层库位移转-调度车辆取货并运送到目标枯萎 |
| | | * 跨楼层库位移转-调度车辆取货并运送到目标库位 |
| | | * 如需主方法执行continue,请返回false |
| | | * ps:返回值true并不代表该方法执行成功,返回值仅做标记用于主方法是否执行continue |
| | | */ |
| | |
| | | } |
| | | |
| | | //小车已抵达目标输送站点,将货物搬运到目标库位 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), targetBasDevp.getLocNo(), wrkMast.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), targetBasDevp.getLocNo(), wrkMast.getLocNo()); |
| | | if (result == null) {//路径计算失败 |
| | | return false; |
| | | } |