21.3、列表插件,获取单据编码,ListModel.GetData原创
金蝶云社区-林荫大道cc
林荫大道cc
14人赞赏了该文章 9432次浏览 未经作者许可,禁止转载编辑于2020年07月06日 15:36:47
封面

21.2



1、注释,隐藏上一节代码


              #region//获取单据体分录FID
              //  //定义一个字符串数组,接收分录FID的值
              //string[] listKey = listcoll.GetEntryPrimaryKeyValues();
              
              //  //和上一节,一样循环,显示
              //  foreach(string key in listKey)
              //  {
              //      info = info + "," + key;
              //  }
              
              #endregion//  this.View.ShowMessage(info);



2、添加使用

using Kingdee.BOS.Orm.DataEntity;



                //获取行选择信息
              this.ListModel.GetData(listcoll);
               
                //定义字段,赋值
              DynamicObjectCollection dycoll = this.ListModel.GetData(listcoll);
              
                //通过循环,读取数据
                for(int i =0;i<dycoll.Count;i++)
                {
                    info = info + "," + dycoll[i]["FBillNo"];
                    info = info + "," + dycoll[i]["FDate"];
                }
                
                //显示
                this.View.ShowMessage(info);



2.1、重新生成dll



2.2、最终效果,重新打开销售出库单列表,选中单据,点按钮


image.png






3、调试,监视值,请参考 18.4


返回的类型  Kingdee.BOS.Orm.DataEntity.DynamicObjectCollection

image.png



4、选择3行,调试,监视 3

image.png




5、直接输入,获取值

dycoll[0]["FDAte"]


image.png



dycoll[0]["FbillNo"]


image.png




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;
using Kingdee.BOS.Orm.DataEntity;
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
              #region//获取单据体分录FID
              //  //定义一个字符串数组,接收分录FID的值
              //string[] listKey = listcoll.GetEntryPrimaryKeyValues();
              //  //和上一节,一样循环,显示
              //  foreach(string key in listKey)
              //  {
              //      info = info + "," + key;
              //  }
              #endregion//  this.View.ShowMessage(info);
                
                
                
                //获取行选择信息
              this.ListModel.GetData(listcoll);
               
                //定义字段,赋值
              DynamicObjectCollection dycoll = this.ListModel.GetData(listcoll);
              
                //通过循环,读取数据
                for(int i =0;i<dycoll.Count;i++)
                {
                    info = info + "," + dycoll[i]["FBillNo"];
                    info = info + "," + dycoll[i]["FDate"];
                }
                
                //显示
                this.View.ShowMessage(info);
            }
        }
    }
}



总目录链接

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



赞 14