From 20d5d0fd8a8e6394022d4b6bff0dacdd11d68f53 Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Thu, 24 Apr 2025 18:06:08 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20--s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/operate/PayApplySaveOperation.java | 7 +++++ .../operate/PaybillPushSapOperation.java | 29 ++++++------------- .../fi/fi/plugin/task/PaybillPushSAPTask.java | 4 ++- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java index a6b9d8c..86c6e86 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java @@ -85,6 +85,13 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem this.operationResult.addSuccessPkId(bill.getPkValue()); } } + //费控 + else if ("B".equals(sourcesystem)) { + DynamicObject shjhMembersubject = xdMembersubject(bill); + bill.set("shjh_membersubject", shjhMembersubject); + SaveServiceHelper.save(new DynamicObject[]{bill}); + this.operationResult.addSuccessPkId(bill.getPkValue()); + } } } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PaybillPushSapOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PaybillPushSapOperation.java index 7e391f8..1763ac2 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PaybillPushSapOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PaybillPushSapOperation.java @@ -53,13 +53,18 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl if (!"D".equals(billstatus)) { this.addErrorMessage(entity, "付款单状态不为已付款,不允许推送SAP凭证"); } + //已推送,校验 + if (bill.getBoolean("shjh_ispushsap")) { + this.addErrorMessage(entity, "已推送SAP凭证,不允许重复推送"); + } String shjhSourcesystem = bill.getString("shjh_sourcesystem");//来源系统,A_sap,B_fk DynamicObject paymentidentify = bill.getDynamicObject("paymentidentify");//付款单标识 - + String paymenttypeNumber = bill.getString("paymenttype.number"); if (null != paymentidentify) { //FKBS01 主动付款 FKBS02 被动付款 String number = paymentidentify.getString("number");//付款单标识 - if ("FKBS01".equals(number)) { + //付款类型:同名转账 跨主体调拨 + if ("FKBS01".equals(number) && !("214".equals(paymenttypeNumber) || "217".equals(paymenttypeNumber))) { if (!"A".equals(shjhSourcesystem)) { this.addErrorMessage(entity, "付款单为主动付款且来源系统不为SAP,不允许推送SAP凭证"); } @@ -171,7 +176,7 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl } private JSONArray getIT_ITEM(DynamicObject bill) { - + String shjhSourcesystem = bill.getString("shjh_sourcesystem");//来源系统 //客户(bd_customer)||供应商(bd_supplier) 收款人id:payee String payeetype = bill.getString("payeetype");//收款人类型 String customerOrsupnum = getCustomerOrSupplierNumber(payeetype, bill,"payee"); @@ -231,7 +236,7 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl if (null != account) { //isbank boolean isbank = account.getBoolean("isbank"); - if (!isbank) { + if ("A".equals(shjhSourcesystem) &&!isbank) { continue;//非银行科目 } IT_ITEMS.put("HKONT", account.getString("number")); // 总账科目_科目(凭证分录account) @@ -247,14 +252,11 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl // 获取贷方金额 BigDecimal creditlocal = (BigDecimal) entry.get("creditlocal");//贷方 - String shjhSourcesystem = bill.getString("shjh_sourcesystem");//来源系统 - String entrydc = (String) entry.get("entrydc");//分录方向(1.借方,-1.贷方) // 进行空值检查 if (debitlocal != null && creditlocal != null && entrydc != null) { BigDecimal amountToPut = BigDecimal.ZERO; // 获取分录方向 若A,只拿一方,当前拿的借方 - boolean isSourceSystemA = "A".equals(shjhSourcesystem); boolean isEntryDC1 = "1".equals(entrydc); boolean isEntryDCNegative1 = "-1".equals(entrydc); if (isEntryDC1) { @@ -262,23 +264,10 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl } else if (isEntryDCNegative1) { amountToPut = creditlocal.negate();//相反 } -// if (isSourceSystemA && isEntryDC1) { -// amountToPut = debitlocal; -// } else if (!isSourceSystemA) { -// -// }else if (!isSourceSystemA) { -// if (isEntryDC1) { -// amountToPut = debitlocal; -// } else if (isEntryDCNegative1) { -// amountToPut = creditlocal.negate();//相反 -// } IT_ITEMS.put("DMBTR", String.valueOf(amountToPut)); } IT_ITEM.add(IT_ITEMS); } -// entries.forEach(entry -> { - -// }); } } return IT_ITEM; diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/task/PaybillPushSAPTask.java b/main/java/shjh/jhzj7/fi/fi/plugin/task/PaybillPushSAPTask.java index aab0350..e591e38 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/task/PaybillPushSAPTask.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/task/PaybillPushSAPTask.java @@ -31,7 +31,9 @@ public class PaybillPushSAPTask extends AbstractTask implements Plugin { QFilter q2 = new QFilter("paymentidentify.number", QCP.equals, "FKBS01");//付款标识为主动付款 QFilter q3 = new QFilter("shjh_sourcesystem", QCP.equals, "A");//来源系统,A_sap,B_fk QFilter q4 = new QFilter("paymentidentify.number", QCP.equals, "FKBS02");//付款标识为被动付款 - QFilter filter = q1.and((q2.and(q3)).or(q4));//是否推送SAP为否 + 主动且来源系统为SAP + 被动所有 + QFilter q5 = new QFilter("paymenttype.number", QCP.equals, "214");//付款类型:同名转账 + QFilter q6 = new QFilter("paymenttype.number", QCP.equals, "217");//付款类型:跨主体调拨 + QFilter filter = q1.and((q2.and(q3.or(q5).or(q6))).or(q4));//是否推送SAP为否 + 主动且来源系统为SAP + 被动所有 DynamicObject[] paybills = BusinessDataServiceHelper.load("cas_paybill", "id", filter.toArray()); if (paybills.length!=0){ ArrayList ids = new ArrayList<>();