5.4、表单插件,获取单据体FENTRYID内码,GetEntryPKValue原创
金蝶云社区-林荫大道cc
林荫大道cc
12人赞赏了该文章 12825次浏览 未经作者许可,禁止转载编辑于2020年07月02日 15:18:46
封面


5.3、表单插件,创建、复制,新行this.View.Model.CreateNewEntryRow




1、注释,上一节代码



2、获取单据体第1到3行内码,方便后续从数据库操作


 this.View.Model.GetEntryPKValue("FSaleOrderEntry", 0);
 this.View.Model.GetEntryPKValue("FSaleOrderEntry", 1);
 this.View.Model.GetEntryPKValue("FSaleOrderEntry", 2);



3、展示效果,BOS打开销售订单,增加一个整数类型字段


image.png


image.png


调整新增的字段,到第一列


image.png




4、赋值this.View.Model.SetValue();获取行的内码,赋值给新增的字段F_YDIE_EntryID


this.View.Model.SetValue("F_YDIE_EntryID", this.View.Model.GetEntryPKValue("FSaleOrderEntry", 0),0);
this.View.Model.SetValue("F_YDIE_EntryID", this.View.Model.GetEntryPKValue("FSaleOrderEntry", 1),1);               
this.View.Model.SetValue("F_YDIE_EntryID", this.View.Model.GetEntryPKValue("FSaleOrderEntry", 2),2);

 


5、重新生成dll



6、最终效果,重新打开销售订单,选择3个物料,点暂存,再点按钮,自动获取单据体内码ID


image.png


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//引用,单据体插件
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS;
using System.ComponentModel;


namespace Kingdee.Bos.Project.BillEntry.Plugln
{
    //插件名字
    [Description("单据体属性测试")]
    
    //热启动
    [Kingdee.BOS.Util.HotUpdate]
    
    
    //继承表单插件类
    public class ClassName:AbstractBillPlugIn
    {
        //单据体,按钮点击事件
        public override void EntryBarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
        {
            base.EntryBarItemClick(e);
            
            
            //if条件判断,当点击YDIE_tbTest这个按钮时候触发
            if(e.BarItemKey.Equals("YDIE_tbTest"))
            {
                //删除单据体信息
                //FSaleOrderEntry,代表订单明细 
                //this.View.Model.DeleteEntryData("FSaleOrderEntry");
                
                //逐行,删除单据体分录,0代表第1行
                //this.View.Model.DeleteEntryRow("FSaleOrderEntry", 0);
                
                //新增行
                //this.View.Model.CreateNewEntryRow("FSaleOrderEntry");
                
                //类似上一节功能,复制行
                //参数说明: 0代表第1行;  1代表复制到第2行; false代表不携带源单关系
                //this.View.Model.CopyEntryRow("FSaleOrderEntry", 0, 1, false);
                
                //获取单据体第1到3行内码,方便后续从数据库操作
                //this.View.Model.GetEntryPKValue("FSaleOrderEntry", 0);
                //this.View.Model.GetEntryPKValue("FSaleOrderEntry", 1);
                //this.View.Model.GetEntryPKValue("FSaleOrderEntry", 2);
                
                
                //赋值this.View.Model.SetValue();获取行的内码,赋值给新增的字段F_YDIE_EntryID
           this.View.Model.SetValue("F_YDIE_EntryID", this.View.Model.GetEntryPKValue("FSaleOrderEntry", 0),0);
           this.View.Model.SetValue("F_YDIE_EntryID", this.View.Model.GetEntryPKValue("FSaleOrderEntry", 1),1);
           this.View.Model.SetValue("F_YDIE_EntryID", this.View.Model.GetEntryPKValue("FSaleOrderEntry", 2),2);
                
                
                //刷新,单据体界面
                this.View.UpdateView("FSaleOrderEntry");
            }
        }
    }
}


          

总目录链接

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





赞 12