From accb86943163e6224d4ef9a3418ad4f4cf830160 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期四, 23 四月 2026 09:32:45 +0800
Subject: [PATCH] feat(production): 添加工艺路线反向新增功能
---
src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
index 55c9394..d93307c 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.service.IProductModelService;
import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -165,9 +166,40 @@
}
}
- public Boolean checkProductModelExist(ProductModelAnticlockwiseDto productModelDto, String uuid) {
+ //鍙嶅悜鏂板鎴愬搧浜у搧锛屽彧鏈夐攢鍞叧鑱旀柊澧炵殑鏃跺�欒皟鐢�
+ @Override
+ public Long productModelAnticlockwise(ProductModelAnticlockwiseDto productModelDto) {
+ ProductModel oldProductModel = productModelMapper.selectOldProductModel(productModelDto.getModel(), productModelDto.getProductName());
+ //瀛樺湪灏辨洿鏂�
+ if (oldProductModel != null) {
+ oldProductModel.setModel(productModelDto.getModel());
+ oldProductModel.setUnit(productModelDto.getUnit());
+ oldProductModel.setSubUnit(productModelDto.getSubUnit());
+ oldProductModel.setDeptId(SecurityUtils.getDeptId()[0]);
+ productModelMapper.updateById(oldProductModel);
+ Product product = productMapper.selectById(oldProductModel.getProductId());
+ product.setProductName(productModelDto.getProductName());
+ productMapper.updateById(product);
+ return oldProductModel.getId();
+ }else {
+ //鎵惧埌鐖惰妭鐐�
+ Product productParent = productMapper.selectOne(new QueryWrapper<Product>().lambda().eq(Product::getProductName, "鎴愬搧").last("limit 1"));
+ //鏂板浜у搧澶х被
+ Product product = new Product();
+ product.setProductName(productModelDto.getProductName());
+ product.setParentId(productParent.getId());
+ product.setDeptId(SecurityUtils.getDeptId()[0]);
+ productMapper.insert( product);
+ //鏂板浜у搧瑙勬牸
+ ProductModel productModel = new ProductModel();
+ productModel.setProductId(product.getId());
+ productModel.setModel(productModelDto.getModel());
+ productModel.setUnit(productModelDto.getUnit());
+ productModel.setSubUnit(productModelDto.getSubUnit());
+ productModel.setDeptId(SecurityUtils.getDeptId()[0]);
+ productModelMapper.insert(productModel);
+ return productModel.getId();
-
- return true;
+ }
}
}
--
Gitblit v1.9.3