Acumatica:在 TaxRegistrationID 更改时更新供应商状态

Acumatica: Update Vendor Status when TaxRegistrationID changes

我是 Acumatica 的新手,需要做一些非常简单的事情,但我并不真正理解语法或如何去做。

如果“采购设置”选项卡中的 TaxRegistrationID 发生变化,我想将供应商状态更新为 "Hold"。这看起来很简单,但我只是没有得到正确的步骤。我从这里开始:

public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
{
#region Event Handlers
    protected void LocationExtAddress_TaxRegistrationID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
     {
      cache.SetValue<Vendor.Status>(e.Row, "Hold");  

      }

#endregion
}

我认为这过于简单化了,但不确定它应该是什么。有人可以在这里给我一些指导吗?如果我了解它是如何工作的,我可以独自走很长的路。

你做的很好。你还有一些问题。 1. 在

的 Acumatica 字段状态声明中
[Vendor.status.List]

看起来像这样:

public class ListAttribute : PXStringListAttribute
  {
    public ListAttribute()
      : base(new string[5]{ "A", "H", "P", "I", "T" }, new string[5]
      {
        "Active",
        "On Hold",
        "Hold Payments",
        "Inactive",
        "One-Time"
      })
    {
    }
  }
}

正如您从 On Hold 状态声明中看到的那样,责任键值 "H"。

  1. 其页面声明中的 TaxRegistrationID 字段未将 CommitChanges 设置为 true。如果您想立即做出反应,您需要在自定义中将 CommitChanges 设置为 true。
  2. 您需要更新特定的供应商,而不是更新缓存对象。
  3. 在供应商屏幕上使用的不是 Vendor class,而是 VendorR class

所以更正确的代码版本将如下所示:

     public class VendorMaint_Extension : PXGraphExtension<VendorMaint>
     {
        #region Event Handlers
        protected void LocationExtAddress_TaxRegistrationID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
              Base.BAccount.SetValueExt<VendorR.status>(Base.BAccount.Current, "H"); 

        }

        #endregion
     }