From 314e894c0d6ce2739344dcd1c94ae7770868a0f1 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 28 五月 2025 14:51:16 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java index a23d30f..e795ce3 100644 --- a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java +++ b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java @@ -285,6 +285,25 @@ } @Override + public CommandResponse move(ForkLiftCommand command) { + CommandResponse response = new CommandResponse(false); + + short[] array = new short[4]; + array[0] = command.getTaskNo();//浠诲姟鍙� + array[1] = command.getMode();//浠诲姟妯″紡 + array[2] = command.getPick();//鍙栬揣鏁版嵁 + array[3] = command.getPut();//鏀捐揣鏁版嵁 + OperateResult result = siemensS7Net.Write("DB103.0", array); + if (result.IsSuccess) { + OperateResult result2 = siemensS7Net.Write("DB103.8", command.getConfirm()); + if (result2.IsSuccess) { + response.setResult(true); + } + } + return response; + } + + @Override public CommandResponse reset() { CommandResponse response = new CommandResponse(false); OperateResult result = siemensS7Net.Write("DB103.10", (short) 1); @@ -300,6 +319,7 @@ if (this.forkLiftProtocol.getTaskNo() == null || this.forkLiftProtocol.getProtocolStatus() == null || this.forkLiftProtocol.getModel() == null + || this.forkLiftProtocol.getErrorCode() == null ) { return false; } @@ -307,7 +327,9 @@ boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id && this.forkLiftProtocol.getWrkNo() == 0 && this.forkLiftProtocol.getTaskNo() == 0 - && this.forkLiftProtocol.getModel() == 2; + && this.forkLiftProtocol.getModel() == 2 + && this.forkLiftProtocol.getErrorCode() == 0 + ; return res; } @@ -328,13 +350,16 @@ if (this.forkLiftProtocol.getTaskNo() == null || this.forkLiftProtocol.getProtocolStatus() == null || this.forkLiftProtocol.getModel() == null + || this.forkLiftProtocol.getErrorCode() == null ) { return false; } boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id && this.forkLiftProtocol.getWrkNo() == 0 - && this.forkLiftProtocol.getModel() == 2; + && this.forkLiftProtocol.getModel() == 2 + && this.forkLiftProtocol.getErrorCode() == 0 + ; return res; } @@ -399,6 +424,24 @@ return commands; } + @Override + public List<ForkLiftCommand> getMoveCommand(Integer taskNo, Integer pick, Integer put) { + Integer realPick = pick % 1000; + Integer realPut = put % 1000; + + List<ForkLiftCommand> commands = new ArrayList<>(); + ForkLiftCommand command = new ForkLiftCommand(); + command.setLiftNo(slave.getId()); + command.setTaskNo(taskNo.shortValue()); + command.setMode(ForkLiftTaskModeType.MOVE.id.shortValue()); + command.setPick(realPick.shortValue()); + command.setPut(realPut.shortValue()); + command.setConfirm((short) 1); + + commands.add(command); + return commands; + } + /** * 鎵╁睍瀛楁 */ -- Gitblit v1.9.1