From f392f9d594095738ba4d82885251de40b752f843 Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期五, 26 一月 2024 15:02:55 +0800 Subject: [PATCH] 代码更新 --- springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java | 43 +++++++++++++++++++------------------------ 1 files changed, 19 insertions(+), 24 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java index 6e6ef8a..4367d0b 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java +++ b/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,45 +53,32 @@ 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); + // // 璋冪敤initbit鏂规硶 + // PlcParameterObject PlcframeObject= initUtil.initword(jsonFilePath3); + PlcParameterObject PlcReadObjects=PlcReadObject; + // readAndUpdateWordValues(PlcReadObject); + // readAndUpdateWordValues(PlcMesObject); // readAndUpdateWordValues(PlcframeObject); - - - // readAndUpdateWordValues(plcStateObject); int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); - //System.out.println(index); + // System.out.println(index); PlcMesObject.getPlcParameter("AddStart").getAddress(index); - //System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); + // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); List<String> addresses = new ArrayList<>(); addresses.add("FeedID"); addresses.add("AddStart"); - //System.out.println(addresses); - //System.out.println(PlcMesObject.getPlcParameterValues(addresses)); + // System.out.println(addresses); + // System.out.println(PlcMesObject.getPlcParameterValues(addresses)); List<String> addresses2 = new ArrayList<>(); addresses2.add("FeedID"); addresses2.add("FeedCarStatus"); System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); - - - } } -- Gitblit v1.8.0