| | |
| | | |
| | | List<WrkMast> selectShuttleWrkByLev(String lev); |
| | | |
| | | List<WrkMast> selectShuttleOutWrkByLev(String lev); |
| | | |
| | | WrkMast selectLiftWrkMast(Integer liftNo); |
| | | |
| | | List<WrkMast> selectInOutWrkMast();//查询出入库工作档 |
| | |
| | | //查询指定楼层已分配车辆的任务 |
| | | List<WrkMast> selectShuttleWrkByLev(Integer lev); |
| | | |
| | | //查询指定楼层已分配车辆的出库任务 |
| | | List<WrkMast> selectShuttleOutWrkByLev(Integer lev); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | if (wrkMast.getShuttleNo() == null) {//没有绑定小车,进行调度 |
| | | //强制预留一台小车给入库任务 |
| | | int lev = Utils.getLev(wrkMast.getSourceLocNo()); |
| | | //获取当前楼层有几台空闲可用小车 |
| | | int shuttleCount = shuttleDispatchUtils.getShuttleCountByLev(lev); |
| | | if (shuttleCount >= 2) {//只有可用小车数量大于2,才进行入库任务预留小车 |
| | | int shuttleWrkInObligateCount = 1;//预留小车数量 |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "shuttleWrkInObligateCount").eq("status", 1)); |
| | | if (config != null) { |
| | | shuttleWrkInObligateCount = Integer.parseInt(config.getValue()); |
| | | } |
| | | //可用出库小车数量(给入库任务预留一台车) |
| | | int useShuttleCount = shuttleCount - shuttleWrkInObligateCount; |
| | | //查询楼层已分配车辆的出库任务数量 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectShuttleOutWrkByLev(lev); |
| | | if (wrkMasts.size() >= useShuttleCount) { |
| | | News.info("{}任务,当前楼层可用小车{}台,出库任务已分配{}台,系统等待中。", wrkMast.getWrkNo(), useShuttleCount, wrkMasts.size()); |
| | | return false; |
| | | } |
| | | } |
| | | boolean result = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo());//调度小车到货物所在库位进行取货 |
| | | News.info("{}任务,调度小车{}系统等待中。", wrkMast.getWrkNo(), result ? "成功" : "失败"); |
| | | return false; |
| | |
| | | public List<WrkMast> selectShuttleWrkByLev(Integer lev) { |
| | | return this.baseMapper.selectShuttleWrkByLev("%" + lev); |
| | | } |
| | | |
| | | @Override |
| | | public List<WrkMast> selectShuttleOutWrkByLev(Integer lev) { |
| | | return this.baseMapper.selectShuttleOutWrkByLev("%" + lev); |
| | | } |
| | | } |
| | |
| | | return true;//无充电任务放行 || 去充电桩中放行 |
| | | } |
| | | |
| | | /** |
| | | * 获取楼层可用空闲小车数量 |
| | | */ |
| | | public int getShuttleCountByLev(int lev) { |
| | | int count = 0; |
| | | for (ShuttleSlave slave : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车线程 |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | |
| | | NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (checkChargeWrk(slave.getId())) { |
| | | continue;//存在充电任务,过滤小车 |
| | | } |
| | | |
| | | if (!shuttleProtocol.isIdle()) { |
| | | continue;//小车忙碌中 |
| | | } |
| | | |
| | | if (shuttleProtocol.getSuspendState() == 1) { |
| | | //小车处于管制中 |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleProtocol.getPoint().getZ() == lev) { |
| | | //同一楼层空闲可用小车 |
| | | count++; |
| | | continue; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | } |
| | |
| | | add(309);add(312); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ |
| | | add(302);add(304); |
| | | add(305);add(306); |
| | | add(307);add(308); |
| | | add(310);add(311); |
| | | add(312);add(313); |
| | | add(314);add(315); |
| | | add(316);add(318); |
| | | add(319);add(320); |
| | | add(321);add(322); |
| | | add(323);add(324); |
| | | add(326);add(327); |
| | | add(328);add(329); |
| | | add(330);add(332); |
| | | add(334);add(335); |
| | | add(336);add(337); |
| | | add(338);add(342); |
| | | add(343);add(344); |
| | | }}; |
| | | |
| | | //高低信号站点 |
| | | public static final ArrayList<Integer> locType1StaNos = new ArrayList<Integer>() {{ |
| | | add(100);add(103); |
| | |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(100); |
| | | for (Integer staNo : staNos2) { |
| | | OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48); |
| | | if (result5.IsSuccess) { |
| | | StaProtocol staProtocol = station.get(staNo); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(staNo); |
| | | station.put(staNo, staProtocol); |
| | | } |
| | | |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 8, 1); |
| | | boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result5.Content, 21, 1); |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 34)); // 工作号 |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 40)); // 目标站 |
| | | staProtocol.setAutoing(status1[0]); // 自动 |
| | | staProtocol.setLoading(status2[2]); // 有物 |
| | | } |
| | | } |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | <select id="selectShuttleWrkByLev" resultMap="BaseResultMap"> |
| | | select * from dbo.asr_wrk_mast |
| | | where shuttle_no is not null |
| | | and ((wrk_sts not in (14,15) and loc_no like #{lev}) or (wrk_sts not in (34,35) and source_loc_no like #{lev})) |
| | | and ((wrk_sts not in (9,10) and loc_no like #{lev}) or (wrk_sts not in (29,30) and source_loc_no like #{lev})) |
| | | order by io_pri desc,wrk_sts desc |
| | | </select> |
| | | |
| | | <select id="selectShuttleOutWrkByLev" resultMap="BaseResultMap"> |
| | | select * from dbo.asr_wrk_mast |
| | | where shuttle_no is not null |
| | | and (wrk_sts not in (29,30) and source_loc_no like #{lev}) |
| | | order by io_pri desc,wrk_sts desc |
| | | </select> |
| | | |