如何在 ARInvoiceEntry 图形覆盖中访问 ShippingAddress PostalCode

How to access ShippingAddress PostalCode in ARInvoiceEntry graph override

我正在扩展 ARInvoiceEntry 图并为 RowPersisting 添加偶数处理程序,但我在发票中看到的唯一数据是 ShipAddressID:

namespace PX.Objects.AR
{
  public class ARInvoiceEntry_Extension : PXGraphExtension<ARInvoiceEntry>
  {
    protected void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting InvokeBaseHandler)
    {
      var row = (ARInvoice)e.Row;
      if (row != null)
      {
        // ???
      }
    }
  }
}

我需要使用那个 ShipAddressID 和 运行 查询吗?如果地址是覆盖,查询将不起作用。

您需要 select 来自基础图表 Shipping_Address 数据视图的当前 ARShippingAddress 记录。

public void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
  ARInvoice invoice = e.Row as ARInvoice;
  ARShippingAddress shipAddress = Base.Shipping_Address.Select();

  if (invoice != null && shipAddress != null)
  {
    throw new PXException("Address Line 1: " + shipAddress.AddressLine1 + Environment.NewLine +
                          "Address Line 2: " + shipAddress.AddressLine2 + Environment.NewLine +
                          "Address Line 3: " + shipAddress.AddressLine3 + Environment.NewLine);
  }
}