4.1、表单插件,表单常用方法,获取单据标题 this.View.GetFormTitle()原创
金蝶云社区-林荫大道_找工作身份
林荫大道_找工作
35人赞赏了该文章 1.7万次浏览 未经作者许可,禁止转载编辑于2020年07月11日 22:30:22
封面

续   

1.1


1、打开VS,新建类库,名字 

Kingdee.Bos.ProJectName.Bill.Plugln


2、修改类名称为 

ClassName


3、修改属性,输出路径 为安装目录 

E:\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin


4、引用

Kingdee.BOS
Kingdee.BOS.Core
//单据体
Kingdee.BOS.DataEntity

image.png



4.0、使用 using

//基本
using Kingdee.BOS

//表单插件
using Kingdee.BOS.Core.Bill.PlugIn;
//说明
using System.ComponentModel;


4.1、插件名字

[Description("表单插件,表单常用方法")]


4.2、热启动,不用重启IIS

[Kingdee.BOS.Util.HotUpdate]


5、继承表单插件

public class ClassName:AbstractBillPlugIn

image.png



6、生成dll

image.png


6.1、销售订单绑定,注册插件



6.2、BOS,保存

image.png



----------------------------------------------------------------------------------


7、重写按钮点击事件

public override void BarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)        
{            
    base.BarItemClick(e);        
}


7.1、if条件判断,当点击YDIE_ tbGetSetValue这个按钮时候触发

if(e.BarItemKey =="YDIE_tbGetSetValue")
{

}



常用的表单插件属性

8、获取单据标题 this.View.GetFormTitle()

string FormTitle = this.View.GetFormTitle();


9、显示出来,显示到备注上面,赋值给备注

this.View.Model.SetValue("FNote", FormTitle);



10、重新生成dll



11、最终效果,重新打开销售订单,点按钮,备注的值,变成单据标题“销售订单”

image.png



image.png


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//引用插件,不管什么情况,先把这2个引用
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS;

//热启动,不用重启IIS
using System.ComponentModel;


namespace Kingdee.Bos.ProJectName.Bill.Plugln
{
    //插件名字
    [Description("表单插件,表单常用方法")]
    
    //热启动,不用重启IIS
    [Kingdee.BOS.Util.HotUpdate]
    
    
    //继承表单插件
    public class ClassName:AbstractBillPlugIn
    {
        //重写按钮点击事件
        public override void BarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
        {
            base.BarItemClick(e);
            
            
            //条件判断,当点击YDIE_ tbGetSetValue这个按钮时候触发
            if(e.BarItemKey =="YDIE_tbGetSetValue")
            {
                //获取单据标题 this.View.GetFormTitle()
                string FormTitle = this.View.GetFormTitle();
                
                //显示出来,显示到备注上面,赋值给备注
                this.View.Model.SetValue("FNote", FormTitle);
            }
        }
    }
}


总目录链接

https://vip.kingdee.com/article/64993872014591232


赞 35