fix: 阶梯管绑定异常

This commit is contained in:
2025-02-20 10:19:15 +08:00
parent 4fdeb43703
commit 5237f12bf1

View File

@@ -121,24 +121,27 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
}
public static void main(String[] args) {
List<String> lines = new ArrayList<>();
lines.add("纸制简管|纸管|6英寸|1300");
lines.add("纸制简管|纸管|3英寸|12|650");
lines.add("玻璃纤维及其制品|FRP管|6英寸|15-20|1700|阶梯");
lines.add("玻璃纤维及其制品|FRP管|6英寸|15|1700|高强");
// 定义正则表达式,去除最后的中文部分
String regex = "\\|[\\u4e00-\\u9fa5]+$";
// 处理每一行数据
List<String> cleanedLines = new ArrayList<>();
for (String line : lines) {
cleanedLines.add(line.replaceAll(regex, ""));
}
// 打印结果
for (String cleanedLine : cleanedLines) {
System.out.println(cleanedLine);
}
// List<String> lines = new ArrayList<>();
// lines.add("纸制简管|纸管|6英寸|1300");
// lines.add("纸制简管|纸管|3英寸|12|650");
// lines.add("玻璃纤维及其制品|FRP管|6英寸|15-20|1700|阶梯");
// lines.add("玻璃纤维及其制品|FRP管|6英寸|15|1700|高强");
// // 定义正则表达式,去除最后的中文部分
// String regex = "\\|[\\u4e00-\\u9fa5]+$";
//
// // 处理每一行数据
// List<String> cleanedLines = new ArrayList<>();
// for (String line : lines) {
// cleanedLines.add(line.replaceAll(regex, ""));
// }
//
// // 打印结果
// for (String cleanedLine : cleanedLines) {
// System.out.println(cleanedLine);
// }
String material_name = "玻璃纤维及其制品|FRP管|6英寸|15-20|1100|阶梯";
String[] tubeArray = material_name.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
System.out.println(tubeArray);
}
@Override
@@ -182,7 +185,7 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
if (ObjectUtil.isNotEmpty(nextPaper)) {
//获取第二排的纸管高度和纸管类型
String nextMaterialName = nextPaper.getMaterial_name();
String[] nextArray = nextMaterialName.split("\\|");
String[] nextArray = nextMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
int nextLength = Integer.parseInt(nextArray[nextArray.length - 1]);
if (Math.abs(nextLength - currLength) <= 50) {
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM");
@@ -196,7 +199,7 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
if (ObjectUtil.isNotEmpty(nextPaper)) {
//获取后一排的纸管高度和纸管类型
String nextMaterialName = nextPaper.getMaterial_name();
String[] nextArray = nextMaterialName.split("\\|");
String[] nextArray = nextMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
int nextLength = Integer.parseInt(nextArray[nextArray.length - 1]);
if (Math.abs(nextLength - currLength) <= 50) {
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM");
@@ -210,7 +213,7 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
if (ObjectUtil.isNotEmpty(prePaper)) {
//获取后一排的纸管高度和纸管类型
String preMaterialName = prePaper.getMaterial_name();
String[] preArray = preMaterialName.split("\\|");
String[] preArray = preMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
int preLength = Integer.parseInt(preArray[preArray.length - 1]);
if (Math.abs(preLength - currLength) <= 50) {
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM");