ZengTao
2024-01-26 90e0a2c1a18ef254ca0c1863df59e39b98b8e885
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java
@@ -50,32 +50,35 @@
            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();
            System.out.println(jsonFilePath);
            // 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(PlcframeObject);
            readAndUpdateWordValues(PlcMesObject);
             PlcParameterObject  PlcReadObject= initUtil.initword(jsonFilePath2);
            //  // 调用initbit方法
            // PlcParameterObject  PlcframeObject= initUtil.initword(jsonFilePath3);
            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("FeedCarStatus");
            addresses.add("OutRequest");
            System.out.println(PlcReadObject.getPlcParameterValues(addresses));
            addresses.add("FeedID");
            addresses.add("AddStart");
            //System.out.println(addresses);
            //System.out.println(PlcMesObject.getPlcParameterValues(addresses));
            List<String> addresses2 = new ArrayList<>();
            addresses2.add("conveyorVelocity(AutoSLOW)");
            addresses2.add("D01.SRdec");
            addresses2.add("FeedID");
            addresses2.add("FeedCarStatus");
            System.out.println(PlcReadObject.getPlcParameterValues(addresses2));