#
mrzhssss
2023-01-09 44cf1e2793733f703cfe7ccad5e2727a81a98cad
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -121,7 +121,7 @@
                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                        staProtocol.setWorkNo((short) 9998);
                        staProtocol.setStaNo((short)14);
                        staProtocol.setStaNo((short) 14);
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        // led 异常显示
@@ -207,9 +207,11 @@
                            if (!result) {
                                throw new CoolException("更新plc站点信息失败");
                            }
                            String successMsg = "入库工作档--工作号:" + dto.getWorkNo() + " 目标库位:" + dto.getLocNo();
                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, successMsg));
                        } else {
                            staProtocol.setWorkNo((short) 9998);
                            staProtocol.setStaNo((short)14);
                            staProtocol.setStaNo((short) 14);
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (ledThread != null) {
@@ -376,11 +378,11 @@
                }
                String barcode = barcodeThread.getBarcode();
                if(!Cools.isEmpty(barcode) && (staProtocol.getWorkNo() != 9998 || staProtocol.getWorkNo() != 9996 )) {
                if (!Cools.isEmpty(barcode) && (staProtocol.getWorkNo() != 9998 || staProtocol.getWorkNo() != 9996)) {
                    log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
                    if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                        staProtocol.setWorkNo((short) 9998);
                        staProtocol.setStaNo((short)14);
                        staProtocol.setStaNo((short) 14);
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        // led 异常显示
@@ -395,9 +397,6 @@
                }
//                // 入出库模式判断
//                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
@@ -405,7 +404,7 @@
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && ( staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9997 || staProtocol.getWorkNo() == 9995)
                        && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9997 || staProtocol.getWorkNo() == 9995)
                        && staProtocol.isPakMk()) {
                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
@@ -1094,6 +1093,50 @@
            return;
        }
        // 双深库位且浅库位有货,则需先对浅库位进行库位移转
        if (Utils.isDeepLoc(slaveProperties, wrkMast.getSourceLocNo())) {
            String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getSourceLocNo());
            LocMast shallowLoc = locMastService.selectById(shallowLocNo);
            // O.空库位、Q.拣料/盘点/并板再入库、S.入库预约、X.禁用 直接搬!
            if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
                WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
                if (null == waitWrkMast) {
                    log.error("{}库位异常,未检索到相应工作档!", shallowLocNo);
                } else {
                    if (waitWrkMast.getWrkSts() == 11) {
                        waitWrkMast.setIoPri(15D);
                        waitWrkMast.setModiTime(new Date());
                        if (wrkMastMapper.updateById(waitWrkMast) == 0) {
                            log.error("调整工作档优先级失败!工作号={}", waitWrkMast.getWrkNo());
                        }
                        return;
                    } else {
                    }
                }
            } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
//                            WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
                //2022-08-16 modify,不根据updmk标记移库任务(容易被取消导致堵塞),查询工作档是否存在任务
                WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
                // 此标记避免多次执行移库任务
//                            if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())
//                                || Cools.isEmpty(waitWrkMast)) {
                if (Cools.isEmpty(waitWrkMast)) {
                    wrkMast.setUpdMk("Y");
                    wrkMastMapper.updateById(wrkMast);
                    // 生成工作档,将浅库位移转到新的库位中
                    moveLocForDeepLoc(slave, shallowLoc);
                }
                log.error("{}任务出库失败,浅库位堵塞!浅库位号:{}", wrkMast.getWrkNo(), shallowLocNo);
                return;
            } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) {
                WrkMast waitWrkMast = wrkMastMapper.selectByLocNo1(shallowLocNo);
                if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
                    return;
                }
            }
        }
        // 已经存在吊车执行任务时,则过滤
        if (wrkMastMapper.selectWorking(slave.getId()) != null) {
            return;
@@ -1480,26 +1523,19 @@
            // 获取LED线程
            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
            // 相同工作号集合则过滤
            if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
                continue;
            }
//            if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
//                continue;
//            }
            // 命令下发 -------------------------------------------------------------------------------
            if (!commands.isEmpty()) {
                if (led.getId() == 7) {
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                        continue;
                    } else {
                        ledThread.setLedMk(false);
                    }
                String errMsg = "";
                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
                    log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                    continue;
                } else {
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                        continue;
                    } else {
                        ledThread.setLedMk(false);
                    }
                    ledThread.setLedMk(false);
                }
            }
@@ -2046,7 +2082,7 @@
                    JSONObject data = (JSONObject) jsonObject.get("data");
                    log.info((String) data.get("msg"));
                } else {
                    log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/auto/emptyOut/v1","", response);
                    log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/auto/emptyOut/v1", "", response);
                }
            } catch (Exception e) {
                e.printStackTrace();