diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/BankSaveOP.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/BankSaveOP.java new file mode 100644 index 0000000..a32838d --- /dev/null +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/BankSaveOP.java @@ -0,0 +1,60 @@ +package shkd.sys.sys.plugin.operation; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.PreparePropertysEventArgs; +import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.entity.plugin.args.BeforeOperationArgs; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; + +import java.util.List; + +public class BankSaveOP extends AbstractOperationServicePlugIn { + + + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + } + + @Override + public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { + super.beforeExecuteOperationTransaction(e); + DynamicObject[] dataEntities = e.getDataEntities(); + + + if("banksave".equals(e.getOperationKey()) ) { //按钮操作编码 + + if(dataEntities != null && dataEntities.length != 0) { + + for(int i = 0;i < dataEntities.length;i ++) { + + DynamicObject dynamicObject = dataEntities[i]; + dynamicObject.set("kdretflag", null); //数据赋值 + + if(dynamicObject != null) { + //通过基础资料或单据标识 的id 获取数据 + DynamicObject bei_transdetail = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), "bei_transdetail"); + + if(bei_transdetail != null ) { + bei_transdetail.set("kdretflag", null); //数据赋值 + SaveServiceHelper.save(new DynamicObject[] {bei_transdetail}); + + + } + + } + dataEntities[i]=dynamicObject; + } + } + } + e.setDataEntities(dataEntities); + } + + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs e) { + super.afterExecuteOperationTransaction(e); + } +}