金蝶云苍穹打印插件afterOutputElement方法案例

涎涎原创约 472 字大约 2 分钟...KingdeeKingdee

86-金蝶云苍穹打印插件afterOutputElement方法样例.mdopen in new window

注意

本博文仅供学术研究和交流参考,严禁将其用于商业用途。如因违规使用产生的任何法律问题,使用者需自行负责。

前置条件

请确保有做单据,例笔者有完成一个采购申请单

操作步骤

  1. 新建打印模板
  1. 添加三个文本,并分别修改其属性
  1. 编码
package kd.bos.print.plugin;

import kd.bos.entity.plugin.AbstractPrintServicePlugin;
import kd.bos.entity.plugin.IPrintScriptable;
import kd.bos.entity.plugin.args.OutputElementArgs;

/**
 * <p>Title: </p>
 * <p>
 *    Description:
 *    试验成功
 * </p>
 * <p>Copyright: Copyright (c) 2020</p>
 * @author xx
 * @date 2020年3月16日
 * see_to_overridden
 * @version 1.0
 */
public class MyPrintPlugin6 extends AbstractPrintServicePlugin {
	/**
	 * <p>Title: </p>
	 * <p>
	 *    Description:
	 * </p>
	 * <p>Copyright: Copyright (c) 2020</p>
	 * @author xx
	 * @date 2020年3月16日
	 * @param param the bare_field_name
	 * @param e
	 * @see kd.bos.entity.plugin.IPrintServicePlugin#afterOutputElement(kd.bos.entity.plugin.args.OutputElementArgs)
	 * @version 1.0
	 */
	@Override
	public void afterOutputElement(OutputElementArgs e){
		if(e.getKey().equals("text")) {
			IPrintScriptable apw = e.getOutput();//获取控件输出对象;
			Object value = apw.getFieldValue("billstatus");
			if(value !=  null) {
				apw.setValue("进入了是");
			} else {
				apw.setValue("进入了否");
			}
		} else if (e.getKey().equals("text1")) {
			/* 获取页码并赋值给text1控件 */
			IPrintScriptable apw = e.getOutput();//获取控件输出对象;
			int pageNumber = apw.getPageNumber();
			apw.setValue("pageNumber: " + pageNumber);
		} else if (e.getKey().equals("text2")) {
			/* 获取同一数据源下绑定的字段为billstatus的值并赋值给text2控件 */
			IPrintScriptable apw = e.getOutput();//获取控件输出对象;
			Object newValue = apw.getFieldValue("billstatus");
			apw.setValue(newValue != null ? newValue : "没有值哇");
		}
	}
}

预览测试

重启服务后注册插件

进入采购申请单列表界面预览测试,如下图所示测试成功


分割线


相关信息

以上就是我关于 金蝶云苍穹打印插件afterOutputElement方法样例 知识点整理与总结的全部内容,希望对你有帮助。。。。。。。

上次编辑于:
贡献者: 涎涎
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.15.4