4.3、表单插件,获取表单Fid内码,this.View.Model.GetPKValue原创
金蝶云社区-林荫大道cc身份
林荫大道cc
19人赞赏了该文章 9501次浏览 未经作者许可,禁止转载编辑于2020年07月02日 15:11:18
封面



4.2、表单插件,获取表单Fid内码,this.View.Model.DataObject["Id"]



1、注释,上一节代码

                //获取单据内码,并转换成字符串.ToString()
                //string FormTitle = this.View.Model.DataObject["Id"].ToString();
                
                //显示出来,显示到备注上面,赋值给备注
                //this.View.Model.SetValue("FNote", FormTitle);


2、//获取单据内码,并转换成字符串.ToString()

string FormTitle = this.View.Model.GetPKValue().ToString();


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

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


4、重新生成dll



5、重新打开销售订单,点暂存,然后再点按钮,备注自动显示单据内码FID


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);
                
                //获取单据内码,并转换成字符串.ToString()
                //string FormTitle = this.View.Model.DataObject["Id"].ToString();
                
                //显示出来,显示到备注上面,赋值给备注
                //this.View.Model.SetValue("FNote", FormTitle);
                
                //获取单据内码,并转换成字符串.ToString()
                string FormTitle = this.View.Model.GetPKValue().ToString();
                
                //显示出来,显示到备注上面,赋值给备注
                this.View.Model.SetValue("FNote", FormTitle);
            }
        }
    }
}


总目录链接

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


赞 19