野心家
2023-08-10 fe87eb25a80054e54d3a58307a135edaa8289e8d
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -151,6 +151,12 @@
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    WrkMast wrkMast1 = wrkMastMapper.selectPakInStepBarcode(barcode);
                    if (wrkMast1 !=null){
                        if (wrkMast1.getIoType()==103 || wrkMast1.getIoType()==107 || wrkMast1.getIoType()==104){
                            continue;
                        }
                    }
                    if (wrkMast != null) {
                        log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
                        continue;
@@ -199,11 +205,7 @@
                            if(!Cools.isEmpty(ledThread)){
                                String errorMsg =  jsonObject.getString("msg");
                                if(!Cools.isEmpty(errorMsg)){
                                    LedCommand ledCommand = new LedCommand();
                                    ledCommand.setTitle(errorMsg);
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(9, ledCommand));
                                }
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
                            }
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                        }
@@ -298,8 +300,12 @@
                }
//                // 入出库模式判断
                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
               // 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; }
//                staProtocol.setPakMk(true);
                // 判断是否满足入库条件
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990)
@@ -365,6 +371,8 @@
                    staProtocol = staProtocol.clone();
                }
//                staProtocol.setPakMk(true);
//                // 入出库模式判断
//                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){
@@ -769,6 +777,11 @@
            // 获取工作状态为11(生成出库ID)的出库工作档
//            WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
            List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo());
            // 获取工作状态为14的工作档 且 出库任务为盘点/拣料出库的任务
            WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep14(slave.getId(), crnStn.getStaNo());
            if ( wrkMast1 !=null) {
                continue;
            }
            for (WrkMast wrkMast : wrkMasts){
                if (wrkMast == null) {
                    continue;
@@ -1264,9 +1277,12 @@
//                // 入出库模式判断
//                if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
                if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; }
                if ( emptyInSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; }
//                if ( emptyInSta.getStaNo()==203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { continue; }
//                if ( emptyInSta.getStaNo()==402 && devpThread.ioModeOf4F == IoModeType.PAKOUT_MODE) { continue; }
                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 (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) {
@@ -1429,7 +1445,7 @@
//                ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
                if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10 ) {
                    List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())));
                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(),wrkDetl.getSpecs())));
                }
                commands.add(ledCommand);
            }
@@ -1442,15 +1458,15 @@
            }
            // 命令下发 -------------------------------------------------------------------------------
            if (!commands.isEmpty()) {
                if (led.getId() == 7) {
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
                if (led.getId()>4){
                    if (!MessageQueue.offer(SlaveType.Led, led.getId()-4, 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))) {
                }else {
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
                        log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                        continue;
                    } else {
@@ -1532,20 +1548,10 @@
            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 {
                    }
                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 {
                    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 {
                    }
                }
            }
        }
@@ -1769,7 +1775,10 @@
                        continue;
                    }
                    LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn.getId());
                    LocMast sourceLoc = locMastService.queryDemoSourceLoc0(crn.getId());
                    if(sourceLoc == null){
                        locMastService.queryDemoSourceLoc(crn.getId());
                    }
                    LocMast loc = locMastService.queryDemoLoc(crn.getId());
                    if (null == sourceLoc || null == loc) {
                        continue;
@@ -1927,7 +1936,7 @@
                                devpThread.ioModeOf1F = IoModeType.PAKIN_MODE;
                            }
                            break;
                        case 103://1F
                        case 103://2F
                            if (pakout != null) {
                                if (devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {
                                    // 出库切换中
@@ -1945,7 +1954,7 @@
                                devpThread.ioModeOf2F = IoModeType.PAKIN_MODE;
                            }
                            break;
                        case 105://1F
                        case 105://3F
                            if (pakout != null) {
                                if (devpThread.ioModeOf3F != IoModeType.PAKOUT_MODE) {
                                    // 出库切换中
@@ -1963,7 +1972,7 @@
                                devpThread.ioModeOf3F = IoModeType.PAKIN_MODE;
                            }
                            break;
                        case 107://1F
                        case 107://4F
                            if (pakout != null) {
                                if (devpThread.ioModeOf4F != IoModeType.PAKOUT_MODE) {
                                    // 出库切换中