错误CS0426:“PX.Objects.SO.SOOrderType”类型中不存在类型名称“UsrUserRole”

时间:2016-07-14 12:32:10

标签: customization acumatica

我想通过当前用户登录角色中的用户在SOOrder屏幕上设置默认OrderType。所以我在屏幕上创建了新的字段Order Type:SO201000,用于选择角色名称。例如:OrderType:C1表示userRole:001A,OrderType:C2表示userRole:001D。

屏幕上的OrderType:SO201000和UsrUserRole(新字段)

 [PXDBString(64)]
 [PXDefault()]
 [PXSelector(typeof(Search2<PX.SM.Roles.rolename>))]
 [PXUIField(DisplayName="User Role", Visibility = PXUIVisibility.SelectorVisible)]

屏幕SOOrder:OrderType(自定义现有字段)

 [PXDefault(typeof(Search2<SOOrderType.orderType,InnerJoin<PX.SM.UsersInRoles, On<PX.SM.UsersInRoles.rolename, Equal<SOOrderType.UsrUserRole>>>,Where<PX.SM.UsersInRoles.username, Equal<Current<AccessInfo.userName>>>>), PersistingCheck = PXPersistingCheck.Nothing)] 

默认OrderType(自定义现有字段)

 [PXSelector(typeof(Search5<SOOrderType.orderType,InnerJoin<SOOrderTypeOperation, On<SOOrderTypeOperation.orderType, Equal<SOOrderType.orderType>, And<SOOrderTypeOperation.operation, Equal<SOOrderType.defaultOperation>>>,LeftJoin<SOSetupApproval, On<SOOrderType.orderType, Equal<SOSetupApproval.orderType>>>>,Aggregate<GroupBy<SOOrderType.orderType>>>),DescriptionField = typeof(SOOrderTypeT.descr))]   [PXRestrictor(typeof(Where<SOOrderTypeOperation.iNDocType,NotEqual<INTranType.transfer>, Or<FeatureInstalled<FeaturesSet.warehouse>>>), ErrorMessages.ElementDoesntExist, typeof(SOOrderType.orderType))]
 [PXRestrictor(typeof(Where<SOOrderType.requireAllocation, NotEqual<True>, Or<AllocationAllowed>>), ErrorMessages.ElementDoesntExist, typeof(SOOrderType.orderType))]
 [PXRestrictor(typeof(Where<SOOrderType.active,Equal<True>>), null)]

1 个答案:

答案 0 :(得分:0)

当您编写搜索时,您正在编写搜索以获取所需的字段。在这种情况下,您需要SOOrderType.orderType的值。

如果您确定在PXDefault属性中搜索是正确的,可能需要检查Acumatica屏幕的逻辑如何分配值。可能有一些逻辑会覆盖你的价值。

UsrUserRole是SOOrderType的扩展吗?如果那时你应该使用它像YourExtension.UsrUserRole而不是SOOrderType.UsrUserRole