From db6fc85e117c2732f8b5b904cbdfa38f7d9c100a Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期三, 12 十一月 2025 13:39:46 +0800
Subject: [PATCH] 半托功能调整

---
 src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java |   63 ++++++++++++++++++++++++++++---
 1 files changed, 56 insertions(+), 7 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 721ccff..3f7f416 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -34,9 +34,15 @@
     @Override
     public void deleteMatBarcode(List<MatBarcode> list) {
         for (MatBarcode matBarcode : list) {
+            //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+            Integer thickness = 0;
+            if (matBarcode.getSpecs() != null){
+                String[] split = matBarcode.getSpecs().split("\\*");
+                thickness = Integer.parseInt(split[1]);
+            }
             HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(matBarcode.getZpallet());
             halfBarcode.setAnfme(halfBarcode.getAnfme() - 1);
-            halfBarcode.setPrice(halfBarcode.getPrice() + 1);
+            halfBarcode.setPrice(halfBarcode.getPrice() + thickness);
             if (!halfBarcodeService.half(halfBarcode)){
                 throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
             }
@@ -58,17 +64,23 @@
             throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
         }
         HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
+        //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+        Integer thickness = 0;
+        if (mat.getSpecs() != null){
+            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(24-1);
+                hb.setPrice(2650 - thickness);
             }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
-                hb.setPrice(24-1);
+                hb.setPrice(1750 - thickness);
             }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
-                hb.setPrice(24-1);
+                hb.setPrice(800 - thickness);
             }
             if (!halfBarcodeService.insert(hb)){
                 throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
@@ -76,13 +88,13 @@
         }else {
             if (Integer.parseInt(waitPakin.getBarcode().substring(0,1))==6){
                 halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(halfBarcode.getPrice()-1);
+                halfBarcode.setPrice(2650 - thickness);
             }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==7){
                 halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(halfBarcode.getPrice()-1);
+                halfBarcode.setPrice(1750 - thickness);
             }else if(Integer.parseInt(waitPakin.getBarcode().substring(0,1))==8){
                 halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
-                halfBarcode.setPrice(halfBarcode.getPrice()-1);
+                halfBarcode.setPrice(800 - thickness);
             }
             if (!halfBarcodeService.half(halfBarcode)){
                 throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
@@ -112,6 +124,43 @@
         if (mat.getColor().equals("鎶ュ簾")){
             throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
         }
+        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(mat.getUnit());
+        //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+        Integer thickness = 0;
+        if (mat.getSpecs() != null){
+            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());

--
Gitblit v1.9.1