| | |
| | | import com.zy.core.model.LiftSlave; |
| | | import com.zy.core.model.ShuttleSlave; |
| | | import com.zy.core.model.protocol.LiftProtocol; |
| | | import com.zy.core.model.protocol.LiftStaProtocol; |
| | | import com.zy.core.model.protocol.NyShuttleProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.LiftThread; |
| | |
| | | if (currentAllDistance < recentAllDistance) { |
| | | //如果当前楼层的车路径更小,则更新最近穿梭车 |
| | | recentShuttle = shuttleThread; |
| | | recentAllDistance = currentAllDistance; |
| | | } |
| | | } |
| | | }else { |
| | |
| | | if (currentAllDistance < recentAllDistance) { |
| | | //如果当前楼层的车路径更小,则更新最近穿梭车 |
| | | recentShuttle = shuttleThread; |
| | | recentAllDistance = currentAllDistance; |
| | | } |
| | | } |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | Integer staNo = null; |
| | | Integer sourceStaNo = null;//小车换层源站点 |
| | | Integer staNo = null;//小车换层目标站点 |
| | | if (Utils.getLev(locNo) != shuttleProtocol.getPoint().getZ()) { |
| | | //目标库位和小车库位处于不同一楼层,需要通过提升机调度 |
| | | //获取穿梭车最近且空闲的提升机输送站点 |
| | | BasDevp liftSta = this.getRecentLiftSta(shuttleNo); |
| | | LiftStaProtocol liftSta = this.getRecentLiftSta(shuttleNo); |
| | | if (liftSta == null) { |
| | | return false;//没有可用且空闲的输送站点 |
| | | } |
| | | staNo = liftSta.getDevNo(); |
| | | sourceStaNo = liftSta.getStaNo();//源站点 |
| | | //提升机号*100+目标楼层=目标站点 |
| | | staNo = liftSta.getLiftNo() * 100 + Utils.getLev(locNo);//目标站 |
| | | } |
| | | |
| | | // 获取工作号 |
| | |
| | | wrkMast.setShuttleNo(shuttleNo);//穿梭车号 |
| | | wrkMast.setSourceLocNo(shuttleProtocol.getCurrentLocNo()); // 源库位 => 小车当前库位号 |
| | | wrkMast.setLocNo(locNo); // 目标库位 |
| | | wrkMast.setSourceStaNo(sourceStaNo);//源站 |
| | | wrkMast.setStaNo(staNo);//目标站 |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | |
| | | /** |
| | | * 获取穿梭车最近且空闲的提升机输送站点 |
| | | */ |
| | | public BasDevp getRecentLiftSta(Integer shuttleNo) { |
| | | public LiftStaProtocol getRecentLiftSta(Integer shuttleNo) { |
| | | //获取四向穿梭车线程 |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | if (shuttleThread == null) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | //获取小车同一楼层的站点 |
| | | ArrayList<LiftStaProtocol> list = new ArrayList<>(); |
| | | int lev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//小车楼层 |
| | | for (LiftSlave slave : slaveProperties.getLift()) { |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, slave.getId()); |
| | | if (liftThread == null) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | BasDevp basDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(shuttleProtocol.getCurrentLocNo()), slave.getId()); |
| | | if (basDevp == null) { |
| | | LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(slave.getId(), lev); |
| | | if (liftStaProtocol == null) { |
| | | continue; |
| | | } |
| | | return basDevp; |
| | | |
| | | list.add(liftStaProtocol); |
| | | } |
| | | |
| | | return null; |
| | | if (list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | String currentLocNo = shuttleProtocol.getCurrentLocNo();//小车位置 |
| | | Integer recentAllDistance = 9999999; |
| | | LiftStaProtocol recentSta = null;//最近站点 |
| | | //搜索距离小车最近的站点 |
| | | for (LiftStaProtocol liftStaProtocol : list) { |
| | | Integer staNo = liftStaProtocol.getStaNo();//站点号 |
| | | String locNo = liftStaProtocol.getLocNo();//站点库位号 |
| | | |
| | | //当前穿梭车线程到目标地点距离 |
| | | List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleNo, Utils.getLev(currentLocNo)));//使用正常通道地图 |
| | | if (currentShuttlePath == null) { |
| | | continue; |
| | | } |
| | | Integer currentAllDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//计算当前路径行走总距离 |
| | | if (currentAllDistance < recentAllDistance) { |
| | | //如果当前楼层的车路径更小,则更新最近站点 |
| | | recentSta = liftStaProtocol; |
| | | recentAllDistance = currentAllDistance; |
| | | } |
| | | } |
| | | |
| | | return recentSta; |
| | | } |
| | | |
| | | } |