From 893d7c04b9b35b77f7440f7d4a32fa7466fd17f9 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 10 五月 2023 09:18:34 +0800
Subject: [PATCH] 入库状态2提升机指令
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 162 ++++++++++++++++++++++++++++++++++++-----------------
src/main/java/com/zy/asrs/mapper/WrkMastMapper.java | 4
src/main/resources/mapper/WrkMastMapper.xml | 13 ++-
3 files changed, 120 insertions(+), 59 deletions(-)
diff --git a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
index 5acd59d..aaa3adc 100644
--- a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
@@ -100,9 +100,9 @@
WrkMast selectByWorkNo(Integer workNo);
- WrkMast selectLiftStep62327();
+ WrkMast selectLiftStep262327();
- WrkMast selectByWorkNo72428(Integer workNo);
+ WrkMast selectByWorkNo372428(Integer workNo);
List<WrkMast> selectBy2125();
}
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 e271946..dabeb91 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1197,7 +1197,7 @@
}
//鎼滅储鏄惁鏈夊緟澶勭悊鐨勪换鍔�
- WrkMast wrkMast = wrkMastMapper.selectLiftStep62327();
+ WrkMast wrkMast = wrkMastMapper.selectLiftStep262327();
if (wrkMast == null) {
continue;
}
@@ -1205,56 +1205,40 @@
//缁欐彁鍗囨満鍒嗛厤浠诲姟
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
-
- if (liftLev != currentLocNoLey) {
//鎻愬崌鏈哄墠寰�鐩爣妤煎眰
LiftCommand command3 = new LiftCommand();
command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
@@ -1264,19 +1248,89 @@
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
+ }else {
+ 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
}
- //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
- 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;
@@ -1315,9 +1369,12 @@
//鎻愬崌鏈轰负绛夊緟纭
if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WAITING.id && liftProtocol.getTaskNo() != 0) {
//灏嗕换鍔℃。鏍囪涓哄畬鎴�
- WrkMast wrkMast = wrkMastMapper.selectByWorkNo72428(liftProtocol.getTaskNo().intValue());
+ WrkMast wrkMast = wrkMastMapper.selectByWorkNo372428(liftProtocol.getTaskNo().intValue());
if (wrkMast != null) {
switch (wrkMast.getWrkSts().intValue()) {
+ case 3://3.鎻愬崌鏈烘惉杩愪腑 ==> 4.鎻愬崌鏈烘惉杩愬畬鎴�
+ wrkMast.setWrkSts(4L);
+ break;
case 7://7.鎻愬崌鏈鸿縼绉诲皬杞︿腑 ==> 8.鎻愬崌鏈鸿縼绉诲皬杞﹀畬鎴�
wrkMast.setWrkSts(8L);
break;
@@ -1326,6 +1383,7 @@
break;
case 28://28.鎻愬崌鏈烘惉杩愪腑 ==> 29.鎻愬崌鏈烘惉杩愬畬鎴�
wrkMast.setWrkSts(29L);
+ wrkMast.setWrkSts(34L);//34.鍑哄簱瀹屾垚锛屾殏鏃跺厛鐩存帴瀹屾垚鍑哄簱宸ヤ綔妗o紝鍚庣画闇�瑕佹牴鎹緭閫佺嚎缁欏嚭鐨勭姸鎬佹潵纭畾34.鍑哄簱瀹屾垚鐘舵��
break;
default:
}
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index 42734d6..243d307 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -251,17 +251,20 @@
where wrk_no=#{workNo}
</select>
- <select id="selectLiftStep62327" resultMap="BaseResultMap">
+ <select id="selectLiftStep262327" resultMap="BaseResultMap">
select top 1 * from dbo.asr_wrk_mast
- where wrk_sts in (6,23,27)
- and shuttle_no is not null
+ where 1=1
+ and (wrk_sts in (6,23,27)
+ and shuttle_no is not null)
+ or (wrk_sts in (2)
+ and shuttle_no is null)
order by io_pri desc,wrk_sts desc
</select>
- <select id="selectByWorkNo72428" resultMap="BaseResultMap">
+ <select id="selectByWorkNo372428" resultMap="BaseResultMap">
select top 1 * from dbo.asr_wrk_mast
where wrk_no=#{workNo}
- and wrk_sts in (7,24,28)
+ and wrk_sts in (3,7,24,28)
</select>
<select id="selectBy2125" resultMap="BaseResultMap">
--
Gitblit v1.9.1