wuyouming666
2024-03-26 0b30ecf9d6581b4e7a6f7b397ced716acaeaefc0
UnLoadGlassModule/src/main/java/com/mes/tools/InitUtil.java
@@ -2,7 +2,6 @@
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.mes.common.PlcTools.S7control;
import com.mes.entity.device.PlcBitInfo;
import com.mes.entity.device.PlcBitObject;
import com.mes.entity.device.PlcParameterInfo;
@@ -11,6 +10,8 @@
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class InitUtil {
@@ -107,18 +108,18 @@
//
    public static void readAndUpdateBitValues(PlcBitObject plcBitObject) {
//        Boolean[] values1 = { false, true, true, true, false, false, true, false,
//          false, true ,true };
//         List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1));
        List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength());
        Boolean[] values1 = { false, true, true, true, false, false, true, false,
          false, true ,true };
         List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1));
        //List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength());
        plcBitObject.setPlcBitList(getplcvlues);
    }
    public static void readAndUpdateWordValues(PlcParameterObject plcParameterObject) {
        // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02};
        byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
         byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03,0x03};
       // byte[] getplcvlues = MockS7PLC.getInstance().readByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
        plcParameterObject.setPlcParameterList(getplcvlues);
    }