DynamicObject FAuxPropId = this.View.Model.GetValue("FAuxPropId", 0) as DynamicObject;
//定义DynamicObject数据类型,这个是关键
//每个辅助属性都有两个字段来保存,一个是F100001,就是F加上该辅助属性内码,另一个是F100001_Id,用于保存该辅助属性对应的辅助资料的Id
DynamicObjectType auxType = new DynamicObjectType("myAuxType");
DynamicProperty FNumber = auxType.RegisterSimpleProperty("FNumber", typeof(string), string.Empty);
DynamicProperty FDataValue = auxType.RegisterSimpleProperty("FDataValue", typeof(string), string.Empty);
DynamicProperty Id = auxType.RegisterSimpleProperty("Id", typeof(string), string.Empty);
//查询需要的辅助资料
string sql = @"select b.FNUMBER FNumber ,b.FENTRYID,a.FNUMBER,c.FDATAVALUE
from T_BAS_ASSISTANTDATA a
inner join T_BAS_ASSISTANTDATAENTRY b on a.FID = b.FID
left join T_BAS_ASSISTANTDATAENTRY_L c on b.FENTRYID = c.FENTRYID
where a.FNUMBER = 'BAOZHUANG' and b.FENTRYID = '5ffc0fd980b75a'";
DynamicObjectCollection datas = DBUtils.ExecuteDynamicObject(this.Context, sql);
DynamicObject t = new DynamicObject(auxType);
t["FNumber"] = datas[0]["FNumber"].ToString();
t["FDataValue"] = datas[0]["FDATAVALUE"].ToString();
t["Id"] = datas[0]["FENTRYID"].ToString();
FAuxPropId["F100001"] = t;
FAuxPropId["F100001_Id"] = datas[0]["FENTRYID"].ToString();
this.Model.SetValue("FAUXPROPID", FAuxPropId, 0);
本文转载自:云星空社区
作者:云社区用户n7090215
原文链接:https://vip.kingdee.com/article/79477605124002048?productLineId=1
推荐阅读