From de8a641769b80abca23a344b521bcdfe0dbca31f Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 11 十二月 2025 09:00:35 +0800
Subject: [PATCH] 入库流程功能优化

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 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 0aac059..218e81a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -589,9 +589,12 @@
             throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱");
         }
 
-        if (param.getBarcode().length() != 8) {
-            throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode());
+        if (Objects.isNull(param.getBarcode())) {
+            throw new CoolException("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
         }
+//        if (param.getBarcode().length() != 8) {
+//            throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode());
+//        }
 
         if (Objects.isNull(param.getType())) {
             param.setType("0");
@@ -691,18 +694,19 @@
                 }
             });
 
+            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("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
+            }
+
             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();
@@ -711,22 +715,21 @@
                 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() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
-                }
+//                //鏈�澶氬彲鏀炬暟閲�
+//                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();
                 BeanUtils.copyProperties(mat, waitPakin);
-//                waitPakin.sync(mat);
                 waitPakin.setOrderNo(detlDto.getOrderNo());   // 鍗曟嵁缂栧彿
                 waitPakin.setOrderId(detlDto.getOrderId());
                 waitPakin.setBatch(detlDto.getBatch());     // 搴忓垪鐮�
@@ -1223,16 +1226,13 @@
      */
     @Override
     public R callAgvMove(AgvCallParams params, Long userId) {
-        if (Objects.isNull(params.getTarSite())) {
-            throw new CoolException("鐩爣鍙傛暟涓嶈兘涓虹┖锛侊紒");
-        }
         if (Objects.isNull(params.getOrgSite())) {
             throw new CoolException("婧愮珯鐐逛笉鑳戒负绌猴紒锛�");
         }
         LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>()
                 .eq("frozen", 0)
                 .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-                .eq("loc_no", params.getTarSite())
+//                .eq("loc_no", params.getTarSite())
                 .orderAsc(Arrays.asList("loc_no"))
                 .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
         if (Objects.isNull(locCache)) {

--
Gitblit v1.9.1