From 463b9e4b68b8ab62a11c6985081fd5d62692cc79 Mon Sep 17 00:00:00 2001
From: cpT <1@123>
Date: 星期四, 29 一月 2026 19:42:07 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/utils/DualCrnOperateProcessUtils.java |  134 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 127 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/core/utils/DualCrnOperateProcessUtils.java b/src/main/java/com/zy/core/utils/DualCrnOperateProcessUtils.java
index f4b4492..c0b1e29 100644
--- a/src/main/java/com/zy/core/utils/DualCrnOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/DualCrnOperateProcessUtils.java
@@ -15,6 +15,7 @@
 import com.zy.asrs.service.WrkMastService;
 import com.zy.asrs.utils.NotifyUtils;
 import com.zy.asrs.utils.Utils;
+import com.zy.common.entity.FindCrnNoResult;
 import com.zy.common.model.StartupDto;
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.RedisUtil;
@@ -341,6 +342,22 @@
         }
 
         Integer station = inStationObjModel.getDualCrnExecuteStation();
+        if (station == 1) {
+            List<Integer> basList = basDualCrnp.getDisableStationOneBays$();
+            if (basList.contains(Utils.getBay(wrkMast.getLocNo()))) {
+                //绂佹鏀捐揣鍒楋紝鐢宠閲嶆柊鍒嗛厤
+                reassignTaskLocNo(wrkMast, inStationObjModel);
+                return false;
+            }
+        }else {
+            List<Integer> basList = basDualCrnp.getDisableStationTwoBays$();
+            if (basList.contains(Utils.getBay(wrkMast.getLocNo()))) {
+                //绂佹鏀捐揣鍒楋紝鐢宠閲嶆柊鍒嗛厤
+                reassignTaskLocNo(wrkMast, inStationObjModel);
+                return false;
+            }
+        }
+
         String sourceLocNo = Utils.getLocNo(inStationObjModel.getDeviceRow(), inStationObjModel.getDeviceBay(), inStationObjModel.getDeviceLev());
 
         List<DualCrnCommand> commandList = new ArrayList<>();
@@ -387,7 +404,25 @@
             return false;
         }
 
+        List<StationObjModel> enableUseStationList = new ArrayList<>();
         for (StationObjModel stationObjModel : outStationList) {
+            if (!stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) {
+                continue;
+            }
+
+            if(stationObjModel.getDualCrnExecuteStation().equals(station)) {
+                enableUseStationList.add(stationObjModel);
+            }
+
+            StationObjModel dualCrnSlaveStation = stationObjModel.getDualCrnSlaveStation();
+            if(dualCrnSlaveStation != null) {
+                if (dualCrnSlaveStation.getDualCrnExecuteStation().equals(station)) {
+                    enableUseStationList.add(stationObjModel);
+                }
+            }
+        }
+
+        for (StationObjModel stationObjModel : enableUseStationList) {
             StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
             if (stationThread == null) {
                 continue;
@@ -591,15 +626,34 @@
             } else if (wrkMast.getWrkSts() == WrkStsType.OUTBOUND_RUN.sts) {
                 updateWrkSts = WrkStsType.OUTBOUND_RUN_COMPLETE.sts;
                 notifyUtils.notify(String.valueOf(SlaveType.DualCrn), basDualCrnp.getCrnNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.DUAL_CRN_OUT_TASK_COMPLETE, null);
-                
+
+                List<StationObjModel> outStationList = basDualCrnp.getOutStationList$();
+                if(outStationList.isEmpty()){
+                    News.info("鍙屽伐浣嶅爢鍨涙満:{} 鍑哄簱绔欑偣鏈缃�", basDualCrnp.getCrnNo());
+                    return;
+                }
+
+                StationObjModel outStationObjModel = null;
+                for (StationObjModel stationObjModel : outStationList) {
+                    if (stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) {
+                        outStationObjModel = stationObjModel;
+                        break;
+                    }
+                }
+
+                if (outStationObjModel == null) {
+                    News.info("鍙屽伐浣嶅爢鍨涙満:{} 鏈壘鍒板尮閰嶇殑浠诲姟鍑哄簱绔�", basDualCrnp.getCrnNo());
+                    return;
+                }
+
+                if (station == 1) {
+                    redisUtil.set(RedisKeyType.DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(outStationObjModel, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24);
+                }else {
+                    redisUtil.set(RedisKeyType.DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(outStationObjModel.getDualCrnSlaveStation(), SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24);
+                }
+
                 if(mainProcessPlugin.contains("Fake")) {
                     //鐢熸垚浠跨湡绔欑偣鏁版嵁
-                    List<StationObjModel> outStationList = basDualCrnp.getOutStationList$();
-                    if(outStationList.isEmpty()){
-                        News.info("鍙屽伐浣嶅爢鍨涙満:{} 鍑哄簱绔欑偣鏈缃�", basDualCrnp.getCrnNo());
-                        return;
-                    }
-
                     for (StationObjModel stationObjModel : outStationList) {
                         if (!stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) {
                             continue;
@@ -780,4 +834,70 @@
         return 0;
     }
 
+    private boolean reassignTaskLocNo(WrkMast wrkMast, StationObjModel stationObjModel) {
+        StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
+        if (stationThread == null) {
+            return false;
+        }
+
+        Map<Integer, StationProtocol> stationProtocolMap = stationThread.getStatusMap();
+        StationProtocol stationProtocol = stationProtocolMap.get(stationObjModel.getStationId());
+        if (stationProtocol == null) {
+            return false;
+        }
+
+        String response = wmsOperateUtils.applyReassignTaskLocNo(wrkMast.getWrkNo(), stationObjModel.getStationId());
+        if (response == null) {
+            News.taskError(wrkMast.getWrkNo(), "璇锋眰WMS閲嶆柊鍒嗛厤鍏ュ簱搴撲綅鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲锛侊紒锛乺esponse锛歿}", response);
+            return false;
+        }
+
+        JSONObject jsonObject = JSON.parseObject(response);
+        if (jsonObject.getInteger("code").equals(200)) {
+            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+
+            String sourceLocNo = wrkMast.getLocNo();
+            String locNo = dto.getLocNo();
+
+            LocMast sourceLocMast = locMastService.queryByLoc(sourceLocNo);
+            if (sourceLocMast == null) {
+                News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 婧愬簱浣嶄俊鎭笉瀛樺湪", sourceLocNo);
+                return false;
+            }
+
+            if (!sourceLocMast.getLocSts().equals("S")) {
+                News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 婧愬簱浣嶇姸鎬佷笉澶勪簬鍏ュ簱棰勭害", sourceLocNo);
+                return false;
+            }
+
+            LocMast locMast = locMastService.queryByLoc(locNo);
+            if (locMast == null) {
+                News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 鐩爣搴撲綅淇℃伅涓嶅瓨鍦�", locNo);
+                return false;
+            }
+
+            if (!locMast.getLocSts().equals("O")) {
+                News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 鐩爣搴撲綅鐘舵�佷笉澶勪簬绌哄簱浣�", locNo);
+                return false;
+            }
+            //鏇存柊婧愬簱浣�
+            sourceLocMast.setLocSts("O");
+            sourceLocMast.setModiTime(new Date());
+            locMastService.updateById(sourceLocMast);
+
+            //鏇存柊鐩爣搴撲綅
+            locMast.setLocSts("S");
+            locMast.setModiTime(new Date());
+            locMastService.updateById(locMast);
+
+            //鏇存柊宸ヤ綔妗f暟鎹�
+            wrkMast.setLocNo(locNo);
+            wrkMastService.updateById(wrkMast);
+            return true;
+        } else {
+            News.error("璇锋眰WMS鏇存崲鍙屽伐浣嶅簱浣嶆帴鍙eけ璐ワ紒锛侊紒response锛歿}", response);
+        }
+        return false;
+    }
+
 }

--
Gitblit v1.9.1