自动化立体仓库 - WCS系统
#
luxiaotao1123
2020-08-14 84cffa40e13a64d8b91e393fd44e09c973d7ee99
src/main/java/com/zy/core/thread/DevpThread.java
@@ -56,7 +56,7 @@
                    default:
                        break;
                }
                Thread.sleep(3000);
                Thread.sleep(400);
            } catch (Exception e) {
                e.printStackTrace();
            }
@@ -75,7 +75,7 @@
            result = true;
            log.info("输送线plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
        } else {
            log.info("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
            log.error("输送线plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
        }
        siemensS7Net.ConnectClose();
        return result;
@@ -106,7 +106,6 @@
                staProtocol.setInEnable(status[2]); // 可入
                staProtocol.setOutEnable(status[3]);// 可出
                staProtocol.setEmptyMk(status[4]);  // 空板信号
            }
        }
    }
@@ -119,7 +118,6 @@
            return;
        }
        OperateResult write = siemensS7Net.Write("DB100." + (staProtocol.getSiteId() - 1) * 2, staProtocol.getWorkNo());    // 工作号
        System.out.println(((staProtocol.getSiteId() - 1) * 2) + 20);
        OperateResult write1 = siemensS7Net.Write("DB100." + ((staProtocol.getSiteId() - 1) * 2 + 20), staProtocol.getStaNo());    // 目标站
        boolean[] status = new boolean[8];
        status[0] = staProtocol.isAutoing();
@@ -135,22 +133,21 @@
    @Override
    public void close() {
        siemensS7Net.ConnectClose();
    }
    public static void main(String[] args) {
        Slave slave = new Slave();
        slave.setIp("192.168.2.125");
        DevpThread devpThread = new DevpThread(slave);
        boolean connect = devpThread.connect();
        System.out.println(connect);
        devpThread.read();
        // 写
        StaProtocol staProtocol = devpThread.getStation().get(1);
        staProtocol.setWorkNo((short) 9999);
        staProtocol.setStaNo((short) 100);
        staProtocol.setAutoing(false);
        staProtocol.setEmptyMk(false);
        StaProtocol staProtocol = devpThread.getStation().get(2);
        staProtocol.setWorkNo((short) 0);
        staProtocol.setStaNo((short) 1001);
        staProtocol.setAutoing(true);
        staProtocol.setEmptyMk(true);
        staProtocol.setInEnable(true);
        devpThread.write(staProtocol);
        System.out.println("----------------------------------------");
        // 读