供应商保存后设置中台供应商id

This commit is contained in:
sez 2025-12-12 17:57:21 +08:00
parent b3bae62bf6
commit 1a853e7988
1 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package tqq9.lc123.cloud.app.plugin.operate.sys; package tqq9.lc123.cloud.app.plugin.operate.sys;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -8,6 +9,8 @@ import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin; import kd.sdk.plugin.Plugin;
import oadd.org.apache.commons.lang3.StringUtils; import oadd.org.apache.commons.lang3.StringUtils;
import java.util.List;
/** /**
* 单据操作插件 * 单据操作插件
* 供应商保存后设置中台供应商id * 供应商保存后设置中台供应商id
@ -17,13 +20,16 @@ public class SupSaveAfterOp extends AbstractOperationServicePlugIn implements Pl
@Override @Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e); super.afterExecuteOperationTransaction(e);
DynamicObject[] dataEntities = e.getDataEntities(); OperationResult operationResult = this.getOperationResult();
for (DynamicObject dataEntity : dataEntities) { List<Object> successPkIds = operationResult.getSuccessPkIds();
for (Object successPkId : successPkIds) {
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier");
String tqq9_ztsupplierid = dataEntity.getString("tqq9_ztsupplierid"); String tqq9_ztsupplierid = dataEntity.getString("tqq9_ztsupplierid");
if (StringUtils.isBlank(tqq9_ztsupplierid)) { if (StringUtils.isBlank(tqq9_ztsupplierid)) {
dataEntity.set("tqq9_ztsupplierid", dataEntity.getPkValue()); dataEntity.set("tqq9_ztsupplierid", dataEntity.getPkValue());
SaveServiceHelper.save(new DynamicObject[]{dataEntity}); SaveServiceHelper.save(new DynamicObject[]{dataEntity});
} }
} }
} }
} }