自动化立体仓库 - WCS系统
#
Junjie
2025-03-29 f348f4257b886aedb372723a79ccfad8a509e4a8
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -1,8 +1,12 @@
package com.zy.core.dispatcher;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.domain.ShuttleGatherResult;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
@@ -45,6 +49,8 @@
    private NavigateUtils navigateUtils;
    @Autowired
    private ConfigService configService;
    @Autowired
    private BasShuttleService basShuttleService;
    /**
     * 调度车辆-调度指定穿梭车
@@ -57,18 +63,6 @@
     * 调度车辆
     */
    public boolean dispatchShuttle(Integer wrkNo, String locNo) {
        //检测目标库位组是否存在小车,如存在小车则直接指定该车
        WrkMast wrkMast = wrkMastService.selectByWorkNo(wrkNo);
        if (wrkMast != null) {
            String targetLocNo = wrkMast.getIoType() < 100 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo();
            List<String> groupLoc = Utils.getGroupLoc(targetLocNo);
            Integer groupShuttleNo = Utils.checkGroupLocHasShuttle(groupLoc);
            if (groupShuttleNo != null) {
                //存在小车,直接调度该车
                return shuttleMoveGenerate(wrkNo, locNo, groupShuttleNo);
            }
        }
        ArrayList<ShuttleThread> sameLev = new ArrayList<>();//相同楼层的穿梭车
        ArrayList<ShuttleThread> diffLev = new ArrayList<>();//不同楼层的穿梭车
@@ -86,6 +80,13 @@
            if (!shuttleThread.isIdle()) {
                continue;//小车忙碌中
            }
            BasShuttle basShuttle = basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", shuttle.getId()));
            if (basShuttle != null) {
                if (basShuttle.getStatus() == 0) {
                    continue;//小车被禁用
                }
            }
            int currentLev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//小车当前层高
@@ -296,6 +297,29 @@
    }
    /**
     * 小车集合
     */
    public List<ShuttleGatherResult> shuttleGather() {
        List<BasShuttle> basShuttles = basShuttleService.selectList(new EntityWrapper<BasShuttle>().eq("status", 1));
        List<ShuttleGatherResult> list = new ArrayList<>();
        for (BasShuttle basShuttle : basShuttles) {
            String idleLoc = basShuttle.getIdleLoc();
            if(Cools.isEmpty(idleLoc)) {
                continue;
            }
            boolean result = shuttleMoveGenerate(null, idleLoc, basShuttle.getShuttleNo());
            ShuttleGatherResult gatherResult = new ShuttleGatherResult();
            gatherResult.setShuttleNo(basShuttle.getShuttleNo());
            gatherResult.setIdleLoc(idleLoc);
            gatherResult.setResult(result);
            list.add(gatherResult);
        }
        return list;
    }
    /**
     * 检测目标楼层车数量是否小于允许的最大数量
     * true: 小于最大数量  false: 大于或等于最大数量
     */
@@ -316,6 +340,16 @@
                continue;
            }
            //小车有充电任务
            if (shuttleThread.isCharging()) {
                continue;
            }
            //小车故障跳过
            if (shuttleThread.isFault()) {
                continue;
            }
            String currentLocNo = shuttleProtocol.getCurrentLocNo();
            if (currentLocNo == null) {
                continue;