From 9f6bae6e952b0b6836b539703f3418b0acc725d3 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 19 九月 2023 08:25:00 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java b/src/main/java/com/zy/common/utils/ShuttleDispatchUtils.java
index 041362d..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,6 +46,8 @@
private WrkChargeMapper wrkChargeMapper;
@Autowired
private CommonService commonService;
+ @Autowired
+ private BasDevpService basDevpService;
/**
* 璋冨害杞﹁締-璋冨害鎸囧畾绌挎杞�
@@ -146,7 +153,7 @@
* 灏忚溅杩佺Щ浠诲姟鐢熸垚
*/
@Transactional
- private boolean shuttleMoveGenerate(Integer wrkNo, String locNo, Integer shuttleNo) {
+ public boolean shuttleMoveGenerate(Integer wrkNo, String locNo, Integer shuttleNo) {
Date now = new Date();
//鑾峰彇鍥涘悜绌挎杞︾嚎绋�
NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
@@ -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