From 80523e92e25ba762a3fe737ef7997f7e831890a0 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 01 十月 2023 09:49:19 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java | 43 +++++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
index 3d84c4f..138a943 100644
--- a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
@@ -87,6 +87,7 @@
if (wrkMast1 != null) {
wrkMast1.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
wrkMastMapper.updateById(wrkMast1);
+ return true;
}
break;
}
@@ -123,29 +124,31 @@
}
}else {
//鍚屼竴妤煎眰锛屾病鏈夌┖闂茬┛姊溅锛屽彧鑳戒粠鍏朵粬妤煎眰璋冨害
- //瀵绘壘绂讳换鍔℃渶杩戠殑绌挎杞�
- for (NyShuttleThread shuttleThread : diffLev) {
+ //瀵绘壘绂讳换鍔℃ゼ灞傛渶杩戠殑绌挎杞�(涓嶈�冭檻璺ㄦゼ灞傚皬杞︾Щ鍔ㄨ窛绂�)
- //褰撳墠绌挎杞﹀簱浣嶅彿
- String currentLocNo = shuttleThread.getShuttleProtocol().getCurrentLocNo();
- int currentLev = Utils.getLev(currentLocNo);
- List<WrkMast> wrkMasts1 = wrkMastService.selectNoShuttleWrkByLev(currentLev);//鍒ゆ柇褰撳墠绌挎杞︽ゼ灞傛槸鍚︽湁寰呭垎閰嶈溅杈嗙殑浠诲姟锛屽鏋滄湁鍒欎笉鍒嗛厤杩欒締杞�
- if (wrkMasts1.size() > 0) {
- //瀛樺湪鍏朵粬浠诲姟锛岃烦杩囪繖杈嗚溅
- continue;
- }
+ //鑾峰彇浠诲姟
+ WrkMast wrkMast1 = wrkMastMapper.selectByWorkNo(wrkNo);
- //褰撳墠绌挎杞︾嚎绋嬪埌褰撳墠杞﹀瓙鎵�鍦ㄦゼ灞傜殑鎻愬崌鏈哄彛璺濈
- List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, Utils.levToOutInStaLocNo(currentLev), NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), currentLev));//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
- if (currentShuttlePath == null) {
- continue;
- }
+ if (wrkMast1 != null) {
+ int lev = Utils.getLev(wrkMast1.getLocNo());//鐩爣妤煎眰
+ int recentValue = 99999;//鏈�灏忓樊鍊�
+ for (NyShuttleThread shuttleThread : diffLev) {
+ //褰撳墠绌挎杞﹀簱浣嶅彿
+ String currentLocNo = shuttleThread.getShuttleProtocol().getCurrentLocNo();
+ int currentLev = Utils.getLev(currentLocNo);
+ List<WrkMast> wrkMasts1 = wrkMastService.selectNoShuttleWrkByLev(currentLev);//鍒ゆ柇褰撳墠绌挎杞︽ゼ灞傛槸鍚︽湁寰呭垎閰嶈溅杈嗙殑浠诲姟锛屽鏋滄湁鍒欎笉鍒嗛厤杩欒締杞�
+ if (wrkMasts1.size() > 0) {
+ //瀛樺湪鍏朵粬浠诲姟锛岃烦杩囪繖杈嗚溅
+ continue;
+ }
- Integer currentAllDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
- if (currentAllDistance < recentAllDistance) {
- //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠┛姊溅
- recentShuttle = shuttleThread;
- recentAllDistance = currentAllDistance;
+ //ABS(鐩爣妤煎眰 - 褰撳墠妤煎眰) 寰楀埌宸窛锛屽彇鏈�灏忓樊鍊�
+ int currentValue = Math.abs(lev - currentLev);
+ if (currentValue < recentValue) {
+ //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠┛姊溅
+ recentShuttle = shuttleThread;
+ recentValue = currentValue;
+ }
}
}
}
--
Gitblit v1.9.1