|
@@ -9,7 +9,10 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.dataentity.entity.LocaleString;
|
|
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
|
|
import kd.bos.db.DB;
|
|
|
+import kd.bos.entity.EntityMetadataCache;
|
|
|
+import kd.bos.entity.botp.runtime.TableDefine;
|
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
|
+import kd.bos.id.ID;
|
|
|
import kd.bos.logging.Log;
|
|
|
import kd.bos.logging.LogFactory;
|
|
|
import kd.bos.openapi.common.custom.annotation.ApiController;
|
|
@@ -178,6 +181,7 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
|
String position = inputData.getString("position");//职位
|
|
|
String biller = inputData.getString("biller");//制单人工号
|
|
|
String applier = inputData.getString("applier");//经办人工号
|
|
|
+ String isRelapj = "0";
|
|
|
|
|
|
if(StringUtils.isEmpty(srmBillNo)){
|
|
|
returnMessage = ("".equals(returnMessage) ? "" : ",") + "SRM单号 不能为空";
|
|
@@ -211,6 +215,8 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
|
if(StringUtils.isEmpty(project)){
|
|
|
returnMessage = ("".equals(returnMessage) ? "" : ",") + "项目类付款 项目编码 不能为空";
|
|
|
}
|
|
|
+
|
|
|
+ isRelapj = "1";
|
|
|
}
|
|
|
|
|
|
if(!StringUtils.isEmpty(returnMessage)){
|
|
@@ -321,6 +327,7 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
|
bizAcctOutBill.set("sharerule", "orgrule");//
|
|
|
bizAcctOutBill.set("sharemethod", "rate");//
|
|
|
bizAcctOutBill.set("nckd_pageid", "nckd_er_publicsrmapply");//默认页面布局
|
|
|
+ bizAcctOutBill.set("nckd_isrelapj", isRelapj);//是否关联项目
|
|
|
|
|
|
BigDecimal totalReimburseAmount = BigDecimal.ZERO;//报销金额合计
|
|
|
|
|
@@ -560,9 +567,38 @@ public class SRMSynPayApiPlugin implements Serializable {
|
|
|
entry.set("sourcebillid", prepayBillInfo.getString("id"));//源单id
|
|
|
entry.set("sourceentryid", prepayEntry.getString("id"));//源单分录id
|
|
|
entry.set("srcbilltype", "er_prepaybill");//源单类型
|
|
|
-
|
|
|
entry.set("seq", srmseq);
|
|
|
|
|
|
+ //目标单标识
|
|
|
+ String targetEntityNumber = "er_publicreimbursebill";//对公报销
|
|
|
+ String targetEntryKey = "writeoffmoney";//对公报销-冲预付、冲借款
|
|
|
+ String srcEntityNumber = "er_prepaybill";//预付单
|
|
|
+ String srcEntryKey = "expenseentryentity";//预付信息
|
|
|
+ // 获取目标单单据体的实体表格定义:主实体 + 单据体 -> 对应一个唯一的实体表格定义
|
|
|
+ TableDefine targetTableDefine = EntityMetadataCache.loadTableDefine(targetEntityNumber, targetEntryKey);
|
|
|
+ // 获取源单单据体的表格定义:记录关联关系时,需要用到此对象中的tableId值,用一个长整数值唯一标识源单及单据体
|
|
|
+ TableDefine srcTableDefine = EntityMetadataCache.loadTableDefine(srcEntityNumber, srcEntryKey);
|
|
|
+
|
|
|
+ DynamicObjectCollection linkRows = entry.getDynamicObjectCollection("writeoffmoney_lk");
|
|
|
+ if (!linkRows.isEmpty()) {
|
|
|
+ // 已经有关联源单,无需再重建
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String lkEntryKey ="writeoffmoney_lk";
|
|
|
+ Long srcTableId = srcTableDefine.getTableId();
|
|
|
+
|
|
|
+ // 找到了匹配的行,创建一条_lk子实体上数据,记录源单内码
|
|
|
+ DynamicObject linkRow = new DynamicObject(linkRows.getDynamicObjectType());
|
|
|
+ linkRows.add(linkRow);
|
|
|
+ // 在lk行中,记录源单分录表格编码、源单内码、源单分录内码
|
|
|
+
|
|
|
+ linkRow.set("id", ID.genLongId());
|
|
|
+ linkRow.set("seq", 1);
|
|
|
+ linkRow.set(lkEntryKey + "_stableid", srcTableId); // 源单分录表格编码:以此标识源单类型及单据体
|
|
|
+ linkRow.set(lkEntryKey + "_sbillid", prepayBillInfo.getString("id")); // 源单内码
|
|
|
+ linkRow.set(lkEntryKey + "_sid", prepayEntry.getString("id")); // 源单分录行内码
|
|
|
+
|
|
|
writeoffmoney.add(entry);
|
|
|
|
|
|
totalLoanCheckAmount = totalLoanCheckAmount.add(checkAmountOri);
|