From a3b3e3ac062d8ac4c1d66d7b2a992720ea5e7ca2 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期一, 02 二月 2026 09:35:00 +0800
Subject: [PATCH] #站点库位管理

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOtherServiceImpl.java |  256 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 254 insertions(+), 2 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOtherServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOtherServiceImpl.java
index 5794a96..11a5e42 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOtherServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOtherServiceImpl.java
@@ -4,19 +4,40 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 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.PdaOtherService;
+import com.vincent.rsf.server.manager.entity.BasStation;
+import com.vincent.rsf.server.manager.entity.Loc;
+import com.vincent.rsf.server.manager.entity.LocItem;
 import com.vincent.rsf.server.manager.entity.Transfer;
-import com.vincent.rsf.server.manager.entity.WkOrder;
-import com.vincent.rsf.server.manager.enums.OrderType;
+import com.vincent.rsf.server.manager.enums.LocStatusType;
+import com.vincent.rsf.server.manager.enums.LocStsType;
+import com.vincent.rsf.server.manager.service.BasStationService;
+import com.vincent.rsf.server.manager.service.LocItemService;
+import com.vincent.rsf.server.manager.service.LocService;
 import com.vincent.rsf.server.manager.service.TransferService;
+import com.vincent.rsf.server.system.entity.User;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
 
 @Service
 public class PdaOtherServiceImpl implements PdaOtherService {
 
     @Autowired
     private TransferService transferService;
+
+    @Autowired
+    private LocService locService;
+    @Autowired
+    private LocItemService locItemService;
+
+    @Autowired
+    private BasStationService basStationService;
 
     @Override
     public R transferPage(String orderNo, Integer curr, Integer limit) {
@@ -26,4 +47,235 @@
         Page<Transfer> page1 = transferService.page(page, transferLambdaQueryWrapper);
         return R.ok(page1);
     }
+
+    @Override
+    public R inspectList(PdaGeneralParam generalParam) {
+       if (Cools.isEmpty(generalParam.getContainerNo())) {
+           throw new CoolException("瀹瑰櫒鐮佷负绌�");
+       }
+       Loc loc = null;
+       try {
+           loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, generalParam.getContainerNo()));
+       }catch (Exception e){
+           throw new CoolException("鏁版嵁閿欒,鏌ヨ鍒板鏉″簱浣�");
+       }
+       if (Cools.isEmpty(loc)) {
+           throw new CoolException("鏈壘鍒板搴旂殑搴撲綅");
+       }
+       if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)){
+           throw new CoolException("搴撲綅涓嶄负鍦ㄥ簱鐘舵��");
+       }
+        List<LocItem> list = locItemService.list(new LambdaQueryWrapper<LocItem>()
+                .eq(LocItem::getLocId, loc.getId())
+                .eq(!Cools.isEmpty(generalParam.getMatnrCode()),LocItem::getMatnrCode, generalParam.getMatnrCode())
+        );
+       if (Cools.isEmpty(list)) {
+           throw new CoolException("搴撲綅涓哄湪搴撶姸鎬�,浣嗗簱浣嶄负绌�");
+       }
+       return R.ok(list);
+
+    }
+
+    @Override
+    public R inspectConfirm(PdaGeneralParam generalParam) {
+        if (Cools.isEmpty(generalParam.getMatnrList())){
+            throw new CoolException("鍙傛暟涓虹┖");
+        }
+        for (LocItem locItem : generalParam.getMatnrList()) {
+            LocItem locItem1 = locItemService.getById(locItem.getId());
+            if (Cools.isEmpty(locItem1)) {
+                throw new CoolException("鏁版嵁閿欒");
+            }
+            if (locItem1.getStatus().equals(LocStatusType.FREEZE.type)){
+                continue;
+            }
+            if (locItem.getStatus().equals(LocStatusType.FREEZE.type)){
+                locItem1.setStatus(LocStatusType.FREEZE.type);
+                locItemService.updateById(locItem1);
+            }
+
+
+        }
+        return R.ok();
+    }
+
+    @Override
+    public R inspectConfirm2(PdaGeneralParam generalParam) {
+        if (Cools.isEmpty(generalParam.getMatnrList())){
+            throw new CoolException("鍙傛暟涓虹┖");
+        }
+        for (LocItem locItem : generalParam.getMatnrList()) {
+            LocItem locItem1 = locItemService.getById(locItem.getId());
+            if (Cools.isEmpty(locItem1)) {
+                throw new CoolException("鏁版嵁閿欒");
+            }
+            if (locItem1.getStatus().equals(LocStatusType.NORMAL.type)){
+                continue;
+            }
+            if (locItem.getStatus().equals(LocStatusType.NORMAL.type)){
+                locItem1.setStatus(LocStatusType.NORMAL.type);
+                locItemService.updateById(locItem1);
+            }
+
+
+        }
+        return R.ok();
+    }
+
+    @Override
+    public R stationPage(String staNo, Integer curr, Integer limit) {
+        Page<BasStation> page = new Page<>(curr, limit);
+        LambdaQueryWrapper<BasStation> basStationLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        basStationLambdaQueryWrapper.eq(!Cools.isEmpty(staNo), BasStation::getStationName, staNo);
+        Page<BasStation> page1 = basStationService.page(page, basStationLambdaQueryWrapper);
+        return R.ok(page1);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public R staOperate(PdaGeneralParam generalParam, User user) {
+        switch (generalParam.getStaOperateType()){
+            case 1:
+                stationDisabled(generalParam.getTransferStationNo(),user);
+                break;
+            case 2:
+                stationLiftTheBan(generalParam.getTransferStationNo(),user);
+                break;
+            case 3:
+                stationRelease(generalParam.getTransferStationNo(),user);
+                break;
+            default:
+                break;
+        }
+
+        return R.ok();
+    }
+
+
+    @Transactional(rollbackFor = Exception.class)
+    public void stationDisabled(String transferStationNo,User user){
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, transferStationNo));
+        if (Cools.isEmpty(basStation)) {
+            throw new CoolException("鏈壘鍒版纭殑绔欑偣");
+        }
+        if (basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+            throw new CoolException("褰撳墠绔欑偣姝e湪宸ヤ綔");
+        }
+        basStation.setUseStatus(LocStsType.LOC_STS_TYPE_X.type);
+        basStation.setUpdateBy(user.getId());
+        basStation.setUpdateTime(new Date());
+        basStationService.updateById(basStation);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void stationLiftTheBan(String transferStationNo,User user){
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, transferStationNo));
+        if (Cools.isEmpty(basStation)) {
+            throw new CoolException("鏈壘鍒版纭殑绔欑偣");
+        }
+        if (basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+            throw new CoolException("褰撳墠绔欑偣姝e湪宸ヤ綔");
+        }
+
+        basStation.setUseStatus(Cools.isEmpty(basStation.getBarcode())?LocStsType.LOC_STS_TYPE_O.type:LocStsType.LOC_STS_TYPE_F.type);
+        basStation.setUpdateBy(user.getId());
+        basStation.setUpdateTime(new Date());
+        basStationService.updateById(basStation);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void stationRelease(String transferStationNo,User user){
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, transferStationNo));
+        if (Cools.isEmpty(basStation)) {
+            throw new CoolException("鏈壘鍒版纭殑绔欑偣");
+        }
+        if (basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+            throw new CoolException("褰撳墠绔欑偣姝e湪宸ヤ綔");
+        }
+
+        basStation.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
+        basStation.setBarcode(null);
+        basStation.setUpdateBy(user.getId());
+        basStation.setUpdateTime(new Date());
+        basStationService.updateById(basStation);
+    }
+
+
+    @Override
+    public R locPage(String locNo, Integer curr, Integer limit) {
+        Page<Loc> page = new Page<>(curr, limit);
+        LambdaQueryWrapper<Loc> basStationLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        basStationLambdaQueryWrapper.eq(!Cools.isEmpty(locNo), Loc::getCode, locNo);
+        Page<Loc> page1 = locService.page(page, basStationLambdaQueryWrapper);
+        return R.ok(page1);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public R locOperate(PdaGeneralParam generalParam, User user) {
+        switch (generalParam.getStaOperateType()){
+            case 1:
+                locDisabled(generalParam.getLocNo(),user);
+                break;
+            case 2:
+                locLiftTheBan(generalParam.getLocNo(),user);
+                break;
+            case 3:
+                locRelease(generalParam.getLocNo(),user);
+                break;
+            default:
+                break;
+        }
+
+        return R.ok();
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void locDisabled(String transferStationNo,User user){
+        Loc lco = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, transferStationNo));
+        if (Cools.isEmpty(lco)) {
+            throw new CoolException("鏈壘鍒版纭殑搴撲綅");
+        }
+        if (lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+            throw new CoolException("褰撳墠绔欑偣姝e湪宸ヤ綔");
+        }
+        lco.setUseStatus(LocStsType.LOC_STS_TYPE_X.type);
+        lco.setUpdateBy(user.getId());
+        lco.setUpdateTime(new Date());
+        locService.updateById(lco);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void locLiftTheBan(String transferStationNo,User user){
+        Loc lco = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, transferStationNo));
+        if (Cools.isEmpty(lco)) {
+            throw new CoolException("鏈壘鍒版纭殑搴撲綅");
+        }
+        if (lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+            throw new CoolException("褰撳墠搴撲綅姝e湪宸ヤ綔");
+        }
+
+        lco.setUseStatus(Cools.isEmpty(lco.getBarcode())?LocStsType.LOC_STS_TYPE_O.type:LocStsType.LOC_STS_TYPE_F.type);
+        lco.setUpdateBy(user.getId());
+        lco.setUpdateTime(new Date());
+        locService.updateById(lco);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void locRelease(String transferStationNo,User user){
+        Loc lco = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, transferStationNo));
+        if (Cools.isEmpty(lco)) {
+            throw new CoolException("鏈壘鍒版纭殑搴撲綅");
+        }
+        if (lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || lco.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+            throw new CoolException("褰撳墠搴撲綅姝e湪宸ヤ綔");
+        }
+
+        lco.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
+        lco.setBarcode(null);
+        lco.setUpdateBy(user.getId());
+        lco.setUpdateTime(new Date());
+        locService.updateById(lco);
+    }
+
 }

--
Gitblit v1.9.1