|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.core.common.Arith; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.asrs.entity.BasShuttle; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocMast; | 
|---|
|  |  |  | import com.zy.asrs.entity.WrkMast; | 
|---|
|  |  |  | import com.zy.asrs.mapper.WrkMastMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.BasShuttleService; | 
|---|
|  |  |  | import com.zy.asrs.service.LocMastService; | 
|---|
|  |  |  | import com.zy.asrs.service.WrkMastService; | 
|---|
|  |  |  | import com.zy.asrs.service.impl.MainServiceImpl; | 
|---|
|  |  |  | import com.zy.common.model.NavigateNode; | 
|---|
|  |  |  | import com.zy.common.model.enums.NavigationMapType; | 
|---|
|  |  |  | 
|---|
|  |  |  | //搜索一条没有小车的空巷道,并调度小车 | 
|---|
|  |  |  | public static boolean searchEmptyGroupToMoveShuttle(int z, Integer currentShuttleId, NyShuttleThread shuttleThread) { | 
|---|
|  |  |  | LocMastService locMastService = SpringUtils.getBean(LocMastService.class); | 
|---|
|  |  |  | MainServiceImpl mainServiceImpl = SpringUtils.getBean(MainServiceImpl.class); | 
|---|
|  |  |  | WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class); | 
|---|
|  |  |  | CommonService commonService = SpringUtils.getBean(CommonService.class); | 
|---|
|  |  |  | ShuttleDispatchUtils shuttleDispatchUtils = SpringUtils.getBean(ShuttleDispatchUtils.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | int distY = -1; | 
|---|
|  |  |  | int distX = -1; | 
|---|
|  |  |  | int distZ = -1; | 
|---|
|  |  |  | //获取避让库位 | 
|---|
|  |  |  | String distLocNo = null; | 
|---|
|  |  |  | for (int y = 20; y <= 56; y++) { | 
|---|
|  |  |  | boolean searchFlag = true; | 
|---|
|  |  |  | for (int x = 10; x <= 11; x++) { | 
|---|
|  |  |  | 
|---|
|  |  |  | distY = y; | 
|---|
|  |  |  | distX = 11; | 
|---|
|  |  |  | distZ = z; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取避让库位 | 
|---|
|  |  |  | String locNo = NavigatePositionConvert.xyzToLocNo(distX, distY, distZ); | 
|---|
|  |  |  | LocMast distLocMast = locMastService.queryByLoc(locNo); | 
|---|
|  |  |  | if (distLocMast == null) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断该库位是否存在工作档 | 
|---|
|  |  |  | EntityWrapper<WrkMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.eq("loc_no", locNo); | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastService.selectOne(wrapper); | 
|---|
|  |  |  | if (wrkMast != null) { | 
|---|
|  |  |  | continue;//存在工作档跳过该库位 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | distLocNo = locNo; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (distY != -1) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取避让库位 | 
|---|
|  |  |  | String distLocNo = NavigatePositionConvert.xyzToLocNo(distX, distY, distZ); | 
|---|
|  |  |  | LocMast distLocMast = locMastService.queryByLoc(distLocNo); | 
|---|
|  |  |  | if (distLocMast == null) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (distLocNo != null) { | 
|---|
|  |  |  | //调度小车到避让位置 | 
|---|
|  |  |  | return shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(7), distLocNo, shuttleProtocol.getShuttleNo().intValue()); | 
|---|
|  |  |  | } | 
|---|