严智鑫
2025-03-21 f1fdf0c1e332227dd41c8d85411b2edc9744b65e
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7object.java
@@ -13,8 +13,8 @@
 */
public class S7object extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型
    private String ip = "192.168.10.11"; // plc ip地址
    private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型
    private String ip = "172.17.125.130"; // plc ip地址
    private int port = 102; // plc 端口号
@@ -26,7 +26,6 @@
            plccontrol = new S7control(plcType, ip, port, 0, 0);
            String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCacheGlass.json";
//            String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath();
            System.out.println("Load Glass File: " + PlcLoadGlass);
            PlcMesObject = InitUtil.initword(PlcLoadGlass);
        }
    }
@@ -48,11 +47,9 @@
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
            if (getplcvlues != null) {
                PlcMesObject.setPlcParameterList(getplcvlues);