野心家
2025-05-08 b427e1d0102d4b3b4263c7c6e572f29f9c50bef9
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -172,7 +172,7 @@
     */
    private void read() throws InterruptedException {
//        // 更新入出库模式
        updateIoMode();
//        updateIoMode();
        ArrayList<Integer> staNos = getStaNo();
        int staNoSize = staNos.size();
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8));
@@ -207,6 +207,7 @@
        //外形检测
        OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.702.0", (short) (barcodeSize*1));
        if(resultErr1.IsSuccess){
        StaProtocol staProtocol1 = station.get(101);
        boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, 0, 1);
        staProtocol1.setFrontErr(status1[0]);
@@ -216,6 +217,8 @@
        staProtocol1.setRightErr(status1[4]);
        staProtocol1.setWeightErr(status1[5]);
        staProtocol1.setBarcodeErr(status1[6]);
        }
        Thread.sleep(200);
        if(slave.getId()==1) {
@@ -291,33 +294,7 @@
        }
    }
    // 更新入出库模式
    private void updateIoMode() throws InterruptedException {
        if (this.ioModeOf1F != IoModeType.NONE) {
            if (!siemensS7Net.Write("DB100.80", this.ioModeOf1F.id).IsSuccess) {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F1入出库模式失败。输送线plc编号={1}", slave.getId()));
                log.error("写入输送线1F入出库模式失败。输送线plc编号={}", slave.getId());
            }
        }
        if (this.ioModeOf2F != IoModeType.NONE) {
            if (!siemensS7Net.Write("DB100.82", this.ioModeOf2F.id).IsSuccess) {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F2入出库模式失败。输送线plc编号={1}", slave.getId()));
                log.error("写入输送线2F入出库模式失败。输送线plc编号={}", slave.getId());
            }
        }
        if (this.ioModeOf3F != IoModeType.NONE) {
            if (!siemensS7Net.Write("DB100.84", this.ioModeOf3F.id).IsSuccess) {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F3入出库模式失败。输送线plc编号={1}", slave.getId()));
                log.error("写入输送线3F入出库模式失败。输送线plc编号={}", slave.getId());
            }
        }
        if (this.ioModeOf4F != IoModeType.NONE) {
            if (!siemensS7Net.Write("DB100.86", this.ioModeOf4F.id).IsSuccess) {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F4入出库模式失败。输送线plc编号={1}", slave.getId()));
                log.error("写入输送线4F入出库模式失败。输送线plc编号={}", slave.getId());
            }
        }
    }
    /**
     * 心跳