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 |  129 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 125 insertions(+), 4 deletions(-)

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 e173bdb..22afdef 100644
--- a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -38,6 +38,10 @@
     private OrderDetlService orderDetlService;
     @Autowired
     private InOutService inOutService;
+    @Autowired
+    private MatService matService;
+    @Autowired
+    private HalfBarcodeService halfBarcodeService;
 
     public ReturnT<String> start(WrkMast wrkMast) {
         // 4.鍏ュ簱瀹屾垚
@@ -123,13 +127,57 @@
                             locDetl.setModel(wrkDetl.getModel());
 
                             InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr());
+                            Mat mat = matService.selectByMatnr(wrkDetl.getMatnr());
                             if (inOut != null){
-                                inOut.setTemp1("鍦ㄥ簱");
+                                inOut.setTemp1("鍦ㄥ簱");//灞炴�� 鏄惁鍦ㄥ簱
+                                inOut.setBrand(wrkDetl.getZpallet());//鎵樼洏鏉$爜
+                                inOut.setTemp2(mat.getName());//濂楀彿
+                                inOut.setTemp3(wrkMast.getLocNo());//搴撲綅鍙�
 //                                inOut.setModiTime(now.toString());
                             }
                             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("鏇存柊鍗婃墭淇℃伅澶辫触");
+                                }
+                            }
+
 
                             if (!locDetlService.insert(locDetl)) {
 //                                exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 娣诲姞搴撳瓨鏄庣粏澶辫触锛沎workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
@@ -184,11 +232,26 @@
 
                             InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr());
                             if (inOut != null){
-                                inOut.setTemp1("涓嶅湪搴�");
+                                inOut.setTemp1("涓嶅湪搴�");//灞炴�� 鏄惁鍦ㄥ簱
+                                inOut.setBrand("");//鎵樼洏鏉$爜
+                                inOut.setTemp3("");
 //                                inOut.setModiTime(now.toString());
                             }
                             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); // 鏁伴噺
                             }
 
 
@@ -252,11 +315,52 @@
 
                             InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr());
                             if (inOut != null){
-                                inOut.setTemp1("鍦ㄥ簱");
+                                inOut.setTemp1("鍦ㄥ簱");//灞炴�� 鏄惁鍦ㄥ簱
+                                inOut.setBrand(wrkDetl.getZpallet());//鎵樼洏鏉$爜
+                                inOut.setTemp3(wrkMast.getLocNo());//搴撲綅鍙�
 //                                inOut.setModiTime(now.toString());
                             }
                             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();
@@ -393,13 +497,30 @@
 
                     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.setTemp1("涓嶅湪搴�");//灞炴�� 鏄惁鍦ㄥ簱
+                            inOut.setBrand("");//鎵樼洏鏉$爜
+                            inOut.setTemp3("");//搴撲綅鍙�
 //                            inOut.setModiTime(now.toString());
                         }
                         if (!inOutService.updateById(inOut)){
                             return FAIL.setMsg("鏇存柊妯″叿灞炴�уけ璐�");
                         }
+                        if (!halfBarcodeService.half(halfBarcode)){
+                            return FAIL.setMsg("鏇存柊鍗婃墭淇℃伅澶辫触");
+                        }
                     }
 
                     for (WrkDetl wrkDetl : wrkDetls101) {

--
Gitblit v1.9.1