From 4715b1787c85a2186b9c0c43222b64b63c58459b Mon Sep 17 00:00:00 2001
From: czkh <czkh@163.com>
Date: 星期五, 05 十二月 2025 16:43:38 +0800
Subject: [PATCH] #1

---
 src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
index fa83c2b..be1adfe 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -41,22 +41,30 @@
     public void deleteMatBarcode(List<MatBarcode> list) {
         for (MatBarcode matBarcode : list) {
             //瀵逛簬宸茬粡鏈夊簱瀛� 缁勬墭妗� 宸ヤ綔妗g殑鏁版嵁 涓嶅厑璁歌В缁�
+//            Integer locCount = locDetlService.selectCountByMatNr(matBarcode.getMatnr());
+//            Integer waitCount = waitPakinService.selectCountByMatNr(matBarcode.getMatnr());
+//            Integer wrkCount = wrkDetlService.selectCountByMatNr(matBarcode.getMatnr());
+//            if (locCount > 0 || waitCount > 0){
+//                throw new CoolException("搴撳瓨/缁勬墭妗e瓨鍦ㄨ妯″叿,涓嶈兘瑙g粦,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr() + "鎵樼洏鐮�:" + matBarcode.getZpallet());
+//            }
+            Integer wrkNo = wrkDetlService.selectWrkNoByMatnr(matBarcode.getMatnr());
+            if (wrkNo != null){
+                WrkMast wrkMast = wrkMastService.selectById(wrkNo);
+                if (wrkMast == null){
+                    throw new CoolException("宸ヤ綔妗e紓甯革紝鏈夊伐浣滄槑缁嗘。鏃犲伐浣滄。");
+                }
+                if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 101){
+                    throw new CoolException("宸ヤ綔妗d笉鏄叏鏉垮嚭搴�/鎷f枡鍑哄簱");
+                }
+                if (wrkMast.getWrkSts() != 14 && wrkMast.getWrkSts() != 15){
+                    throw new CoolException("宸ヤ綔妗f湭瀹屾垚");
+                }
+            }
+            //瀵逛簬宸茬粡鏈夊簱瀛� 缁勬墭妗� 宸ヤ綔妗g殑鏁版嵁 涓嶅厑璁歌В缁�
             Integer locCount = locDetlService.selectCountByMatNr(matBarcode.getMatnr());
             Integer waitCount = waitPakinService.selectCountByMatNr(matBarcode.getMatnr());
-            //Integer wrkCount = wrkDetlService.selectCountByMatNr(matBarcode.getMatnr());
             if (locCount > 0 || waitCount > 0){
                 throw new CoolException("搴撳瓨/缁勬墭妗e瓨鍦ㄨ妯″叿,涓嶈兘瑙g粦,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr() + "鎵樼洏鐮�:" + matBarcode.getZpallet());
-            }
-            Integer wrkNo = wrkDetlService.selectWrkNoByMatnr(matBarcode.getMatnr());
-            WrkMast wrkMast = wrkMastService.selectById(wrkNo);
-            if (wrkMast == null){
-                throw new CoolException("宸ヤ綔妗e紓甯革紝鏈夊伐浣滄槑缁嗘。鏃犲伐浣滄。");
-            }
-            if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 101){
-                throw new CoolException("宸ヤ綔妗d笉鏄叏鏉垮嚭搴�/鎷f枡鍑哄簱");
-            }
-            if (wrkMast.getWrkSts() != 14 && wrkMast.getWrkSts() != 15){
-                throw new CoolException("宸ヤ綔妗f湭瀹屾垚");
             }
             //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
             Integer thickness = 0;
@@ -65,10 +73,12 @@
                 thickness = Integer.parseInt(split[1]);
             }
             HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(matBarcode.getZpallet());
-            halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
-            halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
-            if (!halfBarcodeService.half(halfBarcode)){
-                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+            if (halfBarcode != null){
+                halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
+                halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
+                if (!halfBarcodeService.half(halfBarcode)){
+                    throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+                }
             }
             matBarcodeMapper.deleteByMatnr(matBarcode.getMatnr());
         }

--
Gitblit v1.9.1