From 11788cc8e4ddc3af0eb430badac4d1ad8b8595e4 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期五, 19 十二月 2025 16:52:22 +0800
Subject: [PATCH] #1

---
 src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java       |  109 +++++++++++++++++++++
 src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java |  185 +++++++++++++++++++------------------
 src/main/webapp/static/js/common.js                               |    2 
 3 files changed, 205 insertions(+), 91 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..377ec10 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatBarcodeServiceImpl.java
@@ -47,25 +47,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 +77,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 +102,43 @@
         if (mat.getColor().equals("鎶ュ簾")){
             throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
         }
-        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(waitPakin.getBarcode());
+//        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 +163,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());
diff --git a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
index 0705f50..22afdef 100644
--- a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -40,6 +40,8 @@
     private InOutService inOutService;
     @Autowired
     private MatService matService;
+    @Autowired
+    private HalfBarcodeService halfBarcodeService;
 
     public ReturnT<String> start(WrkMast wrkMast) {
         // 4.鍏ュ簱瀹屾垚
@@ -137,6 +139,46 @@
                                 return FAIL.setMsg("鏇存柊妯″叿灞炴�уけ璐�");
                             }
 
+                            //鏇存柊鍗婃墭淇℃伅
+                            HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet());
+                            //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+                            Integer thickness = 0;
+                            if (!Cools.isEmpty(wrkDetl.getSpecs())){
+                                String[] split = wrkDetl.getSpecs().split("\\*");
+                                thickness = Integer.parseInt(split[1]);
+                            }
+                            if (halfBarcode == null){
+                                HalfBarcode hb = new HalfBarcode();
+                                hb.setZpallet(wrkDetl.getZpallet());
+                                hb.setSpecs(wrkDetl.getZpallet().substring(0,1));
+                                hb.setAnfme(1);
+                                if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){
+                                    hb.setPrice(2650 - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){
+                                    hb.setPrice(1750 - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){
+                                    hb.setPrice(800 - thickness);
+                                }
+                                if (!halfBarcodeService.insert(hb)){
+                                    throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+                                }
+                            }else {
+                                if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){
+                                    halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+                                    halfBarcode.setPrice(halfBarcode.getPrice() - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){
+                                    halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+                                    halfBarcode.setPrice(halfBarcode.getPrice() - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){
+                                    halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+                                    halfBarcode.setPrice(halfBarcode.getPrice() - thickness);
+                                }
+                                if (!halfBarcodeService.half(halfBarcode)){
+                                    throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+                                }
+                            }
+
+
                             if (!locDetlService.insert(locDetl)) {
 //                                exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 娣诲姞搴撳瓨鏄庣粏澶辫触锛沎workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
                                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -197,6 +239,19 @@
                             }
                             if (!inOutService.updateById(inOut)){
                                 return FAIL.setMsg("鏇存柊妯″叿灞炴�уけ璐�");
+                            }
+
+                            // 瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+                            Integer thickness = 0;
+                            if (wrkDetl.getSpecs() != null){
+                                String[] split = wrkDetl.getSpecs().split("\\*");
+                                thickness = Integer.parseInt(split[1]);
+                            }
+                            // 鏍规嵁鎵樼洏鐮佹壘鍒板崐鎵樹俊鎭�
+                            HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet());
+                            if (halfBarcode != null){
+                                halfBarcode.setPrice(thickness + halfBarcode.getPrice()); // 鍙斁鍘氬害
+                                halfBarcode.setAnfme(halfBarcode.getAnfme() - 1); // 鏁伴噺
                             }
 
 
@@ -267,6 +322,45 @@
                             }
                             if (!inOutService.updateById(inOut)){
                                 return FAIL.setMsg("鏇存柊妯″叿灞炴�уけ璐�");
+                            }
+
+                            //鏇存柊鍗婃墭淇℃伅
+                            HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet());
+                            //瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+                            Integer thickness = 0;
+                            if (!Cools.isEmpty(wrkDetl.getSpecs())){
+                                String[] split = wrkDetl.getSpecs().split("\\*");
+                                thickness = Integer.parseInt(split[1]);
+                            }
+                            if (halfBarcode == null){
+                                HalfBarcode hb = new HalfBarcode();
+                                hb.setZpallet(wrkDetl.getZpallet());
+                                hb.setSpecs(wrkDetl.getZpallet().substring(0,1));
+                                hb.setAnfme(1);
+                                if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){
+                                    hb.setPrice(2650 - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){
+                                    hb.setPrice(1750 - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){
+                                    hb.setPrice(800 - thickness);
+                                }
+                                if (!halfBarcodeService.insert(hb)){
+                                    throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+                                }
+                            }else {
+                                if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){
+                                    halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+                                    halfBarcode.setPrice(halfBarcode.getPrice() - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){
+                                    halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+                                    halfBarcode.setPrice(halfBarcode.getPrice() - thickness);
+                                }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){
+                                    halfBarcode.setAnfme(halfBarcode.getAnfme() + 1);
+                                    halfBarcode.setPrice(halfBarcode.getPrice() - thickness);
+                                }
+                                if (!halfBarcodeService.half(halfBarcode)){
+                                    throw new CoolException("鏇存柊鍗婃墭淇℃伅澶辫触");
+                                }
                             }
 
                             locDetl = new LocDetl();
@@ -403,6 +497,18 @@
 
                     for (WrkDetl wrkDetl : wrkDetls101) {
                         InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr());
+                        // 瀵规ā鍏风殑瑙勬牸鍋氬鐞嗗緱鍒板帤搴�
+                        Integer thickness = 0;
+                        if (wrkDetl.getSpecs() != null){
+                            String[] split = wrkDetl.getSpecs().split("\\*");
+                            thickness = Integer.parseInt(split[1]);
+                        }
+                        // 鏍规嵁鎵樼洏鐮佹壘鍒板崐鎵樹俊鎭�
+                        HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet());
+                        if (halfBarcode != null){
+                            halfBarcode.setPrice(thickness + halfBarcode.getPrice()); // 鍙斁鍘氬害
+                            halfBarcode.setAnfme(halfBarcode.getAnfme() - 1); // 鏁伴噺
+                        }
                         if (inOut != null){
                             inOut.setTemp1("涓嶅湪搴�");//灞炴�� 鏄惁鍦ㄥ簱
                             inOut.setBrand("");//鎵樼洏鏉$爜
@@ -412,6 +518,9 @@
                         if (!inOutService.updateById(inOut)){
                             return FAIL.setMsg("鏇存柊妯″叿灞炴�уけ璐�");
                         }
+                        if (!halfBarcodeService.half(halfBarcode)){
+                            return FAIL.setMsg("鏇存柊鍗婃墭淇℃伅澶辫触");
+                        }
                     }
 
                     for (WrkDetl wrkDetl : wrkDetls101) {
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index 18bc5d2..eb6eba7 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -278,7 +278,7 @@
     ,{field: 'outOrderNo', align: 'center',title: '鍚堝悓鍙�', sort:true, hide: true}
     ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: true}
     ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜', hide: false}
-    ,{field: 'anfme', align: 'center',title: '缁戝畾鏁伴噺', hide: false}
+    ,{field: 'anfme', align: 'center',title: '妯″叿鏁伴噺', hide: false}
     ,{field: 'specs', align: 'center',title: '瑙勬牸', hide: true}
     ,{field: 'color', align: 'center',title: '棰滆壊', hide: true}
     ,{field: 'brand', align: 'center',title: '鍝佺墝', hide: true}

--
Gitblit v1.9.1