自动化立体仓库 - WCS系统
rgv
Junjie
2023-07-13 5ac4d85e8e6a80ada870b5c92eb45897c7815b51
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -21,6 +21,8 @@
import com.zy.common.service.CommonService;
import com.zy.common.utils.CollectionUtils;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.RedisUtil;
import com.zy.common.utils.RgvUtils;
import com.zy.core.CrnThread;
import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
@@ -89,6 +91,8 @@
    private BasRgvErrLogService basRgvErrLogService;
    @Autowired
    private BasRgvPathService basRgvPathService;
    @Autowired
    private RedisUtil redisUtil;
    @Value("${wms.url}")
    private String wmsUrl;
@@ -626,6 +630,19 @@
                        if (rgvProtocol.getTaskNo1() != 0 || rgvProtocol.getLoaded1() != 0) {//RGV是否无任务、RGV是否无货
                            continue;
                        }
                        //判断行走路径是否被占用
                        Integer staNo = wrkMast.getStaNo();
                        BasDevp basDevp = basDevpService.selectById(staNo);
                        if (basDevp == null) {
                            continue;//目标站不存在
                        }
                        //起始路径
                        int startPath = rgvProtocol.getRgvPos().intValue();
                        //目标路径值
                        int endPath = basDevp.getLocType3().intValue();
                        boolean pathUsed = RgvUtils.isPathUsed(startPath, endPath);
                        //  命令下发区 --------------------------------------------------------------------------
                        RgvCommand rgvCommand = new RgvCommand();
@@ -2841,7 +2858,21 @@
     * 初始化RGV地图
     */
    public synchronized void initRgvMap() {
        Object data = redisUtil.get("rgv_map");
        if (data == null) {
            //重新获取全路径地图
            BasRgvPath basRgvPath = basRgvPathService.selectByRgvNo(0);//获取默认路径
            if (basRgvPath != null) {
                ArrayList<RgvNode> rgvNodes = new ArrayList<>();
                List<Integer> rgvPath = JSON.parseArray(basRgvPath.getPath(), Integer.class);
                for (Integer integer : rgvPath) {
                    RgvNode rgvNode = new RgvNode(integer);
                    rgvNodes.add(rgvNode);
                }
                //将数据库地图数据存入redis
                redisUtil.set("rgv_map", JSON.toJSONString(rgvNodes));
            }
        }
    }
    /**