From 1ee1574b1fce92407e45438b0141121d266efd3d Mon Sep 17 00:00:00 2001
From: Administrator <1051256694@qq.com>
Date: 星期三, 29 四月 2026 15:27:58 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 642f3c5..4b1c90e 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -421,17 +421,13 @@
         }
         String matnr = detl == null ? null : detl.getMatnr();
         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(wrkMast.getLocNo())) {
+            LocMast sourceLoc = locMastService.selectById(wrkMast.getLocNo());
             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};
+        int[] candidates = sourceCrnNo != null && sourceCrnNo < 5 ? new int[]{1, 2} : new int[]{1, 2, 3, 4};
         Integer chosenCrnNo = null;
         Integer chosenCount = null;
         for (int candidate : candidates) {
@@ -471,6 +467,9 @@
                     .eq("whs_type", 1)
                     .orderBy("lev1,bay1"));
         }
+        if (!Cools.isEmpty(locMast) && sourceCrnNo != null && sourceCrnNo.equals(locMast.getCrnNo())) {
+            locMast = null;
+        }
         if (Cools.isEmpty(locMast)) {
             List<LocMast> anyLocs = locMastService.selectList(new EntityWrapper<LocMast>()
                     .eq("loc_sts", "O")

--
Gitblit v1.9.1