From e0b041aca4e2ed0e0881e596c6cd1ec3dc63ddba Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 09 一月 2026 15:51:20 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java |  207 +++++++++++++++++++++++++++++----------------------
 1 files changed, 117 insertions(+), 90 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 be1adfe..766b520 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -1,5 +1,6 @@
 package com.zy.asrs.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.core.common.Cools;
 import com.core.exception.CoolException;
@@ -10,6 +11,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -47,25 +49,29 @@
 //            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湭瀹屾垚");
-                }
-            }
+
+
+
+
+//            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());
-            if (locCount > 0 || waitCount > 0){
-                throw new CoolException("搴撳瓨/缁勬墭妗e瓨鍦ㄨ妯″叿,涓嶈兘瑙g粦,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr() + "鎵樼洏鐮�:" + matBarcode.getZpallet());
-            }
+//            Integer waitCount = waitPakinService.selectCountByMatNr(matBarcode.getMatnr());
+//            if (locCount > 0 || waitCount > 0){
+//                throw new CoolException("搴撳瓨/缁勬墭妗e瓨鍦ㄨ妯″叿,涓嶈兘瑙g粦,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr() + "鎵樼洏鐮�:" + matBarcode.getZpallet());
+//            }
             //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
             Integer thickness = 0;
             if (!Cools.isEmpty(matBarcode.getSpecs())){
@@ -73,7 +79,8 @@
                 thickness = Integer.parseInt(split[1]);
             }
             HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(matBarcode.getZpallet());
-            if (halfBarcode != null){
+            // 濡傛灉妯″叿娌℃湁搴撳瓨 鏇存柊鍗婃墭淇℃伅 鏁伴噺 鍙斁鍘氬害
+            if (halfBarcode != null && locCount <= 0){
                 halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
                 halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
                 if (!halfBarcodeService.half(halfBarcode)){
@@ -97,43 +104,58 @@
         if (mat.getColor().equals("鎶ュ簾")){
             throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
         }
-        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
+        //瀵逛簬宸茬粡缁勬墭杩囩殑 妯″叿 涓嶅厑璁稿啀娆$粦瀹�
+        Integer waitPakinCount = waitPakinService.selectByBarcodeAndMatnr(waitPakin.getMatnr());
+        if (waitPakinCount >= 1){
+            throw new CoolException("璇ユā鍏峰凡缁忕粍鎵�,鍟嗗搧妯″叿鍚嶇О:" + waitPakin.getMatnr());
+        }
+        //瀵逛簬宸茬粡鏈夊簱瀛樼殑妯″叿 涓嶅厑璁稿啀娆$粦瀹�
+        List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", waitPakin.getMatnr()));
+        if (!Cools.isEmpty(locDetlList)) {
+            throw new CoolException("璇ユā鍏峰凡缁忓叆搴�,鍟嗗搧妯″叿鍚嶇О:" + waitPakin.getMatnr());
+        }
+        //瀵逛簬宸茬粡鏈夊伐浣滄。鐨勬ā鍏� 涓嶅厑璁稿啀娆$粦瀹�
+        List<WrkDetl> wrkDetlList = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("matnr", waitPakin.getMatnr()));
+        if (!Cools.isEmpty(wrkDetlList)) {
+            throw new CoolException("璇ユā鍏峰凡缁忓瓨鍦ㄥ伐浣滄。,鍟嗗搧妯″叿鍚嶇О:" + waitPakin.getMatnr());
+        }
+//        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
         //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
-        Integer thickness = 0;
-        if (!Cools.isEmpty(mat.getSpecs())){
-            String[] split = mat.getSpecs().split("\\*");
-            thickness = Integer.parseInt(split[1]);
-        }
-        if (halfBarcode == null){
-            HalfBarcode hb = new HalfBarcode();
-            hb.setZpallet(waitPakin.getBarcode());
-            hb.setSpecs(waitPakin.getBarcode().substring(0,1));
-            hb.setAnfme(1);
-            if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
-                hb.setPrice(2650 - thickness);
-            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
-                hb.setPrice(1750 - thickness);
-            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
-                hb.setPrice(800 - thickness);
-            }
-            if (!halfBarcodeService.insert(hb)){
-                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
-            }
-        }else {
-            if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
-                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(2650 - thickness);
-            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
-                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(1750 - thickness);
-            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
-                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(800 - thickness);
-            }
-            if (!halfBarcodeService.half(halfBarcode)){
-                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
-            }
-        }
+//        Integer thickness = 0;
+//        if (!Cools.isEmpty(mat.getSpecs())){
+//            String[] split = mat.getSpecs().split("\\*");
+//            thickness = Integer.parseInt(split[1]);
+//        }
+//        if (halfBarcode == null){
+//            HalfBarcode hb = new HalfBarcode();
+//            hb.setZpallet(waitPakin.getBarcode());
+//            hb.setSpecs(waitPakin.getBarcode().substring(0,1));
+//            hb.setAnfme(1);
+//            if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
+//                hb.setPrice(2650 - thickness);
+//            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
+//                hb.setPrice(1750 - thickness);
+//            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
+//                hb.setPrice(800 - thickness);
+//            }
+//            if (!halfBarcodeService.insert(hb)){
+//                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+//            }
+//        }else {
+//            if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
+//                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+//                halfBarcode.setPrice(2650 - thickness);
+//            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
+//                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+//                halfBarcode.setPrice(1750 - thickness);
+//            }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
+//                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+//                halfBarcode.setPrice(800 - thickness);
+//            }
+//            if (!halfBarcodeService.half(halfBarcode)){
+//                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+//            }
+//        }
         MatBarcode mb=new MatBarcode();
         mb.setZpallet(waitPakin.getBarcode());
         mb.setMatnr(mat.getMatnr());
@@ -158,43 +180,43 @@
         if (mat.getColor().equals("鎶ュ簾")){
             throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
         }
-        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit());
+//        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit());
         //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
-        Integer thickness = 0;
-        if (!Cools.isEmpty(mat.getSpecs())){
-            String[] split = mat.getSpecs().split("\\*");
-            thickness = Integer.parseInt(split[1]);
-        }
-        if (halfBarcode == null){
-            HalfBarcode hb = new HalfBarcode();
-            hb.setZpallet(mat.getUnit());
-            hb.setSpecs(mat.getUnit().substring(0,1));
-            hb.setAnfme(1);
-            if (Integer.parseInt(mat.getUnit().substring(0,1))==6){
-                hb.setPrice(2650 - thickness);
-            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
-                hb.setPrice(1750 - thickness);
-            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
-                hb.setPrice(800 - thickness);
-            }
-            if (!halfBarcodeService.insert(hb)){
-                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
-            }
-        }else {
-            if (Integer.parseInt(mat.getUnit().substring(0,1))==6){
-                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
-            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
-                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
-            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
-                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
-            }
-            if (!halfBarcodeService.half(halfBarcode)){
-                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
-            }
-        }
+//        Integer thickness = 0;
+//        if (!Cools.isEmpty(mat.getSpecs())){
+//            String[] split = mat.getSpecs().split("\\*");
+//            thickness = Integer.parseInt(split[1]);
+//        }
+//        if (halfBarcode == null){
+//            HalfBarcode hb = new HalfBarcode();
+//            hb.setZpallet(mat.getUnit());
+//            hb.setSpecs(mat.getUnit().substring(0,1));
+//            hb.setAnfme(1);
+//            if (Integer.parseInt(mat.getUnit().substring(0,1))==6){
+//                hb.setPrice(2650 - thickness);
+//            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
+//                hb.setPrice(1750 - thickness);
+//            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
+//                hb.setPrice(800 - thickness);
+//            }
+//            if (!halfBarcodeService.insert(hb)){
+//                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+//            }
+//        }else {
+//            if (Integer.parseInt(mat.getUnit().substring(0,1))==6){
+//                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+//                halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
+//            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==7){
+//                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+//                halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
+//            }else if(Integer.parseInt(mat.getUnit().substring(0,1))==8){
+//                halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+//                halfBarcode.setPrice(halfBarcode.getPrice()- thickness);
+//            }
+//            if (!halfBarcodeService.half(halfBarcode)){
+//                throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+//            }
+//        }
         MatBarcode mb=new MatBarcode();
         mb.setZpallet(mat.getUnit());
         mb.setMatnr(mat.getMatnr());
@@ -214,4 +236,9 @@
         Integer spec = Integer.valueOf(param.get("spec").toString());
         return matBarcodeMapper.page(pageNo,pageSize,barcode,spec);
     }
+
+    @Override
+    public List<MatBarcode> select100() {
+        return this.baseMapper.select100();
+    }
 }

--
Gitblit v1.9.1