From 8f49410c2b06a387e4e9a7ee17fd1fa9928e9479 Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期三, 28 六月 2023 20:48:02 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 5aafe19..38f1687 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -162,14 +162,18 @@
     @Transactional
     public void startupFullTakeStore(StockOutParam param, Long userId) {
         List<StockOutParam.LocDetl> locDetls = new ArrayList<>();
+        List<String> locs = new ArrayList<>();
+        for(StockOutParam.LocDetl one : param.getLocDetls()){
+            locs.add(one.getLocNo());
+        }
 
         //鍑哄簱鏃讹紝濡傛灉褰撳墠搴撲綅缁勬湁鐩稿悓鐨勭墿鏂欙紝鍒欏厛鍑哄渚х墿鏂�
         for (StockOutParam.LocDetl locDetl : param.getLocDetls()) {
             List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo());
-            outerSingleLoc.add(locDetl.getLocNo());
             boolean flag = false;
             Double useCount = 0D;
             for (String locNo : outerSingleLoc) {
+                if(locs.contains(locNo)) continue;
                 for (LocDetl locDetl0 : locDetlService.selectByLocNo(locNo)) {
                     if (!locDetl0.getMatnr().equals(locDetl.getMatnr())) {
                         //涓嶆槸鐩稿悓鐗╂枡
@@ -177,6 +181,9 @@
                     }
                     double lastCount = locDetl.getCount() - useCount;//鍓╀綑鎵�闇�鏁伴噺
                     double realCount = 0;//瀹為檯鎻愪緵鏁伴噺
+                    if (lastCount==0){
+                        continue;
+                    }
                     if (locDetl0.getAnfme() >= lastCount) {//瀹為檯鏁伴噺澶т簬鎵�闇�鏁伴噺锛屾寜鎵�闇�鏁伴噺鎻愪緵
                         realCount = lastCount;
                     } else {
@@ -198,6 +205,14 @@
                 locDetls.add(locDetl);
             }
 
+        }
+        for(StockOutParam.LocDetl one : param.getLocDetls()){
+            List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(one.getLocNo());
+            for (String s : outerSingleLoc) {
+                if (!locs.contains(s)) {
+                    throw new CoolException("娴呭簱浣嶆湁鐩稿悓鐗╂枡涓嶆敮鎸佸嚭搴�");
+                }
+            }
         }
 
 //        ArrayList<String> locNos = new ArrayList<>();
@@ -471,7 +486,7 @@
                     if (!locDetl.getMatnr().equals(matnr)) {
                         flag = true;
                         break;
-                    }else if (ioWorkType.equals(IoWorkType.CHECK_OUT)){
+                    }else if (!Cools.isEmpty(ioWorkType) && ioWorkType.equals(IoWorkType.CHECK_OUT)){
                         flag = true;
                         break;
                     }

--
Gitblit v1.9.1