SAP应收未清凭证号批量查询2.0----支持多种隔断、不隔断查询

This commit is contained in:
李贵强 2025-07-18 10:38:16 +08:00
parent 0c654cd10a
commit 57ae76b7e7
1 changed files with 35 additions and 8 deletions

View File

@ -19,8 +19,10 @@ import kd.bos.logging.LogFactory;
import shjh.jhzj7.fi.fi.utils.SapUtils;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.EventObject;
import java.util.List;
/**
* 动态表单插件-SAP应收未清 shjh_sapyswq
@ -216,17 +218,42 @@ public class ASParbillFormPlugin extends AbstractFormPlugin {
}
}
// private void parseQueryNumber(JSONArray IT_LIST, String field, String queryText) {
// // 1. 清理输入去除空格中文逗号统一用英文逗号分隔
// String cleanedText = queryText.replaceAll("\\s+", "") // 去空格
// .replace("", ","); // 中文逗号转英文
//
// // 2. 按空格拆分
// String[] numbers = cleanedText.split(",");
//
// // 3. 遍历处理每个凭证号
// for (String number : numbers) {
// if (number.isEmpty()) continue;
// JSONObject eqQuery = new JSONObject();
// eqQuery.put("FIELD", field);
// eqQuery.put("SIGN", "I");
// eqQuery.put("OPTION", "EQ");
// eqQuery.put("LOW", number);
// eqQuery.put("HIGH", number);
// IT_LIST.add(eqQuery);
// }
// }
private void parseQueryNumber(JSONArray IT_LIST, String field, String queryText) {
// 1. 清理输入去除空格中文逗号统一用英文逗号分隔
String cleanedText = queryText.replaceAll("\\s+", "") // 去空格
.replace("", ","); // 中文逗号转英文
// 1. 只保留数字
String digitsOnly = queryText.replaceAll("[^0-9]", "");
// 2. 按空格拆分
String[] numbers = cleanedText.split(",");
// 2. 按每10位拆分
List<String> voucherNumbers = new ArrayList<>();
for (int i = 0; i < digitsOnly.length(); i += 10) {
int endIndex = Math.min(i + 10, digitsOnly.length());
String voucher = digitsOnly.substring(i, endIndex);
if (voucher.length() == 10) { // 仅保留10位的凭证号
voucherNumbers.add(voucher);
}
}
// 3. 遍历处理每个凭证号
for (String number : numbers) {
if (number.isEmpty()) continue;
// 3. 生成查询条件
for (String number : voucherNumbers) {
JSONObject eqQuery = new JSONObject();
eqQuery.put("FIELD", field);
eqQuery.put("SIGN", "I");