From 4315668f4de2ab2bf8a24ac206d71f072dd00357 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 31 七月 2023 15:28:33 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 809 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 665 insertions(+), 144 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 45518cf..769aec2 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -96,6 +96,8 @@
@Autowired
private OrderDetlMapper orderDetlMapper;
@Autowired
+ private BasLiftService basLiftService;
+ @Autowired
private RedisUtil redisUtil;
/**
@@ -803,9 +805,9 @@
BasDevp basDevp = basDevpService.queryByLocNo(liftSiteLocNo);
Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//绔欑偣浜岀淮鐮�
- //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, 500);
- commands.add(moveCommand);
+// //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, 500);
+// commands.add(moveCommand);
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(liftSiteLocNo);
@@ -825,12 +827,12 @@
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, 1600, runDirection, null, null, 500);
- commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+// short startCode = liftProtocol.getBarcode();//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
+// Short distCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈哄彛绔欑偣浜岀淮鐮�
+// Short runDirection = ShuttleRunDirection.BOTTOM.id;//杩愯鏂瑰悜
+// //鑾峰彇鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1600, runDirection, null, null, 500);
+// commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
// assignCommand.setCommands(commands);
//鍒嗛厤鐩爣搴撲綅
@@ -1268,9 +1270,9 @@
BasDevp basDevp = basDevpService.queryByLocNo(liftSiteLocNo);
Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//绔欑偣浜岀淮鐮�
- //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, 500);
- commands.add(moveCommand);
+// //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, 500);
+// commands.add(moveCommand);
//鐩爣搴撲綅
assignCommand.setLocNo(liftSiteLocNo);
@@ -1306,12 +1308,12 @@
continue;//鏈壘鍒拌矾寰�
}
- //姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
- short startCode = liftProtocol.getBarcode();//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
- Short distCode = commands.get(0).getStartCodeNum();//鐩爣浜岀淮鐮�
- //鑾峰彇绉诲姩鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1600, commands.get(0).getRunDirection(), null, null, 500);
- commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+// //姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
+// short startCode = liftProtocol.getBarcode();//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
+// Short distCode = commands.get(0).getStartCodeNum();//鐩爣浜岀淮鐮�
+// //鑾峰彇绉诲姩鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1600, commands.get(0).getRunDirection(), null, null, 500);
+// commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(wrkMast.getSourceLocNo());
@@ -1661,10 +1663,10 @@
//瀛樺湪鏈畬鎴愪换鍔″彿
continue;
}
- if (liftProtocol.getPlatShuttleCheck()) {
- //鎻愬崌鏈烘鏃舵湁鍥涘悜杞︼紝鍙兘鏈夋湭瀹屾垚鐨勪换鍔★紝绂佹鍒嗛厤鏂颁换鍔�
- continue;
- }
+// if (liftProtocol.getPlatShuttleCheck()) {
+// //鎻愬崌鏈烘鏃舵湁鍥涘悜杞︼紝鍙兘鏈夋湭瀹屾垚鐨勪换鍔★紝绂佹鍒嗛厤鏂颁换鍔�
+// continue;
+// }
//鑾峰彇鐩爣绔�
StaProtocol staProtocol = devpThread.getStation().get(wrkMast.getStaNo());
@@ -1683,32 +1685,32 @@
}
Integer distStaNo = Utils.levToOutInStaNo(levTmp);
- if (liftProtocol.getPositionArrivalFeedback().intValue() != LiftLevType.TWO.realLev.intValue()) {
- //鎻愬崌鏈轰笉鍦ㄨ緭閫佺嚎妤煎眰锛岃幏鍙栧埌杈撻�佺嚎灞傜殑鎻愬崌鏈哄懡浠�
- LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.TWO.lev);
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
- }
+// if (liftProtocol.getPositionArrivalFeedback().intValue() != LiftLevType.TWO.realLev.intValue()) {
+// //鎻愬崌鏈轰笉鍦ㄨ緭閫佺嚎妤煎眰锛岃幏鍙栧埌杈撻�佺嚎灞傜殑鎻愬崌鏈哄懡浠�
+// LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.TWO.lev);
+// commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+// }
- //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(鏃犺揣姝h浆)
- LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 3);
- command2.setOperaStaNo((short) 102);//鎿嶄綔102绔�
- command2.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
- command2.setDevpId(devpId);
- command2.setStaNo(distStaNo.shortValue());//璁剧疆鐩爣绔�
- commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
-
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
- LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), levTmp);
- commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
-
- //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(姝h浆)
- //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
- LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
- command4.setOperaStaNo(distStaNo.shortValue());//鎿嶄綔鐩爣妤煎眰绔欑偣
- command4.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
- command4.setDevpId(devpId);
- command4.setStaNo(distStaNo.shortValue());//璁剧疆鐩爣绔�
- commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
+// //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(鏃犺揣姝h浆)
+// LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 3);
+// command2.setOperaStaNo((short) 102);//鎿嶄綔102绔�
+// command2.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
+// command2.setDevpId(devpId);
+// command2.setStaNo(distStaNo.shortValue());//璁剧疆鐩爣绔�
+// commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
+//
+// //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+// LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), levTmp);
+// commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
+//
+// //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(姝h浆)
+// //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+// LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
+// command4.setOperaStaNo(distStaNo.shortValue());//鎿嶄綔鐩爣妤煎眰绔欑偣
+// command4.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
+// command4.setDevpId(devpId);
+// command4.setStaNo(distStaNo.shortValue());//璁剧疆鐩爣绔�
+// commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
//缁欐彁鍗囨満鍒嗛厤浠诲姟
liftProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());//璁剧疆浠诲姟鍙�
@@ -1735,13 +1737,13 @@
if (!shuttleProtocol.isIdle(wrkMast.getWrkNo().shortValue())) {
continue;//灏忚溅鐘舵�佸繖
}
- if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
- continue;//灏忚溅褰撳墠浜岀淮鐮佸拰鎻愬崌鏈哄唴閮ㄤ簩缁寸爜涓嶄竴鑷达紝涓嶅厑璁告墽琛�
- }
- if (!liftProtocol.getPlatShuttleCheck()) {
- //鎻愬崌鏈烘湭妫�娴嬪埌灏忚溅锛岀姝㈡墽琛�
- continue;
- }
+// if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
+// continue;//灏忚溅褰撳墠浜岀淮鐮佸拰鎻愬崌鏈哄唴閮ㄤ簩缁寸爜涓嶄竴鑷达紝涓嶅厑璁告墽琛�
+// }
+// if (!liftProtocol.getPlatShuttleCheck()) {
+// //鎻愬崌鏈烘湭妫�娴嬪埌灏忚溅锛岀姝㈡墽琛�
+// continue;
+// }
//宸ヤ綔妗g洰鏍囧簱浣嶅彿
String wrkMastLocNo = wrkMast.getLocNo();
@@ -1751,9 +1753,9 @@
wrkMastLocNoLey++;
}
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
- LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+// //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+// LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
+// commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
//缁欐彁鍗囨満鍒嗛厤浠诲姟
liftProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());//璁剧疆浠诲姟鍙�
@@ -1781,13 +1783,13 @@
if (!shuttleProtocol.isIdle(wrkMast.getWrkNo().shortValue())) {
continue;//灏忚溅鐘舵�佸繖
}
- if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
- continue;//灏忚溅褰撳墠浜岀淮鐮佸拰鎻愬崌鏈哄唴閮ㄤ簩缁寸爜涓嶄竴鑷达紝涓嶅厑璁告墽琛�
- }
- if (!liftProtocol.getPlatShuttleCheck()) {
- //鎻愬崌鏈烘湭妫�娴嬪埌灏忚溅锛岀姝㈡墽琛�
- continue;
- }
+// if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
+// continue;//灏忚溅褰撳墠浜岀淮鐮佸拰鎻愬崌鏈哄唴閮ㄤ簩缁寸爜涓嶄竴鑷达紝涓嶅厑璁告墽琛�
+// }
+// if (!liftProtocol.getPlatShuttleCheck()) {
+// //鎻愬崌鏈烘湭妫�娴嬪埌灏忚溅锛岀姝㈡墽琛�
+// continue;
+// }
//宸ヤ綔妗g洰鏍囧簱浣嶅彿
String wrkMastLocNo = wrkMast.getSourceLocNo();
@@ -1797,9 +1799,9 @@
wrkMastLocNoLey++;
}
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
- LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+// //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+// LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
+// commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
//缁欐彁鍗囨満鍒嗛厤浠诲姟
liftProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());//璁剧疆浠诲姟鍙�
@@ -1812,10 +1814,10 @@
//鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛屼笖鎻愬崌鏈轰换鍔″彿鍜屽綋鍓嶅伐浣滄。浠诲姟鍙蜂笉涓�鑷�
continue;
}
- if (liftProtocol.getPlatShuttleCheck()) {
- //鎻愬崌鏈烘鏃舵湁鍥涘悜杞︼紝鍙兘鏈夋湭瀹屾垚鐨勪换鍔★紝绂佹鍒嗛厤鏂颁换鍔�
- continue;
- }
+// if (liftProtocol.getPlatShuttleCheck()) {
+// //鎻愬崌鏈烘鏃舵湁鍥涘悜杞︼紝鍙兘鏈夋湭瀹屾垚鐨勪换鍔★紝绂佹鍒嗛厤鏂颁换鍔�
+// continue;
+// }
//宸ヤ綔妗f簮搴撲綅鍙�
String wrkMastLocNo = wrkMast.getSourceLocNo();
@@ -1825,42 +1827,42 @@
//鎻愬崌鏈哄綋鍓嶆ゼ灞�
int liftLev = liftProtocol.getLev().intValue();
- //鍒ゆ柇鎻愬崌鏈烘槸鍚﹀埌浣�
- StaProtocol staProtocol = devpThread.getStation().get(Utils.levToOutInStaNo(wrkMastLocNoLey >= 2 ? wrkMastLocNoLey + 1 : wrkMastLocNoLey));//璧峰绔欑偣
- if (liftLev != wrkMastLocNoLey && !staProtocol.isLiftArrival()) {
- //鎻愬崌鏈轰笉鍦ㄥ伐浣滄。婧愬簱浣嶆ゼ灞傦紝璋冨害鎻愬崌鏈�
- LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
- }
-
- //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(鏃犺揣鍙嶈浆)
- LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 4);
- command2.setOperaStaNo(staProtocol.getSiteId().shortValue());//杈撻�佺嚎鎿嶄綔绔欑偣鍙�
- command2.setRotationDire(2);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屽弽杞�
- command2.setDevpId(devpId);//杈撻�佺嚎ID
- command2.setStaNo((short) 104);//鍐欏叆鍑哄簱鐩爣绔�104
- commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
-
- //鎻愬崌鏈哄墠寰�鍑哄簱鍙o紝杈撻�佺嚎妤煎眰
- LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.TWO.lev);
- command3.setDevpId(devpId);//杈撻�佺嚎ID
- commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
-
- //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(鍙嶈浆)
- //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
- LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
- command4.setOperaStaNo((short) 102);//鎿嶄綔102绔�
- command4.setRotationDire(2);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屽弽杞�
- command4.setDevpId(devpId);//杈撻�佺嚎ID
- commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
-
- //鎻愬崌鏈洪摼鏉℃墽琛屽畬姣曞悗锛岀粰102绔欏啓鍏ヨ祫鏂�
- LiftCommand command5 = liftThread.getResetCommand();
- command5.setDevpId(devpId);//杈撻�佺嚎ID
- command5.setOperaStaNo((short) 102);//鎿嶄綔102绔�
- command5.setStaNo((short) 104);//鍐欏叆鍑哄簱鐩爣绔�104
- command5.setRotationDire(0);//閾炬潯杞姩鍋滄
- commands.add(command5);
+// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹀埌浣�
+// StaProtocol staProtocol = devpThread.getStation().get(Utils.levToOutInStaNo(wrkMastLocNoLey >= 2 ? wrkMastLocNoLey + 1 : wrkMastLocNoLey));//璧峰绔欑偣
+// if (liftLev != wrkMastLocNoLey && !staProtocol.isLiftArrival()) {
+// //鎻愬崌鏈轰笉鍦ㄥ伐浣滄。婧愬簱浣嶆ゼ灞傦紝璋冨害鎻愬崌鏈�
+// LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
+// commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+// }
+//
+// //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(鏃犺揣鍙嶈浆)
+// LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 4);
+// command2.setOperaStaNo(staProtocol.getSiteId().shortValue());//杈撻�佺嚎鎿嶄綔绔欑偣鍙�
+// command2.setRotationDire(2);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屽弽杞�
+// command2.setDevpId(devpId);//杈撻�佺嚎ID
+// command2.setStaNo((short) 104);//鍐欏叆鍑哄簱鐩爣绔�104
+// commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
+//
+// //鎻愬崌鏈哄墠寰�鍑哄簱鍙o紝杈撻�佺嚎妤煎眰
+// LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.TWO.lev);
+// command3.setDevpId(devpId);//杈撻�佺嚎ID
+// commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
+//
+// //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(鍙嶈浆)
+// //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+// LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
+// command4.setOperaStaNo((short) 102);//鎿嶄綔102绔�
+// command4.setRotationDire(2);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屽弽杞�
+// command4.setDevpId(devpId);//杈撻�佺嚎ID
+// commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
+//
+// //鎻愬崌鏈洪摼鏉℃墽琛屽畬姣曞悗锛岀粰102绔欏啓鍏ヨ祫鏂�
+// LiftCommand command5 = liftThread.getResetCommand();
+// command5.setDevpId(devpId);//杈撻�佺嚎ID
+// command5.setOperaStaNo((short) 102);//鎿嶄綔102绔�
+// command5.setStaNo((short) 104);//鍐欏叆鍑哄簱鐩爣绔�104
+// command5.setRotationDire(0);//閾炬潯杞姩鍋滄
+// commands.add(command5);
//缁欐彁鍗囨満鍒嗛厤浠诲姟
liftProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());//璁剧疆浠诲姟鍙�
@@ -1899,7 +1901,7 @@
//鎻愬崌鏈轰负绛夊緟纭涓旂┖闂�
if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WAITING.id
&& liftProtocol.getTaskNo() != 0
- && !liftProtocol.getRunning()
+ && !liftProtocol.getBusy()
) {
DevpThread devpThread = null;
@@ -1951,9 +1953,9 @@
wrkMast.setWrkSts(25L);
break;
case 28://28.鎻愬崌鏈烘惉杩愪腑 ==> 29.鎻愬崌鏈烘惉杩愬畬鎴�
- if (liftProtocol.getPositionArrivalFeedback().intValue() != 2) {
- continue;//鎻愬崌鏈烘槸鍚﹁揪鍒拌緭閫佺嚎妤煎眰
- }
+// if (liftProtocol.getPositionArrivalFeedback().intValue() != 2) {
+// continue;//鎻愬崌鏈烘槸鍚﹁揪鍒拌緭閫佺嚎妤煎眰
+// }
wrkMast.setWrkSts(29L);
wrkMast.setWrkSts(34L);//34.鍑哄簱瀹屾垚锛屾殏鏃跺厛鐩存帴瀹屾垚鍑哄簱宸ヤ綔妗o紝鍚庣画闇�瑕佹牴鎹緭閫佺嚎缁欏嚭鐨勭姸鎬佹潵纭畾34.鍑哄簱瀹屾垚鐘舵��
//浠诲姟鍙锋竻闆�
@@ -2007,10 +2009,10 @@
//璁剧疆鎻愬崌鏈轰负绌洪棽鐘舵��
liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE);
//鍒ゆ柇鏄惁涓哄洓鍚戠┛姊溅璋冨害鎻愬崌鏈猴紝濡傛槸鍒欐棤闇�娓呯悊浠诲姟鍙�
- if (!liftProtocol.getSecurityMk()) {
- //浠诲姟鍙锋竻闆�
- liftProtocol.setTaskNo((short) 0);
- }
+// if (!liftProtocol.getSecurityMk()) {
+// //浠诲姟鍙锋竻闆�
+// liftProtocol.setTaskNo((short) 0);
+// }
//鏍囪澶嶄綅
liftProtocol.setPakMk(true);
//浠诲姟鎸囦护娓呴浂
@@ -2118,9 +2120,9 @@
BasDevp basDevp = basDevpService.queryByLocNo(liftSiteLocNo);
Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//绔欑偣浜岀淮鐮�
- //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, 500);
- commands.add(moveCommand);
+// //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, 500);
+// commands.add(moveCommand);
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(liftSiteLocNo);
@@ -2210,15 +2212,15 @@
return false;//绔欑偣鎻愬崌鏈哄埌浣嶄俊鍙穎alse
}
- 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, 1600, runDirection, null, null, 500);
- commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+// 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, 1600, runDirection, null, null, 500);
+// commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
- currentLocNo = basDevp.getLocNo();//浣跨敤杈撻�佺珯鐐瑰彛浣滀负璧风偣鍧愭爣
+// currentLocNo = basDevp.getLocNo();//浣跨敤杈撻�佺珯鐐瑰彛浣滀负璧风偣鍧愭爣
}
//鐩存帴璁$畻杞﹀埌婧愬簱浣嶅埌鐩爣搴撲綅璺緞
@@ -2779,9 +2781,9 @@
}
Short basDevpQrCode = Short.parseShort(basDevp.getQrCodeValue());//绔欑偣浜岀淮鐮�
- //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(basDevpQrCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, basDevpQrCode, 1600, 500);
- commands.add(moveCommand);
+// //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(basDevpQrCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, basDevpQrCode, 1600, 500);
+// commands.add(moveCommand);
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(chargeLocNo);
@@ -2809,11 +2811,11 @@
continue;
}
- //鍒ゆ柇灏忚溅鏄惁鍦ㄦ彁鍗囨満鍐�
- if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
- //灏忚溅涓嶅湪鎻愬崌鏈哄唴
- continue;
- }
+// //鍒ゆ柇灏忚溅鏄惁鍦ㄦ彁鍗囨満鍐�
+// if (shuttleProtocol.getCurrentCode().intValue() != liftProtocol.getBarcode().intValue()) {
+// //灏忚溅涓嶅湪鎻愬崌鏈哄唴
+// continue;
+// }
//缁欐彁鍗囨満鍒嗛厤浠诲姟
liftProtocol.setTaskNo(wrkCharge.getWrkNo().shortValue());//璁剧疆浠诲姟鍙�
@@ -2823,10 +2825,10 @@
//鍛戒护list
ArrayList<LiftCommand> commands = new ArrayList<>();
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
- //鑾峰彇鍏呯數搴撲綅鐩爣妤煎眰鍛戒护
- LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), chargeLocNoLev >= 2 ? chargeLocNoLev + 1 : chargeLocNoLev);
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+// //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
+// //鑾峰彇鍏呯數搴撲綅鐩爣妤煎眰鍛戒护
+// LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), chargeLocNoLev >= 2 ? chargeLocNoLev + 1 : chargeLocNoLev);
+// commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
wrkCharge.setWrkSts(54L);//鎻愬崌鏈烘惉杩愪腑
//鎵�闇�鍛戒护缁勫悎瀹屾瘯锛屾洿鏂版暟鎹簱锛屾彁浜ゅ埌绾跨▼鍘诲伐浣�
@@ -2866,12 +2868,12 @@
continue;//鏈壘鍒拌矾寰�
}
- short startCode = liftProtocol.getBarcode();//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
- Short distCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈哄彛绔欑偣浜岀淮鐮�
- Short runDirection = ShuttleRunDirection.BOTTOM.id;//杩愯鏂瑰悜
- //鑾峰彇鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1600, runDirection, startCode, 1600, 500);
- commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+// short startCode = liftProtocol.getBarcode();//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
+// Short distCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈哄彛绔欑偣浜岀淮鐮�
+// Short runDirection = ShuttleRunDirection.BOTTOM.id;//杩愯鏂瑰悜
+// //鑾峰彇鍛戒护
+// ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1600, runDirection, startCode, 1600, 500);
+// commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
//杩涜鍏呯數涓�
shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING);
@@ -2938,6 +2940,525 @@
}
+ /**
+ * 璋冨害杞﹁締
+ */
+ public void dispatchShuttle(Integer wrkNo, String locNo) {
+ ArrayList<NyShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅
+ ArrayList<NyShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
+
+ for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+ continue;
+ }
+
+ if (!shuttleProtocol.isIdle()) {
+ continue;
+ }
+
+ int currentLev = shuttleProtocol.getPoint().getZ();//灏忚溅褰撳墠灞傞珮
+ String currentLocNo = shuttleProtocol.getCurrentLocNo();//灏忚溅褰撳墠搴撲綅鍙�
+
+ if (currentLocNo.equals(locNo)) {
+ //杞﹁締褰撳墠浣嶇疆宸茬粡鏄洰鏍囧簱浣嶏紝璋冨害璇ヨ溅
+ shuttleMoveGenerate(wrkNo, locNo, shuttleProtocol.getShuttleNo().intValue());
+ break;
+ }
+
+ if (currentLev == Utils.getLev(locNo)) {
+ //宸ヤ綔妗fゼ灞傜浉鍚岀殑绌挎杞�
+ sameLev.add(shuttleThread);
+ }else {
+ //宸ヤ綔妗d笉鍚屾ゼ灞傜殑绌挎杞�
+ diffLev.add(shuttleThread);
+ }
+
+ }
+
+ Integer recentAllDistance = 9999999;
+ NyShuttleThread recentShuttle = null;//褰撳墠璺濈鏈�杩戠殑鍥涘悜绌挎杞︾嚎绋�
+ if (sameLev.size() > 0) {
+ //鍚屼竴妤煎眰鏈夌┖闂茬┛姊溅锛屽垯鍙湪宸ヤ綔妗fゼ灞傚鎵�
+ //瀵绘壘绂讳换鍔℃渶杩戠殑绌挎杞�
+ for (NyShuttleThread shuttleThread : sameLev) {
+ //褰撳墠绌挎杞﹀簱浣嶅彿
+ String currentLocNo = shuttleThread.getShuttleProtocol().getCurrentLocNo();
+ //褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
+ List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, locNo, NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), Utils.getLev(currentLocNo)));//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
+ if (currentShuttlePath == null) {
+ continue;
+ }
+ Integer currentAllDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ if (currentAllDistance < recentAllDistance) {
+ //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠┛姊溅
+ recentShuttle = shuttleThread;
+ }
+ }
+ }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;
+ }
+
+ //褰撳墠绌挎杞︾嚎绋嬪埌褰撳墠杞﹀瓙鎵�鍦ㄦゼ灞傜殑鎻愬崌鏈哄彛璺濈
+ List<NavigateNode> currentShuttlePath = NavigateUtils.calc(currentLocNo, Utils.levToOutInStaLocNo(currentLev), NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), currentLev));//鎼滅储绌洪棽绌挎杞︼紝浣跨敤姝e父閫氶亾鍦板浘
+ if (currentShuttlePath == null) {
+ continue;
+ }
+
+ Integer currentAllDistance = NavigateUtils.getOriginPathAllDistance(currentShuttlePath);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ if (currentAllDistance < recentAllDistance) {
+ //濡傛灉褰撳墠妤煎眰鐨勮溅璺緞鏇村皬锛屽垯鏇存柊鏈�杩戠┛姊溅
+ recentShuttle = shuttleThread;
+ }
+ }
+ }
+
+ if (recentShuttle == null) {//娌℃湁鎼滅储鍒板彲鐢ㄧ┛姊溅
+ return;
+ }
+
+ //鎼滅储鍒板彲鐢ㄧ┛姊溅锛岃皟搴﹁杞�
+ shuttleMoveGenerate(wrkNo, locNo, recentShuttle.getSlave().getId());
+ }
+
+ /**
+ * 灏忚溅杩佺Щ浠诲姟鐢熸垚
+ */
+ @Transactional
+ public boolean shuttleMoveGenerate(Integer wrkNo, String locNo, Integer shuttleNo) {
+ Date now = new Date();
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
+ if (shuttleThread == null) {
+ return false;
+ }
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ //灏忚溅澶勪簬绌洪棽鐘舵��
+ if (!shuttleProtocol.isIdleNoCharge()) {
+ return false;
+ }
+
+ //鍒ゆ柇绌挎杞︽槸鍚﹀瓨鍦ㄦ湭瀹屾垚鐨勫皬杞︾Щ搴撲换鍔�
+ WrkMast hasMoveWorking = wrkMastMapper.selectShuttleHasMoveWorking(shuttleNo);
+ if (hasMoveWorking != null) {//灏忚溅瀛樺湪绉诲簱浠诲姟锛岀瓑寰呮墽琛屽畬鎴愬悗鍐嶇敓鎴愭柊鐨勪换鍔�
+ return false;
+ }
+
+ //鍒ゆ柇鏄惁鏈夊叾浠栦换鍔℃鍦ㄤ娇鐢ㄧ┛姊溅
+ WrkMast wrkMast2 = wrkMastMapper.selectShuttleWorking(shuttleNo);
+ if (wrkMast2 != null) {//灏忚溅瀛樺湪鍏朵粬宸ヤ綔妗d换鍔★紝绛夊緟鎵ц瀹屾垚鍚庡啀鐢熸垚鏂扮殑浠诲姟
+ return false;
+ }
+
+ //鍒ゆ柇鏄惁鏈夊厖鐢典换鍔℃鍦ㄤ娇鐢ㄧ┛姊溅
+ WrkCharge wrkCharge = wrkChargeMapper.selectWorking(shuttleNo);
+ if (wrkCharge != null) {//灏忚溅瀛樺湪鍏呯數浠诲姟锛岀瓑寰呮墽琛屽畬鎴愬悗鍐嶇敓鎴愭柊鐨勪换鍔�
+ return false;
+ }
+
+ // 鑾峰彇宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(0);
+ // 淇濆瓨宸ヤ綔妗�
+ WrkMast wrkMast = new WrkMast();
+ wrkMast.setWrkNo(workNo);
+ wrkMast.setIoTime(now);
+ wrkMast.setWrkSts(101L); // 宸ヤ綔鐘舵�侊細101.绉诲姩鍒拌繎鐐圭瓑寰呰縼鍑�
+ wrkMast.setIoType(200); // 鍏ュ嚭搴撶姸鎬侊細 200.灏忚溅绉诲簱
+ wrkMast.setIoPri(20D);
+ wrkMast.setShuttleNo(shuttleNo);//绌挎杞﹀彿
+ wrkMast.setSourceLocNo(shuttleProtocol.getCurrentLocNo()); // 婧愬簱浣� => 灏忚溅褰撳墠搴撲綅鍙�
+ wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
+ wrkMast.setPicking("N"); // 鎷f枡
+ wrkMast.setExitMk("N"); // 閫�鍑�
+ wrkMast.setLinkMis("N");
+ wrkMast.setAppeTime(now);
+ wrkMast.setModiTime(now);
+ int res = wrkMastMapper.insert(wrkMast);
+ if (res == 0) {
+ News.error("灏忚溅杩佺Щ --- 淇濆瓨宸ヤ綔妗eけ璐ワ紒 绌挎杞﹀彿锛�" + shuttleNo);
+ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+ }
+
+ //缁欏伐浣滄。缁戝畾灏忚溅鍙�
+ WrkMast wrkMast1 = wrkMastMapper.selectByWorkNo(wrkNo);
+ if (wrkMast1 != null) {
+ wrkMast1.setShuttleNo(shuttleNo);
+ wrkMastMapper.updateById(wrkMast1);
+ }
+
+ return true;
+ }
+
+ /**
+ * 鎵ц灏忚溅绉诲簱浠诲姟
+ */
+ public synchronized void shuttleMoveExecute() {
+ //鏌ヨ灏忚溅绉诲簱浠诲姟
+ List<WrkMast> wrkMasts = wrkMastMapper.selectShuttleMoveWrk();
+ for (WrkMast wrkMast : wrkMasts) {
+ boolean step1 = this.shuttleMoveExecuteStep1(wrkMast);//灏忚溅绉诲姩鍒版彁鍗囨満涓�
+ if (!step1) {
+ continue;
+ }
+
+ boolean step2 = this.shuttleMoveExecuteStep2(wrkMast);//鎻愬崌鏈烘惉杩愪腑
+ if (!step2) {
+ continue;
+ }
+
+ boolean step3 = this.shuttleMoveExecuteStep3(wrkMast);//灏忚溅杩佸嚭鎻愬崌鏈轰腑
+ if (!step3) {
+ continue;
+ }
+
+ boolean step4 = this.shuttleMoveExecuteStep4(wrkMast);//灏忚溅绉诲姩鍒扮洰鏍囧簱浣嶄腑
+ if (!step4) {
+ continue;
+ }
+ }
+ }
+
+ /**
+ * 灏忚溅杩佺Щ-灏忚溅绉诲姩鍒版彁鍗囨満涓�
+ * 濡傞渶涓绘柟娉曟墽琛宑ontinue锛岃杩斿洖false
+ * ps:杩斿洖鍊紅rue骞朵笉浠h〃璇ユ柟娉曟墽琛屾垚鍔燂紝杩斿洖鍊间粎鍋氭爣璁扮敤浜庝富鏂规硶鏄惁鎵цcontinue
+ */
+ private boolean shuttleMoveExecuteStep1(WrkMast wrkMast) {
+ //--------------------------------------灏忚溅绉诲姩鍒版彁鍗囨満涓�-----------------------------------------//
+ Date now = new Date();
+
+ //灏忚溅绉诲姩鍒版彁鍗囨満涓� 101.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 102.灏忚溅鍒版彁鍗囨満涓�
+ if (wrkMast.getWrkSts() == 101) {
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
+ if (shuttleThread == null) {
+ return false;
+ }
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ //灏忚溅澶勪簬绌洪棽鐘舵��
+ if (!shuttleProtocol.isIdleNoCharge()) {
+ return false;
+ }
+
+ if (Utils.getLev(wrkMast.getLocNo()) == shuttleProtocol.getPoint().getZ()) {
+ //鐩爣搴撲綅鍜屽皬杞﹀簱浣嶅浜庡悓涓�妤煎眰锛岄渶瑕侀�氳繃鎻愬崌鏈鸿皟搴�
+ return true;//鐩存帴杩涘叆108.灏忚溅绉诲姩涓�
+ }
+
+ //璁$畻璺濈灏忚溅鏈�杩戠殑鎻愬崌鏈虹珯鐐�
+ //鏌ヨ灏忚溅鎵�鍦ㄦゼ灞傛彁鍗囨満杈撻�佺珯鐐�
+ int recentAllDistance = 9999999;//榛樿鏈�杩戣窛绂�
+ BasDevp recentDevp = null;//鏈�杩戠珯鐐�
+ List<BasDevp> basDevps = basDevpService.selectHasLiftNoByLev(shuttleProtocol.getPoint().getZ());
+ for (BasDevp basDevp : basDevps) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo());
+ if (liftThread == null) {
+ continue;
+ }
+ LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+ if (liftProtocol == null) {
+ continue;
+ }
+ if (!liftProtocol.isIdle()) {
+ continue;
+ }
+
+ //璁$畻璺緞
+ List<NavigateNode> calc = NavigateUtils.calc(shuttleProtocol.getCurrentLocNo(), basDevp.getLocNo(), NavigationMapType.NORMAL.id, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), Utils.getLev(shuttleProtocol.getCurrentLocNo())));
+ if (calc == null) {
+ continue;//璁$畻澶辫触锛屾壘涓嬩竴涓珯鐐�
+ }
+
+ Integer allDistance = NavigateUtils.getOriginPathAllDistance(calc);//鏍规嵁鍘熷鑺傜偣缁撴灉锛岃绠楁�昏璧拌窛绂�
+ if (recentAllDistance > allDistance) {
+ recentAllDistance = allDistance;//鏇存柊璺濈
+ recentDevp = basDevp;//鏇存柊杈撻�佺珯鐐�
+ }
+ }
+
+ if (recentDevp == null) {
+ //娌℃湁鎵惧埌鍙敤杈撻�佺珯鐐�
+ return false;//绛夊緟涓嬩竴娆¤疆璇�
+ }
+
+ //鑾峰彇鎻愬崌鏈烘暟鎹�
+ BasLift basLift = basLiftService.selectById(recentDevp.getLiftNo());
+ if (basLift == null) {
+ return false;//娌℃湁鎻愬崌鏈烘暟鎹�
+ }
+ if (basLift.getPoint() == null) {
+ return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍�
+ }
+ NavigateNode liftNode = new NavigateNode(basLift.getPoint().getX(), basLift.getPoint().getY());
+ liftNode.setZ(basLift.getPoint().getZ());
+
+ //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
+ NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), recentDevp.getLocNo());
+ //鑾峰彇灏忚溅杩涙彁鍗囨満琛岃蛋鍛戒护
+ NyShuttleHttpCommand moveCommand = NyHttpUtils.getInOutLiftCommand(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), NavigatePositionConvert.locNoToNode(recentDevp.getLocNo()), liftNode, true);
+ if (result.getCommands() == null) {
+ return false;//璺緞璁$畻澶辫触
+ }
+ List<NyShuttleHttpCommand> commands = result.getCommands();
+ commands.add(moveCommand);//娣诲姞灏忚溅杩佸叆鎻愬崌鏈哄懡浠�
+
+ ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+ assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
+ assignCommand.setTaskMode(ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id.shortValue());//灏忚溅绉诲簱浠诲姟
+ assignCommand.setTaskNo(wrkMast.getWrkNo().shortValue());//浠诲姟鍙�
+ assignCommand.setAuto(true);//鑷姩妯″紡
+ assignCommand.setCommands(commands);
+ assignCommand.setNodes(result.getNodes());
+
+ wrkMast.setWrkSts(102L);//灏忚溅绉诲姩鍒版彁鍗囨満涓� 101.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 102.灏忚溅鍒版彁鍗囨満涓�
+ wrkMast.setLiftNo(basLift.getLiftNo());//鎻愬崌鏈哄彿
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ //涓嬪彂浠诲姟
+ MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand));
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 灏忚溅杩佺Щ-鎻愬崌鏈烘惉杩愪腑
+ * 濡傞渶涓绘柟娉曟墽琛宑ontinue锛岃杩斿洖false
+ * ps:杩斿洖鍊紅rue骞朵笉浠h〃璇ユ柟娉曟墽琛屾垚鍔燂紝杩斿洖鍊间粎鍋氭爣璁扮敤浜庝富鏂规硶鏄惁鎵цcontinue
+ */
+ private boolean shuttleMoveExecuteStep2(WrkMast wrkMast) {
+ //--------------------------------------鎻愬崌鏈烘惉杩愪腑-----------------------------------------//
+ Date now = new Date();
+
+ //鎻愬崌鏈烘惉杩愪腑 103.灏忚溅鍒版彁鍗囨満瀹屾垚 ==> 104.鎻愬崌鏈烘惉杩愪腑
+ if (wrkMast.getWrkSts() == 103) {
+
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast.getLiftNo());
+ if (liftThread == null) {
+ return false;
+ }
+ LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+ if (liftProtocol == null) {
+ return false;
+ }
+ if (!liftProtocol.isIdle(wrkMast.getWrkNo().shortValue())) {
+ return false;
+ }
+
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
+ if (shuttleThread == null) {
+ return false;
+ }
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ //灏忚溅澶勪簬绌洪棽鐘舵��
+ if (!shuttleProtocol.isIdleNoCharge()) {
+ return false;
+ }
+
+ //鑾峰彇婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
+ BasDevp sourceBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getSourceLocNo()), liftProtocol.getLiftNo().intValue());
+ //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
+ BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), liftProtocol.getLiftNo().intValue());
+ if (sourceBasDevp == null || targetBasDevp == null) {
+ return false;//缂哄皯绔欑偣淇℃伅
+ }
+
+ //鑾峰彇鎻愬崌鏈哄懡浠�
+ NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceBasDevp.getDevNo(), targetBasDevp.getDevNo(), wrkMast.getWrkNo());
+
+ ArrayList<NyLiftCommand> commands = new ArrayList<>();
+ commands.add(liftCommand);
+
+ //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
+ LiftAssignCommand assignCommand = new LiftAssignCommand();
+ assignCommand.setCommands(commands);
+ assignCommand.setLiftNo(liftProtocol.getLiftNo());
+ assignCommand.setTaskNo(wrkMast.getWrkNo().shortValue());
+ assignCommand.setTaskMode(NyLiftTaskModelType.MOVE_CAR.id.shortValue());
+
+ wrkMast.setWrkSts(104L);//鎻愬崌鏈烘惉杩愪腑 103.灏忚溅鍒版彁鍗囨満瀹屾垚 ==> 104.鎻愬崌鏈烘惉杩愪腑
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ //涓嬪彂浠诲姟
+ MessageQueue.offer(SlaveType.Lift, liftProtocol.getLiftNo().intValue(), new Task(3, assignCommand));
+ }
+
+ }
+ return true;
+ }
+
+ /**
+ * 灏忚溅杩佺Щ-灏忚溅杩佸嚭鎻愬崌鏈轰腑
+ * 濡傞渶涓绘柟娉曟墽琛宑ontinue锛岃杩斿洖false
+ * ps:杩斿洖鍊紅rue骞朵笉浠h〃璇ユ柟娉曟墽琛屾垚鍔燂紝杩斿洖鍊间粎鍋氭爣璁扮敤浜庝富鏂规硶鏄惁鎵цcontinue
+ */
+ private boolean shuttleMoveExecuteStep3(WrkMast wrkMast) {
+ //--------------------------------------灏忚溅杩佸嚭鎻愬崌鏈轰腑-----------------------------------------//
+ Date now = new Date();
+
+ //灏忚溅杩佸嚭鎻愬崌鏈轰腑 105.鎻愬崌鏈烘惉杩愬畬鎴� ==> 106.灏忚溅杩佸嚭鎻愬崌鏈轰腑
+ if (wrkMast.getWrkSts() == 105) {
+
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, wrkMast.getLiftNo());
+ if (liftThread == null) {
+ return false;
+ }
+ LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+ if (liftProtocol == null) {
+ return false;
+ }
+ if (!liftProtocol.isIdle(wrkMast.getWrkNo().shortValue())) {
+ return false;
+ }
+
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
+ if (shuttleThread == null) {
+ return false;
+ }
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ //灏忚溅澶勪簬绌洪棽鐘舵��
+ if (!shuttleProtocol.isIdleNoCharge()) {
+ return false;
+ }
+
+ //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
+ BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), liftProtocol.getLiftNo().intValue());
+ if (targetBasDevp == null) {
+ return false;//缂哄皯绔欑偣淇℃伅
+ }
+
+ //鑾峰彇鎻愬崌鏈烘暟鎹�
+ BasLift basLift = basLiftService.selectById(targetBasDevp.getLiftNo());
+ if (basLift == null) {
+ return false;//娌℃湁鎻愬崌鏈烘暟鎹�
+ }
+ if (basLift.getPoint() == null) {
+ return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍�
+ }
+ NavigateNode liftNode = new NavigateNode(basLift.getPoint().getX(), basLift.getPoint().getY());
+ liftNode.setZ(basLift.getPoint().getZ());
+
+ List<NyShuttleHttpCommand> commands = new ArrayList<>();
+ //鑾峰彇灏忚溅鍑烘彁鍗囨満琛岃蛋鍛戒护
+ NyShuttleHttpCommand moveCommand = NyHttpUtils.getInOutLiftCommand(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), liftNode, NavigatePositionConvert.locNoToNode(targetBasDevp.getLocNo()), false);
+ commands.add(moveCommand);//娣诲姞灏忚溅杩佸嚭鎻愬崌鏈哄懡浠�
+
+ ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+ assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
+ assignCommand.setTaskMode(ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id.shortValue());//灏忚溅绉诲簱浠诲姟
+ assignCommand.setTaskNo(wrkMast.getWrkNo().shortValue());//浠诲姟鍙�
+ assignCommand.setAuto(true);//鑷姩妯″紡
+ assignCommand.setCommands(commands);
+ assignCommand.setNodes(null);
+
+ wrkMast.setWrkSts(106L);//灏忚溅杩佸嚭鎻愬崌鏈轰腑 105.鎻愬崌鏈烘惉杩愬畬鎴� ==> 106.灏忚溅杩佸嚭鎻愬崌鏈轰腑
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ //涓嬪彂浠诲姟
+ MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand));
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 灏忚溅杩佺Щ-灏忚溅绉诲姩鍒扮洰鏍囧簱浣嶄腑
+ * 濡傞渶涓绘柟娉曟墽琛宑ontinue锛岃杩斿洖false
+ * ps:杩斿洖鍊紅rue骞朵笉浠h〃璇ユ柟娉曟墽琛屾垚鍔燂紝杩斿洖鍊间粎鍋氭爣璁扮敤浜庝富鏂规硶鏄惁鎵цcontinue
+ */
+ private boolean shuttleMoveExecuteStep4(WrkMast wrkMast) {
+ //--------------------------------------灏忚溅绉诲姩鍒扮洰鏍囧簱浣嶄腑-----------------------------------------//
+ Date now = new Date();
+
+ //灏忚溅绉诲姩鍒扮洰鏍囧簱浣嶄腑 107.灏忚溅杩佸嚭鎻愬崌鏈哄畬鎴� ==> 108.灏忚溅绉诲姩涓�
+ if (wrkMast.getWrkSts() == 107) {
+
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
+ if (shuttleThread == null) {
+ return false;
+ }
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ //灏忚溅澶勪簬绌洪棽鐘舵��
+ if (!shuttleProtocol.isIdleNoCharge()) {
+ return false;
+ }
+
+ //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
+ BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), wrkMast.getLiftNo());
+ if (targetBasDevp == null) {
+ return false;//缂哄皯绔欑偣淇℃伅
+ }
+
+ //鑾峰彇鎻愬崌鏈烘暟鎹�
+ BasLift basLift = basLiftService.selectById(targetBasDevp.getLiftNo());
+ if (basLift == null) {
+ return false;//娌℃湁鎻愬崌鏈烘暟鎹�
+ }
+ if (basLift.getPoint() == null) {
+ return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍�
+ }
+ NavigateNode liftNode = new NavigateNode(basLift.getPoint().getX(), basLift.getPoint().getY());
+ liftNode.setZ(basLift.getPoint().getZ());
+
+ //鑾峰彇灏忚溅浠庤緭閫佺珯鍒扮洰鏍囧簱浣嶅懡浠�
+ NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), targetBasDevp.getLocNo(), wrkMast.getLocNo());
+ if (result.getCommands() == null) {
+ return false;//璺緞璁$畻澶辫触
+ }
+ List<NyShuttleHttpCommand> commands = result.getCommands();
+
+ ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+ assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
+ assignCommand.setTaskMode(ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id.shortValue());//灏忚溅绉诲簱浠诲姟
+ assignCommand.setTaskNo(wrkMast.getWrkNo().shortValue());//浠诲姟鍙�
+ assignCommand.setAuto(true);//鑷姩妯″紡
+ assignCommand.setCommands(commands);
+ assignCommand.setNodes(result.getNodes());
+
+ wrkMast.setWrkSts(108L);//灏忚溅绉诲姩鍒扮洰鏍囧簱浣嶄腑 107.灏忚溅杩佸嚭鎻愬崌鏈哄畬鎴� ==> 108.灏忚溅绉诲姩涓�
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ //涓嬪彂浠诲姟
+ MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand));
+ }
+ }
+ return true;
+ }
/**
* 鍑哄叆搴撴ā寮忓垏鎹�
--
Gitblit v1.9.1