From 46d68076bfa7b706549e0420dfe09314024e3696 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 22 十一月 2024 21:02:39 +0800
Subject: [PATCH] #读取地图文件优化
---
src/main/java/com/zy/core/thread/NyShuttleThread.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java
index cab5c90..c382847 100644
--- a/src/main/java/com/zy/core/thread/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -172,6 +172,8 @@
shuttleProtocol.setStatusSum(jsonObject.getObject("statusSum", NyShuttleProtocol.StatusSumClass.class));
//闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�
shuttleProtocol.setErrTime(jsonObject.getInteger("errTime"));
+ //鏈�杩戜竴娆″湪绾挎椂闂�
+ shuttleProtocol.setLastOnlineTime(System.currentTimeMillis());
//灏忚溅澶勪簬杩愯涓紝灏嗘爣璁扮疆涓篺alse
if (shuttleProtocol.getFree() == 0) {
@@ -800,7 +802,7 @@
}
}
}
- }else {//璺戝簱浣�
+ } else if (shuttleProtocol.getMoveType() == 1) {//璺戝簱浣�
Integer xCurrent = shuttleProtocol.getXCurrent();
if (xCurrent > shuttleProtocol.getXTarget()) {//褰揦鍊煎ぇ浜嶺鐩爣鍊硷紝杩涜褰掗浂涓擸鏂瑰悜+1
shuttleProtocol.setXCurrent(shuttleProtocol.getXStart());
@@ -824,12 +826,56 @@
//璋冨害鍘荤洰鏍囦綅缃�
if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) {
shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝璺宠繃
- }else {
+ } else {
boolean result = shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(3), target.getLocNo());
if (result) {//璋冨害鎴愬姛
shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);
}
}
+ } else if (shuttleProtocol.getMoveType() == 2) {//姣嶈建閬撳惊鐜窇
+ Integer xCurrent = shuttleProtocol.getXCurrent();
+ Integer yCurrent = shuttleProtocol.getYCurrent();
+
+ String locNo = Utils.getLocNo(xCurrent, yCurrent, lev);
+ //璋冨害鍘荤洰鏍囦綅缃�
+ if (shuttleProtocol.getCurrentLocNo().equals(locNo)) {
+ if (yCurrent.equals(shuttleProtocol.getYStart())) {
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYTarget());//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝鍒囨崲搴撲綅
+ }else {
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYStart());//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝鍒囨崲搴撲綅
+ }
+ } else {
+ boolean result = shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(3), locNo);
+ if (result) {//璋冨害鎴愬姛
+ if (yCurrent.equals(shuttleProtocol.getYStart())) {
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYTarget());//鍒囨崲搴撲綅
+ }else {
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYStart());//鍒囨崲搴撲綅
+ }
+ }
+ }
+ } else if (shuttleProtocol.getMoveType() == 3) {//瀛愯建閬撳惊鐜窇
+ Integer xCurrent = shuttleProtocol.getXCurrent();
+ Integer yCurrent = shuttleProtocol.getYCurrent();
+
+ String locNo = Utils.getLocNo(xCurrent, yCurrent, lev);
+ //璋冨害鍘荤洰鏍囦綅缃�
+ if (shuttleProtocol.getCurrentLocNo().equals(locNo)) {
+ if (xCurrent.equals(shuttleProtocol.getXStart())) {
+ shuttleProtocol.setXCurrent(shuttleProtocol.getXTarget());//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝鍒囨崲搴撲綅
+ }else {
+ shuttleProtocol.setXCurrent(shuttleProtocol.getXStart());//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝鍒囨崲搴撲綅
+ }
+ } else {
+ boolean result = shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(3), locNo);
+ if (result) {//璋冨害鎴愬姛
+ if (xCurrent.equals(shuttleProtocol.getXStart())) {
+ shuttleProtocol.setXCurrent(shuttleProtocol.getXTarget());//鍒囨崲搴撲綅
+ }else {
+ shuttleProtocol.setXCurrent(shuttleProtocol.getXStart());//鍒囨崲搴撲綅
+ }
+ }
+ }
}
}
--
Gitblit v1.9.1