From fcb71b8fc63f74cd00d3faa76c73f4c5566ee352 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期三, 07 五月 2025 23:23:09 +0800
Subject: [PATCH] 解决提升机在本层,而没有锁提升机的问题
---
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java | 59 ++++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
index bcbe6e4..b743284 100644
--- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -30,7 +30,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import javax.rmi.CORBA.Util;
import java.util.*;
/**
@@ -363,7 +362,7 @@
/**
* 璋冨害杞﹁締
*/
- public boolean searchDispatchShuttleNoLift(Integer wrkNo, String sourceLocNo, String locNo, String flag) {
+ public synchronized boolean searchDispatchShuttleNoLift(Integer wrkNo, String sourceLocNo, String locNo, String flag) {
ArrayList<ShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
int lev1 = 0;
boolean tongLev = false;
@@ -389,6 +388,10 @@
continue;//灏忚溅琚鐢�
}
}
+ WrkMast wrkMast = wrkMastService.selectByShuttleNo(basShuttle.getShuttleNo());
+ if(wrkMast!=null){
+ continue;
+ }
diffLev.add(shuttleThread);
if (lev1 != 0) {
if (lev1 == Utils.getLev(shuttleProtocol.getCurrentLocNo())) {
@@ -399,7 +402,7 @@
}
}
- //瀵绘壘绂讳换鍔℃ゼ灞傛渶杩戠殑绌挎杞�(涓嶈�冭檻璺ㄦゼ灞傚皬杞︾Щ鍔ㄨ窛绂�)
+ //
if (!diffLev.isEmpty()) {
Map<Integer, ShuttleThread> diffShuttles = new TreeMap<>();//鑷劧鎺掑簭灏忚溅Map
//鑾峰彇浠诲姟
@@ -420,11 +423,11 @@
//妫�娴嬬洰鏍囨ゼ灞傝溅鏁伴噺鏄惁灏忎簬鍏佽鐨勬渶澶ф暟閲�
- boolean checkDispatchMaxNum = checkDispatchMaxNum(lev);
- if (!checkDispatchMaxNum) {
- News.info("{}浠诲姟锛寋}灞傦紝宸茬粡杈惧埌褰撳墠妤煎眰璋冨害杞﹁締鏈�澶у��", wrkMast1.getWrkNo(), lev);
- return false;
- }
+// boolean checkDispatchMaxNum = checkDispatchMaxNum(lev);
+// if (!checkDispatchMaxNum) {
+// News.info("{}浠诲姟锛寋}灞傦紝宸茬粡杈惧埌褰撳墠妤煎眰璋冨害杞﹁締鏈�澶у��", wrkMast1.getWrkNo(), lev);
+// return false;
+// }
for (ShuttleThread shuttleThread : diffLev) {
ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
@@ -434,25 +437,35 @@
if (wrkMast1.getIoType() == 101 && currentLocNo.equals(locNo)) {
//杞﹁締褰撳墠浣嶇疆宸茬粡鏄洰鏍囧簱浣嶏紝璋冨害璇ヨ溅
//缁欏伐浣滄。缁戝畾灏忚溅鍙�
- diffShuttles.put(-1, shuttleThread);
+ diffShuttles.put(-2, shuttleThread);
} else {
- if (tongLev) {
- //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
- List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleProtocol.getShuttleNo(), Utils.getLev(currentLocNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
- if (currentShuttlePath == null) {
- continue;
- }
- Integer currentAllDistance = navigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
- diffShuttles.put(currentAllDistance, shuttleThread);
- } else {
- //ABS(鐩爣妤煎眰 - 褰撳墠妤煎眰) 寰楀埌宸窛锛屽彇鏈�灏忓樊鍊�
- int currentValue = Math.abs(lev - currentLev);
- if (diffShuttles.get(currentValue) != null) {
+// if (tongLev && diffLev.size() >= 2) {
+// //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
+// List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleProtocol.getShuttleNo(), Utils.getLev(currentLocNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
+// if (currentShuttlePath == null) {
+// continue;
+// }
+// Integer currentAllDistance = navigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+// diffShuttles.put(currentAllDistance, shuttleThread);
+// } else {
+ //ABS(鐩爣妤煎眰 - 褰撳墠妤煎眰) 寰楀埌宸窛锛屽彇鏈�灏忓樊鍊�
+ int currentValue = Math.abs(lev - currentLev);
+ if (diffShuttles.get(currentValue) != null) {
+ try {
+ List<NavigateNode> currentShuttlePath = navigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleProtocol.getShuttleNo(), Utils.getLev(currentLocNo)), null);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
+ if (currentShuttlePath == null) {
+ continue;
+ }
+ Integer currentAllDistance = navigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ diffShuttles.put(currentAllDistance, shuttleThread);
+ diffShuttles.put(currentValue - 1, shuttleThread);
+ } catch (Exception e) {
diffShuttles.put(currentValue + 1, shuttleThread);
- } else {
- diffShuttles.put(currentValue, shuttleThread);
}
+ } else {
+ diffShuttles.put(currentValue, shuttleThread);
}
+ // }
}
}
--
Gitblit v1.9.1