自动化立体仓库 - WCS系统
#
luxiaotao1123
2021-01-04 d7ad1041d05544fdd364a7670ba088e4a5f8768b
#
1个文件已修改
54 ■■■■■ 已修改文件
src/main/java/com/zy/core/thread/SiemensDevpThread.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -45,17 +45,6 @@
        add(200);add(201);add(202);add(203);add(204);add(205);
    }};
    public static void main(String[] args) {
        for (Integer siteId : staNos) {
            int divides = (int) Arith.divides(0, siteId, 100);
            int remainder = (int) Arith.remainder(siteId, 100);
            int index = ((divides - 1) * 50) + remainder;
//            System.out.print(siteId + " 任务地址 : " + index*2);
//            System.out.print(" 目标地址 : " + (index*2+200) );
            System.out.println(siteId + " 状态 : " + (index*2) );
        }
    }
    public SiemensDevpThread(DevpSlave slave) {
        this.slave = slave;
    }
@@ -83,9 +72,8 @@
                    default:
                        break;
                }
                // 心跳
                heartbeat();
//                heartbeat();
                Thread.sleep(400);
            } catch (Exception e) {
                e.printStackTrace();
@@ -243,25 +231,25 @@
        siemensS7Net.ConnectClose();
    }
//    public static void main(String[] args) throws Exception {
//        DevpSlave slave = new DevpSlave();
//        slave.setIp("192.168.2.125");
//        SiemensDevpThread devpThread = new SiemensDevpThread(slave);
//        devpThread.connect();
//        devpThread.read();
//        // 写
//        StaProtocol staProtocol = devpThread.getStation().get(1);
//        staProtocol.setWorkNo((short) 232);
//        staProtocol.setStaNo((short) 6);
//        staProtocol.setAutoing(true);
//        staProtocol.setEmptyMk(true);
//        staProtocol.setInEnable(true);
//        devpThread.write(staProtocol);
//        System.out.println("----------------------------------------");
//        // 读
//        devpThread.read();
//        System.out.println(JSON.toJSONString(devpThread.station));
//
//    }
    public static void main(String[] args) throws Exception {
        DevpSlave slave = new DevpSlave();
        slave.setIp("192.168.2.125");
        SiemensDevpThread devpThread = new SiemensDevpThread(slave);
        devpThread.connect();
        devpThread.read();
        // 写
        StaProtocol staProtocol = devpThread.getStation().get(1);
        staProtocol.setWorkNo((short) 232);
        staProtocol.setStaNo((short) 6);
        staProtocol.setAutoing(true);
        staProtocol.setEmptyMk(true);
        staProtocol.setInEnable(true);
        devpThread.write(staProtocol);
        System.out.println("----------------------------------------");
        // 读
        devpThread.read();
        System.out.println(JSON.toJSONString(devpThread.station));
    }
}