确定一条记录是否已 updated/inserted/deleted

Determine if a record has been updated/inserted/deleted

我有一个名为 APTran 的 DAC。我想确保我在这个 DAC 中的所有记录都已插入。

这是根据相应的 POReceiptLine 未开票数量审核我的 APTran 记录

foreach(APTran apTran in Base.Transactions.Select())
{
   // determine the state of apTran (inserted, Deleted)
}
bool isInserted = cache.GetStatus(apTran) == PXEntryStatus.Inserted;
bool isDeleted = cache.GetStatus(apTran) == PXEntryStatus.Deleted;
bool isInsertedDeleted = cache.GetStatus(apTran) == PXEntryStatus.InsertedDeleted;

InsertedDeleted 是一种特殊情况,其中记录被插入到缓存中,但在它被保存到数据库之前被删除。

我不知道检查记录是否实际插入数据库的官方方法。 我通常做的是检查数据库生成的字段值之一。在插入数据库之前,它们将为空。

bool hasBeenPersisted = apTran.Tstamp != null;