///
/// 赋值维度字段,公用
///
/// 页面View类
/// 目标单据体Key
/// 来源rowKey
/// 目标字段
/// 来源单行号
/// 目标赋值行号
public static void SetFlexValue(IBillView View, string EntityKey, string srcValue, string destFiled, int srcRow, int destRow)
{
//获取目标字段
Field destStockField = View.BusinessInfo.GetField(destFiled);
if (srcRow == -1)
{
View.Model.SetValue(destStockField.Key, null, destRow);
return;
}
DynamicObject value = (DynamicObject)ObjectUtils.CreateCopy(
View.Model.GetValue(srcValue, srcRow) as DynamicObject);
RelatedFlexGroupField flexField = (RelatedFlexGroupField)destStockField;
//获取单据体
Entity entity = View.Model.BusinessInfo.GetEntity(EntityKey);
DynamicObject dycol = View.Model.GetEntityDataObject(entity, destRow);
DynamicObject cloneFlexObj = (DynamicObject)ObjectUtils.CreateCopy(value);
flexField.DynamicProperty.SetValue(dycol, cloneFlexObj);
//更新字段
View.UpdateView(flexField.Key, destRow);
}
推荐阅读