|
@@ -22,6 +22,8 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.DispatchServiceHelper;
|
|
import kd.bos.servicehelper.DispatchServiceHelper;
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
import nckd.base.helper.CommonHelperUtils;
|
|
import nckd.base.helper.CommonHelperUtils;
|
|
|
|
+import scala.Dynamic;
|
|
|
|
+
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -519,17 +521,45 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
|
|
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);
|
|
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);
|
|
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("accloanamount", checkAmountOri);//冲销金额
|
|
- entry.set("sourcebillid", prepayBillInfo.getPkValue().toString());//源单id
|
|
|
|
|
|
+ entry.set("curraccloanamount", checkAmountOri.multiply(exchangeRate));//冲销金额(本位币)
|
|
|
|
+ entry.set("sourcebillid", prepayBillInfo.getString("id"));//源单id
|
|
|
|
+ entry.set("sourceentryid", prepayEntry.getString("id"));//源单分录id
|
|
|
|
+ entry.set("srcbilltype", "er_prepaybill");//源单类型
|
|
|
|
+
|
|
entry.set("seq", srmseq);
|
|
entry.set("seq", srmseq);
|
|
|
|
|
|
writeoffmoney.add(entry);
|
|
writeoffmoney.add(entry);
|