pang.jiabao
2024-10-26 bbf283177eee80b573b583f2e29e62531eaf7f0a
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -205,15 +205,17 @@
                    //过滤判断,防止拣料再入库货物,经过入库站再入库时,被退回到退库站
                    WrkMast wrkMast1 = wrkMastMapper.selectPakInStepBarcode(barcode);
                    if (wrkMast1 !=null){
                        if (wrkMast1.getIoType()==103 || wrkMast1.getIoType()==107 || wrkMast1.getIoType()==104){
                        if (wrkMast1.getIoType()==103 || wrkMast1.getIoType() == 53 || wrkMast1.getIoType()==107 || wrkMast1.getIoType()== 57 || wrkMast1.getIoType()==104){
                            continue;
                        }
                    }
                    if (wrkMast != null) {
                        News.warn(""+mark+" - 4"+" - 满托盘入库工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
                        if (devp.getId() == 2) {
                            staProtocol.setWorkNo((short)9999);
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
//                            staProtocol.setWorkNo((short)9999);
//                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
                            staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (!result) {
@@ -224,7 +226,7 @@
                        // led 异常显示
                        if (ledThread != null) {
                            String errorMsg = "工作档已存在该条码号===>>" + barcode;
                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
                        }
                        continue;
                    }
@@ -275,9 +277,9 @@
                                ledCommand.setBarcode(barcode);
                                commands.add(ledCommand);
                                if (devp.getId() == 1) {
                                     if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands))){
                                         ledThread.setLedMk(false);
                                     }
//                                     if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands))){
//                                         ledThread.setLedMk(false);
//                                     }
                                } else {
                                    if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands))){
                                        ledThread.setLedMk(false);
@@ -536,9 +538,9 @@
                    ledCommand.setMatDtos(matDtos);
                    commands.add(ledCommand);
                    if (devp.getId() == 1) {
                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands))) {
                            ledThread.setLedMk(false);
                        }
//                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands))) {
//                            ledThread.setLedMk(false);
//                        }
                    } else {
                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands))){
                            ledThread.setLedMk(false);
@@ -1556,7 +1558,13 @@
                        && staProtocol.isLoading()
                ) {
                    News.warnNoLog(""+mark+" - 0"+" - 开始执行:空栈板初始化入库,叉车入库站放货");
                    // 判断上一个空托入库写入后,线程还读取到,造成重复请求
                    List<WrkMast> wrkMastList = wrkMastMapper.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts",2)
                            .eq("io_type",10).eq("source_sta_no",emptyInSta.getStaNo()));
                    if(!wrkMastList.isEmpty()) {
                        log.warn("查询到一个在设备上走任务:{}",wrkMastList.get(0).getWrkNo());
                        continue;
                    }
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
@@ -1583,7 +1591,6 @@
                                News.errorNoLog(""+mark+" - 1"+" - 更新plc站点信息失败");
                                throw new CoolException("更新plc站点信息失败");
                            }
                            if (ledThread != null) {
                                // 命令集合
                                List<LedCommand> commands = new ArrayList<>();
@@ -1602,16 +1609,16 @@
                                ledCommand.setMatDtos(matDtos);
                                commands.add(ledCommand);
                                if (devp.getId() == 1) {
                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
//                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
                                } else {
                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands));
                                }
//                                ledThread.errorReset();
                            }
                            Thread.sleep(500);
                            Thread.sleep(1000);
                        } else {
                            staProtocol.setWorkNo((short)9991);
                            staProtocol.setStaNo((short)100);
                            staProtocol.setStaNo(emptyInSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (!result) {