质量追溯结果显示相关单据的界面如何实现按某个字段排序显示原创
金蝶云社区-SkyZPP
SkyZPP
4人赞赏了该文章 574次浏览 未经作者许可,禁止转载编辑于2020年09月25日 17:02:31

说明:需要基于2019年10月份的补丁版本或其后版本才可以;本例以日期字段降序为例

1、二开单据转换插件继承TraceModelEdit,重写BindEntitys方法;

2、BOS设计器中找到质量追溯模型元数据扩展,表单插件中注册二开的插件,取消标准产品插件的引用,如图所示:

2.png

具体二开示例代码如下: 

using Kingdee.BOS.Core.Metadata.EntityElement;

using Kingdee.BOS.Orm.DataEntity;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Kingdee.K3.Core.MFG.EntityHelper;

using Kingdee.BOS.Util;

using Kingdee.BOS;

using Kingdee.BOS.ServiceHelper;

using Kingdee.K3.Core.MFG.EnumConst;

 

namespace Kingdee.K3.MFG.QM.Business.PlugIn.Bill

{

    public class test : TraceModelEdit

    {

        protected override void BindEntitys(BOS.Core.DynamicForm.IOperationResult result)

        {

            base.BindEntitys(result);

            Entity finalentity =              this.View.BusinessInfo.GetEntity(CONST_QT_TraceModel.CONST_FEntity.ENTITY_FEntity);

 DynamicObjectCollection finalentrys = this.View.Model.GetEntityDataObject(finalentity); 

if (finalentrys.IsEmpty()) return; 

//List<DynamicObject> orderInfos = entrys.OrderBy(o => o.GetDynamicValue<DateTime>(CONST_QT_TraceModel.CONST_FEntity.ORM_FDate)).ToList();//升序 

List<DynamicObject> orderInfos = finalentrys.OrderByDescending(o => o.GetDynamicValue<DateTime>(CONST_QT_TraceModel.CONST_FEntity.ORM_FDate)).ToList();//降序 

finalentrys.Clear(); 

this.Model.BeginIniti(); 

       foreach (DynamicObject orderInfo in orderInfos) 

      { 

         finalentrys.Add(orderInfo); 

       } 

        this.Model.EndIniti(); 

        this.View.UpdateView(CONST_QT_TraceModel.CONST_FEntity.ENTITY_FEntity);      

      }

   }

}

实现效果如下图所示:

image.png




赞 4