From 53f87c2ff10f7ab71d6b0340a5a4811089d7cd1e Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期五, 28 十一月 2025 17:17:48 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java |   89 ++++++++++++++++++++++----------------------
 1 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java b/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java
index ef0cf30..afc903f 100644
--- a/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java
@@ -111,6 +111,16 @@
                     if (!locDetls2.isEmpty()) {
                         locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", basAgvMast.getLocNo()));
                     }
+
+                    LocMast locMast2 = locMastService.selectById(basAgvMast.getLocNo());
+                    // 淇敼搴撲綅鐘舵�� S ====>> F
+                    if (locMast2.getLocSts().equals("S")) {
+                        locMast2.setLocSts("F");
+                        locMast2.setIoTime(now);
+                        locMast2.setModiTime(now);
+                    } else {
+                        return FAIL.setMsg("搴撲綅鐘舵�佸紓甯�");
+                    }
                     List<LocDetl> locDetlList1 = new ArrayList<>();
                     List<LocDetl> locDetlList2 = new ArrayList<>();
                     List<BasAgvLocDetl> basAgvLocDetlList = basAgvLocDetlService.selectList(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getSourceLocNo()));
@@ -123,59 +133,50 @@
                         }
                     } else if (!basAgvWrkDetlList.isEmpty()){
                         for (BasAgvWrkDetl wrkDetl : basAgvWrkDetlList){
+                            LocDetl locDetl = new LocDetl();
+                            locDetl.sync(wrkDetl);
+                            locDetl.setLocNo(basAgvMast.getLocNo()); // 搴撲綅鍙�
+                            locDetl.setAnfme(wrkDetl.getAnfme()); // 鏁伴噺
+                            locDetl.setZpallet(wrkDetl.getZpallet()); // 鎵樼洏鏉$爜
+                            locDetl.setModiTime(now);
+                            locDetl.setAppeTime(now);
+                            locDetl.setOrigin("鍦ㄥ簱");
+                            locDetlList2.add(locDetl);
 
-                            LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand()
-                                    ,wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(),wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3());
+                        }
+                    } else {
+                        locMast2.setLocSts("D");
+                    }
+
+                    if (!locMastService.updateById(locMast2)) {
+                        return FAIL;
+                    }
+                    if (!locDetlList1.isEmpty()){
+                        for (LocDetl locDetlold : locDetlList1) {
+                            LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand()
+                                    ,locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3(),locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3());
                             if (null != locDetl) {
-                                if (!locDetlService.updateAnfme(wrkDetl.getAnfme(), basAgvMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(),wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3()
-                                        ,wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3())) {
-//                                exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 鏇存柊搴撳瓨鏄庣粏澶辫触锛沎workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
-                                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                                    return FAIL.setMsg("鍏ㄦ澘鍏ュ簱 ===>> 鏇存柊搴撳瓨鏄庣粏澶辫触; [workNo=" + basAgvMast.getTaskNo() + "],[locNo=" + basAgvMast.getLocNo() + "]");
+                                if (!locDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3()
+                                        ,locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3())) {
                                 }
                             } else {
-                                locDetl = new LocDetl();
-                                locDetl.sync(wrkDetl);
-                                locDetl.setLocNo(basAgvMast.getLocNo()); // 搴撲綅鍙�
-                                locDetl.setAnfme(wrkDetl.getAnfme()); // 鏁伴噺
-                                locDetl.setZpallet(wrkDetl.getZpallet()); // 鎵樼洏鏉$爜
-                                locDetl.setModiTime(now);
-                                locDetl.setAppeTime(now);
-                                locDetl.setOrigin("鍦ㄥ簱");
-                                if (!locDetlService.insert(locDetl)) {
-//                                exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 娣诲姞搴撳瓨鏄庣粏澶辫触锛沎workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
-                                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                                    return FAIL.setMsg("鍏ュ簱 ===>> 娣诲姞搴撳瓨鏄庣粏澶辫触; [workNo=" + basAgvMast.getTaskNo() + "],[locNo=" + basAgvMast.getLocNo() + "]");
+                                if (!locDetlService.insert(locDetlold)) {
                                 }
                             }
-
-                        }
-                    }
-
-                    LocMast locMast2 = locMastService.selectById(basAgvMast.getLocNo());
-
-
-                    // 淇敼搴撲綅鐘舵�� S ====>> F
-                    if (locMast2.getLocSts().equals("S")) {
-                        locMast2.setLocSts("F");
-                        locMast2.setIoTime(now);
-                        locMast2.setModiTime(now);
-                        if (!locMastService.updateById(locMast2)) {
-//                            exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 淇敼搴撲綅鐘舵�佸け璐ワ紱[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
-                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                            return FAIL.setMsg("鍏ㄥ叆搴� ===>> 淇敼搴撲綅鐘舵�佸け璐�; [TaskNo=" + basAgvMast.getTaskNo() + "],[locNo=" + basAgvMast.getLocNo() + "]");
-                        }
-                    }
-
-
-                    if (!locDetlList1.isEmpty()){
-                        for (LocDetl locDetl : locDetlList1) {
-                            locDetlService.insert(locDetl);
                         }
                     }
                     if (!locDetlList2.isEmpty()){
-                        for (LocDetl locDetl : locDetlList2) {
-                            locDetlService.insert(locDetl);
+                        for (LocDetl locDetlold : locDetlList2) {
+                            LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand()
+                                    ,locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3(),locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3());
+                            if (null != locDetl) {
+                                if (!locDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3()
+                                        ,locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3())) {
+                                }
+                            } else {
+                                if (!locDetlService.insert(locDetlold)) {
+                                }
+                            }
                         }
                     }
 

--
Gitblit v1.9.1