瀏覽代碼

SRM接口
1、针对发票信息逻辑调整,多发票时,如果发票合计可用金额与本次报销金额不一样,则发票本次报销金额默认为0,由用户手工在单据维护

wanghaiwu 3 周之前
父節點
當前提交
bd21a82ddf

+ 19 - 0
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/webapi/SRMSynPayApiPlugin.java

@@ -681,6 +681,11 @@ public class SRMSynPayApiPlugin implements Serializable {
         type = invoiceEntry.getDynamicObjectType();
         JSONArray fpentry = inputData.getJSONArray("fpentry");
 
+        //发票数量
+        int fpCount = fpentry.size();
+        //发票合计可用金额
+        BigDecimal totalInvAmount = BigDecimal.ZERO;
+
         String invoiceCode = "";
         String invoiceName = "";
 
@@ -800,6 +805,13 @@ public class SRMSynPayApiPlugin implements Serializable {
                         bizAcctOutBill.set("automapinvoice", false);
                     }
 
+                    totalInvAmount = totalInvAmount.add(entry.getBigDecimal("poolreimburseamount"));
+
+                    if(fpCount == 1){
+                        if(totalReimburseAmount.compareTo(entry.getBigDecimal("poolreimburseamount")) < 0) {
+                            entry.set("poolreimburseamount", totalReimburseAmount);//本次报销金额
+                        }
+                    }
 
                     String invoiceGoodsName = "";
 
@@ -897,6 +909,13 @@ public class SRMSynPayApiPlugin implements Serializable {
             }
             invoiceEntry.add(entry);
         }
+
+        if(fpCount > 1 && totalInvAmount.compareTo(totalReimburseAmount) != 0){
+            for(DynamicObject checkEntry : invoiceEntry){
+                checkEntry.set("poolreimburseamount", BigDecimal.ZERO);
+            }
+        }
+
         bizAcctOutBill.set("invoiceentry", invoiceEntry);
 
         if(invoiceName.length() > 200){