|  |  | 
 |  |  | package com.zy.common.utils; | 
 |  |  |  | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import com.zy.asrs.entity.WrkCharge; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import com.zy.asrs.mapper.WrkChargeMapper; | 
 |  |  | import com.zy.asrs.mapper.WrkMastMapper; | 
 |  |  | import com.zy.asrs.service.BasDevpService; | 
 |  |  | import com.zy.asrs.service.WrkMastService; | 
 |  |  | import com.zy.asrs.utils.Utils; | 
 |  |  | import com.zy.common.model.NavigateNode; | 
 |  |  | 
 |  |  | import com.zy.core.News; | 
 |  |  | import com.zy.core.cache.SlaveConnection; | 
 |  |  | import com.zy.core.enums.SlaveType; | 
 |  |  | 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.NyShuttleProtocol; | 
 |  |  | import com.zy.core.properties.SlaveProperties; | 
 |  |  | import com.zy.core.thread.LiftThread; | 
 |  |  | import com.zy.core.thread.NyShuttleThread; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | 
 |  |  |     private WrkChargeMapper wrkChargeMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private CommonService commonService; | 
 |  |  |     @Autowired | 
 |  |  |     private BasDevpService basDevpService; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 调度车辆-调度指定穿梭车 | 
 |  |  | 
 |  |  |         return true; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取穿梭车最近且空闲的提升机输送站点 | 
 |  |  |      */ | 
 |  |  |     public BasDevp getRecentLiftSta(Integer shuttleNo) { | 
 |  |  |         //获取四向穿梭车线程 | 
 |  |  |         NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); | 
 |  |  |         if (shuttleThread == null) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); | 
 |  |  |         if (shuttleProtocol == null) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         for (LiftSlave slave : slaveProperties.getLift()) { | 
 |  |  |             LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, slave.getId()); | 
 |  |  |             if (liftThread == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             LiftProtocol liftProtocol = liftThread.getLiftProtocol(); | 
 |  |  |             if (liftProtocol == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             if (!liftProtocol.isIdle()) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             BasDevp basDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(shuttleProtocol.getCurrentLocNo()), slave.getId()); | 
 |  |  |             if (basDevp == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             return basDevp; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |