首页 文章

Acumatica . 使用sender.SetValueExt进行自定义

提问于
浏览
1

Acumatica

我正在尝试在Acumatica ERP中的装运屏幕上创建自定义 .

当我们选择订单号时,我创建了额外的自定义来将OpenOrderQty复制到Shipped Qty .

在这里我的编码:

public void SOShipLine_RowInserting(PXCache sender, PXRowInsertingEventArgs e, PXRowInserting baseMethod)
  {
      if (baseMethod != null)
          baseMethod(sender, e);

      SOShipLine line = e.Row as SOShipLine;

      if (line == null) return; // just in case

      if (line.ShippedQty == 0)
      {

        sender.SetValueExt<SOShipLine.ShippedQty>(line, line.OpenOrderQty);

      }
  }

但是,当我发布自定义时,会出现错误:

\ App_RuntimeCode \ SOShipmentEntry.cs(85):错误CS0118:'PX.Objects.SO.SOShipLine.ShippedQty'是'属性',但用作'类型'

sender.SetValueExt有问题吗?

Thansk .

1 回答

  • 0

    您可以使用' s hippedQty ' variable instead of ' S hippedQty'来修复该错误 . 注意第一个字母是不同的情况,小写与大写 .

    大写变量是C#属性,用于获取值或设置字段值时使用:

    line.ShippedQty = 1M;
    var myQuantity = line.ShippedQty;
    

    将字段称为类型时,将使用小写变量 . 当您提供SetValueExt的泛型类型(T)时,您没有设置或获取T的值 . 您告诉SetValueExt它应该使用该类型来设置line.ShippedQty字段的值:

    SetValueExt<SOShipLine.shippedQty>
    

    当期望一个类型(lowercaste)时,它通常被称为visual studio intellisense中的Field参数:
    enter image description here

相关问题