From 91acbe8b56194bbd834b1169b5578de8a5ed442c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期六, 14 三月 2026 17:53:10 +0800
Subject: [PATCH] fix: BOM产品查询调整、重命名字段
---
src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
index 678cfd2..6fc0783 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
@@ -143,8 +143,8 @@
JSONObject formData = item.getJSONObject("formData");
// 澶勭悊鐗╂枡涓昏〃鏁版嵁
ProductMaterial material = new ProductMaterial();
- material.setMaterialName(formData.getString("textField_l92f36f5"));
- material.setBaseUnit(formData.getString("textField_la147lnw"));
+ material.setProductName(formData.getString("textField_l92f36f5"));
+ material.setUnit(formData.getString("textField_la147lnw"));
material.setRemark(formData.getString("textareaField_l92f36f9"));
String materialType = formData.getString("selectField_l92f36fb");
@@ -156,11 +156,11 @@
// 澶勭悊鐗╂枡瑙勬牸鏁版嵁
ProductMaterialSku sku = new ProductMaterialSku();
- sku.setMaterialId(materialId);
+ sku.setProductId(materialId);
sku.setFormInstanceId(formInstanceId);
sku.setIdentifierCode(formData.getString("textField_l92h77ju"));
sku.setMaterialCode(formData.getString("textField_l92f36f2"));
- sku.setSpecification(formData.getString("textField_l92f36f6"));
+ sku.setModel(formData.getString("textField_l92f36f6"));
sku.setSupplyType(formData.getString("selectField_la14k51j"));
sku.setOriginatorName(originatorName);
sku.setOriginatorOrg("瀹佸涓垱缁胯兘瀹炰笟闆嗗洟鏈夐檺鍏徃");
@@ -175,7 +175,7 @@
private Long getOrCreateMaterial(ProductMaterial material) {
LambdaQueryWrapper<ProductMaterial> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductMaterial::getMaterialName, material.getMaterialName());
+ queryWrapper.eq(ProductMaterial::getProductName, material.getProductName());
ProductMaterial exist = this.getOne(queryWrapper);
if (exist == null) {
@@ -194,8 +194,8 @@
exist.setInventoryCategoryId(material.getInventoryCategoryId());
needUpdate = true;
}
- if (StringUtils.isNotEmpty(material.getBaseUnit()) && !material.getBaseUnit().equals(exist.getBaseUnit())) {
- exist.setBaseUnit(material.getBaseUnit());
+ if (StringUtils.isNotEmpty(material.getUnit()) && !material.getUnit().equals(exist.getUnit())) {
+ exist.setUnit(material.getUnit());
needUpdate = true;
}
if (needUpdate) {
@@ -229,8 +229,8 @@
for (ProductMaterialSku sku : list) {
LambdaQueryWrapper<ProductMaterialSku> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(ProductMaterialSku::getMaterialId, sku.getMaterialId())
- .eq(ProductMaterialSku::getSpecification, sku.getSpecification());
+ wrapper.eq(ProductMaterialSku::getProductId, sku.getProductId())
+ .eq(ProductMaterialSku::getModel, sku.getModel());
if (StringUtils.isNotEmpty(sku.getMaterialCode())) {
wrapper.eq(ProductMaterialSku::getMaterialCode, sku.getMaterialCode());
@@ -242,7 +242,7 @@
if (exist == null) {
productMaterialSkuService.save(sku);
affected++;
- log.info("鏂板鐗╂枡瑙勬牸 {}", sku.getSpecification());
+ log.info("鏂板鐗╂枡瑙勬牸 {}", sku.getModel());
} else {
if (exist.getFormModifiedTime() == null || !exist.getFormModifiedTime().equals(sku.getFormModifiedTime())) {
sku.setId(exist.getId());
@@ -250,7 +250,7 @@
productMaterialSkuService.updateById(sku);
affected++;
- log.info("鏇存柊鐗╂枡瑙勬牸 {}", sku.getSpecification());
+ log.info("鏇存柊鐗╂枡瑙勬牸 {}", sku.getModel());
}
}
}
@@ -273,7 +273,7 @@
ProductMaterial::getId,
ProductMaterial::getMaterialTypeId,
ProductMaterial::getInventoryCategoryId,
- ProductMaterial::getMaterialName
+ ProductMaterial::getProductName
)
);
materialMap = materialList.stream()
@@ -307,10 +307,10 @@
ProductMaterial::getId,
ProductMaterial::getMaterialTypeId,
ProductMaterial::getInventoryCategoryId,
- ProductMaterial::getMaterialName
+ ProductMaterial::getProductName
);
if (StringUtils.isNotEmpty(materialName)) {
- wrapper.like(ProductMaterial::getMaterialName, materialName);
+ wrapper.like(ProductMaterial::getProductName, materialName);
}
if (materialTypeId != null) {
wrapper.eq(ProductMaterial::getMaterialTypeId, materialTypeId);
@@ -345,7 +345,7 @@
private ProductMaterialDto convert(ProductMaterial m) {
ProductMaterialDto dto = new ProductMaterialDto();
dto.setId(m.getId());
- dto.setMaterialName(m.getMaterialName());
+ dto.setProductName(m.getProductName());
dto.setMaterialTypeId(m.getMaterialTypeId());
dto.setInventoryCategoryId(m.getInventoryCategoryId());
return dto;
@@ -355,7 +355,7 @@
@Transactional(rollbackFor = Exception.class)
public void addProductMaterial(ProductMaterial productMaterial) {
validateProductMaterial(productMaterial, false);
- if (existsMaterialName(productMaterial.getMaterialName(), null)) {
+ if (existsMaterialName(productMaterial.getProductName(), null)) {
throw new ServiceException("鐗╂枡鍚嶇О宸插瓨鍦�");
}
LocalDateTime now = LocalDateTime.now();
@@ -366,7 +366,7 @@
if (!this.save(productMaterial)) {
throw new ServiceException("鏂板鐗╂枡澶辫触");
}
- log.info("鏂板鐗╂枡鎴愬姛 materialName={}", productMaterial.getMaterialName());
+ log.info("鏂板鐗╂枡鎴愬姛 materialName={}", productMaterial.getProductName());
}
@Override
@@ -377,7 +377,7 @@
if (exist == null) {
throw new ServiceException("鐗╂枡涓嶅瓨鍦�");
}
- if (existsMaterialName(productMaterial.getMaterialName(), productMaterial.getId())) {
+ if (existsMaterialName(productMaterial.getProductName(), productMaterial.getId())) {
throw new ServiceException("鐗╂枡鍚嶇О宸插瓨鍦�");
}
productMaterial.setUpdateTime(LocalDateTime.now());
@@ -406,7 +406,7 @@
if (requireId && productMaterial.getId() == null) {
throw new ServiceException("涓婚敭ID涓嶈兘涓虹┖");
}
- if (StringUtils.isEmpty(productMaterial.getMaterialName())) {
+ if (StringUtils.isEmpty(productMaterial.getProductName())) {
throw new ServiceException("鐗╂枡鍚嶇О涓嶈兘涓虹┖");
}
}
@@ -416,7 +416,7 @@
return false;
}
LambdaQueryWrapper<ProductMaterial> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ProductMaterial::getMaterialName, materialName);
+ queryWrapper.eq(ProductMaterial::getProductName, materialName);
if (excludeId != null) {
queryWrapper.ne(ProductMaterial::getId, excludeId);
}
--
Gitblit v1.9.3