From 6883e31331af4633d1b7d74ea7deb5f972afa05d Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 23 五月 2025 20:02:19 +0800
Subject: [PATCH] 新增移库功能

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 12 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 5793052..117d58e 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
@@ -1,16 +1,14 @@
 package com.vincent.rsf.server.api.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 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.service.AgvService;
-import com.vincent.rsf.server.manager.entity.BasStation;
-import com.vincent.rsf.server.manager.entity.WaitPakin;
-import com.vincent.rsf.server.manager.entity.WaitPakinItem;
-import com.vincent.rsf.server.manager.entity.WarehouseAreas;
+import com.vincent.rsf.server.manager.entity.*;
+import com.vincent.rsf.server.manager.enums.LocStsType;
 import com.vincent.rsf.server.manager.enums.PakinIOStatus;
-import com.vincent.rsf.server.manager.enums.StaUseStatusType;
 import com.vincent.rsf.server.manager.service.*;
 import com.vincent.rsf.server.manager.utils.LocManageUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +32,8 @@
     private WarehouseAreasService warehouseAreasService;
     @Autowired
     private TaskService taskService;
+    @Autowired
+    private BasContainerService basContainerService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -53,7 +53,7 @@
         }
         BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                 .eq(BasStation::getStationName, sta)
-                .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_O.type)
+                .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
         );
         if (Cools.isEmpty(basStation)){
             throw new CoolException("鏈壘鍒版帴椹崇珯鐐逛俊鎭紝璇锋鏌ョ珯鐐圭姸鎬�");
@@ -94,7 +94,7 @@
         }
         BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                 .eq(BasStation::getStationName, sta)
-                .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type)
+                .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type)
         );
         if (Cools.isEmpty(basStation)){
             throw new CoolException("鏈壘鍒版帴椹崇珯鐐逛俊鎭紝璇锋鏌ョ珯鐐圭姸鎬�");
@@ -113,7 +113,7 @@
 
         taskService.generateAGVTasks(waitPakin,targetLoc,sta,loginUserId);
 
-        basStation.setUseStatus(StaUseStatusType.TYPE_R.type);
+        basStation.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
         if (!basStationService.updateById(basStation)){
             throw new CoolException("鏇存柊绔欑偣鐘舵�佸け璐�");
         }
@@ -133,7 +133,7 @@
         }
         BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                 .eq(BasStation::getStationName, sta)
-                .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type)
+                .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type)
         );
         if (Cools.isEmpty(basStation)){
             throw new CoolException("鏈壘鍒版帴椹崇珯鐐逛俊鎭紝璇锋鏌ョ珯鐐圭姸鎬�");
@@ -149,7 +149,7 @@
             throw new CoolException("鏈壘鍒扮粍鎵樻暟鎹�,璇锋鏌ョ姸鎬�");
         }
         basStation.setBarcode(null);
-        basStation.setUseStatus(StaUseStatusType.TYPE_O.type);
+        basStation.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
         if (!basStationService.updateById(basStation)){
             throw new CoolException("鏇存柊绔欑偣鐘舵�佸け璐�");
         }
@@ -166,7 +166,7 @@
         }
         BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                 .eq(BasStation::getStationName, sta)
-                .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type)
+                .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type)
         );
         if (Cools.isEmpty(basStation)){
             throw new CoolException("鏈壘鍒版帴椹崇珯鐐逛俊鎭紝璇锋鏌ョ珯鐐圭姸鎬�");
@@ -216,7 +216,7 @@
         //楠岃瘉鍩虹淇℃伅
         BasStation basStation = checkStaStatus(barcode, sta);
         //鏇存柊绔欑偣鐘舵��
-        basStation.setUseStatus(StaUseStatusType.TYPE_F.type);
+        basStation.setUseStatus(LocStsType.LOC_STS_TYPE_F.type);
         basStation.setBarcode(barcode);
         if (!basStationService.updateById(basStation)){
             throw new CoolException("鏇存柊绔欑偣鐘舵�佸け璐�");
@@ -256,6 +256,20 @@
         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 = containers.stream()
+                    .map(BasContainer::getCodeType)
+                    .anyMatch(codeType -> barcode.matches(codeType));
+            if (!matches) {
+                throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
+            }
+        }
+
         return basStation;
     }
 }

--
Gitblit v1.9.1