#
TQS
2022-11-23 f4756eb3081fe22aee7bad094539b44bac94e4af
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1367,7 +1367,13 @@
        if (wrkMast.getWrkSts() == 17) {
            //查找库位
            boolean flag = false;
            String[] deeplocs  = Utils.getDeepLocs(wrkMast.getSourceLocNo());
//            append
            Integer row = Utils.getGroupRow(wrkMast.getSourceLocNo());
            Integer bay = Utils.getBay(wrkMast.getSourceLocNo());
            Integer lev = Utils.getLev(wrkMast.getSourceLocNo());
            String locNo = Utils.append(row, bay, lev);
            String[] deeplocs  = Utils.getDeepLocs(locNo);
            if(!Cools.isEmpty(deeplocs)){
                for(String deepLocNo : deeplocs) {
                    LocMast deepLoc = locMastService.selectById(deepLocNo);
@@ -1383,7 +1389,7 @@
                        wrkMast.setIoPri((double)9999);
                        wrkMast.setWrkSts(2L);
                        wrkMast.setLocNo(deepLocNo);
                        wrkMast.setSteNo(null);
                        wrkMast.setSteNo(0);
                        wrkMast.setModiTime(new Date());
                        if (wrkMastMapper.updateById(wrkMast) == 0) {
                            log.error("修改工作档状态 17.移库完成 => 2.移库再入库中 失败!!,工作号={}", wrkMast.getWrkNo());
@@ -1461,10 +1467,23 @@
                // 有小车
                if (steNo != null) {
                    // 小车行走到堆垛机待搬移点
                    if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) {
                    if (wrkMast.getWrkSts() == 2L && (wrkMast.getSteNo() == null || wrkMast.getSteNo() == 0)) {
                        // 没有其他任务
                        if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) {
                            this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo());
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { return; }
                            if(steProtocol.getLoca()==3 || steProtocol.getLoca()==4){
                                //小车已经在待机位时,无需下发到待机位任务,直接更新状态微3,同时绑定小车
                                wrkMast.setWrkSts(3L);
                                wrkMast.setSteNo(steNo);
                                wrkMast.setModiTime(new Date());
                                if (wrkMastMapper.updateById(wrkMast) == 0) {
                                    log.error("修改工作档状态 绑定穿梭车 失败!!,工作号={}", wrkMast.getWrkNo());
                                }
                            } else {
                                this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo());
                            }
                        }
                    }
                    // 堆垛机将货放至小车上 3.小车待搬(小车不用搬运,已经在当前组库位) / 6.小车待入  ===>> 7.吊车入库中
@@ -1509,7 +1528,7 @@
                    }
                    // 没有小车
                } else {
                    if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) {
                    if (wrkMast.getWrkSts() == 2L && (wrkMast.getSteNo() == null || wrkMast.getSteNo() == 0)) {
                        // 寻找当前堆垛机对应的小车
                        SteThread steThread = queryIdleCar(wrkMast);
                        if (steThread != null) {
@@ -2472,8 +2491,9 @@
//                        }
                        if (locMastService.isOutMost(wrkMast.getLocNo())) {
                            wrkMast.setWrkSts(17L);
                            wrkMast.setSteNo(0);
                            // 默认目标库位是空板
                            String locSts = "D";
                            String locSts = "";
                            // 库位移转判断是否为空板移转
                            if (wrkMast.getEmptyMk().equals("N")) {
                                locSts = "F";
@@ -2483,6 +2503,11 @@
                                    continue;
                                }
                            }
                            if(Cools.isEmpty(locSts)){
                                log.error("库位移转 ===>> 库存状态为空;[源库位={}],[目标库位={}]", wrkMast.getSourceLocNo(), wrkMast.getLocNo());
                                continue;
                            }
                            // 修改源库位状态 ==> O
                            LocMast sourceLoc = locMastService.selectById(wrkMast.getSourceLocNo());
                            if (null != sourceLoc) {
@@ -3577,10 +3602,19 @@
                    rows = "18,19";
                    break;
            }
            LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("crn_no",crn.getId())
            LocMast loc = null;
            List<LocMast> locs = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no",crn.getId())
                                                .eq("loc_type1",shallowLoc.getLocType1())
                                                .eq("loc_sts","O")
                                                .last(" and row1 in (" + rows + ") order by bay1,lev1"));
            for (LocMast one : locs){
                if(Utils.getGroupRow(one.getLocNo()) != Utils.getGroupRow(shallowLoc.getLocNo())
                    || Utils.getBay(one.getLocNo()) != Utils.getBay(shallowLoc.getLocNo())
                    || Utils.getLev(one.getLocNo()) != Utils.getLev(shallowLoc.getLocNo())){
                    loc = one;
                    break;
                }
            }
            if (null == loc) {
                log.error("深库位出库 --- 浅库位阻塞异常! 待移转浅库位:" + shallowLoc.getLocNo());