lty
2025-05-21 ce7a8f994eead6c0c982afa01919427685b2bd1c
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -87,7 +87,6 @@
    }};
    public static final ArrayList<Integer> staNoWeight1 = new ArrayList<Integer>() {{
        add(123);
        add(223);add(225);add(228);add(231);
    }};
@@ -267,13 +266,15 @@
    private void read() throws InterruptedException {
//        // 更新入出库模式
//        updateIoMode();
//        if (slave.getId()==1) return;
        ArrayList<Integer> staNos = getStaNo();
        ArrayList<Integer> staNosErrList = getStaNoErr();
        ArrayList<Integer> staNoWeight = getStaNoWeight();
        int staNoSize = staNos.size();
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (500 * 8));
        OperateResultExOne<byte[]> resultWeight = siemensS7Net.Read("DB102.0", (short) (10 * 4));
        OperateResultExOne<byte[]> resultWeight1 = siemensS7Net.Read("DB102.8", (short) (10));
        OperateResultExOne<byte[]> resultWeight = siemensS7Net.Read("DB102.0", (short)  (8 * 4));
        OperateResultExOne<byte[]> resultWeight2 = siemensS7Net.Read("DB102.0", (short)  (4 * 4));
        if (result.IsSuccess && resultWeight.IsSuccess) {
            int j = 0;
@@ -290,8 +291,14 @@
                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result.Content, offset));     // 工作号
                if (staNoWeight.contains(siteId)) {
                    staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight.Content, j));
                    j = j + 4;
                    if(staNoWeight.size() == 4){
                        staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight2.Content, j));
                        j = j + 4;
                    }else{
                        staProtocol.setWeight(siemensS7Net.getByteTransform().TransInt32(resultWeight.Content, j));
                        j = j + 4;
                    }
                }
                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, offset+ 4));   // 目标站
                status = siemensS7Net.getByteTransform().TransBool(result.Content, offset+ 6, 2);
@@ -333,6 +340,11 @@
                    Integer siteId = staNoErrs.get(i); // 站点编号
                    boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i * 4 + 2, 1);
                    StaProtocol staProtocol = station.get(siteId);
                    if (staProtocol == null) {
                        staProtocol = new StaProtocol();
                        staProtocol.setSiteId(siteId);
                        station.put(siteId, staProtocol);
                    }
                    staProtocol.setFrontErr(status[0]);
                    staProtocol.setBackErr(status[1]);
                    staProtocol.setHighErr(status[2]);