From 09fcc4ec56a1ce6c0fcb308348d8dd5e2c08d336 Mon Sep 17 00:00:00 2001 From: fyxc <fyxc@qq.com> Date: 星期四, 22 五月 2025 14:33:06 +0800 Subject: [PATCH] server commit files --- src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 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 10900c0..03bc4eb 100644 --- a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java +++ b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java @@ -17,7 +17,6 @@ import com.zy.common.utils.RedisUtil; import com.zy.core.News; import com.zy.core.action.ForkLiftAction; -import com.zy.core.action.ShuttleAction; import com.zy.core.cache.OutputQueue; import com.zy.core.enums.ForkLiftIoModeType; import com.zy.core.enums.ForkLiftProtocolStatusType; @@ -33,7 +32,10 @@ import lombok.extern.slf4j.Slf4j; import java.text.MessageFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.List; @Slf4j @SuppressWarnings("all") @@ -67,12 +69,12 @@ siemensS7Net.setRack(slave.getRack().byteValue()); siemensS7Net.setSlot(slave.getSlot().byteValue()); OperateResult connect = siemensS7Net.ConnectServer(); - if(connect.IsSuccess){ + if (connect.IsSuccess) { result = true; - OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); + OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); News.info("璐у弶鎻愬崌鏈鸿繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); } else { - OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); + OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); News.error("璐у弶鎻愬崌鏈鸿繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); } // siemensS7Net.ConnectClose(); @@ -167,7 +169,7 @@ InnerForkLiftExtend forkLiftExtend = (InnerForkLiftExtend) forkLiftProtocol.getExtend(); forkLiftProtocol.setExtend(forkLiftExtend); - }else { + } else { OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆憑1}璇诲彇璐у弶鎻愬崌鏈虹姸鎬佷俊鎭け璐�", DateUtils.convert(new Date()), slave.getId())); } @@ -220,7 +222,7 @@ //璁惧鐘舵�� basLift.setDeviceStatus(JSON.toJSONString(forkLiftProtocol)); if (basLiftService.updateById(basLift)) { - OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), forkLiftProtocol.getLiftNo())); + OutputQueue.FORKLIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛", DateUtils.convert(new Date()), forkLiftProtocol.getLiftNo())); } } catch (Exception e) { @@ -300,6 +302,7 @@ if (this.forkLiftProtocol.getTaskNo() == null || this.forkLiftProtocol.getProtocolStatus() == null || this.forkLiftProtocol.getModel() == null + || this.forkLiftProtocol.getErrorCode() == null ) { return false; } @@ -307,7 +310,8 @@ 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 +332,15 @@ 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; } @@ -365,13 +371,16 @@ @Override public List<ForkLiftCommand> getPickAndPutCommand(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.PICK_PUT.id.shortValue()); - command.setPick(pick.shortValue()); - command.setPut(put.shortValue()); + command.setPick(realPick.shortValue()); + command.setPut(realPut.shortValue()); command.setConfirm((short) 1); commands.add(command); @@ -379,14 +388,17 @@ } @Override - public List<ForkLiftCommand> getShuttleSwitchCommand(Integer taskNo, Integer originLev, Integer targetLev) { + public List<ForkLiftCommand> getShuttleSwitchCommand(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.SHUTTLE_SWITCH.id.shortValue()); - command.setPick(originLev.shortValue()); - command.setPut(targetLev.shortValue()); + command.setPick(realPick.shortValue()); + command.setPut(realPut.shortValue()); command.setConfirm((short) 1); commands.add(command); -- Gitblit v1.9.1