【问题标题】:Acumatica: Update Vendor Status when TaxRegistrationID changesAcumatica:TaxRegistrationID 更改时更新供应商状态
【发布时间】:2019-07-06 00:01:42
【问题描述】:

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

如果“购买设置”选项卡中的 TaxRegistrationID 发生更改,我想将供应商状态更新为“保留”。这似乎很简单,但我只是没有得到正确的步骤。我从这里开始:

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
}

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

【问题讨论】:

    标签: c# customization acumatica


    【解决方案1】:

    你做得很好。你还有几个问题。 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"
          })
        {
        }
      }
    }
    

    正如您从“暂停状态”声明中看到的那样,负责键值“H”。

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

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

         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
         }
    

    【讨论】:

    • 谢谢 Yuriy,我尝试了一些变化,但实际上没有任何效果。 SetValue 未将供应商状态值设置为 Hold 或“H”。是否需要将供应商状态设置为保留的其他步骤?
    • 我找到了你的博客和答案。这行得通……谢谢!:Base.BAccount.SetValueExt(Base.BAccount.Current, "H");
    • 哦,是的,这是另一种方法。您能否判断更新后的答案是否反映了您从我的博客中所做的更改,如果是,您能否将我的答案标记为已接受?
    猜你喜欢
    • 2016-06-25
    • 1970-01-01
    • 1970-01-01
    • 2018-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 2020-01-28
    相关资源
    最近更新 更多