单据转换插件-插件基类

1 插件介绍
系统预置了单据转换插件基类AbstractConvertPlugIn,单据转换插件,必须从插件基类AbstractConvertPlugIn中派生。
2 插件接口和实现类
单据转换插件实现了转换插件接口IConvertPlugin:
package kd.bos.entity.botp.plugin;
public class AbstractConvertPlugIn implements IConvertPlugIn {单据转换插件接口是IConvertPlugin:
package kd.bos.entity.botp.plugin;
public interface IConvertPlugIn {3 创建并注册插件
自定义单据转换插件,必须扩展插件基类AbstractConvertPlugIn,绑定到单据转换规则上

自定义单据转换插件示例:
package kd.bos.plugin.sample.bill.billconvert.bizcase;
import kd.bos.entity.BillEntityType;
import kd.bos.entity.botp.ConvertOpType;
import kd.bos.entity.botp.ConvertRuleElement;
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
import kd.bos.entity.botp.plugin.args.AfterBuildQueryParemeterEventArgs;
import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
import kd.bos.entity.botp.plugin.args.AfterCreateLinkEventArgs;
import kd.bos.entity.botp.plugin.args.AfterCreateTargetEventArgs;
import kd.bos.entity.botp.plugin.args.AfterFieldMappingEventArgs;
import kd.bos.entity.botp.plugin.args.AfterGetSourceDataEventArgs;
import kd.bos.entity.botp.plugin.args.BeforeBuildGroupModeEventArgs;
import kd.bos.entity.botp.plugin.args.BeforeBuildRowConditionEventArgs;
import kd.bos.entity.botp.plugin.args.BeforeCreateLinkEventArgs;
import kd.bos.entity.botp.plugin.args.BeforeCreateTargetEventArgs;
import kd.bos.entity.botp.plugin.args.BeforeGetSourceDataEventArgs;
import kd.bos.entity.botp.plugin.args.InitVariableEventArgs;
/**
* 演示单据转换插件事件的触发时机
*
* @author rd_JohnnyDing
*
*/
public class BillConvertEventSample extends AbstractConvertPlugIn {
/**
* 演示如何获取上下文信息
*/
private void getContext(){
// 源单主实体
BillEntityType srcMainType = this.getSrcMainType();
// 目标单主实体
BillEntityType tgtMainType = this.getTgtMainType();
// 转换规则
ConvertRuleElement rule = this.getRule();
// 转换方式:下推、选单
ConvertOpType opType = this.getOpType();
}
/**
* 初始化变量事件
*
* @param e
* @remark
* 获取上下文信息,构建一些必须的变量
*/
@Override
public void initVariable(InitVariableEventArgs e) {
this.printEventInfo("initVariable", "");
}
/**
* 构建取数参数后事件
*
* @param e
* @remark
* 添加额外的字段、过滤条件
*/
@Override
public void afterBuildQueryParemeter(AfterBuildQueryParemeterEventArgs e) {
this.printEventInfo("afterBuildQueryParemeter", "");
}
/**
* 编译数据筛选条件前事件
*
* @param e
* @remark
* 设置忽略规则原生的条件,改用插件定制条件,或者在规则条件基础上,追加定制条件
*
*/
@Override
public void beforeBuildRowCondition(BeforeBuildRowConditionEventArgs e) {
this.printEventInfo("beforeBuildRowCondition", "");
}
/**
* 取源单数据前事件
*
* @param e
* @remark
* 修改取数语句、取数条件
*/
@Override
public void beforeGetSourceData(BeforeGetSourceDataEventArgs e) {
this.printEventInfo("beforeGetSourceData", "");
}
/**
* 取源单数据后事件
*
* @param e
* @remark
* 根据源单数据,获取其他定制的引用数据;也可以替换系统自动获取到的数据
*/
@Override
public void afterGetSourceData(AfterGetSourceDataEventArgs 单据转换插件-插件基类
1 插件介绍系统预置了单据转换插件基类AbstractConvertPlugIn,单据转换插件,必须从插件基类AbstractConvertPlugIn中派生。2 插件接口和...
点击下载文档文档为doc格式
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
上一篇
已经是第一篇



