|  |  | 
 |  |  | package com.zy.common.utils; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.core.common.SpringUtils; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import com.zy.asrs.entity.WrkCharge; | 
 |  |  | 
 |  |  | import com.zy.core.properties.SlaveProperties; | 
 |  |  | import com.zy.core.thread.LiftThread; | 
 |  |  | import com.zy.core.thread.NyShuttleThread; | 
 |  |  | import com.zy.system.entity.Config; | 
 |  |  | import com.zy.system.service.ConfigService; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | 
 |  |  |  | 
 |  |  |             if (wrkMast1 != null) { | 
 |  |  |                 int lev = Utils.getLev(wrkMast1.getLocNo());//目标楼层 | 
 |  |  |  | 
 |  |  |                 //检测目标楼层车数量是否小于允许的最大数量 | 
 |  |  |                 boolean checkDispatchMaxNum = checkDispatchMaxNum(lev); | 
 |  |  |                 if (!checkDispatchMaxNum) { | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 int recentValue = 99999;//最小差值 | 
 |  |  |                 for (NyShuttleThread shuttleThread : diffLev) { | 
 |  |  |                     //当前穿梭车库位号 | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 检测目标楼层车数量是否小于允许的最大数量 | 
 |  |  |      * true: 小于最大数量  false: 大于或等于最大数量 | 
 |  |  |      */ | 
 |  |  |     public boolean checkDispatchMaxNum(Integer lev) { | 
 |  |  |         ConfigService configService = SpringUtils.getBean(ConfigService.class); | 
 |  |  |         EntityWrapper<Config> wrapper = new EntityWrapper<>(); | 
 |  |  |         wrapper.eq("code", "dispatchShuttleMaxNum"); | 
 |  |  |         Config config = configService.selectOne(wrapper); | 
 |  |  |         if (config == null) { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         int levCount = 0;//目标楼层车辆数量 | 
 |  |  |         for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { | 
 |  |  |             //获取四向穿梭车线程 | 
 |  |  |             NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); | 
 |  |  |             NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); | 
 |  |  |             if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (shuttleProtocol.getPoint().getZ().equals(lev)) { | 
 |  |  |                 levCount++;//目标楼层有车,数量增加 | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return levCount < Integer.parseInt(config.getValue()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取穿梭车最近且空闲的提升机输送站点 | 
 |  |  |      */ | 
 |  |  |     public LiftStaProtocol getRecentLiftSta(Integer shuttleNo) { |