From bfc2c6e32a69ace11bb8909c0d120998d9689258 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期二, 13 一月 2026 13:31:37 +0800
Subject: [PATCH] lsh#

---
 rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx                              |   13 ++--
 rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx                                |    5 +
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   80 ++++++++++++++++++++++----
 rsf-server/src/main/java/com/vincent/rsf/server/common/enums/WarehouseAreaType.java       |    3 
 rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java          |    2 
 rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx                                |   10 +++
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java  |   66 ++++++++++++++++++++--
 7 files changed, 152 insertions(+), 27 deletions(-)

diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
index be2b2a8..5341c65 100644
--- a/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
+++ b/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
@@ -97,14 +97,15 @@
                                     />
                                 </Grid>
                                 <Grid item xs={6} display="flex" gap={1}>
-                                    <AutocompleteInput
-                                        choices={dicts}
-                                        optionText="label"
+                                    <SelectInput
                                         label="table.field.basStation.type"
                                         source="type"
-                                        optionValue="value"
-                                        parse={v => v}
-                                        validate={[required()]} />
+                                        choices={[
+                                            { id: 0, name: '鍏夌數' },
+                                            { id: 1, name: '鏃犲厜鐢�' },
+                                        ]}
+                                        validate={[required()]}
+                                    />
                                 </Grid>
                                 <Grid item xs={6} display="flex" gap={1}>
                                     <SelectInput
diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx
index 973ee19..2c2b12e 100644
--- a/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx
+++ b/rsf-admin/src/page/basicInfo/basStation/BasStationEdit.jsx
@@ -74,6 +74,16 @@
                                 autoFocus
                             />
                         </Stack>
+                        <Stack direction='row' gap={2}>
+                            <SelectInput
+                                label="table.field.basStation.type"
+                                source="type"
+                                choices={[
+                                    { id: 0, name: '鍏夌數' },
+                                    { id: 1, name: '鏃犲厜鐢�' },
+                                ]}
+                            />
+                        </Stack>
                         <Stack direction='row' gap={2}>                            
                             <SelectInput
                                     label="table.field.basStation.inAble"
diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
index 7b02a1f..6370340 100644
--- a/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
+++ b/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
@@ -137,6 +137,11 @@
                     <TextField source="useStatus$" label="table.field.basStation.useStatus" />
                     <TextField source="barcode" label="table.field.basStation.barcode" />
                     <FunctionField
+                        source="type"
+                        label="table.field.basStation.type"
+                        render={record => record.type === 1 ? '鏃犲厜鐢�' : '鍏夌數'}
+                    />
+                    <FunctionField
                         source="inAble"
                         label="table.field.basStation.inAble"
                         render={record => record.inAble === 1 ? '鏄�' : '鍚�'}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
index 4ab03d2..929447f 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
@@ -1,11 +1,13 @@
 package com.vincent.rsf.server.api.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.vincent.rsf.framework.common.Cools;
 import com.vincent.rsf.framework.common.R;
 import com.vincent.rsf.framework.exception.CoolException;
 import com.vincent.rsf.server.api.entity.params.PdaGeneralParam;
+import com.vincent.rsf.server.api.service.AgvService;
 import com.vincent.rsf.server.api.service.InBoundService;
 import com.vincent.rsf.server.api.utils.LocUtils;
 import com.vincent.rsf.server.manager.controller.params.GenerateTaskParams;
@@ -48,6 +50,55 @@
     @Autowired
     private TaskService taskService;
 
+
+    private BasStation checkStaStatus(String barcode, String sta) {
+        if (Cools.isEmpty(barcode)) {
+            throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
+        }
+        if (Cools.isEmpty(sta)) {
+            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("绔欑偣鐘舵�佷笉涓虹┖闂�");
+        }
+        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;
+            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("鏉$爜涓庣珯鐐逛笉鍖归厤");
+            }
+        }
+
+        return basStation;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public synchronized R generateTasks(PdaGeneralParam param, Long loginUserId) {
@@ -65,13 +116,15 @@
             throw new CoolException("鏈壘鍒版墍灞炲簱鍖轰俊鎭�");
         }
 
-        BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
-                .eq(BasContainer::getCode, param.getContainerNo()));
-        if (Objects.isNull(container)) {
-            throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
-        }
+//        BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
+//                .eq(BasContainer::getCode, param.getContainerNo()));
+//        if (Objects.isNull(container)) {
+//            throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
+//        }
+        //楠岃瘉鍩虹淇℃伅
+        BasStation basStation = checkStaStatus(param.getContainerNo(), param.getTransferStationNo());
         /**鑾峰彇搴撲綅*/
-        String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
+        String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null);
         if (Cools.isEmpty(targetLoc)) {
             throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
         }
@@ -88,6 +141,7 @@
                 .setTargLoc(targetLoc)
                 .setOrgSite(deviceSite.getSite())
                 .setBarcode(param.getContainerNo())
+                .setTargSite(deviceSite.getDeviceSite())
                 .setCreateBy(loginUserId)
                 .setUpdateBy(loginUserId);
         if (!taskService.save(task)) {
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/common/enums/WarehouseAreaType.java b/rsf-server/src/main/java/com/vincent/rsf/server/common/enums/WarehouseAreaType.java
index 89b20e4..f5b5319 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/common/enums/WarehouseAreaType.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/common/enums/WarehouseAreaType.java
@@ -10,7 +10,8 @@
 public enum WarehouseAreaType {
     //璁㈠崟绫诲瀷
     WAREHOUSE_AREA_RECEIPT("receipt", "鏀惰揣鍖�"),
-    WAREHOUSE_AREA_COLLECTION("collection", "闆嗚揣鍖�"),
+    WAREHOUSE_AREA_COLLECTION("collection", "瀛樺偍鍖�"),
+    WAREHOUSE_AREA_CACHE("cache", "缂撳瓨鍖�"),
     WAREHOUSE_AREA_DELIVERY("delivery", "鍙戣揣鍖�"),
     ;
 
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index cf7d0b9..d19b6b7 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -207,7 +207,6 @@
         return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
     }
 
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public synchronized R generateFlatWarehouseTasks(WaitPakin pakins, String locCode, Long loginUserId) {
@@ -334,13 +333,16 @@
             throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
         waitPakins.forEach(pakin -> {
-            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
-                    .eq(BasContainer::getCode, pakin.getBarcode()));
-            if (Objects.isNull(container)) {
-                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
-            }
+//            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
+//                    .eq(BasContainer::getCode, pakin.getBarcode()));
+//            if (Objects.isNull(container)) {
+//                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
+//            }
+
+            //楠岃瘉鍩虹淇℃伅
+            BasStation basStation = checkStaStatus(pakin.getBarcode(), deviceSite.getSite());
             /**鑾峰彇搴撲綅*/
-            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
+            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null);
             if (Cools.isEmpty(targetLoc)) {
                 throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
             }
@@ -447,6 +449,53 @@
     }
 
 
+    private BasStation checkStaStatus(String barcode, String sta) {
+        if (Cools.isEmpty(barcode)) {
+            throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
+        }
+        if (Cools.isEmpty(sta)) {
+            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("绔欑偣鐘舵�佷笉涓虹┖闂�");
+        }
+        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;
+            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("鏉$爜涓庣珯鐐逛笉鍖归厤");
+            }
+        }
+
+        return basStation;
+    }
     /**
      * @param loginUserId
      * @author Munch D. Luffy
@@ -482,13 +531,18 @@
             throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
         waitPakins.forEach(pakin -> {
-            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
-                    .eq(BasContainer::getCode, pakin.getBarcode()));
-            if (Objects.isNull(container)) {
-                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
-            }
+
+
+            //楠岃瘉鍩虹淇℃伅
+            BasStation basStation = checkStaStatus(pakin.getBarcode(), deviceSite.getSite());
+
+//            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
+//                    .eq(BasContainer::getCode, pakin.getBarcode()));
+//            if (Objects.isNull(container)) {
+//                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
+//            }
             /**鑾峰彇搴撲綅*/
-            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType(),rowList);
+            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(),null,rowList);
             if (Cools.isEmpty(targetLoc)) {
                 throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
             }
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
index 974c0b7..b202115 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
@@ -53,7 +53,7 @@
     }
 
     public static String getTargetLoc(Long areaId, Long containerType) {
-        Long locType = null;
+        Long locType = containerType;
 //        if (!Objects.isNull(containerType)) {
 //            LocTypeService locService = SpringUtils.getBean(LocTypeService.class);
 //            if (containerType.equals(ContainerType.CONTAINER_TYPE_NORMAL.val)) {

--
Gitblit v1.9.1