同名客户携带改动
This commit is contained in:
		
							parent
							
								
									58b879f9c5
								
							
						
					
					
						commit
						c8b45040e4
					
				|  | @ -634,7 +634,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme | ||||||
|             } else { |             } else { | ||||||
|                 //3.规则生单未配置客户——>取收款入账中心客户 |                 //3.规则生单未配置客户——>取收款入账中心客户 | ||||||
|                 QFilter customerFilter = new QFilter("name", QCP.equals, oppunit); |                 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")); |                 customerFilter.and(new QFilter("enable", QCP.equals, "1")); | ||||||
|                 DynamicObject[] bd_customer = BusinessDataServiceHelper.load("bd_customer", "id,name", customerFilter.toArray()); |                 DynamicObject[] bd_customer = BusinessDataServiceHelper.load("bd_customer", "id,name", customerFilter.toArray()); | ||||||
|  | @ -647,28 +647,36 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme | ||||||
|                         exitCustomerArray = true; |                         exitCustomerArray = true; | ||||||
|                     } else { |                     } else { | ||||||
|                         //存在多个客户,判断组织编码companyNumber是否在客户基础资料客户组5分录中的销售公司编码中配置 |                         //存在多个客户,判断组织编码companyNumber是否在客户基础资料客户组5分录中的销售公司编码中配置 | ||||||
|  |                         List<DynamicObject> matchingCustomers = new ArrayList<>(); | ||||||
|  | 
 | ||||||
|                         for (int i = 0; i < bd_customer.length; i++) { |                         for (int i = 0; i < bd_customer.length; i++) { | ||||||
|                             Set<String> numberSet = new HashSet<>(); |                             Set<String> numberSet = new HashSet<>(); | ||||||
|                             DynamicObject customer = BusinessDataServiceHelper.loadSingle(bd_customer[i].getPkValue(), "bd_customer"); |                             DynamicObject customer = BusinessDataServiceHelper.loadSingle(bd_customer[i].getPkValue(), "bd_customer"); | ||||||
|                             if (customer!=null){ |                             if (customer != null) { | ||||||
|                                 DynamicObjectCollection dynamicObjectCollection = customer.getDynamicObjectCollection("shjh_entry_five"); |                                 DynamicObjectCollection dynamicObjectCollection = customer.getDynamicObjectCollection("shjh_entry_five"); | ||||||
|                                 if (dynamicObjectCollection != null && dynamicObjectCollection.size() != 0) { |                                 if (dynamicObjectCollection != null && dynamicObjectCollection.size() != 0) { | ||||||
|                                     for (DynamicObject item : dynamicObjectCollection) { |                                     for (DynamicObject item : dynamicObjectCollection) { | ||||||
|                                         String saleCompanyNum = item.getString("shjh_salecompanynum"); |                                         String saleCompanyNum = item.getString("shjh_salecompanynum"); | ||||||
|                                         if (saleCompanyNum!=null && !"".equals(saleCompanyNum)){ |                                         if (saleCompanyNum != null && !"".equals(saleCompanyNum)) { | ||||||
|                                             numberSet.add(saleCompanyNum); |                                             numberSet.add(saleCompanyNum); | ||||||
|                                         } |                                         } | ||||||
|                                     } |                                     } | ||||||
|                                     if (numberSet.contains(companyNumber)){ |                                     if (numberSet.contains(companyNumber)) { | ||||||
|                                         bill.set("payer", bd_customer[i].getPkValue()); //付款人id |                                         matchingCustomers.add(bd_customer[i]); | ||||||
|                                         bill.set("payernumber", bd_customer[i].getString("number")); //付款人编码 |  | ||||||
|                                         bill.set("payername", bd_customer[i].getString("name")); //付款人名称 |  | ||||||
|                                         exitCustomerArray = true; |  | ||||||
|                                         break; |  | ||||||
|                                     } |                                     } | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  |                         // 处理匹配结果 | ||||||
|  |                         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) { |                 if (!exitCustomerArray) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue