From 2acd428a1254175dbf6f0cdb1bdb9772a4f4f938 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 19 六月 2023 17:33:18 +0800
Subject: [PATCH] 提升机状态6,8迁移小车问题
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 94 ++++++++++++++++++++++++----------------------
1 files changed, 49 insertions(+), 45 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 4ed63d7..28d2612 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -10,6 +10,7 @@
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.*;
+import com.zy.common.model.enums.NavigationMapType;
import com.zy.common.model.enums.WrkChargeType;
import com.zy.common.service.CommonService;
import com.zy.common.service.erp.ErpService;
@@ -569,7 +570,7 @@
//鏁版嵁搴撲腑涔熶笉瀛樺湪鍦板浘鏁版嵁锛屼粠鍦板浘鏂囦欢涓幏鍙�
//杞藉叆鍦板浘
NavigateMapData mapData = new NavigateMapData(i);
- List<List<MapNode>> lists = mapData.getJsonData(-1);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
+ List<List<MapNode>> lists = mapData.getJsonData(-1, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
//瀛樺叆鏁版嵁搴�
basMap = new BasMap();
@@ -694,7 +695,7 @@
continue;//鎻愬崌鏈轰笉鍦ㄧ洰鏍囨ゼ灞傝烦杩�
}
- Integer staNo = Utils.levToOutInStaNo(lev);
+ Integer staNo = Utils.levToOutInStaNo(lev >= 2 ? lev + 1 : lev);
//鑾峰彇鐩爣绔欎俊鎭�
StaProtocol staProtocol1 = devpThread.getStation().get(staNo);
if (staProtocol1 == null) {
@@ -742,16 +743,19 @@
//鍚屼竴灞傜洿鎺ュ彇璐ф棤闇�缁忚繃鎻愬崌鏈�
//鐩存帴璁$畻杞﹀埌鎻愬崌鏈哄彇璐у啀鍒板簱浣嶈矾寰勬寚浠�
List<ShuttleCommand> commands = this.shuttleAssignCommand(wrkMast.getWrkSts() == 4 ? currentLocNo : liftSiteLocNo, liftSiteLocNo, locNo, assignCommand, shuttleThread);
+ if (commands == null) {
+ continue;//鎵句笉鍒拌矾寰勭瓑寰呬笅涓�娆�
+ }
if (wrkMast.getWrkSts() == 8) {
//姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
- Integer staNo = Utils.levToOutInStaNo(currentLev);//绔欑偣鍙�
+ Integer staNo = Utils.levToOutInStaNo(currentLev >= 2 ? currentLev + 1 : currentLev);//绔欑偣鍙�
BasDevp basDevp = basDevpService.selectById(staNo);
short startCode = liftProtocol.getBarcode();//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
Short distCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈哄彛绔欑偣浜岀淮鐮�
Short runDirection = ShuttleRunDirection.BOTTOM.id;//杩愯鏂瑰悜
//鑾峰彇鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1400, runDirection, startCode, 1400, 1000);
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1400, runDirection, startCode, 1400, 500);
commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
}
assignCommand.setCommands(commands);
@@ -771,7 +775,7 @@
Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//绔欑偣浜岀淮鐮�
//澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1400, ShuttleRunDirection.TOP.id, endStartCode, 1400, 1000);
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1400, ShuttleRunDirection.TOP.id, endStartCode, 1400, 500);
commands.add(moveCommand);
//鍒嗛厤鐩爣搴撲綅
@@ -796,7 +800,7 @@
}
- //鑾峰彇璧风偣-缁堢偣鎸囦护銆俶apType锛�0=>鏃犺揣鐗╁湴鍥撅紝1=銆嬫惡甯﹁揣鐗╁嚭鍏ュ簱鍦板浘
+ //鑾峰彇璧风偣-缁堢偣鎸囦护
public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
//鑾峰彇灏忚溅绉诲姩閫熷害
BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo());
@@ -864,7 +868,7 @@
List<NavigateNode> allNode = new ArrayList<>();
//璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
- List<NavigateNode> calc = NavigateUtils.calc(startLocNo, middleLocNo, 1);//灏忚溅鏃犺揣锛岃蛋鍏ュ簱鍦板浘
+ List<NavigateNode> calc = NavigateUtils.calc(startLocNo, middleLocNo, NavigationMapType.NORMAL.id);//灏忚溅鏃犺揣锛岃蛋姝e父搴撲綅閫氶亾
List<ShuttleCommand> commands = new ArrayList<>();
if (calc != null) {
@@ -898,7 +902,7 @@
commands.add(shuttleThread.getPalletCommand((short) 1));
//璁$畻灏忚溅涓偣鍒扮粓鐐规墍闇�鍛戒护
- List<NavigateNode> calc2 = NavigateUtils.calc(middleLocNo, locNo, 2);//灏忚溅鏈夎揣锛岃蛋鍑哄簱鍦板浘(鍑哄簱鍦板浘鏈変笓鐢ㄨ揣閬�)
+ List<NavigateNode> calc2 = NavigateUtils.calc(middleLocNo, locNo, NavigationMapType.DFX.id);//灏忚溅鏈夎揣锛岃蛋绂佺敤杩嘍FX搴撲綅鐨勫湴鍥鹃�氶亾
if (calc2 == null) {
return null;
}
@@ -1072,7 +1076,7 @@
Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//绔欑偣浜岀淮鐮�
//澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1400, ShuttleRunDirection.TOP.id, endStartCode, 1400, 1000);
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1400, ShuttleRunDirection.TOP.id, endStartCode, 1400, 500);
commands.add(moveCommand);
//鐩爣搴撲綅
@@ -1209,9 +1213,9 @@
String recentLocNo = recentShuttle.getShuttleProtocol().getCurrentLocNo();
//褰撳墠鏈�杩戝洓鍚戠┛姊溅鍒扮洰鏍囧湴鐐硅窛绂�
- List<NavigateNode> recentShuttlePath = NavigateUtils.calc(recentLocNo, distLocNo, ShuttleTaskModeType.PAK_IN.id);
+ List<NavigateNode> recentShuttlePath = NavigateUtils.calc(recentLocNo, distLocNo, NavigationMapType.NORMAL.id);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
//褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
- List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, distLocNo, ShuttleTaskModeType.PAK_IN.id);
+ List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, distLocNo, NavigationMapType.NORMAL.id);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
if (recentShuttlePath == null || currentShuttlePath == null) {
continue;
}
@@ -1241,9 +1245,9 @@
int recentLev = Utils.getLev(recentLocNo);
//褰撳墠鏈�杩戝洓鍚戠┛姊溅鍒板綋鍓嶈溅瀛愭墍鍦ㄦゼ灞傜殑鎻愬崌鏈哄彛璺濈
- List<NavigateNode> recentShuttlePath = NavigateUtils.calc(recentLocNo, Utils.levToOutInStaLocNo(recentLev), ShuttleTaskModeType.PAK_IN.id);
+ List<NavigateNode> recentShuttlePath = NavigateUtils.calc(recentLocNo, Utils.levToOutInStaLocNo(recentLev), NavigationMapType.NORMAL.id);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
//褰撳墠绌挎杞︾嚎绋嬪埌褰撳墠杞﹀瓙鎵�鍦ㄦゼ灞傜殑鎻愬崌鏈哄彛璺濈
- List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, Utils.levToOutInStaLocNo(currentLev), ShuttleTaskModeType.PAK_IN.id);
+ List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, Utils.levToOutInStaLocNo(currentLev), NavigationMapType.NORMAL.id);//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
if (recentShuttlePath == null || currentShuttlePath == null) {
continue;
}
@@ -1446,16 +1450,36 @@
command4.setOperaStaNo(distStaNo.shortValue());//鎿嶄綔鐩爣妤煎眰绔欑偣
command4.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
command4.setDevpId(devpId);
+ command4.setStaNo(distStaNo.shortValue());//璁剧疆鐩爣绔�
commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
wrkMast.setWrkSts(3L);//3.鎻愬崌鏈烘惉杩愪腑
} else if (wrkMast.getWrkSts() == 6) {//6.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 7.鎻愬崌鏈鸿縼绉诲皬杞︿腑
liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//璁剧疆鍥涘悜绌挎杞﹀彿
+ //鍒ゆ柇灏忚溅鏄惁鍦ㄦ彁鍗囨満鍐咃紝涓斿浜庣┖闂茬姸鎬�
+ ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
+ if (shuttleThread == null) {
+ continue;
+ }
+ ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ continue;
+ }
+ if (!shuttleProtocol.isIdle()) {
+ continue;//灏忚溅鐘舵�佸繖
+ }
+ if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
+ continue;//灏忚溅褰撳墠浜岀淮鐮佸拰鎻愬崌鏈哄唴閮ㄤ簩缁寸爜涓嶄竴鑷达紝涓嶅厑璁告墽琛�
+ }
+
//宸ヤ綔妗g洰鏍囧簱浣嶅彿
String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
//宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
int wrkMastLocNoLey = Utils.getLev(wrkMastLocNo);
+ if (wrkMastLocNoLey >= 2) {
+ wrkMastLocNoLey++;
+ }
//鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
@@ -1465,7 +1489,7 @@
} else if(wrkMast.getWrkSts() == 23) {//23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 24.鎻愬崌鏈鸿縼绉诲皬杞︿腑
liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//璁剧疆鍥涘悜绌挎杞﹀彿
- //鎵惧埌鍥涘悜绌挎杞︾殑绾跨▼
+ //鍒ゆ柇灏忚溅鏄惁鍦ㄦ彁鍗囨満鍐咃紝涓斿浜庣┖闂茬姸鎬�
ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
if (shuttleThread == null) {
continue;
@@ -1475,44 +1499,24 @@
continue;
}
- //褰撳墠绌挎杞﹀簱浣嶅彿
- String currentLocNo = shuttleProtocol.getCurrentLocNo();
- //褰撳墠绌挎杞︽ゼ灞�
- int currentLocNoLey = Utils.getLev(currentLocNo);
+ if (!shuttleProtocol.isIdle()) {
+ continue;//灏忚溅鐘舵�佸繖
+ }
+ if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
+ continue;//灏忚溅褰撳墠浜岀淮鐮佸拰鎻愬崌鏈哄唴閮ㄤ簩缁寸爜涓嶄竴鑷达紝涓嶅厑璁告墽琛�
+ }
//宸ヤ綔妗g洰鏍囧簱浣嶅彿
String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
//宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
int wrkMastLocNoLey = Utils.getLev(wrkMastLocNo);
-
- //鎻愬崌鏈哄綋鍓嶆ゼ灞�
- int liftLev = liftProtocol.getLev().intValue();
- if (liftLev == 0) {//鎻愬崌鏈哄綋鍓嶆ゼ灞備负0锛屾彁鍗囨満澶卞幓浣嶇疆淇℃伅锛岃鎻愬崌鏈哄墠寰�涓�妤�
- LiftCommand command = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.ONE.lev);
- commands.add(command);//灏嗗懡浠ゆ坊鍔犺繘list
+ if (wrkMastLocNoLey >= 2) {
+ wrkMastLocNoLey++;
}
- if (liftLev != currentLocNoLey) {
- //涓嶅悓妤煎眰
- //鑾峰彇鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)鍛戒护
- LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), currentLocNoLey);
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
- }
-
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵(鍙嶈浆)
- LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 4);
- commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
-
- if (liftLev != currentLocNoLey) {
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
- LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
- commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
- }
-
- //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓(姝h浆)
- LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
- commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
+ //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+ LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
+ commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
wrkMast.setWrkSts(24L);//23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 24.鎻愬崌鏈鸿縼绉诲皬杞︿腑
} else if (wrkMast.getWrkSts() == 27) {//27.灏忚溅鍑哄簱鎼繍瀹屾垚
--
Gitblit v1.9.1