From 5f470251b97ecf69aa77c654434f9af8ed16d9e2 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 25 三月 2025 09:20:34 +0800
Subject: [PATCH] art: 设备台账-新增 修改

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
index 0433218..748d86a 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
@@ -8,11 +8,14 @@
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.eam.entity.EamEquipment;
 import org.jeecg.modules.eam.service.IEamEquipmentService;
 import org.jeecg.modules.eam.vo.EamEquipmentTree;
+import org.jeecg.modules.mdc.entity.MdcEquipment;
+import org.jeecg.modules.mdc.service.IMdcEquipmentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -35,6 +38,9 @@
 public class EamEquipmentController extends JeecgController<EamEquipment, IEamEquipmentService> {
     @Autowired
     private IEamEquipmentService eamEquipmentService;
+
+    @Autowired
+    private IMdcEquipmentService mdcEquipmentService;
 
     /**
      * 鍒嗛〉鍒楄〃鏌ヨ
@@ -70,7 +76,16 @@
     public Result<?> add(@RequestBody EamEquipment eamEquipment) {
         EamEquipment entity = eamEquipmentService.saveEquipment(eamEquipment);
         if (entity == null) {
-            Result.OK("娣诲姞澶辫触锛�");
+            return Result.OK("娣诲姞澶辫触锛�");
+        }
+        //璋冪敤mdcEquipment鎻掑叆MDC璁惧
+        if(CommonConstant.DEFAULT_1.equals(eamEquipment.getMdcFlag())) {
+            //鎻掑叆MDC璁惧
+            MdcEquipment mdcEquipment = new MdcEquipment();
+            mdcEquipment.setEquipmentId(entity.getEquipmentCode());
+            mdcEquipment.setEquipmentType(entity.getDeviceType());
+            mdcEquipment.setEquipmentName(entity.getEquipmentName());
+            mdcEquipmentService.addNewEquipmentFromEam(mdcEquipment, eamEquipment.getOrgId());
         }
         return Result.OK("娣诲姞鎴愬姛锛�");
     }

--
Gitblit v1.9.3