From 6c95c2f6a3602fe6f92898dd322c20bbe955e69d Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 21 四月 2026 18:03:20 +0800
Subject: [PATCH] feat: 成品入库增加审批环节,原材质检后提交入库时增加一个审批环节

---
 src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
index 0687aad..e781672 100644
--- a/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
@@ -12,6 +12,8 @@
 import com.ruoyi.device.mapper.DeviceLedgerMapper;
 import com.ruoyi.device.pojo.DeviceLedger;
 import com.ruoyi.device.service.IDeviceLedgerService;
+import com.ruoyi.production.mapper.ProductProcessMapper;
+import com.ruoyi.production.pojo.ProductProcess;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.system.mapper.SysUserMapper;
@@ -36,6 +38,8 @@
     private DeviceLedgerMapper deviceLedgerMapper;
     @Autowired
     private SysUserMapper sysUserMapper;
+    @Autowired
+    private ProductProcessMapper productProcessMapper;
 
     @Override
     public IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger) {
@@ -45,10 +49,14 @@
 
     @Override
     public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) {
+        AjaxResult processCheckResult = validateProductProcess(deviceLedger.getProductProcessId());
+        if (processCheckResult != null) {
+            return processCheckResult;
+        }
         LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel());
+        deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName());
         if (this.count(deviceLedgerLambdaQueryWrapper) > 0) {
-            return AjaxResult.error("璁惧鍨嬪彿宸插瓨鍦�");
+            return AjaxResult.error("璁惧鍚嶇О宸插瓨鍦�");
         }
         boolean save = this.save(deviceLedger);
         if (save){
@@ -59,6 +67,10 @@
 
     @Override
     public AjaxResult updateDeviceLedger(DeviceLedger deviceLedger) {
+        AjaxResult processCheckResult = validateProductProcess(deviceLedger.getProductProcessId());
+        if (processCheckResult != null) {
+            return processCheckResult;
+        }
         if (this.updateById(deviceLedger)) {
             return AjaxResult.success();
         }
@@ -66,6 +78,22 @@
     }
 
     @Override
+    public DeviceLedger getDetailById(Long id) {
+        return deviceLedgerMapper.selectById1(id);
+    }
+
+    private AjaxResult validateProductProcess(Long productProcessId) {
+        if (productProcessId == null) {
+            return null;
+        }
+        ProductProcess productProcess = productProcessMapper.selectById(productProcessId);
+        if (productProcess == null) {
+            return AjaxResult.error("宸ュ簭涓嶅瓨鍦紝璇烽噸鏂伴�夋嫨");
+        }
+        return null;
+    }
+
+    @Override
     public void export(HttpServletResponse response, Long[] ids) {
 
         if (ids == null || ids.length == 0) {

--
Gitblit v1.9.3