Acumatica扩展PMProjectStatusEx [英] Acumatica Extending PMProjectStatusEx

查看:50
本文介绍了Acumatica扩展PMProjectStatusEx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在acumatica的项目预算屏幕上工作,该屏幕使用表PMProjectStatusEx,它是PMProjectStatus的Projection表。因此,我扩展了PMProjectStatus表并在其中添加了一个字段,还扩展了PMProjectStatusEx以添加相同的字段并将其添加到屏幕上。但是与更新物理表PMProjectStatus的标准字段不同,我添加的字段不会更新物理表。这可能是什么原因?下面是我的代码

I am working on the Project Budget Screen of acumatica, the screen uses the table PMProjectStatusEx which is a Projection table of PMProjectStatus. So I extended the PMProjectStatus table and added a field in there, I also extended the PMProjectStatusEx to add the same field and added it to the screen. But unlike the standard fields that updates the physical table PMProjectStatus my added field does not update the physical table. What could be the reason for this? Below is my code

谢谢

public class PMProjectStatusExt : 
PXCacheExtension<PX.Objects.PM.PMProjectStatus>
{
  #region UsrMarkupPct
  public abstract class usrMarkupPct : PX.Data.IBqlField
  {
  }
  protected Decimal? _UsrMarkupPct;
  [PXDBDecimal(6, MinValue = 0, MaxValue = 1000)]
  //[PXDefault(TypeCode.Decimal, "0.0")]
  [PXUIField(DisplayName = "Markup %")]
  public virtual Decimal? UsrMarkupPct
  {
      get
      {
          return this._UsrMarkupPct;
      }
      set
      {
          this._UsrMarkupPct = value;
      }
  }
  #endregion


public class PMProjectStatusExExt : 
PXCacheExtension<PX.Objects.PM.PMProjectStatusEx>
  {
      #region UsrMarkupPct
      public abstract class usrMarkupPct : PX.Data.IBqlField
      {
      }
      protected Decimal? _UsrMarkupPct;
      [PXDBDecimal(6, MinValue = 0, MaxValue = 1000, BqlField = typeof(PMProjectStatusExt.usrMarkupPct))]
      [PXDefault(TypeCode.Decimal, "0.0")]
      [PXUIField(DisplayName = "Markup %")]
      public virtual Decimal? UsrMarkupPct
      {
          get
          {
              return this._UsrMarkupPct;
          }
          set
          {
              this._UsrMarkupPct = value;
          }
      }
      #endregion


推荐答案

使用项目编辑器的数据访问部分添加字段时,它将生成DB脚本来更新后台的表:

When you add fields using the DATA ACCESS section of the Project Editor it will generate DB Scripts to update the table behind the scene:

在代码部分中使用DAC扩展名添加字段时,它将不会生成数据库脚本。

When you add fields using a DAC extension in CODE section, it will not generate the DB Scripts.

在这种情况下,您需要在数据库脚本部分中手动添加脚本。

In that case you need to manually add the scripts in DB Scripts section.

编辑

在DB脚本中手动添加数据库字段的一种方法是:

One way to manually add DB field in DB Scripts is:

IF NOT EXISTS(SELECT * FROM Sys.Columns WHERE Name = N'UsrMarkupPct' and 
              Object_ID = Object_ID(N'PMProjectStatus'))
BEGIN
    ALTER TABLE PMProjectStatus ADD UsrMarkupPct DECIMAL(19,6)
END
GO

这篇关于Acumatica扩展PMProjectStatusEx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆