-SAP拉取,调整单,定时任务,优化结算方式

s
This commit is contained in:
weiyunlong 2025-04-30 15:07:32 +08:00
parent 03bd93b43a
commit d5f7bfed3c
3 changed files with 116 additions and 49 deletions

View File

@ -146,9 +146,38 @@ public class SappzFormPlugin extends AbstractFormPlugin {
if (StringUtils.isNotEmpty(kunnr)) {
this.getModel().setValue("shjh_payee", "客户", i);//往来类型
this.getModel().setValue("shjh_payeebanknum", kunnr, i);//往来户名称
//结算方式:银企直连
this.getModel().setValue("shjh_paymenttypenumber", "T", i);//结算方式
this.getModel().setValue("shjh_paymenttype", "银企直连", i);//结算方式
}else {
this.getModel().setValue("shjh_payee", "供应商", i);
this.getModel().setValue("shjh_payeebanknum", lifnr, i); // 往来户名称
QFilter Q3 = new QFilter("number", QCP.equals, lifnr);
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(BD_SUPPLIER, new QFilter[]{Q3});
// 用于标记是否找到合适的结算方式
boolean foundSettlementType = false;
if (dynamicObject != null) {
DynamicObjectCollection shjhEntrySap = dynamicObject.getDynamicObjectCollection("shjh_entry_sap");
if (!shjhEntrySap.isEmpty()) {
for (DynamicObject object : shjhEntrySap) {
if (it_list.getString("BUKRS").equals(object.getString("shjh_companynum"))) {
DynamicObject settlementtype = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, object.getString("shjh_companynum"))});
if (settlementtype != null) {
this.getModel().setValue("shjh_paymenttypenumber", object.getString("shjh_companynum"), i); // 结算方式
this.getModel().setValue("shjh_paymenttype", settlementtype.getString("name"), i); // 结算方式
foundSettlementType = true;
break;
}
}
}
}
}
// 如果没找到合适的结算方式使用默认值
if (!foundSettlementType) {
this.getModel().setValue("shjh_paymenttypenumber", "T", i); // 结算方式
this.getModel().setValue("shjh_paymenttype", "银企直连", i); // 结算方式
}
}
this.getModel().setValue("shjh_description", it_list.getString("BVTYP"), i);//合作银行类型.合作银行类型
this.getModel().setValue("shjh_reasoncode", it_list.getString("RSTGR"), i);//原因码
@ -158,39 +187,40 @@ public class SappzFormPlugin extends AbstractFormPlugin {
this.getModel().setValue("shjh_isselfprocurment", it_list.getString("ZZXCG_FLAG"), i);//是否自行采购
this.getModel().setValue("shjh_paymentcurrency", it_list.getString("WAERS"), i);//付款币别编号CNY,货币码
this.getModel().setValue("shjh_settlementcurrency", it_list.getString("WAERS"), i);//结算币别编号,货币码
this.getModel().setValue("shjh_paymenttypenumber", it_list.getString("ZLSCH"), i);//付款方式
switch (it_list.getString("ZLSCH")) {
case "B":
this.getModel().setValue("shjh_paymenttype", "汇票", i);//付款方式
break;
case "C":
this.getModel().setValue("shjh_paymenttype", "支票", i);//付款方式
break;
case "D":
this.getModel().setValue("shjh_paymenttype", "贷记凭证", i);//付款方式
break;
case "E":
this.getModel().setValue("shjh_paymenttype", "现金", i);//付款方式
break;
case "F":
this.getModel().setValue("shjh_paymenttype", "EPIC-中信银行", i);//付款方式
break;
case "G":
this.getModel().setValue("shjh_paymenttype", "EPIC_线下付款方式", i);//付款方式
break;
case "P":
this.getModel().setValue("shjh_paymenttype", "POS机", i);//付款方式
break;
case "T":
this.getModel().setValue("shjh_paymenttype", "银企直连", i);//付款方式
break;
case "U":
this.getModel().setValue("shjh_paymenttype", "网银及柜台付款", i);//付款方式
break;
case "Y":
this.getModel().setValue("shjh_paymenttype", "自动扣款", i);//付款方式
break;
}
// this.getModel().setValue("shjh_paymenttypenumber", it_list.getString("ZLSCH"), i);//付款方式
// switch (it_list.getString("ZLSCH")) {
// case "B":
// this.getModel().setValue("shjh_paymenttype", "汇票", i);//付款方式
// break;
// case "C":
// this.getModel().setValue("shjh_paymenttype", "支票", i);//付款方式
// break;
// case "D":
// this.getModel().setValue("shjh_paymenttype", "贷记凭证", i);//付款方式
// break;
// case "E":
// this.getModel().setValue("shjh_paymenttype", "现金", i);//付款方式
// break;
// case "F":
// this.getModel().setValue("shjh_paymenttype", "EPIC-中信银行", i);//付款方式
// break;
// case "G":
// this.getModel().setValue("shjh_paymenttype", "EPIC_线下付款方式", i);//付款方式
// break;
// case "P":
// this.getModel().setValue("shjh_paymenttype", "POS机", i);//付款方式
// break;
// case "T":
// this.getModel().setValue("shjh_paymenttype", "银企直连", i);//付款方式
// break;
// case "U":
// this.getModel().setValue("shjh_paymenttype", "网银及柜台付款", i);//付款方式
// break;
// case "Y":
// this.getModel().setValue("shjh_paymenttype", "自动扣款", i);//付款方式
// break;
// }
String uuid = it_list.getString("XBLNR");
this.getModel().setValue("shjh_uuid", uuid, i);//单据号
/**

View File

@ -374,13 +374,32 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
ap_payapply.set("shjh_bookkeepingdate", BUDATs);
//凭证日期
ap_payapply.set("shjh_documentdate", BLDATs);
//结算方式
DynamicObject settlementtypes = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, "T")});//银企直连
// 标记是否设置了结算方式
boolean isSettlementSet = false;
String zlsch = it_list.getString("ZLSCH");//付款方式
if ("供应商".equals(shjh_payee)) {
DynamicObjectCollection shjhEntrySap = party.getDynamicObjectCollection("shjh_entry_sap");
if (!shjhEntrySap.isEmpty()) {
for (DynamicObject object : shjhEntrySap) {
if (org.getString("number").equals(object.getString("shjh_companynum"))) {
// 结算方式(付款方式)
DynamicObject settlementtype = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, zlsch)});
if (null != settlementtype) {
new QFilter[]{new QFilter("number", QCP.equals, object.getString("shjh_companynum"))});
if (settlementtype != null) {
ap_payapply_entry.set("e_settlementtype", settlementtype);
isSettlementSet = true;
break;
}
}
}
}
}
// 如果未设置结算方式则使用默认的银企直连
if (!isSettlementSet) {
ap_payapply_entry.set("e_settlementtype", settlementtypes);
}
String uuid = it_list.getString("XBLNR");//单据号
// 设置付款类型 //付款类型 外部系统单据类型

View File

@ -422,7 +422,7 @@ public class ApplyAdjustBillControler {
String accountingsubject = it_list.getString("SAKNR");//会计科目:1001,总帐科目编号
BigDecimal outstandingamount = new BigDecimal(it_list.getString("WRBTR"));//未清金额,凭证货币金额
BigDecimal KURSF = new BigDecimal(it_list.getString("KURSF"));
String zlsch = it_list.getString("ZLSCH");//付款方式
// String zlsch = it_list.getString("ZLSCH");//付款方式(结算方式)
if (KURSF.compareTo(BigDecimal.ZERO) == 0) {
KURSF = BigDecimal.ONE;
}
@ -458,6 +458,7 @@ public class ApplyAdjustBillControler {
} else {
asstacttype = "供应商";
asstact = lifnr;
}
// String assacct = it_list.getString("BVTYP");//合作银行类型.合作银行类型 A
String assacct = "A";//合作银行类型.合作银行类型 A
@ -544,7 +545,7 @@ public class ApplyAdjustBillControler {
}
// 设置明细信息
String s1 = setEntryInfo(ap_payapply, asstacttype, asstact, assacct, duedate, outstandingamount, fkBillNum,zlsch);
String s1 = setEntryInfo(ap_payapply, asstacttype, asstact, assacct, duedate, outstandingamount, fkBillNum,org);
if (StringUtils.isNotEmpty(s1)) {
return s1;
}
@ -619,7 +620,7 @@ public class ApplyAdjustBillControler {
* 付款方式 _结算
* @return 操作是否成功
*/
private String setEntryInfo(DynamicObject ap_payapply, String asstacttype, String asstact, String assacct, Date duedate, BigDecimal outstandingamount, String fkBillNum,String zlsch) {
private String setEntryInfo(DynamicObject ap_payapply, String asstacttype, String asstact, String assacct, Date duedate, BigDecimal outstandingamount, String fkBillNum,DynamicObject org) {
DynamicObjectCollection entry = ap_payapply.getDynamicObjectCollection("entry");
entry.clear();
DynamicObject ap_payapply_entry = entry.addNew();
@ -678,12 +679,29 @@ public class ApplyAdjustBillControler {
return "同步失败, 供应商的合作银行类型 " + assacct + " 不存在";
}
}
//结算方式
DynamicObject settlementtypes = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, "T")});//银企直连
boolean isSettlementTypeSet = false;
if ("供应商".equals(asstacttype) && party != null) {
DynamicObjectCollection shjhEntrySap = party.getDynamicObjectCollection("shjh_entry_sap");
if (!shjhEntrySap.isEmpty()) {
for (DynamicObject object : shjhEntrySap) {
if (org.getString("number").equals(object.getString("shjh_companynum"))) {
// 结算方式(付款方式)
DynamicObject settlementtype = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, zlsch)});
if (null != settlementtype) {
new QFilter[]{new QFilter("number", QCP.equals, object.getString("shjh_companynum"))});
if (settlementtype != null) {
ap_payapply_entry.set("e_settlementtype", settlementtype);
isSettlementTypeSet = true;
break;
}
}
}
}
}
if (!isSettlementTypeSet) {
ap_payapply_entry.set("e_settlementtype", settlementtypes); // 银企直连
}
//到期日