自动化立体仓库 - WCS系统
#
Junjie
2023-09-04 3f48e38eeaf31f85ec8b68489c8079800ca65e0f
src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -87,6 +87,10 @@
    private void read() {
        try {
            if (this.socket == null || !this.socket.isConnected()) {
                //链接断开重新链接
                this.connect();
            }
            readStatus();
            //四向穿梭车空闲、有任务、标记为true、存在任务指令,需要执行任务的下一条指令
            if (shuttleProtocol.getFree() == ShuttleStatusType.IDLE.id
@@ -111,11 +115,10 @@
            //----------读取四向穿梭车状态-----------
            NyShuttleHttpCommand readStatusCommand = NyHttpUtils.getReadStatusCommand(slave.getId());
            JSONObject result = NyHttpUtils.requestCommand(socket, readStatusCommand);
            if (result == null) {
            JSONObject jsonObject = NyHttpUtils.requestCommand(socket, readStatusCommand);
            if (jsonObject == null) {
                OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向穿梭车plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
            }else {
                JSONObject jsonObject = NyHttpUtils.filterData(result);
                //手动状态/自动状态
                shuttleProtocol.setWorkingMode(jsonObject.getInteger("workingMode"));
                //允许状态 0:运行中1:空闲
@@ -249,6 +252,7 @@
        try {
            Socket socket = new Socket(slave.getIp(),slave.getPort());
            socket.setSoTimeout(60000);
            socket.setKeepAlive(true);
            this.socket = socket;
        } catch (IOException e) {
            OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向穿梭车Socket链接失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));