From f049bb4a433b3fba1859b78e097689628f72af45 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 14 一月 2026 16:00:03 +0800
Subject: [PATCH] lsh#

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java |   88 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
index b3edd3f..3511d61 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
@@ -208,7 +208,7 @@
         String barcode = waitPakinPda.getBarcode();
         String sta = waitPakinPda.getStaNo();
         //楠岃瘉鍩虹淇℃伅
-        BasStation basStation = checkStaStatus(barcode, sta);
+        BasStation basStation = checkStaStatus(barcode, sta,waitPakinPda.getArea());
         //鏇存柊绔欑偣鐘舵��
         basStation.setUseStatus(LocStsType.LOC_STS_TYPE_F.type);
         basStation.setBarcode(barcode);
@@ -255,12 +255,92 @@
                     new LambdaQueryWrapper<BasContainer>()
                             .in(BasContainer::getContainerType, longs1)
             );
-            boolean matches = containers.stream()
-                    .map(BasContainer::getCodeType)
-                    .anyMatch(codeType -> barcode.matches(codeType));
+            boolean matches = false;
+            for (BasContainer container : containers) {
+                String codeType = container.getCodeType();  // 鑾峰彇姝e垯琛ㄨ揪寮�
+                if (barcode.matches(codeType)) {  // 鍒ゆ柇鏉$爜鏄惁绗﹀悎杩欎釜姝e垯
+                    matches = true;
+                    break;  // 鎵惧埌鍖归厤鐨勫氨閫�鍑哄惊鐜�
+                }
+            }
+//            boolean matches = containers.stream()
+//                    .map(BasContainer::getCodeType)
+//                    .anyMatch(codeType -> barcode.matches(codeType));
             if (!matches) {
                 throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
             }
+        } else {
+            throw new CoolException("鏁版嵁寮傚父锛氶獙璇佸熀纭�淇℃伅");
+        }
+
+        return basStation;
+    }
+    private BasStation checkStaStatus(String barcode, String sta,String area) {
+        if (Cools.isEmpty(barcode)) {
+            throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
+        }
+        if (Cools.isEmpty(sta)) {
+            throw new CoolException("鎺ラ┏浣嶆潯鐮佷笉鑳戒负绌�");
+        }
+        WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
+                .eq(WaitPakin::getBarcode, barcode)
+                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val)
+        );
+        if (Cools.isEmpty(waitPakin)) {
+            throw new CoolException("瀹瑰櫒鐮佹湭鎵惧埌缁勬墭淇℃伅,璇锋鏌ョ粍鎵樼姸鎬�");
+        }
+        BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                        .eq(BasStation::getBarcode, barcode)
+                , false
+        );
+        if (!Cools.isEmpty(isBarcodeSta)) {
+            throw new CoolException("璇ユ潯鐮佸凡琚�" + isBarcodeSta.getStationName() + "绔欑粦瀹�");
+        }
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                .eq(BasStation::getStationName, sta)
+        );
+        if (Cools.isEmpty(basStation)) {
+            throw new CoolException("鏈壘鍒扮珯鐐逛俊鎭�");
+        }
+        if (!basStation.getUseStatus().equals("O")) {
+            throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
+        }
+
+        List<String> areaList = JSONObject.parseArray(basStation.getCrossZoneArea(), String.class);
+        if (!areaList.contains(area)) {
+            throw new CoolException("褰撳墠绔欑偣涓嶆敮鎸佺洰鏍囧簱鍖�");
+        }
+        if (!Cools.isEmpty(basStation.getContainerType())) {
+            List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class);
+            List<BasContainer> containers = basContainerService.list(
+                    new LambdaQueryWrapper<BasContainer>()
+                            .in(BasContainer::getContainerType, longs1)
+            );
+            boolean matches = false;
+            boolean matches2 = true;
+            for (BasContainer container : containers) {
+                String codeType = container.getCodeType();  // 鑾峰彇姝e垯琛ㄨ揪寮�
+                if (barcode.matches(codeType)) {  // 鍒ゆ柇鏉$爜鏄惁绗﹀悎杩欎釜姝e垯
+                    List<String> areaList2 = JSONObject.parseArray(container.getAreas(), String.class);
+                    if (!areaList2.contains(area)) {
+                        matches2 = false;
+                        continue;
+                    }
+                    matches = true;
+                    break;  // 鎵惧埌鍖归厤鐨勫氨閫�鍑哄惊鐜�
+                }
+            }
+//            boolean matches = containers.stream()
+//                    .map(BasContainer::getCodeType)
+//                    .anyMatch(codeType -> barcode.matches(codeType));
+            if (!matches2) {
+                throw new CoolException("鏌ヨ鍒扮殑瀹瑰櫒涓嶆敮鎸佺洰鏍囧簱鍖�");
+            }
+            if (!matches) {
+                throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
+            }
+        } else {
+            throw new CoolException("鏁版嵁寮傚父锛氶獙璇佸熀纭�淇℃伅");
         }
 
         return basStation;

--
Gitblit v1.9.1