如何访问自定义字段,该字段在构造功能包-Acumatica中定义 [英] How to access Custom field,which is defined in Construction feature package- Acumatica

查看:40
本文介绍了如何访问自定义字段,该字段在构造功能包-Acumatica中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过阅读我的问题,您可能会认为这很容易,但是我要求所有人尝试访问构造功能包中定义的自定义字段。

By reading my question, you might think its very easy, but i request everyone to try to access a custom field defined in the construction feature package.

我想要可以访问项目屏幕任务选项卡中的类型字段,详细信息

I want to access "Type" field in Project screen's Task Tab in details

UsrType是在Construction features包中定义的自定义字段。在该程序包中,文件已转换为dll。我尝试像通常在定制中那样访问该字段。

UsrType is a custom field defined in Construction features package. In that package, file has been converted into dll. I tried to access that field like we usually do in customization.

但我遇到错误


找不到类型或命名空间 PMTaskExt

Type or Namespace "PMTaskExt" could not be found

我什至尝试了

我遇到错误


UsrType PMTask中不存在

UsrType Doesn't exist in PMTask

APTran中的UsrSubcontractNbr字段也存在同样的问题。不仅这些字段,还有许多此类字段可供访问。
我们如何访问这些字段?

There is also same problem with UsrSubcontractNbr field in APTran. Not Only these fields, there are many such field to be accessed. How can we access such fields?

推荐答案

通过查看PX.Objects.CN.dll,它将位于 PX.Objects.CN.ProjectAccounting.PM.CacheExtensions 命名空间为 PmTaskExt

From looking at PX.Objects.CN.dll it would be in the PX.Objects.CN.ProjectAccounting.PM.CacheExtensions namespace as PmTaskExt

使用了最新的19R2建设项目 ConstructionFeatures_19_205_4_1_157

Used the latest 19R2 Construction project "ConstructionFeatures_19_205_4_1_157"

反编译了我搜索PMTask的自定义dll(使用了DotPeek):

Decompiled the customization dll (used DotPeek) I searched for PMTask:

复制的文本:

using PX.Data;
using PX.Data.BQL;
using PX.Objects.CN.ProjectAccounting.PM.Descriptor;
using PX.Objects.CS;
using PX.Objects.PM;

namespace PX.Objects.CN.ProjectAccounting.PM.CacheExtensions
{
  public sealed class PmTaskExt : PXCacheExtension<PMTask>
  {
    [PXDBString(30)]
    [PXDefault]
    [PXUIField(DisplayName = "Type", Required = true)]
    [ProjectTaskType.List]
    public string UsrType { get; set; }

    public static bool IsActive()
    {
      return PXAccess.FeatureInstalled<FeaturesSet.construction>();
    }

    public abstract class usrType : BqlType<IBqlString, string>.Field<PmTaskExt.usrType>
    {
    }
  }
}

某事像这样的方法应该起作用:

Something like this should work:

var cnExt = PXCache<PX.Objects.PM.PMTask>.GetExtension<PX.Objects.CN.ProjectAccounting.PM.CacheExtensions.PmTaskExt>((PX.Objects.PM.PMTask)e.Row);

请注意PX.Objects.CN.dll的.Net版本使用4.8,以防引起如果您的解决方案是在相同版本的Acumatica for 19R2(4.7.1)上编译的,则Visual Studio中版本兼容性的任何问题

Do note the .Net version of PX.Objects.CN.dll is using 4.8 in case that causes any issues with version compatibility in visual studio if your solution is compiled on the same version of Acumatica for 19R2 which is 4.7.1

这篇关于如何访问自定义字段,该字段在构造功能包-Acumatica中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆