1
This commit is contained in:
@@ -262,12 +262,19 @@ public class InstructionServiceImpl implements IInstructionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String handleTF(String input) {
|
private String handleTF(String input) {
|
||||||
String[] parts = input.replace("TF", "").split("\t"); // 使用制表符分割
|
String body = input.replaceFirst("^TF\\s*", "");
|
||||||
|
String[] lines = body.split("\\r?\\n+");
|
||||||
|
List<String> outputs = new ArrayList<>();
|
||||||
|
for (String line : lines) {
|
||||||
|
if (line == null) continue;
|
||||||
|
line = line.trim();
|
||||||
|
if (line.isEmpty()) continue;
|
||||||
|
String[] parts = line.split("\t"); // 使用制表符分割每一行
|
||||||
if (parts.length >= 3) {
|
if (parts.length >= 3) {
|
||||||
String modelNumber = parts[0].replace("\\n", ""); // 型号
|
String modelNumber = parts[0].replace("\\n", ""); // 型号
|
||||||
String quantityStr = parts[1]; // 数量
|
String quantityStr = parts[1]; // 数量
|
||||||
StringBuilder address = new StringBuilder();
|
StringBuilder address = new StringBuilder();
|
||||||
// 使用正则表达式提取中文字符
|
// 使用正则表达式提取中文字符(常用于姓名开头)
|
||||||
Pattern pattern = Pattern.compile("[\\u4E00-\\u9FA5]+");
|
Pattern pattern = Pattern.compile("[\\u4E00-\\u9FA5]+");
|
||||||
Matcher matcher = pattern.matcher(parts[2]);
|
Matcher matcher = pattern.matcher(parts[2]);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
@@ -280,9 +287,12 @@ public class InstructionServiceImpl implements IInstructionService {
|
|||||||
|
|
||||||
StringBuilder order = new StringBuilder();
|
StringBuilder order = new StringBuilder();
|
||||||
order.append("生").append("\n").append("H-TF").append("\n").append(modelNumber).append("\n").append(jf).append("\n").append(quantityStr).append("\n").append(address);
|
order.append("生").append("\n").append("H-TF").append("\n").append(modelNumber).append("\n").append(jf).append("\n").append(quantityStr).append("\n").append(address);
|
||||||
return generateOrderText(order.toString());
|
outputs.add(generateOrderText(order.toString()));
|
||||||
|
} else {
|
||||||
|
outputs.add("TF 指令格式:TF\t型号\t数量\t地址(可含其它字段) ;也支持多行,每行一条数据");
|
||||||
}
|
}
|
||||||
return "TF 指令格式:TF\t型号\t数量\t地址(可含其它字段)";
|
}
|
||||||
|
return String.join("\n\n", outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String handleH(String input) {
|
private String handleH(String input) {
|
||||||
|
|||||||
Reference in New Issue
Block a user