From 088453238b5086519be49ad6892450e4404e7aba Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 15 五月 2025 15:55:13 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 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 4817d93..709f188 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -7,6 +7,7 @@
 import com.core.exception.CoolException;
 import com.zy.asrs.domain.dto.NotifyCustomDataDto;
 import com.zy.asrs.domain.enums.NotifyMsgType;
+import com.zy.asrs.domain.enums.RedisKeyType;
 import com.zy.asrs.domain.enums.TaskStatusType;
 import com.zy.asrs.domain.enums.WorkNoType;
 import com.zy.asrs.entity.*;
@@ -18,15 +19,12 @@
 import com.zy.asrs.utils.Utils;
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.HttpHandler;
+import com.zy.common.utils.RedisUtil;
 import com.zy.core.CrnThread;
 import com.zy.core.DevpThread;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.SlaveConnection;
 import com.zy.core.enums.*;
-import com.zy.core.enums.DevpType.DevpRequestType;
-import com.zy.core.enums.DevpType.DevpStateType;
-import com.zy.core.enums.DevpType.DevpTrayType;
-import com.zy.core.enums.DevpType.DevpWorkType;
 import com.zy.core.model.CrnSlave;
 import com.zy.core.model.DevpSlave;
 import com.zy.core.model.Task;
@@ -76,13 +74,9 @@
     @Autowired
     private TaskWrkService taskWrkService;
     @Autowired
-    private ConfigService configService;
-    @Autowired
     private StaDescMapper staDescMapper;
     @Autowired
     private CommandInfoService commandInfoService;
-    @Autowired
-    private OpenServiceImpl openServiceImpl;
     @Autowired
     private StaDescService staDescService;
     @Autowired
@@ -93,6 +87,8 @@
     private CrnOperaUtils crnOperaUtils;
     @Autowired
     private NotifyUtils notifyUtils;
+    @Autowired
+    private RedisUtil redisUtil;
     @Value("${wms.count}")
     private Integer maxCount;
     @Value("${wms.url}")
@@ -116,7 +112,7 @@
                     } else {
                         staProtocol = staProtocol.clone();
                     }
-                    Short workNo = staProtocol.getWorkNo();
+                    Short workNo = staProtocol.getWorkNo().shortValue();
                     Short stano = staProtocol.getStaNo();
 
                     // 灏哄妫�娴嬪紓甯�
@@ -152,11 +148,13 @@
                     }
 
                     // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                    if (staProtocol.stateType == DevpStateType.AUTO
-                            && staProtocol.workType == DevpWorkType.BUSY
-                            && staProtocol.requestType == DevpRequestType.IN
-                            && staProtocol.trayType == DevpTrayType.FULL
-                            && staProtocol.isPakMk()) {
+                    if (staProtocol.isAutoing()
+                            && staProtocol.isLoading()
+                            && staProtocol.isInEnable()
+                            && !staProtocol.isEmptyMk()
+                            && staProtocol.isPakMk()
+                            && staProtocol.getWorkNo() == 9999
+                    ) {
                         // 鑾峰彇鏉$爜鎵弿浠俊鎭�
                         BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
                         if (barcodeThread == null) {
@@ -183,6 +181,11 @@
                         String response = "";
                         Boolean success = false;
                         try {
+                            Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key);
+                            if(object != null) {
+                                continue;
+                            }
+
                             response = new HttpHandler.Builder()
                                     .setUri(wmsUrl)
                                     .setPath(inboundTaskApplyPath)
@@ -190,6 +193,7 @@
                                     .build()
                                     .doPost();
                             JSONObject jsonObject = JSON.parseObject(response);
+                            redisUtil.set(RedisKeyType.IN_TASK_LOCK.key, "lock", 5);
                             if (jsonObject.getInteger("code") != 200) {
                                 log.info("鏉$爜锛�" + barcode + "鐢宠WMS澶辫触,response=" + JSON.toJSONString(jsonObject));
                                 continue;
@@ -252,7 +256,7 @@
 
                             StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                     .eq("crn_no", taskWrk.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId()));
-                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
+                            staProtocol.setWorkNo(taskWrk.getWrkNo());
                             staProtocol.setStaNo(staDesc.getCrnStn().shortValue());
                             MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
 
@@ -329,10 +333,7 @@
                             staProtocol = staProtocol.clone();
                         }
 
-                        if (staProtocol.stateType == DevpStateType.AUTO
-                                && staProtocol.workType == DevpWorkType.BUSY
-                                && staProtocol.requestType == DevpRequestType.OUT
-                                && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) {
+                        if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
                             // 鏌ヨ宸ヤ綔妗�
                             TaskWrk taskWrk = taskWrkMapper.selectCrnStaWorking(crnSlave.getId(), staDesc.getStnNo().toString());
                             if (taskWrk == null) {
@@ -340,7 +341,7 @@
                             }
                             log.info("涓嬪彂杈撻�佺嚎浠诲姟锛歵askWrk:" + JSON.toJSONString(taskWrk));
 //                            R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false);
-                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
+                            staProtocol.setWorkNo(taskWrk.getWrkNo());
                             staProtocol.setStaNo(staDesc.getStnNo().shortValue());
                             boolean offer = false;
                             try {
@@ -442,7 +443,8 @@
                     continue;
                 }
 
-                if (staProtocol.stateType == DevpStateType.AUTO && staProtocol.workType == DevpWorkType.BUSY && staProtocol.getWorkNo() > 0) {
+                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+                        && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
                     flag = true;
                 }
                 if (!flag) {
@@ -564,10 +566,8 @@
                     }
 
                     // 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
-                    if (staProtocol.stateType == DevpStateType.AUTO
-                            && staProtocol.workType == DevpWorkType.IDLE
-                            && staProtocol.requestType == DevpRequestType.OUT
-                            && staProtocol.getWorkNo() == 0) {
+                    if (staProtocol.isAutoing() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
+                    ) {
                         // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
 
                         // 鍫嗗灈鏈烘帶鍒惰繃婊�

--
Gitblit v1.9.1