From 103f52ade0f77e420dec306ea3b51d0a3c0ac3ee Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 19 三月 2025 13:23:12 +0800
Subject: [PATCH] art: 设备管理-系统业务编码生成,工艺参数维护功能修改

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
index b5d9480..ef03230 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
@@ -1,13 +1,13 @@
 package org.jeecg.modules.dnc.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.collections4.ListUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
-
+import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.dnc.exception.ExceptionCast;
 import org.jeecg.modules.dnc.mapper.ComponentInfoMapper;
 import org.jeecg.modules.dnc.mapper.PartsInfoMapper;
@@ -16,18 +16,11 @@
 import org.jeecg.modules.dnc.response.PartsInfoCode;
 import org.jeecg.modules.dnc.response.ProductInfoCode;
 import org.jeecg.modules.dnc.response.UcenterCode;
-
 import org.jeecg.modules.dnc.service.*;
-import org.jeecg.modules.dnc.ucenter.Department;
 import org.jeecg.modules.dnc.utils.ValidateUtil;
-
-import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.SysUser;
-import org.apache.commons.collections4.ListUtils;
-
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -54,6 +47,8 @@
     private IDocRelativeService iDocRelativeService;
     @Autowired
     private IProductPermissionService productPermissionService;
+    @Autowired
+    private IProductMixService productMixService;
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public boolean addPartsInfo(PartsInfo partsInfo) {
@@ -114,6 +109,10 @@
         if (!b) {
             ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
         }
+        //娣诲姞缁撴瀯鏍�
+        ProductMix productMix = new ProductMix(Long.parseLong(partsInfo.getPartsId()),Long.parseLong(partsInfo.getComponentId())
+                ,partsInfo.getPartsName(),partsInfo.getPartsCode(),3);
+        productMixService.save(productMix);
         //娣诲姞鐢ㄦ埛鏉冮檺
         PermissionStreamNew stream = new PermissionStreamNew();
         stream.setBusinessId(partsInfo.getPartsId());
@@ -139,6 +138,11 @@
         partsInfo.setProductId(null);
         partsInfo.setComponentId(null);
         boolean b = super.updateById(partsInfo);
+        //鍚屾淇敼缁撴瀯鏍�
+        ProductMix productMix = productMixService.getById(Long.parseLong(id));
+        productMix.setName(partsInfo.getPartsName());
+        productMix.setCode(partsInfo.getPartsCode());
+        productMixService.updateById(productMix);
         if(!b)
             return false;
         PartsPermission permission = partsPermissionService.getByPartsIdAndUserId(id, userId);
@@ -253,7 +257,10 @@
         b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","1");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        return super.removeById(partsInfo.getPartsId());
+        b = productMixService.removeById(partsId);
+        if (!b)
+            ExceptionCast.cast(CommonCode.FAIL);
+        return super.removeById(partsId);
     }
 
     @Override

--
Gitblit v1.9.3