| | |
| | | private ForkLiftAction forkLiftAction; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | @Autowired |
| | | private BasShuttleChargeService basShuttleChargeService; |
| | | |
| | | /** |
| | | * 初始化实时地图 |
| | |
| | | */ |
| | | public synchronized void loopShuttleCharge() { |
| | | try { |
| | | |
| | | List<BasShuttleCharge> charges = basShuttleChargeService.selectList(new EntityWrapper<BasShuttleCharge>().orderBy("charge_id", true)); |
| | | if (charges.isEmpty()) { |
| | | return;//无充电桩 |
| | | } |
| | | |
| | | for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车线程 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | |
| | | |
| | | //小车所在楼层 |
| | | int lev = Utils.getLev(shuttleProtocol.getCurrentLocNo()); |
| | | ShuttleChargeType shuttleCharge = null; |
| | | BasShuttleCharge shuttleCharge = null; |
| | | |
| | | //搜索小车所在楼层有没有充电桩 |
| | | for (ShuttleChargeType chargeType : ShuttleChargeType.values()) { |
| | | if (lev != Utils.getLev(chargeType.locNo)) { |
| | | for (BasShuttleCharge charge : charges) { |
| | | if (lev != Utils.getLev(charge.getLocNo())) { |
| | | continue;//小车和充电桩不在同一层 |
| | | } |
| | | |
| | | //小车和充电桩在同一层 |
| | | if (wrkMastService.selectChargeWorkingByChargeSta(chargeType.id) == null) { |
| | | shuttleCharge = chargeType; |
| | | if (wrkMastService.selectChargeWorkingByChargeSta(charge.getChargeId()) == null) { |
| | | shuttleCharge = charge; |
| | | break; |
| | | } |
| | | } |
| | |
| | | if (shuttleCharge == null) { |
| | | //同楼层没有找到充电桩,找可用充电桩 |
| | | //小车同楼层没有充电桩,只要充电桩可用就生成充电任务 |
| | | for (ShuttleChargeType chargeType : ShuttleChargeType.values()) { |
| | | if (wrkMastService.selectChargeWorkingByChargeSta(chargeType.id) == null) { |
| | | for (BasShuttleCharge charge : charges) { |
| | | if (wrkMastService.selectChargeWorkingByChargeSta(charge.getChargeId()) == null) { |
| | | //判断当前充电桩楼层是否有小车,如有小车,不分配该充电桩 |
| | | int chargeLev = Utils.getLev(chargeType.locNo);//充电桩楼层 |
| | | int chargeLev = Utils.getLev(charge.getLocNo());//充电桩楼层 |
| | | boolean checkLevHasShuttle = Utils.checkLevHasShuttle(chargeLev);//检测楼层是否有穿梭车 |
| | | if (checkLevHasShuttle) { |
| | | //当前充电桩楼层有穿梭车,不分配该充电桩 |
| | | continue; |
| | | } |
| | | |
| | | shuttleCharge = chargeType; |
| | | shuttleCharge = charge; |
| | | break; |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | String chargeLocNo = shuttleCharge.locNo; |
| | | String chargeLocNo = shuttleCharge.getLocNo(); |
| | | wrkMast = new WrkMast(); |
| | | wrkMast.setMk(String.valueOf(shuttleCharge.id)); |
| | | wrkMast.setMk(String.valueOf(shuttleCharge.getChargeId())); |
| | | wrkMast.setWrkNo(commonService.getWorkNo(WrkIoType.SHUTTLE_CHARGE.id)); |
| | | wrkMast.setWrkSts(WrkStsType.NEW_CHARGE.sts); |
| | | wrkMast.setIoType(WrkIoType.SHUTTLE_CHARGE.id);//300.充电 |
| | |
| | | return false; |
| | | } |
| | | |
| | | ShuttleChargeType chargeType = ShuttleChargeType.get(Integer.parseInt(wrkMast.getMk())); |
| | | if(chargeType == null) { |
| | | BasShuttleCharge basShuttleCharge = basShuttleChargeService.selectOne(new EntityWrapper<BasShuttleCharge>().eq("charge_id", wrkMast.getMk())); |
| | | if(basShuttleCharge == null) { |
| | | return false; |
| | | } |
| | | |
| | | //调度小车去待机位 |
| | | boolean dispatched = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), chargeType.waitLocNo, wrkMast.getShuttleNo()); |
| | | boolean dispatched = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), basShuttleCharge.getWaitLocNo(), wrkMast.getShuttleNo()); |
| | | if (!dispatched) { |
| | | return false; |
| | | } |