如何在acumatica中创建缓存副本?

How to create a copy of Cache in acumatica?

我想知道如何创建整个缓存的副本。我们有一个方法 createCopy() 来创建数据记录的副本,有没有类似的方法?

A​​cumatica 中没有类似 CopyCache() 的方法,但缓存确实提供对当前存储在其中的已修改记录的访问。您可以通过三个属性访问它们:PXCache.InsertedPXCache.UpdatedPXCache.Deleted.

您可以从这些集合中收集记录的本地副本,存储在一些变量中,稍后再次推送到缓存中。

正如@Alex Turok 提到的,

我发现的唯一方法是创建一个 class 来保存所需的记录详细信息,例如记录、扩展名和 PXEntryStatus。在 Persist 之前,我遍历 Cache.Cached 记录并获取记录并保存到自定义 class

的本地列表变量中

参考代码

public class BarcodeRecord
        {
            public INItemXRef record;
            public INItemXRefExt recordExt;
            public PXEntryStatus status;
        }
                List<BarcodeRecord> barcodeRecs = new List<BarcodeRecord>();
                foreach (INItemXRef item in this.Base.itemxrefrecords.Cache.Cached)
                {
                    BarcodeRecord rec = new BarcodeRecord();
                    rec.record = item;
                    rec.recordExt = PXCache<INItemXRef>.GetExtension<INItemXRefExt>(item);
                    rec.status = this.Base.itemxrefrecords.Cache.GetStatus(item);
                    barcodeRecs.Add(rec);
                }

注意:我从一家公司复制信息到另一家公司的任务似乎仍然无效! #WorkingWithAcumatica