zwl
2025-07-19 93ff20c63a5e22e83d08a9e326fe12391eb82abc
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -103,7 +103,7 @@
                }
                String barcode = barcodeThread.getBarcode();
                if(!Cools.isEmpty(barcode)) {
                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
//                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                        continue;
                    }
@@ -122,10 +122,43 @@
                // 入出库模式判断
//                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
                if ( inSta.getStaNo()==101 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; }
                if ( inSta.getStaNo()==103 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; }
                if ( inSta.getStaNo()==105 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; }
                if ( inSta.getStaNo()==107 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; }
                if ( inSta.getStaNo()==102 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; }
                if ( inSta.getStaNo()==104 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; }
                if ( inSta.getStaNo()==106 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; }
                //led
                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                // 尺寸检测异常
                boolean back = false;
                String errMsg = "";
                if (staProtocol.isFrontErr()) {
                    errMsg = "前超限";
                    back = true;
                }
                if (!back && staProtocol.isBackErr()) {
                    errMsg = "后超限";
                    back = true;
                }
                if (!back && staProtocol.isHighErr()) {
                    errMsg = "高超限";
                    back = true;
                }
                if (!back && staProtocol.isLeftErr()) {
                    errMsg = "左超限";
                    back = true;
                }
                if (!back && staProtocol.isRightErr()) {
                    errMsg = "右超限";
                    back = true;
                }
                if (!back && staProtocol.isWeightErr()) {
                    errMsg = "超重";
                    back = true;
                }
                if (!back && staProtocol.isBarcodeErr()) {
                    errMsg = "扫码失败";
                    back = true;
                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing() && staProtocol.isLoading()
@@ -133,18 +166,18 @@
                        && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990)
                        && staProtocol.isPakMk()){// && !Cools.isEmpty(barcode)) {
//                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
//                        log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
//                        //条码为空或者不符合,退库到172站点
//                        staProtocol.setWorkNo((short)9999);
//                        staProtocol.setStaNo((short)172);
//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
//                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//                        if (!result) {
//                            throw new CoolException("更新plc站点信息失败");
//                        }
//                        continue;
//                    }
                    if (back) {
                        // led 异常显示
                        if (ledThread != null) {
                            String errorMsg = errMsg;
                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
                        }
                        staProtocol.setWorkNo((short) 9999);
                        staProtocol.setStaNo((short)(inSta.getStaNo()-1));
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        continue;
                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
@@ -181,7 +214,6 @@
                                .build()
                                .doPost();
                        JSONObject jsonObject = JSON.parseObject(response);
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        Integer code = jsonObject.getInteger("code");
                        if (code == 200) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
@@ -738,6 +770,7 @@
            crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 目标库位排
            crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 目标库位列
            crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 目标库位层
            crnCommand.setCommand((short) 1);
            if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
            } else {
@@ -810,10 +843,9 @@
            // 入出库模式判断
            //if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; }
                if (wrkMast.getStaNo() == 101 && devpThread.ioModeOf1F != IoModeType.PAKOUT_MODE) {continue;}
                if (wrkMast.getStaNo() == 103 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {continue;}
                if (wrkMast.getStaNo() == 105 && devpThread.ioModeOf3F != IoModeType.PAKOUT_MODE) {continue;}
                if (wrkMast.getStaNo() == 107 && devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) {continue;}
                if (wrkMast.getStaNo() == 102 && devpThread.ioModeOf1F != IoModeType.PAKOUT_MODE) {continue;}
                if (wrkMast.getStaNo() == 104 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {continue;}
                if (wrkMast.getStaNo() == 106 && devpThread.ioModeOf3F != IoModeType.PAKOUT_MODE) {continue;}
                // 查询站点详细信息
                BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
@@ -895,6 +927,7 @@
                    crnCommand.setDestinationPosX(crnStn.getRow().shortValue());     // 目标库位排
                    crnCommand.setDestinationPosY(crnStn.getBay().shortValue());     // 目标库位列
                    crnCommand.setDestinationPosZ(crnStn.getLev().shortValue());     // 目标库位层
                    crnCommand.setCommand((short) 1);
                    if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                        log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                    } else {
@@ -1124,6 +1157,7 @@
                crnCommand.setDestinationPosX(sta.getRow1().shortValue());     // 目标库位排
                crnCommand.setDestinationPosY(sta.getBay1().shortValue());     // 目标库位列
                crnCommand.setDestinationPosZ(sta.getLev1().shortValue());     // 目标库位层
                crnCommand.setCommand((short) 1);
                if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                    log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                } else {
@@ -1155,6 +1189,7 @@
            crnCommand.setDestinationPosX(sta.getRow1().shortValue());     // 目标库位排
            crnCommand.setDestinationPosY(sta.getBay1().shortValue());     // 目标库位列
            crnCommand.setDestinationPosZ(sta.getLev1().shortValue());     // 目标库位层
            crnCommand.setCommand((short) 1);
            if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
            } else {
@@ -1352,13 +1387,12 @@
                }
                // 入出库模式判断
                if ( emptyInSta.getStaNo()==101 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==103 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==105 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==107 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==102 && devpThread.ioModeOf1F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==104 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==106 && devpThread.ioModeOf3F == IoModeType.PAKOUT_MODE) { continue; }
                // 站点条件判断
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) {
                        && staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 9990 && staProtocol.isPakMk()) {
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);