单据类型跟下拉列表字段的联动二开示例
单据类型跟下拉列表字段的联动二开示例,已采购申请单为例:当采购申请单的单据类型为标准采购申请时,不显示下拉列表中枚举值为3的枚举列。
此示例参考二开案例.表单插件.下拉列表动态绑定枚举类型:https://vip.kingdee.com/article/137494654802820864
表单插件代码如下所示:
using Kingdee.BOS.Core.Bill.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.ServiceHelper; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Kingdee.BOS.Printing.PlugIn.Test { public class CMBPlugIn : AbstractBillPlugIn { public CMBPlugIn() { } public override void DataChanged(Core.DynamicForm.PlugIn.Args.DataChangedEventArgs e) { base.DataChanged(e); if (e.Field.Key == "FBillTypeID") { BindComboField(); } } public override void AfterBindData(EventArgs e) { base.AfterBindData(e); BindComboField(); } private void BindComboField() { var obj = this.View.Model.GetValue("FBillTypeID"); if (obj != null && (obj as DynamicObject)!=null) { string typeName = Convert.ToString(((DynamicObject)obj)["Name"]); if (typeName == "标准采购申请")//如果是标准采购申请,则去掉枚举值为3的发货状态 { var enumList = GetEnumItems(this.Context); var comboList = this.View.GetFieldEditor<ComboFieldEditor>("F_TYJ_Combo", 0); if (comboList != null) { enumList = enumList.Where(p => p.Value != "3").ToList(); comboList.SetComboItems(enumList); } } } } private List<EnumItem> GetEnumItems(Context ctx) { // 获取枚举类型【发货状态】的枚举项明细 var objs = BusinessDataServiceHelper.LoadFromCache(ctx, new object[] { "0113bd8e-03b1-4c47-8fb4-9ed5b9074680" }, EnumObject.EnumObjectType); var enumList = new List<EnumItem>(); if (objs != null && objs.Length > 0) { var enumItems = (DynamicObjectCollection)objs[0]["Items"]; enumList.AddRange(enumItems.Select(o => (EnumItem)o)); } return enumList; } } }
单据类型跟下拉列表字段的联动二开示例
单据类型跟下拉列表字段的联动二开示例,已采购申请单为例:当采购申请单的单据类型为标准采购申请时,不显示下拉列表中枚举值为3的枚举列...
点击下载文档
本文2024-09-23 04:19:14发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-164551.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章