From 1da55d544dffc8d8b2e88efb4532776e71b0b11c Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 15 九月 2023 16:39:09 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java | 66 ++++++++++++++++++++++++++++++--
1 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
index 1390aa8..917c4cd 100644
--- a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
@@ -1,10 +1,12 @@
package com.zy.common.utils;
import com.core.exception.CoolException;
+import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.WrkCharge;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.mapper.WrkChargeMapper;
import com.zy.asrs.mapper.WrkMastMapper;
+import com.zy.asrs.service.BasDevpService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
@@ -13,9 +15,12 @@
import com.zy.core.News;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
+import com.zy.core.model.LiftSlave;
import com.zy.core.model.ShuttleSlave;
+import com.zy.core.model.protocol.LiftProtocol;
import com.zy.core.model.protocol.NyShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.LiftThread;
import com.zy.core.thread.NyShuttleThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -41,18 +46,20 @@
private WrkChargeMapper wrkChargeMapper;
@Autowired
private CommonService commonService;
+ @Autowired
+ private BasDevpService basDevpService;
/**
* 璋冨害杞﹁締-璋冨害鎸囧畾绌挎杞�
*/
- public void dispatchShuttle(Integer wrkNo, String locNo, Integer shuttleNo) {
- shuttleMoveGenerate(wrkNo, locNo, shuttleNo);
+ public boolean dispatchShuttle(Integer wrkNo, String locNo, Integer shuttleNo) {
+ return shuttleMoveGenerate(wrkNo, locNo, shuttleNo);
}
/**
* 璋冨害杞﹁締
*/
- public void dispatchShuttle(Integer wrkNo, String locNo) {
+ public boolean dispatchShuttle(Integer wrkNo, String locNo) {
ArrayList<NyShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅
ArrayList<NyShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
@@ -135,11 +142,11 @@
}
if (recentShuttle == null) {//娌℃湁鎼滅储鍒板彲鐢ㄧ┛姊溅
- return;
+ return false;
}
//鎼滅储鍒板彲鐢ㄧ┛姊溅锛岃皟搴﹁杞�
- shuttleMoveGenerate(wrkNo, locNo, recentShuttle.getSlave().getId());
+ return shuttleMoveGenerate(wrkNo, locNo, recentShuttle.getSlave().getId());
}
/**
@@ -181,6 +188,17 @@
return false;
}
+ Integer staNo = null;
+ if (Utils.getLev(locNo) == shuttleProtocol.getPoint().getZ()) {
+ //鐩爣搴撲綅鍜屽皬杞﹀簱浣嶅浜庝笉鍚屼竴妤煎眰锛岄渶瑕侀�氳繃鎻愬崌鏈鸿皟搴�
+ //鑾峰彇绌挎杞︽渶杩戜笖绌洪棽鐨勬彁鍗囨満杈撻�佺珯鐐�
+ BasDevp liftSta = this.getRecentLiftSta(shuttleNo);
+ if (liftSta == null) {
+ return false;//娌℃湁鍙敤涓旂┖闂茬殑杈撻�佺珯鐐�
+ }
+ staNo = liftSta.getDevNo();
+ }
+
// 鑾峰彇宸ヤ綔鍙�
int workNo = commonService.getWorkNo(0);
// 淇濆瓨宸ヤ綔妗�
@@ -193,6 +211,7 @@
wrkMast.setShuttleNo(shuttleNo);//绌挎杞﹀彿
wrkMast.setSourceLocNo(shuttleProtocol.getCurrentLocNo()); // 婧愬簱浣� => 灏忚溅褰撳墠搴撲綅鍙�
wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
+ wrkMast.setStaNo(staNo);//鐩爣绔�
wrkMast.setPicking("N"); // 鎷f枡
wrkMast.setExitMk("N"); // 閫�鍑�
wrkMast.setLinkMis("N");
@@ -214,4 +233,41 @@
return true;
}
+ /**
+ * 鑾峰彇绌挎杞︽渶杩戜笖绌洪棽鐨勬彁鍗囨満杈撻�佺珯鐐�
+ */
+ public BasDevp getRecentLiftSta(Integer shuttleNo) {
+ //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
+ if (shuttleThread == null) {
+ return null;
+ }
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return null;
+ }
+
+ for (LiftSlave slave : slaveProperties.getLift()) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, slave.getId());
+ if (liftThread == null) {
+ continue;
+ }
+ LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+ if (liftProtocol == null) {
+ continue;
+ }
+ if (!liftProtocol.isIdle()) {
+ continue;
+ }
+
+ BasDevp basDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(shuttleProtocol.getCurrentLocNo()), slave.getId());
+ if (basDevp == null) {
+ continue;
+ }
+ return basDevp;
+ }
+
+ return null;
+ }
+
}
--
Gitblit v1.9.1