常见问题.选单报错 OrmLocaleValue 转换到 Int64 失败原创
103次浏览
编辑于2024年02月19日 08:04:52
【问题演示和修正的代码处理逻辑】
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Kingdee.BOS.Core.Bill.PlugIn;using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;namespace DynamicFormPlugIn.Test{ [Kingdee.BOS.Util.HotUpdate] public class TestFormPlugIn_DrawError : AbstractBillPlugIn { public override void BarItemClick(BarItemClickEventArgs e) { if (string.Equals(e.BarItemKey, "tb_SelectBaseError", StringComparison.OrdinalIgnoreCase)) { ResetBaseDataError(); } else if(string.Equals(e.BarItemKey, "tb_SelectBaseTrue", StringComparison.OrdinalIgnoreCase)) { ResetBaseDataTrue(); } } public string fieldKey = "F_BHR_Base_qtr"; public object pkId = 135705; /// <summary> /// 异常的基础资料数据包赋值 /// </summary> public void ResetBaseDataError() { var billDataObj = this.Model.DataObject; var field = this.View.BillBusinessInfo.GetField(fieldKey) as Kingdee.BOS.Core.Metadata.FieldElement.BaseDataField; View.Model.SetValue(fieldKey, null); //获取全量元数据的数据包 var baseDataFormMeta = Kingdee.BOS.ServiceHelper.MetaDataServiceHelper.Load(this.Context, "BD_Stock") as Kingdee.BOS.Core.Metadata.FormMetadata; var baseDataObj = GetBaseData(pkId, baseDataFormMeta.BusinessInfo.GetDynamicObjectType()); //使用全量的基础资料数据包给基础资料赋值 View.Model.SetValue(fieldKey, baseDataObj); View.UpdateView(fieldKey); } /// <summary> /// 正确的基础资料数据包赋值 /// </summary> public void ResetBaseDataTrue() { var billDataObj = this.Model.DataObject; var field = this.View.BillBusinessInfo.GetField(fieldKey) as Kingdee.BOS.Core.Metadata.FieldElement.BaseDataField; View.Model.SetValue(fieldKey, null); //获取字段匹配的引用片段数据包 var baseDataObj = GetBaseData(pkId, field.RefFormDynamicObjectType); //使用全量的基础资料数据包给基础资料赋值 View.Model.SetValue(fieldKey, baseDataObj); View.UpdateView(fieldKey); } public Kingdee.BOS.Orm.DataEntity.DynamicObject GetBaseData(object pkId, Kingdee.BOS.Orm.Metadata.DataEntity.DynamicObjectType objType) { var baseDataObj = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(this.Context, pkId, objType); return baseDataObj; } } }
赞 0
0人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读