From 313647000723455b7b374b9fe2bd89c304d89db9 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 10 十一月 2025 17:02:09 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   63 ++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 27 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 1867759..64cef33 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -20,6 +20,7 @@
 import com.zy.common.model.enums.WorkNoType;
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.HttpHandler;
+import com.zy.system.timer.LoadingConfigTimer;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -109,6 +110,8 @@
     private BasStationService basStationService;
     @Autowired
     private BasContainerService basContainerService;
+    @Autowired
+    private LoadingConfigTimer loadingConfigTimer;
 
     @Override
     @Transactional
@@ -558,9 +561,24 @@
         if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
             throw new CoolException(BaseRes.PARAM);
         }
-        if (param.getCombMats().size() < 1) {
-            throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒");
+        Integer suplus = null;
+        if (loadingConfigTimer.getZpalletManage()) {
+            BasContainer container = basContainerService.selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
+            if (Objects.isNull(container)) {
+                throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
+            }
+            if (container.getMixMax() < param.getCombMats().size()) {
+                throw new CoolException("瓒呭嚭瀹瑰櫒鏈�澶ф贩瑁呮暟閲忥紝褰撳墠瀹瑰櫒鏈�澶ф暟閲忎负锛�" + container.getMixMax() + "!!");
+            }
+            Set<String> matnrs = param.getCombMats().stream().map(CombParam.CombMat::getMatnr).collect(Collectors.toSet());
+            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
+            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
+            if (tagIds.size() > 1) {
+                throw new CoolException("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
+            }
+            suplus = container.getMixMax();
         }
+
         // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁
         if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                 eq("zpallet", param.getBarcode())
@@ -655,37 +673,28 @@
                 }
             });
 
-            BasContainer container = basContainerService.selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
-            if (Objects.isNull(container)) {
-                throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
-            }
-            if (container.getMixMax() < detlDtos.size()) {
-                throw new CoolException("瓒呭嚭瀹瑰櫒鏈�澶ф贩瑁呮暟閲忥紝褰撳墠瀹瑰櫒鏈�澶ф暟閲忎负锛�" + container.getMixMax() + "!!");
-            }
-            Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
-            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
-            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
-            if (tagIds.size() > 1) {
-                throw new CoolException("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
-            }
+
             //杩樺彲浠ユ斁鍏ュ灏戠鐗╂枡
-            Integer suplus = container.getMixMax();
+
+
             for (DetlDto detlDto : detlDtos) {
                 Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                 if (Cools.isEmpty(mat)) {
                     throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
                 }
-                //鏈�澶氬彲鏀炬暟閲�
-                Double singleMax = mat.getUpQty() * suplus;
-                if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
-                    throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟缁勬墭涓婇檺涓猴細" + mat.getUpQty() + ",褰撳墠鎬婚噺瓒呭嚭鎵樼洏瑁呰浇涓婇檺!!");
-                }
-                BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
-                //褰撳墠鐗╂枡闇�瑕佸崰鐢ㄦ枡绠辨牸鏁�
-                Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
-                suplus = suplus - curr;
-                if (suplus < 0) {
-                    throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
+                //鏈�澶氬彲鏀炬暟閲�,璇ュ姛鑳介渶瑕佸紑鍚鍣ㄧ鐞�
+                if (suplus != null) {
+                    Double singleMax = mat.getUpQty() * suplus;
+                    if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
+                        throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟缁勬墭涓婇檺涓猴細" + mat.getUpQty() + ",褰撳墠鎬婚噺瓒呭嚭鎵樼洏瑁呰浇涓婇檺!!");
+                    }
+                    BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
+                    //褰撳墠鐗╂枡闇�瑕佸崰鐢ㄦ枡绠辨牸鏁�
+                    Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
+                    suplus = suplus - curr;
+                    if (suplus < 0) {
+                        throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
+                    }
                 }
 
                 WaitPakin waitPakin = new WaitPakin();

--
Gitblit v1.9.1