5.5、表单插件,获取单据体行数,this.View.Model.GetEntryRowCount原创
金蝶云社区-林荫大道cc
林荫大道cc
10人赞赏了该文章 11100次浏览 未经作者许可,禁止转载编辑于2020年07月02日 15:19:44
封面



5.4、表单插件,获取单据体FENTRYID内码,GetEntryPKValue




1、注释,上一节代码



2、获取单据体,行数

this.View.Model.GetEntryRowCount("FSaleOrderEntry");



3、展示效果,把获取到的值放到备注FNote里面

this.View.Model.SetValue("FNote", this.View.Model.GetEntryRowCount("FSaleOrderEntry"));



4、重新生成dll



5、最终效果,重新打开销售订单,点按钮,自动获取单据体行数


image.png


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.Model.GetEntryRowCount("FSaleOrderEntry");
                
                //展示效果,把获取到的值放到备注FNote里面
               this.View.Model.SetValue("FNote", this.View.Model.GetEntryRowCount("FSaleOrderEntry"));
                
                
                //刷新,单据体界面
                this.View.UpdateView("FSaleOrderEntry");
            }
        }
    }
}


总目录链接

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




赞 10