|
@@ -22,6 +22,8 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.DispatchServiceHelper;
|
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
import nckd.base.helper.CommonHelperUtils;
|
|
|
+import scala.Dynamic;
|
|
|
+
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.Serializable;
|
|
|
import java.math.BigDecimal;
|
|
@@ -519,17 +521,45 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
|
}
|
|
|
|
|
|
- DynamicObject prepayBillInfo = CommonHelperUtils.queryBillDynamicObject("er_prepaybill", "nckd_srmbillno", sourceBillNumber);
|
|
|
- if(currency == null){
|
|
|
- returnMessage = "预付单(" + sourceBillNumber + ")在星瀚系统中未匹配到数据!";
|
|
|
+ BigDecimal exchangeRate = BigDecimal.ONE;
|
|
|
+ if(currency.getLong("id") != 1L){
|
|
|
+ exchangeRate = CommonHelperUtils.getExchangeRate(exchangeTableId, currency.getLong("id"), 1L, bizDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ DynamicObject prepayBillInfo = CommonHelperUtils.queryBillDynamicObject("er_prepaybill", "nckd_srmbillno", sourceBillNumber, "G");
|
|
|
+ if(prepayBillInfo == null){
|
|
|
+ returnMessage = "预付单(" + sourceBillNumber + ")在星瀚系统中未匹配到已付款状态的数据!";
|
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
|
}
|
|
|
|
|
|
+ DynamicObjectCollection prepayEntrys = prepayBillInfo.getDynamicObjectCollection("expenseentryentity");
|
|
|
+ DynamicObject prepayEntry = prepayEntrys.get(0);
|
|
|
+ DynamicObjectCollection prepayAccounts = prepayBillInfo.getDynamicObjectCollection("accountentry");
|
|
|
+ DynamicObject prepayAccount = prepayAccounts.get(0);
|
|
|
+
|
|
|
DynamicObject entry = new DynamicObject(type);
|
|
|
|
|
|
- entry.set("loancurrency", currency);
|
|
|
+ entry.set("loanbillnov1", prepayBillInfo.getString("billno"));
|
|
|
+ entry.set("sourceentrycostdept", prepayBillInfo.getDynamicObject("costdept"));
|
|
|
+ entry.set("sourceentrycostcompany", prepayBillInfo.getDynamicObject("costcompany"));
|
|
|
+ entry.set("std_srcentrycostcenter", prepayBillInfo.getDynamicObject("std_costcenter"));
|
|
|
+ entry.set("sourceexpenseitem", prepayEntry.getDynamicObject("expenseitem"));
|
|
|
+ entry.set("srcentrywltype", "bd_supplier");
|
|
|
+ entry.set("srcentrywlunit", prepayAccount.getDynamicObject("supplier"));
|
|
|
+ entry.set("writeoffquotetype", "0");
|
|
|
+ entry.set("loanperson", prepayBillInfo.getDynamicObject("applier").getString("name"));
|
|
|
+ entry.set("loanapplydatev1", prepayBillInfo.getDate("bizdate"));
|
|
|
+ entry.set("loandescriptionv1", prepayBillInfo.getString("description"));
|
|
|
+ entry.set("loancurrency", currency);
|
|
|
+ entry.set("loanexchangerate", exchangeRate);
|
|
|
+ entry.set("loanamount", prepayAccount.getBigDecimal("oriaccbalamount"));
|
|
|
+ entry.set("currloanamount", prepayAccount.getBigDecimal("accbalamount"));
|
|
|
entry.set("accloanamount", checkAmountOri);
|
|
|
- entry.set("sourcebillid", prepayBillInfo.getPkValue().toString());
|
|
|
+ entry.set("curraccloanamount", checkAmountOri.multiply(exchangeRate));
|
|
|
+ entry.set("sourcebillid", prepayBillInfo.getString("id"));
|
|
|
+ entry.set("sourceentryid", prepayEntry.getString("id"));
|
|
|
+ entry.set("srcbilltype", "er_prepaybill");
|
|
|
+
|
|
|
entry.set("seq", srmseq);
|
|
|
|
|
|
writeoffmoney.add(entry);
|