ZengTao
2024-01-26 f392f9d594095738ba4d82885251de40b752f843
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java
@@ -35,6 +35,14 @@
        return instance;
    }
    private static String jsonFilePath = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath();
    private static String jsonFilePath2 = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath();
    // 调用initword方法
    public static PlcParameterObject PlcMesObject = initUtil.initword(jsonFilePath);
    // 调用initbit方法
    public static PlcParameterObject PlcReadObject = initUtil.initword(jsonFilePath2);
    @Override
    public void run() {
        while (this != null) {
@@ -45,26 +53,16 @@
                e.printStackTrace();
            }
            String jsonFilePath = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath();
            String jsonFilePath2 = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath();
            // String jsonFilePath3 = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath();
            // String jsonFilePath3 =
            // PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath();
            // System.out.println(jsonFilePath);
            // 调用initword方法
            PlcParameterObject  PlcMesObject= initUtil.initword(jsonFilePath);
            // 调用initbit方法
             PlcParameterObject  PlcReadObject= initUtil.initword(jsonFilePath2);
            //  // 调用initbit方法
            // PlcParameterObject  PlcframeObject= initUtil.initword(jsonFilePath3);
            readAndUpdateWordValues(PlcReadObject);
            readAndUpdateWordValues(PlcMesObject);
            PlcParameterObject PlcReadObjects=PlcReadObject;
            // readAndUpdateWordValues(PlcReadObject);
            // readAndUpdateWordValues(PlcMesObject);
            // readAndUpdateWordValues(PlcframeObject);
            
            // readAndUpdateWordValues(plcStateObject);
            int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex();
@@ -81,9 +79,6 @@
            addresses2.add("FeedCarStatus");
            System.out.println(PlcReadObject.getPlcParameterValues(addresses2));
        }
    }