From 37348c5855649e98defe0f5b1557750cb7c84aa5 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 02 三月 2026 16:56:01 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java | 65 ++++++++++++++++++++++----------
1 files changed, 45 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java b/src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java
index b9b9546..ebf1408 100644
--- a/src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java
@@ -84,6 +84,7 @@
List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
.eq("crn_no", basCrnp.getCrnNo())
.in("wrk_sts", WrkStsType.INBOUND_RUN.sts, WrkStsType.OUTBOUND_RUN.sts)
+ .orderBy("batch_seq", false)
);
if(!wrkMasts.isEmpty()){
continue;
@@ -97,48 +98,68 @@
&& crnProtocol.getForkPos() == 0
&& crnProtocol.getAlarm() == 0
) {
+ Object clearLock = redisUtil.get(RedisKeyType.CLEAR_CRN_TASK_LIMIT.key + basCrnp.getCrnNo());
+ if (clearLock != null) {
+ continue;
+ }
+
// 濡傛灉鏈�杩戜竴娆℃槸鍏ュ簱妯″紡
if (crnProtocol.getLastIo().equals("I")) {
if (basCrnp.getInEnable().equals("Y")) {
- this.crnExecuteIn(basCrnp, crnThread); // 鍏ュ簱
+ boolean result = this.crnExecuteIn(basCrnp, crnThread);// 鍏ュ簱
crnProtocol.setLastIo("O");
+ if (result) {
+ break;
+ }
} else if (basCrnp.getOutEnable().equals("Y")) {
- this.crnExecuteOut(basCrnp, crnThread); // 鍑哄簱
+ boolean result = this.crnExecuteOut(basCrnp, crnThread);// 鍑哄簱
crnProtocol.setLastIo("I");
+ if (result) {
+ break;
+ }
}
}
// 濡傛灉鏈�杩戜竴娆℃槸鍑哄簱妯″紡
else if (crnProtocol.getLastIo().equals("O")) {
if (basCrnp.getOutEnable().equals("Y")) {
- this.crnExecuteOut(basCrnp, crnThread); // 鍑哄簱
+ boolean result = this.crnExecuteOut(basCrnp, crnThread);// 鍑哄簱
crnProtocol.setLastIo("I");
+ if (result) {
+ break;
+ }
} else if (basCrnp.getInEnable().equals("Y")) {
- this.crnExecuteIn(basCrnp, crnThread); // 鍏ュ簱
+ boolean result = this.crnExecuteIn(basCrnp, crnThread);// 鍏ュ簱
crnProtocol.setLastIo("O");
+ if (result) {
+ break;
+ }
}
}
//搴撲綅绉昏浆
- this.crnExecuteLocTransfer(basCrnp, crnThread);
+ boolean transfer = this.crnExecuteLocTransfer(basCrnp, crnThread);
+ if (transfer) {
+ break;
+ }
}
}
}
- private synchronized void crnExecuteIn(BasCrnp basCrnp, CrnThread crnThread) {
+ private synchronized boolean crnExecuteIn(BasCrnp basCrnp, CrnThread crnThread) {
CrnProtocol crnProtocol = crnThread.getStatus();
if(crnProtocol == null){
- return;
+ return false;
}
if(!basCrnp.getInEnable().equals("Y")){
News.info("鍫嗗灈鏈�:{} 鍙叆淇″彿涓嶆弧瓒�", basCrnp.getCrnNo());
- return;
+ return false;
}
List<StationObjModel> inStationList = basCrnp.getInStationList$();
if(inStationList.isEmpty()){
News.info("鍫嗗灈鏈�:{} 鍏ュ簱绔欑偣鏈缃�", basCrnp.getCrnNo());
- return;
+ return false;
}
Integer crnNo = basCrnp.getCrnNo();
@@ -214,25 +235,27 @@
MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command));
notifyUtils.notify(String.valueOf(SlaveType.Crn), crnNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_IN_TASK_RUN, null);
News.info("鍫嗗灈鏈哄懡浠や笅鍙戞垚鍔燂紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", crnNo, JSON.toJSON(command));
+ return true;
}
}
+ return false;
}
- private synchronized void crnExecuteOut(BasCrnp basCrnp, CrnThread crnThread) {
+ private synchronized boolean crnExecuteOut(BasCrnp basCrnp, CrnThread crnThread) {
CrnProtocol crnProtocol = crnThread.getStatus();
if(crnProtocol == null){
- return;
+ return false;
}
if(!basCrnp.getOutEnable().equals("Y")){
News.info("鍫嗗灈鏈�:{} 鍙嚭淇″彿涓嶆弧瓒�", basCrnp.getCrnNo());
- return;
+ return false;
}
List<StationObjModel> outStationList = basCrnp.getOutStationList$();
if(outStationList.isEmpty()){
News.info("鍫嗗灈鏈�:{} 鍑哄簱绔欑偣鏈缃�", basCrnp.getCrnNo());
- return;
+ return false;
}
Integer crnNo = basCrnp.getCrnNo();
@@ -240,6 +263,7 @@
List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
.eq("crn_no", crnNo)
.eq("wrk_sts", WrkStsType.NEW_OUTBOUND.sts)
+ .orderBy("batch_seq", false)
);
for (WrkMast wrkMast : wrkMasts) {
@@ -303,10 +327,11 @@
MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command));
notifyUtils.notify(String.valueOf(SlaveType.Crn), crnNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_OUT_TASK_RUN, null);
News.info("鍫嗗灈鏈哄懡浠や笅鍙戞垚鍔燂紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", crnNo, JSON.toJSON(command));
- return;
+ return true;
}
}
}
+ return false;
}
private synchronized boolean crnExecuteInPlanner(BasCrnp basCrnp, CrnThread crnThread, WrkMast wrkMast) {
@@ -487,10 +512,10 @@
return false;
}
- private synchronized void crnExecuteLocTransfer(BasCrnp basCrnp, CrnThread crnThread) {
+ private synchronized boolean crnExecuteLocTransfer(BasCrnp basCrnp, CrnThread crnThread) {
CrnProtocol crnProtocol = crnThread.getStatus();
if(crnProtocol == null){
- return;
+ return false;
}
Integer crnNo = basCrnp.getCrnNo();
@@ -535,9 +560,10 @@
MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command));
notifyUtils.notify(String.valueOf(SlaveType.Crn), crnNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_TRANSFER_TASK_RUN, null);
News.info("鍫嗗灈鏈哄懡浠や笅鍙戞垚鍔燂紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", crnNo, JSON.toJSON(command));
- return;
+ return true;
}
}
+ return false;
}
//鍫嗗灈鏈轰换鍔℃墽琛屽畬鎴�
@@ -604,7 +630,7 @@
wrkMast.setSystemMsg("");
wrkMast.setIoTime(new Date());
if (wrkMastService.updateById(wrkMast)) {
- CrnCommand resetCommand = crnThread.getResetCommand(crnProtocol.getCrnNo());
+ CrnCommand resetCommand = crnThread.getResetCommand(crnProtocol.getTaskNo(), crnProtocol.getCrnNo());
MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(2, resetCommand));
News.info("鍫嗗灈鏈轰换鍔$姸鎬佹洿鏂版垚鍔燂紝鍫嗗灈鏈哄彿={}锛屽伐浣滃彿={}", basCrnp.getCrnNo(), crnProtocol.getTaskNo());
}
@@ -789,8 +815,7 @@
String shallowLocNo = Utils.getLocNo(shallowRow, Utils.getBay(locNo), Utils.getLev(locNo));
LocMast shallowLocMast = locMastService.queryByLoc(shallowLocNo);
if (shallowLocMast == null) {
- News.taskInfo(taskNo, "娴呭簱浣�:{} 鏁版嵁涓嶅瓨鍦�", shallowLocNo);
- return false;
+ return true;
}
if (shallowLocMast.getLocSts().equals("O")) {
--
Gitblit v1.9.1