#
Junjie
2024-01-16 242bbccea6fd21c130f639cf7b9c6aa95d41fe44
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -228,6 +228,62 @@
    }
    /**
     * 组托
     * 入库站,根据条码扫描通知桁架码垛
     */
    public synchronized void generateStoreWrkFileFull2LouM() {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历码垛口
            for (DevpSlave.Sta driveSta : devp.getDriveSta()) {
                // 获取条码扫描仪信息
                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, driveSta.getBarcode());
                if (barcodeThread == null) {
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                if (!Cools.isEmpty(barcode) && !barcode.equals("") && !barcode.equals("      ")) {
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                        continue;
                    }
                } else {
                    continue;
                }
                // 获取码垛口信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(driveSta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk()
                        && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000) )
                ) {
                    try {
                        BasDevp basDevp = basDevpService.selectById(driveSta.getStaNo());
                        if (basDevp.getReportSign()>0){
                            continue;
                        }
                        basDevp.setBarcode(barcode);
                        basDevp.setReportSign(1);
                        basDevpService.updateById(basDevp);
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                }
            }
        }
    }
    /**
     * wms入库
     * 入库站,根据条码扫描生成入库工作档,工作状态 1 ==>> 2
     */
@@ -235,7 +291,7 @@
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
            for (DevpSlave.Sta inSta : devp.getInSta()) {
            for (DevpSlave.Sta inSta : devp.getInWmsSta()) {
                // 获取入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
@@ -246,9 +302,9 @@
                }
//                // 入出库模式判断
                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) {
                    continue;
                }
//                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) {
//                    continue;
//                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
@@ -3147,6 +3203,7 @@
                // 出库模式
                switch (wrkMast.getIoType()) {
                    case 1:
                    case 202:
                        ledCommand.setTitle("全板入库");
                        break;
                    case 10:
@@ -3185,27 +3242,28 @@
            Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
            // 获取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 (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);
                    }
                } 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);
                    }
                }
//                }
//                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);
//                    }
//                }
            }
@@ -3954,7 +4012,7 @@
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && staProtocol.getWorkNo() == 0
                        && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000))
                ) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
                    //任务完成
@@ -4157,8 +4215,6 @@
                            if (!MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol))) {
                                continue;
                            }
                        }else {
                            continue;
                        }
                        wrkMastSta.setWrkSts(3);
                        wrkMastStaMapper.updateById(wrkMastSta);
@@ -4196,8 +4252,6 @@
                            if (!MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol))) {
                                continue;
                            }
                        }else {
                            continue;
                        }
                        wrkMastSta.setWrkSts(3);
                        wrkMastStaMapper.updateById(wrkMastSta);
@@ -4605,7 +4659,7 @@
                        && rgvProtocol.getTaskNo1()==0
                        && rgvProtocol.getTaskNo2()==0
                ) {
                    BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
                    BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvSlave.getId());
                    basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
                    rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
                }