【问题标题】:Displaying field from another screen从另一个屏幕显示字段
【发布时间】:2021-12-12 08:00:12
【问题描述】:

我在 销售订单 屏幕和 在发票中添加 SO 行对话框 屏幕中分别创建了一个自定义字段,以显示 Tariff Code in Stock 的值项目屏幕。我设法使用下面的代码显示它们:

public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
    #region UsrTariffCode
    [PXDBString(30)]
    [PXUIField(DisplayName = "Tariff Code", Enabled = false)]
    [PXFormula(typeof(Selector<SOLine.inventoryID,InventoryItem.hSTariffCode>))]
    public virtual string UsrTariffCode { get; set; }
    public abstract class usrTariffCode : PX.Data.BQL.BqlString.Field<usrTariffCode> { }
    #endregion
}
    public class SOLineForDirectInvoiceExt : PXCacheExtension<PX.Objects.SO.DAC.Projections.SOLineForDirectInvoice>
{
    #region UsrTariffCode
    [PXDBString(50, BqlField = typeof(SOLineExt.usrTariffCode))]
    [PXUIField(DisplayName = "Tariff Code", Enabled = false)]
    public virtual string UsrTariffCode { get; set; }
    public abstract class usrTariffCode : PX.Data.BQL.BqlString.Field<usrTariffCode> { }
    #endregion
}

是否有通过 FieldUpdatedFieldDefaulting 方法执行此操作的替代方法?

我尝试在 SOLineExt 类中插入以下代码,但未能获得所需的结果。

    protected void _(Events.FieldUpdated<SOLine, SOLine.inventoryID> e)
    {
        SOLine row = e.Row;
        if (row.InventoryID != null)
        {
            InventoryItem item = PXSelectorAttribute.Select<SOLine.inventoryID>(e.Cache, row) as InventoryItem;
            e.Cache.SetValueExt<SOLineExt.usrTariffCode>(row, item.HSTariffCode);
        }
    }

【问题讨论】:

    标签: c# acumatica


    【解决方案1】:

    您可以使用 FeildSelecting 事件作为以编程方式获取和设置所需值的替代方法。

     void ARDocumentResult_YourFeild_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
        {
    
            var returnValue = PerformLogicToGetValue();
            e.ReturnValue = returnValue;
        }
    
        private string PerformLogicToGetValue()
        {
           //do processing to get what you need...
           return "your desired value";
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 2022-12-07
      • 1970-01-01
      • 1970-01-01
      • 2019-06-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多