onload插件报错:未将对象引用设置到对象的实例。
金蝶云社区-181xxxx5035
181xxxx5035
0人赞赏了该文章 1,246次浏览 未经作者许可,禁止转载编辑于2017年08月31日 16:12:44

写了个onload插件,想实现在打开新增“客户”界面时,在单据体分录页面上自动加载所有“物料”的信息。结果打开新增客户时报错,提示:未将对象引用设置到对象的实例。想请问各位大神各位老师们是什么问题?


插件代码如下:
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Orm.DataEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary8
{
public class abc : AbstractBillPlugIn
{
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string SQL_4 = String.Format(@"Select * From T_BD_MATERIAL");

DynamicObjectCollection DynamDate4 = DBUtils.ExecuteDynamicObject(this.Context, SQL_4);

string str = "";
for (int i = 0; i < DynamDate4.Count; i++)
{
this.View.Model.CreateNewEntryRow("F_xc_Entity");
string nodeID = this.View.Model.GetValue("FNodeId", i).ToString();
string name = this.View.Model.GetValue("FName", i).ToString();
string Specification = this.View.Model.GetValue("FSpecification", i).ToString();
string number = this.View.Model.GetValue("FNumber", i) .ToString();
str = nodeID + name + Specification + number;
this.View.ShowMessage(str);
}
}
}
}