From a68f64232c3f3ad22d27f9b5c89fe761c8a56280 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期二, 28 四月 2026 13:16:13 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index fc589c9..642f3c5 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -420,10 +420,24 @@
             detl = wrkDetl.get(0);
         }
         String matnr = detl == null ? null : detl.getMatnr();
-        int[] candidates = wrkMast.getCrnNo() != null && wrkMast.getCrnNo() < 3 ? new int[]{1, 2} : new int[]{1, 2, 3, 4};
+        Integer sourceCrnNo = null;
+        if (moveCrnNo != null && moveCrnNo != 0) {
+            sourceCrnNo = moveCrnNo;
+        } else if (wrkMast != null && !Cools.isEmpty(wrkMast.getSourceLocNo())) {
+            LocMast sourceLoc = locMastService.selectById(wrkMast.getSourceLocNo());
+            if (!Cools.isEmpty(sourceLoc) && sourceLoc.getCrnNo() != null) {
+                sourceCrnNo = sourceLoc.getCrnNo();
+            }
+        } else if (wrkMast != null && wrkMast.getCrnNo() != null) {
+            sourceCrnNo = wrkMast.getCrnNo();
+        }
+        int[] candidates = sourceCrnNo != null && sourceCrnNo < 3 ? new int[]{1, 2} : new int[]{1, 2, 3, 4};
         Integer chosenCrnNo = null;
         Integer chosenCount = null;
         for (int candidate : candidates) {
+            if (sourceCrnNo != null && candidate == sourceCrnNo) {
+                continue;
+            }
             //鍒ゆ柇璇ュ贩閬撴槸鍚﹀瓨鍦ㄧ┖浣�
             LocMast candidateLoc = locMastService.selectOne(new EntityWrapper<LocMast>()
                     .eq("crn_no", candidate)
@@ -469,6 +483,9 @@
                     if (anyLoc == null || anyLoc.getCrnNo() == null) {
                         continue;
                     }
+                    if (sourceCrnNo != null && sourceCrnNo.equals(anyLoc.getCrnNo())) {
+                        continue;
+                    }
                     if (!basCrnpService.checkSiteError(anyLoc.getCrnNo(), true)) {
                         continue;
                     }

--
Gitblit v1.9.1