ZengTao
2024-01-31 3614b4f694d9d40708df6477d56a40b9311ad48a
springboot-vue3/src/main/java/com/example/springboot/component/InitUtil.java
@@ -14,6 +14,7 @@
import java.util.List;
public class InitUtil {
    //初始化word
    public static PlcParameterObject initword(String jsonFilePath) {
        try {
            FileReader fileReader = new FileReader(jsonFilePath);
@@ -47,7 +48,8 @@
                plcParameterObject.addPlcParameter(plcParameterInfo);
            }
           // 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());
           // plcParameterObject.setPlcParameterList(getplcvlues);
            return plcParameterObject;
        } catch (IOException e) {
@@ -56,7 +58,7 @@
        return null;
    }
    //初始化bit
    public static PlcBitObject initbit(String jsonFilePath) {
        PlcBitObject plcBitObject = new PlcBitObject();
@@ -93,11 +95,16 @@
        } catch (IOException e) {
            e.printStackTrace();
        }
           //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);
        return plcBitObject;
    }
//
    public static void readAndUpdateBitValues(PlcBitObject plcBitObject) {
//        Boolean[] values1 = { false, true, true, true, false, false, true, false,