I am developing an extension to Acumatica and one of the things I would like to do is execute Confirm Shipment and Prepare Invoice actions on the Process Shipments screen from code. I also will need to release the invoice.
To simplify the discussion, at a certain point in the code I will have a shipment in the cache and a pointer to the SOShipmentEntry graph:
SOShipment soShipment = soShipmentGraph.Document.Search<SOShipment.shipmentNbr>(shipmentNbr);
Run Code Online (Sandbox Code Playgroud)
我希望能够在不同时间确认发货,准备发票并下达发票。我做了很多挖掘工作,发现了ConfirmShipment方法,但是在尝试调用它时出现错误-装运计数器损坏。我这样称呼它:
SOOrder soOrder = PXSelect<SOOrder, Where<SOOrder.orderNbr,
Equal<Required<SOOrder.orderNbr>>>>.Select(this, orderNbr);
soOrderGraph.Document.Current = …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种解决方案,将注释添加到我在自定义表中创建的数据库行。我从 Ruslan 找到了下面用于访问 noteid 的解决方案,但我不明白如何使用它来向行添加注释。我拥有创建该行的所有代码,我只需要属性或函数调用即可将注释文本实际附加到该行。
=================================================== ===============
要在保存新父记录时自动创建注释记录,应在将父记录插入到缓存中时调用静态 PXNoteAttribute.GetNoteID(PXCache cache, object data) 方法。
例如,要在保存新库存商品时自动创建注释记录,您应该订阅 InventoryItem DAC 的 RowInserted 处理程序并调用 PXNoteAttribute.GetNoteID(...):
public class InventoryItemMaintExt : PXGraphExtension<InventoryItemMaint>
{
public void InventoryItem_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
{
var noteCache = Base.Caches[typeof(Note)];
var oldDirty = noteCache.IsDirty;
PXNoteAttribute.GetNoteID<InventoryItem.noteID>(sender, e.Row);
noteCache.IsDirty = oldDirty;
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码片段可以合并到几乎任何自定义 BLC 中,只需进行一些简单的更改即可用自定义 DAC 替换 InventoryItem。
实施加布里埃尔的建议后:
我似乎没有在数据库中得到任何注释。代码编译并运行良好,但据我所知,注释并未生成。我的表中设置了注释id,但是注释表中没有出现任何数据。请查看我的代码并让我知道需要更改哪些内容。另外,如何将注释列放入网格中,或者正确完成后它是否会自动变得可用?
数据库字段定义:
[NoteID] [uniqueidentifier] NULL
Run Code Online (Sandbox Code Playgroud)
DAC领域:
#region NoteID
public abstract class noteID : PX.Data.IBqlField
{
}
protected Guid? _NoteID;
[PXNote()]
public virtual Guid? NoteID
{ …Run Code Online (Sandbox Code Playgroud) acumatica ×2