#
mrzhssss
2022-12-01 ecc6c94c7d9eeb45f267afcaa9bae35a40f375c7
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -87,6 +87,8 @@
    private BasErrLogService basErrLogService;
    @Autowired
    private BasCrnErrorMapper basCrnErrorMapper;
    @Autowired
    private WrkMastService wrkMastService;
    @Value("${wms.url}")
    private String wmsUrl;
@@ -106,6 +108,8 @@
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                if (!Cools.isEmpty(barcode)) {
                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
@@ -116,6 +120,7 @@
                }
                // 获取入库站信息
//                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                if (staProtocol == null) {
@@ -126,14 +131,16 @@
                // 入出库模式判断
//                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
                    continue;
                }
//                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
//                    continue;
//                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing() && staProtocol.isLoading()
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990)
                        && !staProtocol.isEmptyMk()
                        && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990)
                        && staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
//                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
@@ -155,12 +162,13 @@
                        log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
                        continue;
                    }
//                    // 获取入库通知档
//                    List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N"));
//                    if (waitPakins.isEmpty()) {
//                        log.error("无此入库条码数据。条码号={}", barcode);
//                        continue;
//                    }
                    WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
                            .eq("barcode", barcode)
                            .eq("io_type", 103));
                    if (!Cools.isEmpty(checkPick)) {
                        continue;
                    }
                    try {
@@ -331,19 +339,19 @@
            // 遍历拣料入库口
            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;
//                }
                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;
                }
                // 获取拣料入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -357,7 +365,12 @@
//                // 入出库模式判断
//                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990)
                        && staProtocol.isPakMk()) {
//                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                    if (wrkMast == null) {
@@ -381,7 +394,8 @@
                    // 获取目标站
                    Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                            .eq("type_no", wrkMast.getIoType() - 50)
                            .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站
                            //速腾特有捡料, 11站是出库站, 然后手动走到15站进行再入库
                            .eq("stn_no", 15) // 作业站点 = 拣料出库的目标站
                            .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号
                    StaDesc staDesc = staDescService.selectOne(wrapper);
                    if (Cools.isEmpty(staDesc)) {
@@ -406,7 +420,7 @@
                        wrkMast.setIoTime(now);
                        wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57
                        wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走
                        wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站
                        wrkMast.setSourceStaNo(staDesc.getStnNo()); // 源站
                        wrkMast.setStaNo(staNo); // 目标站
                        wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位
                        wrkMast.setSourceLocNo(""); // 源库位清空
@@ -532,8 +546,11 @@
//            }
            // 只有当堆垛机空闲 并且 无任务时才继续执行
            if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO
                    && crnProtocol.getLoaded() == 0 && crnProtocol.getForkPos() == 0) {
            if (crnProtocol.getStatusType() == CrnStatusType.IDLE
                    && crnProtocol.getTaskNo() == 0
                    && crnProtocol.getModeType() == CrnModeType.AUTO
                    && crnProtocol.getLoaded() == 0
                    && crnProtocol.getForkPos() == 0) {
                // 如果最近一次是入库模式
                if (crnProtocol.getLastIo().equals("I")) {
                    if (basCrnp.getInEnable().equals("Y")) {
@@ -1519,26 +1536,26 @@
                    break;
                }
            }
            // 获取led线程
            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
            // led显示默认内容
            if (reset && !ledThread.isLedMk()) {
                if (led.getId() == 7) {
                    ledThread.setLedMk(true);
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                    } else {
                    }
                } else {
                    ledThread.setLedMk(true);
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                    } else {
                    }
                }
            }
//            // 获取led线程
//            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
//            // led显示默认内容
//            if (reset && !ledThread.isLedMk()) {
//                if (led.getId() == 7) {
//                    ledThread.setLedMk(true);
//                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
//                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
//                    } else {
//
//                    }
//                } else {
//                    ledThread.setLedMk(true);
//                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
//                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
//                    } else {
//
//                    }
//                }
//            }
        }
    }