mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
cad拆单配件汇总修改为长宽高只对比小数后三位
This commit is contained in:
+19
-1
@@ -75,6 +75,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -1719,7 +1720,7 @@ public class WebCadOrderImportAsyncFactory {
|
||||
String brand = part.getBrand();
|
||||
|
||||
// 分类配件的键组合
|
||||
String groupKey = composite + partType + factory + model + spec + height + width + thickness + unit + brand;
|
||||
String groupKey = composite + partType + factory + model + spec + scale3(height) + scale3(width) + scale3(thickness) + unit + brand;
|
||||
|
||||
Long orderPartId = orderPartMap.get(groupKey);
|
||||
if (ObjectUtil.isNull(orderPartId)) {
|
||||
@@ -1783,6 +1784,23 @@ public class WebCadOrderImportAsyncFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留三位小数展示
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String scale3(String value) {
|
||||
if (StringUtils.isNotEmpty(value)) return value;
|
||||
try {
|
||||
BigDecimal bd = new BigDecimal(value);
|
||||
bd = bd.setScale(3, RoundingMode.HALF_UP);
|
||||
return bd.toPlainString();
|
||||
} catch (NumberFormatException e) {
|
||||
// 不是数字就原样返回
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理cad部件数据
|
||||
|
||||
+20
-1
@@ -66,6 +66,7 @@ import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
@@ -1648,7 +1649,7 @@ public class WebCadOrderImportFactory {
|
||||
String brand = part.getBrand();
|
||||
|
||||
// 分类配件的键组合
|
||||
String groupKey = composite + partType + factory + model + spec + height + width + thickness + unit + brand;
|
||||
String groupKey = composite + partType + factory + model + spec + scale3(height) + scale3(width) + scale3(thickness) + unit + brand;
|
||||
|
||||
Long orderPartId = orderPartMap.get(groupKey);
|
||||
if (ObjectUtil.isNull(orderPartId)) {
|
||||
@@ -1712,6 +1713,24 @@ public class WebCadOrderImportFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留三位小数展示
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String scale3(String value) {
|
||||
if (StringUtils.isNotEmpty(value)) return value;
|
||||
try {
|
||||
BigDecimal bd = new BigDecimal(value);
|
||||
bd = bd.setScale(3, RoundingMode.HALF_UP);
|
||||
return bd.toPlainString();
|
||||
} catch (NumberFormatException e) {
|
||||
// 不是数字就原样返回
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从规格中获取属性,例:material、color
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user