| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | public boolean shuttleOutExecuteStep1(WrkMast wrkMast) { |
| | | //21.生成出库任务 => 22.小车搬运中 |
| | | if (wrkMast.getWrkSts() == 21) { |
| | | //获取目标站对应的输送站点 |
| | | BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getLiftNo()); |
| | | if (targetBasDevp == null) { |
| | | return false;//缺少站点信息 |
| | | EntityWrapper<StaDesc> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("type_no", wrkMast.getIoType());//路径类型 |
| | | wrapper.eq("stn_no", wrkMast.getStaNo());//出库站点编号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (staDesc == null) { |
| | | return false;//出库路径不存在 |
| | | } |
| | | |
| | | if (targetBasDevp.getOutEnable().equals("N")) { |
| | | return false;//站点不可出 |
| | | //获取出库站点 |
| | | 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; |
| | | } |
| | | //获取提升机站点list |
| | | List<LiftStaProtocol> liftStaProtocols = liftThread.getLiftStaProtocols(); |
| | | if (liftStaProtocols.isEmpty()) { |
| | | return false; |
| | | } |
| | | |
| | | for (LiftStaProtocol liftStaProtocol : liftStaProtocols) { |
| | | //判断当前出库任务对应楼层的提升机站点状态 |
| | | if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getSourceLocNo())) { |
| | | if (liftStaProtocol.getModel() && !liftStaProtocol.getBusy() && !liftStaProtocol.getHasTray()) { |
| | | return false;//站点必须自动、空闲、没有托盘 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (wrkMast.getShuttleNo() == null) {//没有绑定小车,进行调度 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo());//调度小车到货物所在库位进行取货 |
| | |
| | | } |
| | | |
| | | //小车已抵达货物位置,进行搬运货物 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), targetBasDevp.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getShuttleTransportCommands(wrkMast.getShuttleNo(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getSourceLocNo(), null); |
| | | if (result == null) {//出库路径计算失败 |
| | | return false; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | //判断提升机令牌是否被占用 |
| | | if (liftProtocol.getToken() != 0) { |
| | | continue; |
| | | } |
| | | |
| | | //搜索是否有待处理的任务 |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectLiftStep223103(); |
| | | if (wrkMasts.isEmpty()) { |
| | |
| | | |
| | | //获取源站对应的输送站点 |
| | | BasDevp sourceBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo()); |
| | | //获取目标站对应的输送站点 |
| | | BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo()); |
| | | if (sourceBasDevp == null || targetBasDevp == null) { |
| | | return false;//缺少站点信息 |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | if (targetSta == null) { |
| | | return false;//站点编号不存在 |
| | | } |
| | | |
| | | //获取提升机命令 |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo()); |
| | | |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
| | | commands.add(liftCommand); |
| | | |
| | |
| | | return false;//当前提升机存在未完成任务,等待下一次轮询 |
| | | } |
| | | |
| | | //获取源站对应的输送站点 |
| | | BasDevp sourceBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getSourceLocNo()), liftProtocol.getLiftNo().intValue()); |
| | | //获取目标站对应的输送站点 |
| | | BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getSourceStaNo()); |
| | | if (sourceBasDevp == null || targetBasDevp == null) { |
| | | return false;//缺少站点信息 |
| | | //获取源站对应的牛眼提升机站点编号(起点编号) |
| | | Integer startSta = null; |
| | | for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { |
| | | if (liftStaProtocol.getLev() == Utils.getLev(wrkMast.getLocNo())) { |
| | | startSta = liftStaProtocol.getStaNo(); |
| | | } |
| | | } |
| | | |
| | | if (startSta == null) { |
| | | return false;//站点编号不存在 |
| | | } |
| | | |
| | | //获目标站源站对应的输送站点 |
| | | BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo()); |
| | | if (targetBasDevp == null) { |
| | | return false;//站点不存在 |
| | | } |
| | | //获取牛眼提升机站点编号(目标编号) |
| | | Integer targetSta = Integer.parseInt(targetBasDevp.getQrCodeValue()); |
| | | |
| | | //获取提升机命令 |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo()); |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | | |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
| | | commands.add(liftCommand); |
| | |
| | | } |
| | | |
| | | if (wrkCharge.getWrkSts() == 51) { |
| | | if (!shuttleProtocol.isIdleNoCharge()) { |
| | | continue; |
| | | } |
| | | |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(wrkCharge.getLocNo())) { |
| | | //小车不在充电桩位置 |
| | | shuttleDispatchUtils.dispatchShuttle(wrkCharge.getWrkNo(), wrkCharge.getLocNo(), shuttle.getId());//调度小车去充电桩 |