自动化立体仓库 - WCS系统
Junjie
2023-10-24 42cc083dd05f6c90137fc239482625492965a2e8
src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
@@ -69,6 +69,18 @@
     * 调度车辆
     */
    public boolean dispatchShuttle(Integer wrkNo, String locNo) {
        //检测目标库位组是否存在小车,如存在小车则直接指定该车
        WrkMast wrkMast = wrkMastMapper.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<NyShuttleThread> sameLev = new ArrayList<>();//相同楼层的穿梭车
        ArrayList<NyShuttleThread> diffLev = new ArrayList<>();//不同楼层的穿梭车
@@ -137,8 +149,8 @@
            WrkMast wrkMast1 = wrkMastMapper.selectByWorkNo(wrkNo);
            if (wrkMast1 != null) {
                String locNO=wrkMast1.getIoType()<100?wrkMast1.getLocNo():wrkMast1.getSourceLocNo();
                int lev = Utils.getLev(locNO);//目标楼层
                String targetLoc = wrkMast1.getIoType() < 100 ? wrkMast1.getLocNo() : wrkMast1.getSourceLocNo();
                int lev = Utils.getLev(targetLoc);//目标楼层
                //检测目标楼层车数量是否小于允许的最大数量
                boolean checkDispatchMaxNum = checkDispatchMaxNum(lev);
@@ -236,7 +248,7 @@
        if (Utils.getLev(locNo) != shuttleProtocol.getPoint().getZ()) {
            //目标库位和小车库位处于不同一楼层,需要通过提升机调度
            //获取穿梭车最近且空闲的提升机输送站点
            LiftStaProtocol liftSta = this.getRecentLiftSta(shuttleNo);
            LiftStaProtocol liftSta = this.getRecentLiftSta(shuttleNo, Utils.getLev(locNo));
            if (liftSta == null) {
                return false;//没有可用且空闲的输送站点
            }
@@ -319,13 +331,32 @@
            }
        }
        //搜索是否存在前往目标楼层的小车移动工作档
        for (WrkMast wrkMast : wrkMastMapper.selectShuttleMoveWrk()) {
            if (wrkMast.getSourceLocNo() == null || wrkMast.getLocNo() == null) {
                continue;
            }
            int sourceLev = Utils.getLev(wrkMast.getSourceLocNo());//工作档源楼层
            int targetLev = Utils.getLev(wrkMast.getLocNo());//工作档目标楼层
            if (sourceLev == lev) {
                continue;//工作档楼层和目标楼层相同,跳过
            }
            if (targetLev == lev) {
                levCount++;//工作档目标楼层和实际楼层相同,数量增加
                continue;
            }
        }
        return levCount < Integer.parseInt(config.getValue());
    }
    /**
     * 获取穿梭车最近且空闲的提升机输送站点
     */
    public LiftStaProtocol getRecentLiftSta(Integer shuttleNo) {
    public LiftStaProtocol getRecentLiftSta(Integer shuttleNo, Integer targetLev) {
        //获取四向穿梭车线程
        NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
        if (shuttleThread == null) {
@@ -357,6 +388,16 @@
                continue;
            }
            //判断目标楼层站点是否无托盘
            LiftStaProtocol targetLiftStaProtocol = NyLiftUtils.getLiftStaByLev(slave.getId(), targetLev);
            if (targetLiftStaProtocol == null) {
                continue;
            }
            if (targetLiftStaProtocol.getHasTray()) {
                continue;//有托盘跳过
            }
            list.add(liftStaProtocol);
        }