21.2、列表插件,获取单据体分录,FID内码原创
金蝶云社区-林荫大道cc身份
林荫大道cc
16人赞赏了该文章 11431次浏览 未经作者许可,禁止转载编辑于2020年07月06日 12:11:19
封面



21.1



业务场景:上一节获取的是 单据头,主表FID内码,本节介绍如何获取单据体,分录FID内码




1、注释上一节代码


//获取单据头FID内码

string[] listKey = listcoll.GetPrimaryKeyValues();


              //  //获取所选行的主键,赋值给一个数组listKey
              //  //接收返回的数组值
              //string[] listKey = listcoll.GetPrimaryKeyValues();
              
              ////定义字段
              //info = "";
              
              //  //显示出来,获取的主键
              //  //for循环
              //  foreach(string key in listKey)
              //  {
              //      //给info赋值,读取出来
              //      info = info + "," + key;
              //  }
              //  this.View.ShowMessage(info);




2、

//获取单据体FID内码

string[] listKey = listcoll.GetEntryPrimaryKeyValues();



              string[] listKey = listcoll.GetEntryPrimaryKeyValues();
              
              
              //和上一节,一样循环,显示
                foreach(string key in listKey)
                {
                    info = info + "," + key;
                }
                
                this.View.ShowMessage(info);



3、


--单据头
select * from T_SAL_OUTSTOCK

--单据体
select * from T_SAL_OUTSTOCKENTRY

image.png


image.png



4、重新生成dll




5、最终效果,重新打开销售出库单列表,点击按钮,获取到单据体FENTRYID


image.png

image.png



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


6、为了方便查看阅读,隐藏上一节代码

             #region 获取单据头FID内码
             
             #endregion


              #region 获取单据头FID内码
              //  //获取所选行的主键,赋值给一个数组listKey
              //  //接收返回的数组值
              //string[] listKey = listcoll.GetPrimaryKeyValues();
              ////定义字段
              //info = "";
              //  //显示出来,获取的主键
              //  //for循环
              //  foreach(string key in listKey)
              //  {
              //      //给info赋值,读取出来
              //      info = info + "," + key;
              //  }
              //  this.View.ShowMessage(info);
              #endregion


image.png


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS;
using System.ComponentModel;
//列表插件
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.List;

namespace Kingdee.Bos.ProjectName.List.Plugln
{
    [Description("列表插件,几个常用的方法")]
    [Kingdee.BOS.Util.HotUpdate]
    
    //继承.列表插件
    public class ClassName:AbstractListPlugIn
    {
        //定义字段
        string info;
        
        public override void BarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
        {
            base.BarItemClick(e);
            if(e.BarItemKey.Equals("YDIE_tbTest"))
            {
                //选择的行,获取所有信息,放在listcoll里面
              ListSelectedRowCollection listcoll=  this.ListView.SelectedRowsInfo;
              #region 获取单据头FID内码
              //  //获取所选行的主键,赋值给一个数组listKey
              //  //接收返回的数组值
              //string[] listKey = listcoll.GetPrimaryKeyValues();
              ////定义字段
              //info = "";
              //  //显示出来,获取的主键
              //  //for循环
              //  foreach(string key in listKey)
              //  {
              //      //给info赋值,读取出来
              //      info = info + "," + key;
              //  }
              //  this.View.ShowMessage(info);
              #endregion
              
              
              
              
              //获取分录FID
                //定义一个字符串数组,接收分录FID的值
              string[] listKey = listcoll.GetEntryPrimaryKeyValues();
              
                //和上一节,一样循环,显示
                foreach(string key in listKey)
                {
                    info = info + "," + key;
                }
                
                this.View.ShowMessage(info);
            }
        }
    }
}


总目录链接

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





赞 16