美文网首页
金蝶云苍穹打印插件afterOutputElement方法案例

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

作者: 涎涎 | 来源:发表于2020-08-21 01:18 被阅读0次

前置条件

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

操作步骤

  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方法案例 知识点整理与总结的全部内容,希望对你有帮助。。。。。。。


分割线

相关文章

网友评论

      本文标题:金蝶云苍穹打印插件afterOutputElement方法案例

      本文链接:https://www.haomeiwen.com/subject/rjuyjktx.html