1
zhang
2025-07-21 343ee21510a9c9609e9c73c8c7073540b6caad19
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -54,7 +54,10 @@
    }};
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
        add(300);add(301);add(302);add(303);add(304);
        add(311);add(312);add(313);add(314);add(315);
    }};
    public static final ArrayList<Integer> barcode1 = new ArrayList<Integer>() {{
        add(1); add(2);
@@ -62,6 +65,10 @@
    public static final ArrayList<Integer> barcode2 = new ArrayList<Integer>() {{
       add(3);
    }};
    public static final ArrayList<Integer> barcode3 = new ArrayList<Integer>() {{
        add(4);
    }};
    private Integer count=0;
@@ -163,6 +170,8 @@
                return barcode1;
            case 2:
                return barcode2;
            case 3:
                return barcode3;
            default:
                throw new CoolException("获取条码扫描器失败!");
        }
@@ -224,7 +233,7 @@
                }
            } else {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
                log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort());
//                log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort());
            }
            //条码扫描器
@@ -271,14 +280,14 @@
                }
            } else {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
                log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort());
//                log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort());
            }
            //外形检测
            OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.42", (short) 8);
            if (resultErr.IsSuccess) {
                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, 0, 1);
                StaProtocol staProtocol = station.get(303);
                StaProtocol staProtocol = station.get(304);
                staProtocol.setFrontErr(status[0]);
                staProtocol.setBackErr(status[1]);
                staProtocol.setHighErr(status[2]);
@@ -306,6 +315,7 @@
        }
        // 根据实时信息更新数据库
        try {
            if (!station.isEmpty()) {
            List<BasDevp> basDevps = new ArrayList<>();
            for (Integer siteId : staNos) {
                StaProtocol staProtocol = station.get(siteId);
@@ -316,6 +326,7 @@
            if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
                throw new Exception("更新数据库数据失败");
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));