| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | } |
| | | } |
| | | } |
| | | // 没有小车 |
| | | // 没有小车 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | // 寻找当前堆垛机对应的小车 |
| | |
| | | * 查找当前库位最适合的穿梭车来作业 |
| | | */ |
| | | public SteThread queryIdleCar(WrkMast wrkMast) { |
| | | Integer crnNo = wrkMast.getCrnNo(); |
| | | BasSte basSte = basSteService.findByCrnNo(crnNo); |
| | | // 获取穿梭车信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol != null) { |
| | | if (steProtocol.isIdle()) { |
| | | return steThread; |
| | | List<BasSte> basStes = basSteService.selectList(new EntityWrapper<>()); |
| | | int val = 0; |
| | | SteThread result = null; |
| | | for (BasSte basSte : basStes) { |
| | | // 获取穿梭车信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (!steProtocol.isIdle()) { continue; } |
| | | String locNo = wrkMast.getWrkSts() < 10 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo(); |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | int lev = locMast.getLev1(); |
| | | int bay = locMast.getBay1(); |
| | | int levAbs = Math.abs(lev - steProtocol.getLev()); |
| | | int bayAbs = Math.abs(bay - steProtocol.getBay()); |
| | | if (val == 0) { |
| | | val = levAbs + bayAbs; |
| | | result = steThread; |
| | | } else { |
| | | if ((levAbs + bayAbs) < val) { |
| | | val = levAbs + bayAbs; |
| | | result = steThread; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | return result; |
| | | } |
| | | |
| | | /** |