#
luxiaotao1123
2022-08-30 35b74d8b172b42debb528fc89c482eaa1cad275f
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -220,20 +220,6 @@
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历拣料入库口
            for (DevpSlave.Sta pickSta : devp.getPickSta()) {
                // 获取条码扫描仪信息
                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
                if (barcodeThread == null) {
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                if(!Cools.isEmpty(barcode)) {
                    log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
                    if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                        continue;
                    }
                } else {
                    continue;
                }
                // 获取拣料入库站信息
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -244,6 +230,22 @@
                    staProtocol = staProtocol.clone();
                }
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){
                    // 获取条码扫描仪信息
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
                    if (barcodeThread == null) {
                        continue;
                    }
                    String barcode = barcodeThread.getBarcode();
                    if(!Cools.isEmpty(barcode)) {
                        log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
                        if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                            continue;
                        }
                    } else {
                        continue;
                    }
                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
                    if (wrkMast == null) {
                        // 无拣料数据
@@ -545,7 +547,7 @@
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { continue; }
                        if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
                        if (steProtocol.isIdle()) {
                            // 已经存在吊车执行任务时,则过滤
                            if (wrkMastMapper.selectWorking(slave.getId()) != null) {
@@ -688,13 +690,17 @@
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { continue; }
                            if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
                            if (steProtocol.isIdle()) {
                                // 命令下发区 --------------------------------------------------------------------------
                                SteCommand steCommand = new SteCommand();
                                steCommand.setSteNo(steNo); // 穿梭车编号
                                steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号
                                steCommand.setTaskMode(SteTaskModeType.TO_B); // 任务模式:  去近点 等待堆垛机叉取
                                SteABType ab = Utils.selectAB(steProtocol.getRow().intValue());
                                // todo:luxiaotao
                                if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) {
                                    log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand));
@@ -775,7 +781,7 @@
            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId());
            SteProtocol steProtocol = steThread.getSteProtocol();
            if (steProtocol == null) { continue; }
            if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
            if (steProtocol.isIdle()) {
                if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) {
                    return steProtocol.getSteNo().intValue();
                }
@@ -794,7 +800,7 @@
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo());
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol != null) {
            if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
            if (steProtocol.isIdle()) {
                return steThread;
            }
        }
@@ -810,7 +816,7 @@
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
        if (steProtocol.isIdle()) {
            // 命令下发区 --------------------------------------------------------------------------
            SteCommand steCommand = new SteCommand();
@@ -843,7 +849,7 @@
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
        if (steProtocol.isIdle()) {
            // 堆垛机空闲
            if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) {
                LocMast locMast;
@@ -920,7 +926,7 @@
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        // 穿梭车空闲
        if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
        if (steProtocol.isIdle()) {
            // 堆垛机空闲
            if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) {
@@ -1003,7 +1009,7 @@
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { continue; }
                        if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
                        if (steProtocol.isIdle()) {
                            // 命令下发区 --------------------------------------------------------------------------
                            SteCommand steCommand = new SteCommand();
                            steCommand.setSteNo(steNo); // 穿梭车编号
@@ -1072,7 +1078,7 @@
                    SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                    SteProtocol steProtocol = steThread.getSteProtocol();
                    if (steProtocol == null) { continue; }
                    if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
                    if (steProtocol.isIdle()) {
                        // 穿梭车重新定位排列层
                        if (!steThread.confirmPos()) {
                            log.error("{}号穿梭车重新定位失败!作业工作档任务号:{}", wrkMast.getSteNo(), wrkMast.getWrkNo());
@@ -1403,7 +1409,7 @@
                ledCommand.setStaNo(wrkMast.getStaNo());
                if (wrkMast.getIoType() != 110) {
                    List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatNo(), wrkDetl.getMatName(), wrkDetl.getQty())));
                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())));
                }
                commands.add(ledCommand);
            }