理财申购单新增两个功能按钮
This commit is contained in:
parent
aaa92f87da
commit
a719a19cff
|
|
@ -24,6 +24,7 @@ import java.util.EventObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态表单插件-【SAP应收未清】 shjh_sapyswq
|
* 动态表单插件-【SAP应收未清】 shjh_sapyswq
|
||||||
|
*
|
||||||
* @author yuxueliang
|
* @author yuxueliang
|
||||||
*/
|
*/
|
||||||
public class ASParbillFormPlugin extends AbstractFormPlugin {
|
public class ASParbillFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
@ -145,6 +146,7 @@ public class ASParbillFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击查询按钮
|
* 点击查询按钮
|
||||||
|
*
|
||||||
* @param companyCode 公司编码
|
* @param companyCode 公司编码
|
||||||
* @param customerCode 客户编码
|
* @param customerCode 客户编码
|
||||||
*/
|
*/
|
||||||
|
|
@ -172,7 +174,9 @@ public class ASParbillFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
// 添加SAP应收凭证号过滤条件
|
// 添加SAP应收凭证号过滤条件
|
||||||
if (StringUtils.isNotEmpty(shjh_pzh)) {
|
if (StringUtils.isNotEmpty(shjh_pzh)) {
|
||||||
addFilterCondition(IT_LIST, "BELNR", shjh_pzh, shjh_pzh);
|
//解析多行凭证号用于批量查询
|
||||||
|
parseQueryNumber(IT_LIST, "BELNR", shjh_pzh);
|
||||||
|
//addFilterCondition(IT_LIST, "BELNR", shjh_pzh, shjh_pzh);
|
||||||
}
|
}
|
||||||
// 添加会计科目编号过滤条件
|
// 添加会计科目编号过滤条件
|
||||||
if (StringUtils.isNotEmpty(shjh_kmbh)) {
|
if (StringUtils.isNotEmpty(shjh_kmbh)) {
|
||||||
|
|
@ -212,6 +216,27 @@ 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 boolean parseResponse(JSONObject result) {
|
private boolean parseResponse(JSONObject result) {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
String code = result.getString("code");
|
String code = result.getString("code");
|
||||||
|
|
@ -238,6 +263,7 @@ public class ASParbillFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应收未清分录赋值
|
* 应收未清分录赋值
|
||||||
|
*
|
||||||
* @param detail sap接口返回json分录参数
|
* @param detail sap接口返回json分录参数
|
||||||
* @param i 分录行号
|
* @param i 分录行号
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -124,12 +124,13 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
*/
|
*/
|
||||||
String oppunit = beiIntelpay.getString("oppunit");//收款入账中心的对方户名
|
String oppunit = beiIntelpay.getString("oppunit");//收款入账中心的对方户名
|
||||||
Long companyId = beiIntelpay.getLong("company.id");//收款入账中心的资金组织id
|
Long companyId = beiIntelpay.getLong("company.id");//收款入账中心的资金组织id
|
||||||
|
String companyNumber = beiIntelpay.getString("company.number");//收款入账中心的资金组织编码
|
||||||
bill.set("shjh_dfhm", oppunit);//收款单备注字段
|
bill.set("shjh_dfhm", oppunit);//收款单备注字段
|
||||||
bill.set("payertype", "bd_customer");//付款人类型:客户
|
bill.set("payertype", "bd_customer");//付款人类型:客户
|
||||||
// 2025/6/18 优化: 先根据规则指定的付款人赋值
|
// 2025/6/18 优化: 先根据规则指定的付款人赋值
|
||||||
//判断收款单是否从规则和客户映射表取过数据,如果取过了,则设置为true;没取过,则取值
|
//判断收款单是否从规则和客户映射表取过数据,如果取过了,则设置为true;没取过,则取值
|
||||||
if (!bill.getBoolean("shjh_xdgzkh")) {
|
if (!bill.getBoolean("shjh_xdgzkh")) {
|
||||||
carryCustomerRule(entry,bill,oppunit,companyId);
|
carryCustomerRule(entry, bill, oppunit, companyId, companyNumber);
|
||||||
// DynamicObject ePayerid = entry.getDynamicObject("e_payerid");
|
// DynamicObject ePayerid = entry.getDynamicObject("e_payerid");
|
||||||
// if (null != ePayerid) {
|
// if (null != ePayerid) {
|
||||||
// bill.set("payer", ePayerid.getPkValue()); //付款人id
|
// bill.set("payer", ePayerid.getPkValue()); //付款人id
|
||||||
|
|
@ -382,9 +383,9 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包含某个多选基础资料-收款单表头取数
|
* 包含某个多选基础资料-收款单表头取数
|
||||||
|
*
|
||||||
* @param accountBill 资金计划科目表
|
* @param accountBill 资金计划科目表
|
||||||
* @param recBill 收款处理
|
* @param recBill 收款处理
|
||||||
* @param accountField 被匹配基础资料标识
|
* @param accountField 被匹配基础资料标识
|
||||||
|
|
@ -413,6 +414,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包含某个多选基础资料-收款单分录取数
|
* 包含某个多选基础资料-收款单分录取数
|
||||||
|
*
|
||||||
* @param accountBill 资金计划科目表
|
* @param accountBill 资金计划科目表
|
||||||
* @param recBill 收款处理
|
* @param recBill 收款处理
|
||||||
* @param entryName 分录标识
|
* @param entryName 分录标识
|
||||||
|
|
@ -447,6 +449,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不包含某个多选基础资料
|
* 不包含某个多选基础资料
|
||||||
|
*
|
||||||
* @param accountBill 资金计划科目表
|
* @param accountBill 资金计划科目表
|
||||||
* @param recBill 收款处理
|
* @param recBill 收款处理
|
||||||
* @param accountField 被匹配基础资料标识
|
* @param accountField 被匹配基础资料标识
|
||||||
|
|
@ -475,6 +478,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对包含客户||供应商
|
* 针对包含客户||供应商
|
||||||
|
*
|
||||||
* @param accountBill
|
* @param accountBill
|
||||||
* @param recBill
|
* @param recBill
|
||||||
* @param accountField
|
* @param accountField
|
||||||
|
|
@ -502,6 +506,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对不包含客户||供应商
|
* 针对不包含客户||供应商
|
||||||
|
*
|
||||||
* @param accountBill
|
* @param accountBill
|
||||||
* @param recBill
|
* @param recBill
|
||||||
* @param accountField
|
* @param accountField
|
||||||
|
|
@ -529,6 +534,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 针对客户检查客户组,客户组为必填项
|
* 针对客户检查客户组,客户组为必填项
|
||||||
|
*
|
||||||
* @param accountBill 资金计划科目表
|
* @param accountBill 资金计划科目表
|
||||||
* @param recBill 收款处理
|
* @param recBill 收款处理
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -600,7 +606,7 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
* 3.规则生单未配置客户——>取收款入账中心客户
|
* 3.规则生单未配置客户——>取收款入账中心客户
|
||||||
* 4.以上都未配置——>不确定客户
|
* 4.以上都未配置——>不确定客户
|
||||||
*/
|
*/
|
||||||
private void carryCustomerRule(DynamicObject entry,DynamicObject bill,String oppunit,Long companyId){
|
private void carryCustomerRule(DynamicObject entry, DynamicObject bill, String oppunit, Long companyId, String companyNumber) {
|
||||||
//1.先看取映射表按钮是否打开,打开——>取映射表中客户
|
//1.先看取映射表按钮是否打开,打开——>取映射表中客户
|
||||||
//20250704 经过和建彪沟通先注释根据标记来判断的代码
|
//20250704 经过和建彪沟通先注释根据标记来判断的代码
|
||||||
// boolean shjhEGetcustomer = entry.getBoolean("shjh_e_getcustomer"); //取规则得映射表客户标记
|
// boolean shjhEGetcustomer = entry.getBoolean("shjh_e_getcustomer"); //取规则得映射表客户标记
|
||||||
|
|
@ -631,25 +637,37 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme
|
||||||
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());
|
||||||
boolean exitCustomerArray = false;
|
boolean exitCustomerArray = false;
|
||||||
if (null != bd_customer ) {
|
if (null != bd_customer && bd_customer.length != 0) {
|
||||||
if (bd_customer.length!=0){
|
if (bd_customer.length == 1) {
|
||||||
bill.set("payer", bd_customer[0].getPkValue()); //付款人id
|
bill.set("payer", bd_customer[0].getPkValue()); //付款人id
|
||||||
bill.set("payernumber", bd_customer[0].getString("number")); //付款人编码
|
bill.set("payernumber", bd_customer[0].getString("number")); //付款人编码
|
||||||
bill.set("payername", bd_customer[0].getString("name")); //付款人名称
|
bill.set("payername", bd_customer[0].getString("name")); //付款人名称
|
||||||
exitCustomerArray = true;
|
exitCustomerArray = true;
|
||||||
|
} else {
|
||||||
|
//存在多个客户,判断组织编码companyNumber是否在客户基础资料客户组5分录中的销售公司编码中配置
|
||||||
|
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){
|
||||||
|
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)){
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//else if (bd_customer.length>1){
|
|
||||||
//for (int i = 0; i < bd_customer.length; i++) {
|
|
||||||
//DynamicObjectCollection dynamicObjectCollection = bd_customer[i].getDynamicObjectCollection("shjh_entry_five");
|
|
||||||
// if (dynamicObjectCollection.size()!=0){
|
|
||||||
// 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 (!exitCustomerArray) {
|
if (!exitCustomerArray) {
|
||||||
//4.规则生单未配置客户——>默认不确定客户
|
//4.规则生单未配置客户——>默认不确定客户
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue