From 162072ac75b009a24cb84569ea7000a782c0fa34 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 14 五月 2025 16:00:48 +0800
Subject: [PATCH] 质检单问题修复

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyInspectServiceImpl.java |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyInspectServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyInspectServiceImpl.java
index c163e61..bed6f21 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyInspectServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyInspectServiceImpl.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.vincent.rsf.framework.common.R;
 import com.vincent.rsf.framework.exception.CoolException;
 import com.vincent.rsf.server.manager.controller.params.IsptOrderParam;
@@ -211,4 +212,42 @@
 
         return this.save(qlyInspect);
     }
+
+    /**
+     * @author Ryan
+     * @date 2025/5/14
+     * @description: 璐ㄦ瀹℃牳纭
+     * @version 1.0
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public R verifyComplate(Long id) {
+        if (Objects.isNull(id)) {
+            throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+        }
+        QlyInspect inspect = this.getById(id);
+        if (Objects.isNull(inspect)) {
+            throw new CoolException("璐ㄦ鍗曟嵁涓嶅瓨鍦紒锛�");
+        }
+        inspect.setIsptStatus(QlyIsptStatus.QLY_ISPT_STAS_DONE.val);
+        if (!this.saveOrUpdate(inspect)) {
+            throw new CoolException("鍗曟嵁淇敼澶辫触锛侊紒");
+        }
+        List<QlyIsptItem> items = qlyIsptItemService.selectIsptResult(new LambdaQueryWrapper<QlyIsptItem>().eq(QlyIsptItem::getIspectId, inspect.getId()));
+        if (items.isEmpty()) {
+            throw new CoolException("璐ㄦ鍗曟嵁鏄庣粏涓嶅瓨鍦紒锛�");
+        }
+        for (QlyIsptItem isptItem : items) {
+            if (isptItem.getSafeQty().compareTo(0.0) <= 0 && isptItem.getDisQty().compareTo(0.0) <= 0 ) {
+                continue;
+            }
+            WarehouseAreasItem item = warehouseAreasItemService.getById(isptItem.getRcptId());
+            if (Objects.isNull(item)) {
+                throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦紒锛�");
+            }
+            qlyIsptItemService.confirmReceipt(isptItem, item);
+        }
+
+        return R.ok("瀹℃牳瀹屾垚锛侊紒");
+    }
 }

--
Gitblit v1.9.1