From 2926782a194a79a51ce3a3d6ad43151605892c0e Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 27 八月 2025 16:10:22 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 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 06b5c39..98a7cc5 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -35,12 +35,10 @@
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.BarcodeThread;
 import com.zy.core.thread.SiemensDevpThread;
-import com.zy.system.service.ConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.io.IOException;
@@ -53,7 +51,6 @@
  */
 @Slf4j
 @Service("mainService")
-@Transactional
 public class MainServiceImpl {
 
     public static final long COMMAND_TIMEOUT = 5 * 1000;
@@ -150,7 +147,7 @@
                     if (staProtocol.isAutoing()
                             && staProtocol.isLoading()
                             && staProtocol.isInEnable()
-                            && !staProtocol.isEmptyMk()
+//                            && !staProtocol.isEmptyMk()
                             && staProtocol.isPakMk()
                             && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9998)
                     ) {
@@ -163,6 +160,20 @@
                         String barcode = barcodeThread.getBarcode();
                         if (Cools.isEmpty(barcode)) {
                             News.watchInfo(String.valueOf(staProtocol.getSiteId()), "鍏ュ簱淇″彿婊¤冻锛屾墭鐩樼爜涓虹┖");
+                            continue;
+                        }
+
+                        StaDesc staDesc2 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("type_no", 1).eq("stn_no", staProtocol.getSiteId()));
+                        List<TaskWrk> taskWrkOutList = taskWrkService.selectList(new EntityWrapper<TaskWrk>()
+                                .eq("crn_no", staDesc2.getCrnNo())
+                                .eq("wrk_sts", 12)
+                        );
+                        if (!taskWrkOutList.isEmpty()) {
+                            News.watchInfo(String.valueOf(staProtocol.getSiteId()), "鐢宠鍏ュ簱浠诲姟鏃跺彂鐜版鍦ㄦ墽琛岀殑鍑哄簱浠诲姟,鍏ュ簱浠诲姟琚己鍒堕��鍥�");
+
+                            staProtocol.setWorkNo(9997);
+                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
+                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                             continue;
                         }
 
@@ -183,10 +194,10 @@
                             requestParam.put("wcsStatus", 0);//鎴愬姛
                         }
 
-                        String response = "";
+                        String response = "None";
                         Boolean success = false;
                         try {
-                            Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key);
+                            Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key + inSta.getStaNo());
                             if(object != null) {
                                 continue;
                             }
@@ -198,7 +209,8 @@
                                     .build()
                                     .doPost();
                             JSONObject jsonObject = JSON.parseObject(response);
-                            redisUtil.set(RedisKeyType.IN_TASK_LOCK.key, "lock", 5);
+                            log.info(response);
+                            redisUtil.set(RedisKeyType.IN_TASK_LOCK.key + inSta.getStaNo(), "lock", 5);
                             if (jsonObject.getInteger("code") == 200) {
 
                             } else if (jsonObject.getInteger("code") == 500) {
@@ -248,7 +260,7 @@
                             taskWrk.setBarcode(barcode);//鏉$爜
                             taskWrk.setCrnNo(locMast.getCrnNo());
                             taskWrk.setTargetPoint(resultLocNo);
-                            taskWrk.setStartPoint(String.valueOf(staProtocol.getStaNo()));
+                            taskWrk.setStartPoint(String.valueOf(inSta.getStaNo()));
                             if (!Cools.isEmpty(taskWrk.getTargetPoint())) {
                                 taskWrk.setOriginTargetPoint(taskWrk.getTargetPoint());
                             }
@@ -456,7 +468,7 @@
                     flag = true;
                 }
                 if (!flag) {
-                    News.watchError(crnStn.getStaNo() + "绔欑偣", "鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐圭姸鎬佹娴嬪け璐ワ紝绔欑偣闇�瑕佹弧瓒筹細鑷姩銆佹湁鐗┿�佹湁宸ヤ綔鍙枫�佺珯鐐瑰彲鍏�");
+//                    News.watchError(crnStn.getStaNo() + "绔欑偣", "鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐圭姸鎬佹娴嬪け璐ワ紝绔欑偣闇�瑕佹弧瓒筹細鑷姩銆佹湁鐗┿�佹湁宸ヤ綔鍙枫�佺珯鐐瑰彲鍏�");
                     continue;
                 }
 

--
Gitblit v1.9.1