野心家
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);
                        }
@@ -303,7 +305,7 @@
                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)
@@ -370,7 +372,7 @@
                }
                staProtocol.setPakMk(true);
//                staProtocol.setPakMk(true);
//                // 入出库模式判断
//                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){
@@ -775,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;
@@ -1438,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);
            }
@@ -1451,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 {
@@ -1541,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 {
                    }
                }
            }
        }
@@ -1778,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;