同名客户携带改动
This commit is contained in:
		
							parent
							
								
									58b879f9c5
								
							
						
					
					
						commit
						c8b45040e4
					
				|  | @ -634,7 +634,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|             } else { | ||||
|                 //3.规则生单未配置客户——>取收款入账中心客户 | ||||
|                 QFilter customerFilter = new QFilter("name", QCP.equals, oppunit); | ||||
|                 customerFilter.and(new QFilter("group.name",QCP.not_equals,"员工")); | ||||
|                 customerFilter.and(new QFilter("group.name", QCP.not_equals, "员工")); | ||||
|                 //可用状态 | ||||
|                 customerFilter.and(new QFilter("enable", QCP.equals, "1")); | ||||
|                 DynamicObject[] bd_customer = BusinessDataServiceHelper.load("bd_customer", "id,name", customerFilter.toArray()); | ||||
|  | @ -647,28 +647,36 @@ 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"); | ||||
|                             if (customer!=null){ | ||||
|                             if (customer != null) { | ||||
|                                 DynamicObjectCollection dynamicObjectCollection = customer.getDynamicObjectCollection("shjh_entry_five"); | ||||
|                                 if (dynamicObjectCollection != null && dynamicObjectCollection.size() != 0) { | ||||
|                                     for (DynamicObject item : dynamicObjectCollection) { | ||||
|                                         String saleCompanyNum = item.getString("shjh_salecompanynum"); | ||||
|                                         if (saleCompanyNum!=null && !"".equals(saleCompanyNum)){ | ||||
|                                         if (saleCompanyNum != null && !"".equals(saleCompanyNum)) { | ||||
|                                             numberSet.add(saleCompanyNum); | ||||
|                                         } | ||||
|                                     } | ||||
|                                     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")); //付款人名称 | ||||
|                                         exitCustomerArray = true; | ||||
|                                         break; | ||||
|                                     if (numberSet.contains(companyNumber)) { | ||||
|                                         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; | ||||
|                         } | ||||
|                         // 多个客户都匹配,使用规则4的默认客户 | ||||
|                         // 没有客户匹配,保持原样(将触发规则4处理) | ||||
|                     } | ||||
|                 } | ||||
|                 if (!exitCustomerArray) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue