From d5d7f24188f19f5d5c50f1d2e5cd6e49ba61edcc Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 10 五月 2023 09:54:51 +0800
Subject: [PATCH] 穿梭车redis存储前缀
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 215 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 145 insertions(+), 70 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 3441959..21c409f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -544,6 +544,13 @@
}
/**
+ * 鑾峰彇/鏇存柊瀹炴椂鍦板浘
+ */
+ public synchronized void refreshMap() {
+
+ }
+
+ /**
* 浠巖edis涓噸鍚换鍔�
*/
public synchronized void restartTaskFromRedis() {
@@ -570,7 +577,7 @@
liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);//宸ヤ綔鐘舵��
liftProtocol.setLiftLock(true);//鎻愬崌鏈洪攣瀹�
- }else {//鍥涘悜绌挎杞︿换鍔�
+ }else if(key.toString().contains("shuttle_wrk_no_")){//鍥涘悜绌挎杞︿换鍔�
ShuttleRedisCommand redisCommand = JSON.parseObject(map.get(key).toString(), ShuttleRedisCommand.class);
if (redisCommand == null) {
continue;
@@ -1097,16 +1104,16 @@
WrkMast wrkMast = wrkMastMapper.selectByWorkNo(shuttleProtocol.getTaskNo().intValue());
if (wrkMast != null) {
switch (wrkMast.getWrkSts().intValue()) {
- case 9:
+ case 9://9.灏忚溅鍏ュ簱鎼繍涓� ==> 14.鍏ュ簱瀹屾垚
wrkMast.setWrkSts(14L);
break;
- case 5:
+ case 5://5.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙� ==> 6.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴�
wrkMast.setWrkSts(6L);
break;
- case 22:
+ case 22://22.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙� ==> 23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴�
wrkMast.setWrkSts(23L);
break;
- case 26:
+ case 26://26.灏忚溅鍑哄簱鎼繍涓� ==> 27.灏忚溅鍑哄簱鎼繍瀹屾垚
wrkMast.setWrkSts(27L);
break;
default:
@@ -1197,7 +1204,7 @@
}
//鎼滅储鏄惁鏈夊緟澶勭悊鐨勪换鍔�
- WrkMast wrkMast = wrkMastMapper.selectLiftStep623();
+ WrkMast wrkMast = wrkMastMapper.selectLiftStep262327();
if (wrkMast == null) {
continue;
}
@@ -1205,82 +1212,143 @@
//缁欐彁鍗囨満鍒嗛厤浠诲姟
liftProtocol.setLiftLock(true);//閿佸畾鎻愬崌鏈�
liftProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());//璁剧疆浠诲姟鍙�
- liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//璁剧疆鍥涘悜绌挎杞﹀彿
liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);//璁剧疆鎻愬崌鏈虹姸鎬佷负宸ヤ綔涓�
-
- //鎵惧埌鍥涘悜绌挎杞︾殑绾跨▼
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, liftProtocol.getShuttleNo().intValue());
- if (shuttleThread == null) {
- continue;
- }
- ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
- if (shuttleProtocol == null) {
- continue;
- }
//鍛戒护list
ArrayList<LiftCommand> commands = new ArrayList<>();
- //褰撳墠绌挎杞﹀簱浣嶅彿
- String currentLocNo = shuttleProtocol.getCurrentLocNo();
- //褰撳墠绌挎杞︽ゼ灞�
- int currentLocNoLey = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
+ if (wrkMast.getWrkSts() == 2) {
+ //宸ヤ綔妗g洰鏍囧簱浣嶅彿
+ String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
+ //宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
+ int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length()));
- //宸ヤ綔妗g洰鏍囧簱浣嶅彿
- String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
- //宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
- int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length()));
+ //鎻愬崌鏈哄綋鍓嶆ゼ灞�
+ int liftLev = liftProtocol.getLev().intValue();
+ if (liftLev != 1) {
+ //鎻愬崌鏈轰笉鍦�1灞�
+ LiftCommand command1 = new LiftCommand();
+ command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command1.setRun((short) 1);//鍗囬檷
+ command1.setDistPosition((short) 1);//鐩爣妤煎眰1灞�
+ command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
- //鎻愬崌鏈哄綋鍓嶆ゼ灞�
- int liftLev = liftProtocol.getLev().intValue();
- if (liftLev != currentLocNoLey) {
- //涓嶅悓妤煎眰
- LiftCommand command1 = new LiftCommand();
- command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command1.setRun((short) 1);//鍗囬檷
- command1.setDistPosition((short) currentLocNoLey);//鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)
- command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+ commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
- commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
- }
+ //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵
+ LiftCommand command2 = new LiftCommand();
+ command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
+ command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵
- LiftCommand command2 = new LiftCommand();
- command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
- command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+ commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
- commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
+ //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
+ LiftCommand command3 = new LiftCommand();
+ command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command3.setRun((short) 1);//鍗囬檷
+ command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
+ command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
- LiftCommand command3 = new LiftCommand();
- command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command3.setRun((short) 1);//鍗囬檷
- command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
- command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+ commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
- commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
+ //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+ //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+ LiftCommand command4 = new LiftCommand();
+ command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
+ command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
- //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
- LiftCommand command4 = new LiftCommand();
- command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
- command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
- commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
-
- if (wrkMast.getIoType() == 101) {
- //鍑哄簱浠诲姟
- wrkMast.setWrkSts(24L);//绉诲姩浠诲姟
+ commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
}else {
- //鍏ュ簱浠诲姟
- wrkMast.setWrkSts(7L);//绉诲姩浠诲姟
+ 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;
+ }
+
+ //褰撳墠绌挎杞﹀簱浣嶅彿
+ String currentLocNo = shuttleProtocol.getCurrentLocNo();
+ //褰撳墠绌挎杞︽ゼ灞�
+ int currentLocNoLey = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
+
+ //宸ヤ綔妗g洰鏍囧簱浣嶅彿
+ String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
+ //宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
+ int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length()));
+
+ //鎻愬崌鏈哄綋鍓嶆ゼ灞�
+ int liftLev = liftProtocol.getLev().intValue();
+ if (liftLev != currentLocNoLey) {
+ //涓嶅悓妤煎眰
+ LiftCommand command1 = new LiftCommand();
+ command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command1.setRun((short) 1);//鍗囬檷
+ command1.setDistPosition((short) currentLocNoLey);//鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)
+ command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+
+ commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
+
+ //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵
+ LiftCommand command2 = new LiftCommand();
+ command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
+ command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+
+ commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
+
+ if (liftLev != currentLocNoLey) {
+ //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
+ LiftCommand command3 = new LiftCommand();
+ command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command3.setRun((short) 1);//鍗囬檷
+ command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
+ command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+
+ commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
+
+ //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
+ //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
+ LiftCommand command4 = new LiftCommand();
+ command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
+ command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
+ command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
+ command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+
+ commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
}
+
+ switch (wrkMast.getWrkSts().intValue()) {
+ case 2://2.璁惧涓婅蛋
+ wrkMast.setWrkSts(3L);//3.鎻愬崌鏈烘惉杩愪腑
+ break;//3.鎻愬崌鏈烘惉杩愪腑
+ case 6://6.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴�
+ wrkMast.setWrkSts(7L);//7.鎻愬崌鏈鸿縼绉诲皬杞︿腑
+ break;
+ case 23://23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴�
+ wrkMast.setWrkSts(24L);//24.鎻愬崌鏈鸿縼绉诲皬杞︿腑
+ break;
+ case 27://27.灏忚溅鍑哄簱鎼繍瀹屾垚
+ wrkMast.setWrkSts(28L);//28.鎻愬崌鏈烘惉杩愪腑
+ break;
+ }
+
//鎵�闇�鍛戒护缁勫悎瀹屾瘯锛屾洿鏂版暟鎹簱锛屾彁浜ゅ埌绾跨▼鍘诲伐浣�
LiftAssignCommand assignCommand = new LiftAssignCommand();
assignCommand.setCommands(commands);
@@ -1308,15 +1376,22 @@
//鎻愬崌鏈轰负绛夊緟纭
if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WAITING.id && liftProtocol.getTaskNo() != 0) {
//灏嗕换鍔℃。鏍囪涓哄畬鎴�
- WrkMast wrkMast = wrkMastMapper.selectByWorkNo724(liftProtocol.getTaskNo().intValue());
+ WrkMast wrkMast = wrkMastMapper.selectByWorkNo372428(liftProtocol.getTaskNo().intValue());
if (wrkMast != null) {
switch (wrkMast.getWrkSts().intValue()) {
- case 7:
+ case 3://3.鎻愬崌鏈烘惉杩愪腑 ==> 4.鎻愬崌鏈烘惉杩愬畬鎴�
+ wrkMast.setWrkSts(4L);
+ break;
+ case 7://7.鎻愬崌鏈鸿縼绉诲皬杞︿腑 ==> 8.鎻愬崌鏈鸿縼绉诲皬杞﹀畬鎴�
wrkMast.setWrkSts(8L);
break;
- case 24:
+ case 24://24.鎻愬崌鏈鸿縼绉诲皬杞︿腑 ==> 25.鎻愬崌鏈鸿縼绉诲皬杞﹀畬鎴�
wrkMast.setWrkSts(25L);
break;
+ case 28://28.鎻愬崌鏈烘惉杩愪腑 ==> 29.鎻愬崌鏈烘惉杩愬畬鎴�
+ wrkMast.setWrkSts(29L);
+ wrkMast.setWrkSts(34L);//34.鍑哄簱瀹屾垚锛屾殏鏃跺厛鐩存帴瀹屾垚鍑哄簱宸ヤ綔妗o紝鍚庣画闇�瑕佹牴鎹緭閫佺嚎缁欏嚭鐨勭姸鎬佹潵纭畾34.鍑哄簱瀹屾垚鐘舵��
+ break;
default:
}
--
Gitblit v1.9.1