pjb
2024-06-27 3160d2eb5f67ecb48b9c951b0ca974eade2040a5
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -206,14 +206,16 @@
                            continue;
                        }
                    }
                    if (wrkMast != null && devp.getId() == 2) {
                    if (wrkMast != null) {
                        News.warn(""+mark+" - 4"+" - 工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
                        staProtocol.setWorkNo((short)9999);
                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        if (!result) {
                            throw new CoolException("更新plc站点信息失败");
                        if (devp.getId() == 2) {
                            staProtocol.setWorkNo((short)9999);
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (!result) {
                                throw new CoolException("更新plc站点信息失败");
                            }
                        }
                        // led 异常显示
@@ -264,7 +266,11 @@
                                ledCommand.setStaNo(dto.getStaNo());
                                ledCommand.setBarcode(barcode);
                                commands.add(ledCommand);
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands));
                                if (devp.getId() == 1) {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands));
                                } else {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands));
                                }
//                                ledThread.errorReset();
                            }
                        } else {
@@ -447,10 +453,12 @@
                    StaDesc staDesc = staDescService.selectOne(wrapper);
                    if (Cools.isEmpty(staDesc)) {
                        News.error(""+mark+" - 2"+" - 入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
                        staProtocol.setWorkNo((short) 9999);
                        staProtocol.setStaNo(pickSta.getBackSta().shortValue());
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        if (devp.getId() == 2) {
                            staProtocol.setWorkNo((short) 9999);
                            staProtocol.setStaNo(pickSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        }
                        //LED
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
                        // led 异常显示
@@ -499,6 +507,20 @@
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                        continue;
                    }
                    List<LedCommand> commands = new ArrayList<>();
                    LedCommand ledCommand = new LedCommand();
                    ledCommand.setWorkNo(wrkMast.getWrkNo());
                    ledCommand.setIoType(wrkMast.getIoType());
                    ledCommand.setTitle(wrkMast.getIoType() == 53 ? "拣料再入库" : "盘点再入库");
                    ledCommand.setLocNo(wrkMast.getLocNo());
                    ledCommand.setStaNo(wrkMast.getStaNo());
                    ledCommand.setBarcode(barcode);
                    commands.add(ledCommand);
                    if (devp.getId() == 1) {
                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands));
                    } else {
                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands));
                    }
                    // 更新站点信息 且 下发plc命令
@@ -1546,12 +1568,17 @@
                                // 组装命令
                                LedCommand ledCommand = new LedCommand();
                                ledCommand.setWorkNo(dto.getWorkNo());
                                ledCommand.setIoType(1);
                                ledCommand.setTitle("全板入库");
                                ledCommand.setIoType(10);
                                ledCommand.setTitle("空板入库");
                                ledCommand.setLocNo(dto.getLocNo());
                                ledCommand.setStaNo(dto.getStaNo());
                                ledCommand.setBarcode("");
                                commands.add(ledCommand);
                                MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands));
                                if (devp.getId() == 1) {
                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
                                } else {
                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands));
                                }
//                                ledThread.errorReset();
                            }
                        } else {
@@ -1600,6 +1627,9 @@
            // 工作档集合
            List<WrkMast> wrkMasts = new ArrayList<>();
            for (Integer staNo : led.getStaArr()) {
                if (staNo == 104 || staNo == 204) {
                    continue;
                }
                // 获取叉车站点
                StaProtocol staProtocol = devpThread.getStation().get(staNo);
                if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) {
@@ -1745,11 +1775,20 @@
            // led显示默认内容
            if (reset && !ledThread.isLedMk()) {
                ledThread.setLedMk(true);
                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
                    News.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                } else {
                if (led.getId() <=2 ) {
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
                        News.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                    } else {
                    }
                } else {
                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
                        News.error(""+mark+" - 1"+" - {}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                    } else {
                    }
                }
            }
        }
        News.infoNoLog(""+mark+" - 0"+" - 执行完成:其他  ===>> LED显示器复位,显示默认信息");
@@ -2325,4 +2364,16 @@
        }
    }
    public void resetOneLed() {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) { //遍历输送线
            if (devp.getId() == 1) {
                // 遍历入库口
                for (DevpSlave.Sta inSta : devp.getInSta()) {  // 遍历入库口
                    SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                    StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                }
            }
        }
    }
}