2.3、表单插件,取值GetValue,多选基础资料
1、销售订单上面,添加一个多选基础资料字段
2、打开VS,定义数组,多个客户
object[] custs = new object[] { "300638", "322070", "454978" };
3、给数组赋值
this.View.Model.SetValue("F_YDIE_CustS", custs);
4、最终效果,打开销售订单,点按钮,自动获取多个客户
using System; using System.Collections.Generic; using System.Linq; using System.Text; //引用 using Kingdee.BOS.Core.Bill.PlugIn; //热启动,不用重启IIS,引用 using Kingdee.BOS; //插件名字 using System.ComponentModel; namespace Kingdee.Bos.ObjectName.Bill.Plugln { //插件名字 [Description("表单插件获取和设置值")] //热启动,不用重启IIS [Kingdee.BOS.Util.HotUpdate] //继承函数:AbstractBillPlugIn public class ClassName:AbstractBillPlugIn { //重写点击按钮函数 public override void BarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e) { base.BarItemClick(e); //给单据头,备注赋值,你好 this.View.Model.SetValue("FNote", "你好"); //获取备注FNote的值,并强制转换成字符串.ToString() string FNote = this.View.Model.GetValue("FNote").ToString(); //把获取的值,给新增的字段,备注1,FNote1 this.View.Model.SetValue("FNote1", FNote + "赋值成功"); //把客户FcustId,赋值内码300638 this.View.Model.SetValue("FcustId", 300638); //定义数组,多个客户 object[] custs = new object[] { "300638", "322070", "454978" }; //给数组赋值 this.View.Model.SetValue("F_YDIE_CustS", custs); //刷新字段 this.View.UpdateView("FNote"); this.View.UpdateView("FNote1"); this.View.UpdateView("FcustId"); this.View.UpdateView("F_YDIE_CustS"); } } }