无法找到(是否缺少 using 指令或程序集引用?)

Could not be found (are you missing a using directive or an assembly reference?)

我刚刚在 SOOrder 屏幕上创建了新字段,并想将当前用户登录的默认值 userRole 带入该文本框,但上面出现错误。这是我的编码:

 //Layout Editor: SO301000 (Sales Orders)
 [PXDBString(64)]
 [PXDefault(typeof(Coalesce<Search<UsersInRoles.userName,  Where<UsersInRoles.userName, Equal<Current<AccessInfo.userName>>>>, 
        Search<BAccount.ownerID, Where<BAccount.bAccountID, Equal<Current<SOOrder.customerID>>>>>), 
        PersistingCheck = PXPersistingCheck.Nothing)]
 [PXUIField(DisplayName="Current User" , Enabled = false)]

 error: Cannot implicitly convert type 'PX.Data.PXResultset' to 'PX.SM.UsersInRoles' in file: Code#SOOrderEntry(80)
 error: 'PX.Data.PXRowSelectingEventArgs' does not contain a definition for 'NewValue' and no extension method 'NewValue' accepting a first argument of type 'PX.Data.PXRowSelectingEventArgs' could be found (are you missing a using directive or an assembly reference?) in file: Code#SOOrderEntry(83)

请帮忙!!!

UsersUsersInRoles DAC 位于 PX.SM 命名空间中。 您应该每次都使用 using PX.SM; 或为这些 类 指定命名空间,例如 PX.SM.UsersInRoles.username

P.S。在您的示例中,某些字母的大小写不正确:

UsersInRoles.userName -> UsersInRoles.username

Users.userName -> Users.username

Users.PKID -> Users.pKID