【发布时间】:2020-01-02 19:35:00
【问题描述】:
我有一个自定义 DAC,“BranchPaymentDefault”。其中一个字段是对“帐户”对象的查找。
每当我打开页面或尝试使用选择器选择帐户时,我都会收到一条错误消息,提示“指定的演员无效
我尝试使用 PXSelector 属性而不是 Account 属性,但我得到了同样的错误。
DAC
namespace VendorMasterPaymentDefaults
{
[可序列化] 公共类 BranchPaymentDefault : IBqlTable {
[PXDBInt(IsKey = true)]
[PXDefault()]
[PXUIField(DisplayName = "Branch")]
[Branch()]
public virtual Int32? BranchID { get; set; }
public abstract class branchID : IBqlField { }
[PXDBInt(IsKey = true)]
[PXDefault(typeof(Vendor.bAccountID))]
[PXUIField(DisplayName = "Vendor")]
[PXParent(typeof(Select<Vendor, Where<Vendor.bAccountID, Equal<Current<BranchPaymentDefault.vendorID>>>>))]
public virtual Int32? VendorID { get; set; }
public abstract class vendorID : IBqlField { }
[Account(typeof(Account.accountID), IsKey = false, DisplayName = "Account")]
public virtual int? AccountID { get; set; }
public abstract class accountID : IBqlField { }
[PXDBDecimal]
[PXDefault()]
[PXUIField(DisplayName = "Allotment Amt")]
public virtual decimal? AllotmentAmt { get; set; }
public abstract class allotmentAmt : IBqlField { }
[PXDBString(IsUnicode = true)]
[PXUIField(DisplayName = "Allotment Type")]
[PXDefault(allotmentType.Values.Percentage)]
[PXStringList(new string[]{ allotmentType.Values.Percentage, allotmentType.Values.FixedAmt },
new string[]{ allotmentType.Values.UI.Percentage, allotmentType.Values.UI.FixedAmt })]
public virtual string AllotmentType { get; set; }
public abstract class allotmentType : IBqlField
{
public class Values
{
public const string Percentage = "PCT";
public const string FixedAmt = "FIX";
public class UI
{
public const string Percentage = "Percent";
public const string FixedAmt = "Fixed";
}
}
}
[PXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : IBqlField { }
[PXDBCreatedDateTime]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : IBqlField { }
[PXDBLastModifiedByID]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : IBqlField { }
[PXDBLastModifiedDateTime]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : IBqlField { }
} }
图表
namespace PX.Objects.AP
{
public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
{
public PXSelect<BranchPaymentDefault,
Where<BranchPaymentDefault.vendorID,
Equal<Current<BAccount.bAccountID>>>> BranchPaymentDefaults;
}
}
【问题讨论】:
-
能否将 SQL 表的声明添加到问题中?
-
创建表 [dbo].[BranchPaymentDefault]( [BranchID] [int] NOT NULL, [VendorID] [int] NOT NULL, [AllotmentAmt] [decimal](18, 0) NOT NULL, [AllotmentType] [varchar](3) NOT NULL, [CreatedByID] [uniqueidentifier] NOT NULL, [CreatedDateTime] [smalldatetime] NOT NULL, [LastModifiedByID] [uniqueidentifier] NOT NULL, [LastModifiedDateTime] [smalldatetime] NOT NULL, [AccountID ] [int] 非空)
-
我尝试为帐户 ID 字段使用以下属性.. [PXDefault] [Account( null, typeof(Search
>>> ), DisplayName = "Account", DescriptionField = typeof(Account.description), Visibility = PXUIVisibility.SelectorVisible)] [PXRestrictor(typeof(Where >), PX.Objects.GL。 Messages.YTDNetIncomeMayBeLiability)] 公共虚拟 Int32? AccountID{ 得到;放; } 公共抽象类 accountID:PX.Data.BQL.BqlInt.Field { } -
通常“Specified cast is not valid”错误表示你在Selector/Field Declaration/Database中为字段指定了不同的数据类型。尝试完全删除选择器并使用原始字段。如果可行,那么我们需要了解选择器的确切问题,否则,DAC 或数据库表中存在问题。
-
我删除了 [Account] 属性,但仍然出现错误。 AccountID 的 DB 类型是 INT,我在 DAC 中使用的是 Int32。