同名客户携带改动

This commit is contained in:
李贵强 2025-08-12 15:51:27 +08:00
parent 58b879f9c5
commit c8b45040e4
1 changed files with 17 additions and 9 deletions

View File

@ -647,6 +647,8 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
exitCustomerArray = true;
} else {
//存在多个客户判断组织编码companyNumber是否在客户基础资料客户组5分录中的销售公司编码中配置
List<DynamicObject> matchingCustomers = new ArrayList<>();
for (int i = 0; i < bd_customer.length; i++) {
Set<String> numberSet = new HashSet<>();
DynamicObject customer = BusinessDataServiceHelper.loadSingle(bd_customer[i].getPkValue(), "bd_customer");
@ -660,15 +662,21 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
}
}
if (numberSet.contains(companyNumber)) {
bill.set("payer", bd_customer[i].getPkValue()); //付款人id
bill.set("payernumber", bd_customer[i].getString("number")); //付款人编码
bill.set("payername", bd_customer[i].getString("name")); //付款人名称
matchingCustomers.add(bd_customer[i]);
}
}
}
}
// 处理匹配结果
if (matchingCustomers.size() == 1) {
// 只有一个客户匹配使用该客户
bill.set("payer", matchingCustomers.get(0).getPkValue());
bill.set("payernumber", matchingCustomers.get(0).getString("number"));
bill.set("payername", matchingCustomers.get(0).getString("name"));
exitCustomerArray = true;
break;
}
}
}
}
// 多个客户都匹配使用规则4的默认客户
// 没有客户匹配保持原样将触发规则4处理
}
}
if (!exitCustomerArray) {