From 91aa478d200d53ecf5e3032ce7f7e026a218e526 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 11 十二月 2025 17:26:57 +0800
Subject: [PATCH] no message

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   73 +++++++++++++++++++++++++-----------
 1 files changed, 50 insertions(+), 23 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 b957470..d72316d 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -6,6 +6,8 @@
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.core.common.*;
 import com.core.exception.CoolException;
+import com.zy.api.enums.MatLocType;
+import com.zy.api.enums.MatType;
 import com.zy.asrs.entity.*;
 import com.zy.asrs.entity.param.*;
 import com.zy.asrs.entity.result.FindLocNoAttributeVo;
@@ -701,15 +703,15 @@
                 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() + "!!");
-            }
+//            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() + "!!");
+//            }
             //杩樺彲浠ユ斁鍏ュ灏戠鐗╂枡
-            Integer suplus = container.getMixMax();
+//            Integer suplus = container.getMixMax();
             for (DetlDto detlDto : detlDtos) {
                 Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                 if (Cools.isEmpty(mat)) {
@@ -731,6 +733,7 @@
                 WaitPakin waitPakin = new WaitPakin();
                 BeanUtils.copyProperties(mat, waitPakin);
                 waitPakin.setOrderNo(detlDto.getOrderNo());   // 鍗曟嵁缂栧彿
+                waitPakin.setType(param.getType());
                 waitPakin.setOrderId(detlDto.getOrderId());
                 waitPakin.setBatch(detlDto.getBatch());     // 搴忓垪鐮�
                 waitPakin.setZpallet(param.getBarcode());   // 鎵樼洏鐮�
@@ -1225,7 +1228,7 @@
      * @version 1.0
      */
     @Override
-    public R callAgvMove(AgvCallParams params, Long userId) {
+    public synchronized R callAgvMove(AgvCallParams params, Long userId) {
         if (Objects.isNull(params.getOrgSite())) {
             throw new CoolException("婧愮珯鐐逛笉鑳戒负绌猴紒锛�");
         }
@@ -1290,8 +1293,35 @@
         if (Objects.isNull(locCaches)) {
             throw new CoolException("鏆傛棤婊¤冻闇�姹傚簱浣嶏紒");
         }
+
+        //鑾峰彇缂撳瓨鍖轰俊鎭�
+        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
+        if (Objects.isNull(basAreas)) {
+            throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
+        }
+
+        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+                .eq("area_id", basAreas.getId())
+                .eq("loc_no", locCaches.getLocNo()));
+        if (Objects.isNull(locDetls) || locDetls.isEmpty()) {
+            throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦紒锛�");
+        }
+
+        Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
+        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
+        if (Objects.isNull(matList) || matList.isEmpty()) {
+            throw new CoolException("鐗╂枡搴撲笉瀛樺湪璇ョ墿鏂�!!");
+        }
+        Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
+        if (!longs.isEmpty() && longs.size() > 1) {
+            throw new CoolException("鐗╂枡绫诲瀷涓嶄竴鑷�,璇锋鏌ユ暟鎹槸鍚︽纭�!!");
+        }
+
+        Mat mat = matList.stream().findFirst().get();
+
         BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
                 .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
+                .eq("crn_type", mat.getTagId())
                 .eq("dev_no", params.getTarSite()));
         if (Objects.isNull(station)) {
             throw new CoolException("绔欑偣姝e湪鎵ц浠诲姟锛侊紒");
@@ -1379,8 +1409,6 @@
             throw new CoolException("绔欑偣淇℃伅涓嶅瓨鍦紒锛�");
         }
 
-
-
         List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
         if (!tasks.isEmpty()) {
             throw new CoolException("鎵樼洏宸插湪浠诲姟鎵ц涓�..");
@@ -1434,8 +1462,6 @@
                 throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
             }
         }
-
-
 
         // 淇敼鐩爣搴撲綅鐘舵��
         if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
@@ -1919,15 +1945,16 @@
             throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦紒锛�");
         }
 
-        Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
-        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
-        if (Objects.isNull(matList) || matList.isEmpty()) {
-            throw new CoolException("鐗╂枡搴撲笉瀛樺湪璇ョ墿鏂�!!");
-        }
-        Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
-        if (!longs.isEmpty() && longs.size() > 1) {
-            throw new CoolException("鐗╂枡绫诲瀷涓嶄竴鑷�,璇锋鏌ユ暟鎹槸鍚︽纭�!!");
-        }
+//        Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
+//        List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
+//
+//        if (Objects.isNull(matList) || matList.isEmpty()) {
+//            throw new CoolException("鐗╂枡搴撲笉瀛樺湪璇ョ墿鏂�!!");
+//        }
+//        Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
+//        if (!longs.isEmpty() && longs.size() > 1) {
+//            throw new CoolException("鐗╂枡绫诲瀷涓嶄竴鑷�,璇锋鏌ユ暟鎹槸鍚︽纭�!!");
+//        }
 
         //鑾峰彇绔嬪簱鍖轰俊鎭�
         BasAreas one = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_CRN.type));
@@ -2182,7 +2209,7 @@
      * @version 1.0
      */
     @Transactional(rollbackFor = Exception.class)
-    public void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
+    public synchronized void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
         List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
         if (Objects.isNull(pakins) || pakins.isEmpty()) {
             throw new CoolException("缁勬墭淇℃伅涓嶅瓨鍦紒锛�");

--
Gitblit v1.9.1