From 2f8e173048d22c5b40612c3538b9c1aa5a5397f6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 27 三月 2026 13:38:05 +0800
Subject: [PATCH] #乐观锁

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 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 70927e4..a6790a1 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
@@ -76,7 +76,7 @@
         if (Cools.isEmpty(basStation)) {
             throw new CoolException("鏈壘鍒扮珯鐐逛俊鎭�");
         }
-        if (!basStation.getUseStatus().equals("O")) {
+        if (!basStation.getUseStatus().equals("O") &&  !basStation.getUseStatus().equals("D") && !basStation.getUseStatus().equals("F")) {
             throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
         }
         if (!Cools.isEmpty(basStation.getContainerType())) {
@@ -185,9 +185,11 @@
 //        }
         BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                 .eq(BasStation::getStationName, param.getTransferStationNo()));
-        if (Objects.isNull(station) || (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type) && !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_D.type)) ) {
+        if (Objects.isNull(station) || (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type) && !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type) && !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_D.type)) ) {
             throw new CoolException("绔欑偣涓嶅瓨鍦ㄦ垨绔欑偣涓嶅浜庣┖搴撱�佺┖鏉跨姸鎬侊紒锛�");
         }
+        station.setBarcode("");
+        basStationService.updateById(station);
         StringBuilder errorBuilder = new StringBuilder();
         List<Long> areaTypeList = LocUtils.getAreaTypeList(station.getStationName());
         if (areaTypeList.isEmpty()) {
@@ -273,8 +275,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("浠诲姟鐢熸垚瀹屾瘯锛�");
@@ -287,7 +298,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