我有一张小桌子,只允许我输入一行。每当我尝试添加另一行时,我都会收到一条错误,指出另一个进程更改了数据。我已经做了很多其他更多涉及的自定义,但我只是想不出这个。那里的人有什么想法吗?
非常感谢!
这是DAC:
namespace EDIASNs
{
using System;
using PX.Data;
using PX.Objects.GL;
[System.SerializableAttribute()]
public class EDCompanyData : PX.Data.IBqlTable
{
#region BranchID
public abstract class branchID : PX.Data.IBqlField
{
}
protected int? _BranchID;
[Branch()]
public virtual int? BranchID { get; set; }
#endregion
#region Active
public abstract class active : PX.Data.IBqlField
{
}
protected bool? _Active;
[PXDBBool()]
[PXUIField(DisplayName = "Active")]
[PXDefault(true)]
public virtual bool? Active { get; set; }
#endregion
#region Url
public abstract class url : PX.Data.IBqlField
{
}
protected string _Url;
[PXDBString(100, IsUnicode = true)]
[PXUIField(DisplayName = "Url")]
public virtual string Url { get; set; }
#endregion
#region Service
public abstract class service : PX.Data.IBqlField
{
}
protected string _Service;
[PXDBString(100, IsUnicode = true)]
[PXUIField(DisplayName = "Service Name")]
public virtual string Service { get; set; }
#endregion
#region EDIAccount
public abstract class eDIAccount : PX.Data.IBqlField
{
}
protected string _EDIAccount;
[PXDBString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Account")]
public virtual string EDIAccount { get; set; }
#endregion
#region EDILoginName
public abstract class eDILoginName : PX.Data.IBqlField
{
}
protected string _EDILoginName;
[PXDBString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Login Name")]
public virtual string EDILoginName { get; set; }
#endregion
#region EDIPassword
public abstract class eDIPassword : PX.Data.IBqlField
{
}
protected string _EDIPassword;
[PXDBString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Password")]
public virtual string EDIPassword { get; set; }
#endregion
#region EDIApiKey
public abstract class eDIApiKey : PX.Data.IBqlField
{
}
protected string _EDIApiKey;
[PXDBString(30, IsUnicode = true)]
[PXUIField(DisplayName = "Api Key")]
public virtual string EDIApiKey { get; set; }
#endregion
#region AutoReleaseInvoices
public abstract class autoReleaseInvoices : PX.Data.IBqlField
{
}
protected bool? _AutoReleaseInvoices;
[PXDBBool()]
[PXUIField(DisplayName = "Auto Release Invoices")]
[PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)]
public virtual bool? AutoReleaseInvoices { get; set; }
#endregion
#region NoteID
public abstract class noteID : PX.Data.IBqlField
{
}
protected Guid? _NoteID;
[PXDBField()]
[PXUIField(DisplayName = "NoteID")]
public virtual Guid? NoteID { get; set; }
#endregion
#region ProjectID
public abstract class projectID : PX.Data.IBqlField
{
}
protected int? _ProjectID;
[PXDBInt()]
[PXUIField(DisplayName = "ProjectID")]
public virtual int? ProjectID { get; set; }
#endregion
#region CreatedByID
public abstract class createdByID : PX.Data.IBqlField
{
}
protected Guid? _CreatedByID;
[PXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
#endregion
#region CreatedByScreenID
public abstract class createdByScreenID : PX.Data.IBqlField
{
}
protected string _CreatedByScreenID;
[PXDBCreatedByScreenID()]
public virtual string CreatedByScreenID { get; set; }
#endregion
#region CreatedDateTime
public abstract class createdDateTime : PX.Data.IBqlField
{
}
protected DateTime? _CreatedDateTime;
[PXDBCreatedDateTime()]
public virtual DateTime? CreatedDateTime { get; set; }
#endregion
#region LastModifiedByID
public abstract class lastModifiedByID : PX.Data.IBqlField
{
}
protected Guid? _LastModifiedByID;
[PXDBLastModifiedByID()]
public virtual Guid? LastModifiedByID { get; set; }
#endregion
#region LastModifiedByScreenID
public abstract class lastModifiedByScreenID : PX.Data.IBqlField
{
}
protected string _LastModifiedByScreenID;
[PXDBLastModifiedByScreenID()]
public virtual string LastModifiedByScreenID { get; set; }
#endregion
#region LastModifiedDateTime
public abstract class lastModifiedDateTime : PX.Data.IBqlField
{
}
protected DateTime? _LastModifiedDateTime;
[PXDBLastModifiedDateTime()]
public virtual DateTime? LastModifiedDateTime { get; set; }
#endregion
#region tstamp
public abstract class Tstamp : PX.Data.IBqlField
{
}
protected byte[] _tstamp;
[PXDBTimestamp()]
public virtual byte[] tstamp { get; set; }
#endregion
}
}
这是图表:
using System;
using System.Collections;
using System.Collections.Generic;
using PX.SM;
using PX.Data;
namespace EDIASNs
{
public class EDCompanyMaint : PXGraph<EDCompanyMaint, EDCompanyData>
{
public PXSelect<EDCompanyData> EDCompany;
}
}
这是SQL Server表:
CREATE TABLE [dbo].[EDCompanyData](
[CompanyID] [int] NOT NULL,
[BranchID] [int] NOT NULL,
[Service] [nvarchar](100) NULL,
[Active] [bit] NULL,
[Url] [nvarchar](100) NULL,
[EDIAccount] [nvarchar](30) NULL,
[EDILoginName] [nvarchar](30) NULL,
[EDIPassword] [nvarchar](30) NULL,
[EDIApiKey] [nvarchar](30) NULL,
[AutoReleaseInvoices] [bit] NULL,
[NoteID] [uniqueidentifier] NULL,
[ProjectID] [int] NULL,
[CreatedByID] [uniqueidentifier] NOT NULL,
[CreatedByScreenID] [char](8) NOT NULL,
[CreatedDateTime] [datetime] NOT NULL,
[LastModifiedByID] [uniqueidentifier] NOT NULL,
[LastModifiedByScreenID] [char](8) NOT NULL,
[LastModifiedDateTime] [datetime] NOT NULL,
[tstamp] [timestamp] NOT NULL,
CONSTRAINT [EDCompanyData_PK] PRIMARY KEY CLUSTERED
(
[CompanyID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
答案 0 :(得分:1)
您获得的错误很可能是由数据库级别的主键约束违规引起的。因为您从具有2个泛型类型参数的PXGraph类继承而来,这些参数具有预先定义的一系列操作,所以PXDataSource总是尝试在EDCompanyData中插入新行,而不是更新数据库中唯一的现有记录。我建议只使用1个泛型类型参数继承PXGraph类,并仅定义“保存”和“取消”操作:
public class EDCompanyMaint : PXGraph<EDCompanyMaint, EDCompanyData>
{
public PXSave<EDCompanyData> Save;
public PXCancel<EDCompanyData> Cancel;
public PXSelect<EDCompanyData> EDCompany;
}