From 97e70fa264df2d3d0ed004137a8c55d9035b10f9 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期六, 20 九月 2025 15:42:37 +0800
Subject: [PATCH] 缓冲区库存调整

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 09fcff6..12c145f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -21,6 +21,7 @@
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.HttpHandler;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -544,7 +545,7 @@
         if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
             throw new CoolException(BaseRes.PARAM);
         }
-        if (param.getCombMats().size() > 1) {
+        if (param.getCombMats().size() < 1) {
             throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒");
         }
         // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁
@@ -555,9 +556,6 @@
 
         if (param.getBarcode().length() != 8) {
             throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode());
-        }
-        if (param.getCombMats().size() > 1) {
-            throw new CoolException("涓嶅厑璁告贩鏂�===>>" + param.getBarcode());
         }
 
         int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
@@ -593,7 +591,7 @@
                     throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
                 }
                 WaitPakin waitPakin = new WaitPakin();
-                waitPakin.sync(mat);
+                BeanUtils.copyProperties(mat, waitPakin);
                 waitPakin.setBatch(detlDto.getBatch());
                 waitPakin.setZpallet(param.getBarcode());   // 鎵樼洏鐮�
                 waitPakin.setIoStatus("N");     // 鍏ュ嚭鐘舵��
@@ -617,18 +615,20 @@
             // 鐢熸垚鍏ュ簱閫氱煡妗�
             List<DetlDto> detlDtos = new ArrayList<>();
             param.getCombMats().forEach(elem -> {
-
                 // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
-//                OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch());
-                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
-                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
-                if (elem.getAnfme() > orderDetl.getEnableQty()) {
-                    throw new CoolException(orderDetl.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�");
+//                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
+//                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
+                OrderDetlPakin detls = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
+                        .eq("order_id", order.getId())
+                        .eq("matnr", elem.getMatnr()));
+
+                if (Objects.isNull(detls)) {
+                    throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗕笉瀛樺湪锛侊紒");
                 }
-                // 淇敼璁㈠崟浣滀笟鏁伴噺
-//                if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) {
-//                    throw new CoolException("淇敼鍗曟嵁浣滀笟鏁伴噺澶辫触");
-//                }
+
+                if (elem.getAnfme() > detls.getEnableQty()) {
+                    throw new CoolException(detls.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�");
+                }
                 OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                         elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
                 DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
@@ -647,7 +647,8 @@
                     throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
                 }
                 WaitPakin waitPakin = new WaitPakin();
-                waitPakin.sync(mat);
+                BeanUtils.copyProperties(mat, waitPakin);
+//                waitPakin.sync(mat);
                 waitPakin.setOrderNo(order.getOrderNo());   // 鍗曟嵁缂栧彿
                 waitPakin.setBatch(detlDto.getBatch());     // 搴忓垪鐮�
                 waitPakin.setZpallet(param.getBarcode());   // 鎵樼洏鐮�
@@ -945,7 +946,7 @@
                     throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
                 }
                 WaitPakin waitPakin = new WaitPakin();
-                waitPakin.sync(mat);
+                BeanUtils.copyProperties(mat, waitPakin);
                 waitPakin.setOrderNo(orderNo);
                 waitPakin.setBatch(detlDto.getBatch());
                 waitPakin.setZpallet(param.getBarcode());   // 鎵樼洏鐮�

--
Gitblit v1.9.1