From e711c834aec2293c53b07efe53e81e3573c289b6 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期三, 01 四月 2026 11:42:44 +0800
Subject: [PATCH] lsh#

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java |   45 ++++++++++++++++++++++++++-------------------
 1 files changed, 26 insertions(+), 19 deletions(-)

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 ee84fdf..20b9a6c 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
@@ -15,6 +15,7 @@
 import com.vincent.rsf.server.manager.enums.*;
 import com.vincent.rsf.server.manager.service.*;
 import com.vincent.rsf.server.manager.utils.LocManageUtil;
+import com.vincent.rsf.server.manager.utils.WarehouseLocationRetrievalUtil;
 import com.vincent.rsf.server.system.constant.SerialRuleCode;
 import com.vincent.rsf.server.system.utils.SerialRuleUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -214,14 +215,20 @@
 //                throw new CoolException("鏈壘鍒版墍灞炲簱鍖轰俊鎭�");
             }
 
-            DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
-                    .eq(DeviceSite::getSite, station.getStationName())
-                    .eq(DeviceSite::getAreaIdEnd, warehouseArea.getId())
-                    .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_IN.type).last("limit 1"));
-            if (Cools.isEmpty(deviceSite)) {
+            boolean isItAvailable = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableInArea(station.getStationName(),  warehouseArea.getId(), param.getContainerNo(), TaskType.TASK_TYPE_EMPTY_IN.type);
+//            DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+//                    .eq(DeviceSite::getSite, )
+//                    .eq(DeviceSite::getAreaIdEnd,)
+//                    .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_IN.type).last("limit 1"));
+//            if (Cools.isEmpty(deviceSite)) {
+//                errorBuilder.append("鏃犲彲鐢ㄨ矾寰�");
+//                continue;
+//                throw new CoolException("鏃犲彲鐢ㄨ矾寰勶紒锛�");
+//            }
+            if (!isItAvailable){
                 errorBuilder.append("鏃犲彲鐢ㄨ矾寰�");
                 continue;
-//                throw new CoolException("鏃犲彲鐢ㄨ矾寰勶紒锛�");
+
             }
 
 //        BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
@@ -244,16 +251,7 @@
             if (StringUtils.isBlank(ruleCode)) {
                 throw new CoolException("缂栫爜閿欒锛氳纭缂栫爜銆孲YS_TASK_CODE銆嶆槸鍚﹀凡鐢熸垚!!");
             }
-            String stationName = null;
-            if (Cools.isEmpty(deviceSite.getDeviceCode())) {
-                stationName = station.getStationName();
-            } else {
-                BasStation stationCode = basStationService.getById(deviceSite.getDeviceCode());
-                stationName = stationCode.getStationName();
-                if (Cools.isEmpty(stationCode)) {
-                    stationName = station.getStationName();
-                }
-            }
+            String stationName = station.getStationName();
             Task task = new Task();
             task.setTaskCode(ruleCode)
                     .setTaskStatus(TaskStsType.MISSION_INITIAL.id)
@@ -275,8 +273,17 @@
             if (!basStationService.updateById(station)) {
                 throw new CoolException("绔欑偣鐘舵�佹洿鏂板け璐ワ紒锛�");
             }
-            if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
-                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, param.getContainerNo()))) {
+            Loc taskLoc = locService.getOne(new LambdaQueryWrapper<Loc>()
+                    .eq(Loc::getCode, task.getTargLoc())
+                    .last("limit 1"), false);
+            if (Objects.isNull(taskLoc)) {
+                throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
+            }
+            taskLoc.setUseStatus(LocStsType.LOC_STS_TYPE_S.type)
+                    .setBarcode(param.getContainerNo())
+                    .setUpdateBy(loginUserId)
+                    .setUpdateTime(new Date());
+            if (!locService.updateById(taskLoc)) {
                 throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
             }
             return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
@@ -289,7 +296,7 @@
         if (Cools.isEmpty(param.getTransferStationNo())) {
             return R.error("鏃犲弬鏁�");
         }
-        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationId, param.getTransferStationNo()));
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, param.getTransferStationNo()));
         if (Cools.isEmpty(basStation)) {
             return R.error("鏈壘鍒板尮閰嶇珯鐐�");
         }

--
Gitblit v1.9.1