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

error CS0426: The type name 'UsrUserRole' does not exist in the type 'PX.Objects.SO.SOOrderType'

我想在 SOOrder 屏幕上设置默认的 OrderType,方法是当前用户以角色中的用户登录。因此,我在选择角色名称的屏幕订单 Type:SO201000 上创建了新字段。例如:用户角色的订单类型:C1:001A 和用户角色的订单类型:C2:001D。

屏幕订单Type: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)] 

默认订单类型(自定义现有字段)

 [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)]

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

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

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