首页 文章

自定义字段值始终在准备补货中返回null

提问于
浏览
1

我在Prepare Replenishment中添加了一个自定义下拉字段,它始终返回null并且不保持所选值

enter image description here

以下是DAC扩展代码

public class INReplenishmentFilterExt : PXCacheExtension<PX.Objects.IN.INReplenishmentFilter>
  {
    #region UsrMonthSelection
    [PXString(1)]
    [PXUIField(DisplayName="Months")]
    [PXStringList(new[] { "1", "2", "3", "4", "5", "6" },
                    new[] { "One", "Two", "Three", "Four", "Five", "Six" })]
    public virtual string UsrMonthSelection { get; set; }
    public abstract class usrMonthSelection : IBqlField { }
    #endregion
  }

由于某种原因,它甚至没有触发现场更新事件

流动是字段属性集字段

enter image description here

Update 1

protected void INReplenishmentFilter_UsrMonthSelection_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
    {
        var row = (INReplenishmentFilter)e.Row;
        INReplenishmentFilterExt extn = cache.GetExtension<INReplenishmentFilterExt>(row);
        string sOption = extn.UsrMonthSelection;
        monthsel = Convert.ToInt32(sOption);
    }

我已经完成了源代码,使用DB Columns声明了INReplenishmentFilter表,但数据库中没有物理表 .

我已经将我的扩展字段更改为DB Field,但我仍面临同样的问题

Update 2

protected void INReplenishmentItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
    if (InvokeBaseHandler != null)
        InvokeBaseHandler(cache, e);
    var row = (INReplenishmentItem)e.Row;
    if (row == null) return;

    INReplenishmentFilterExt extn = PXCache<INReplenishmentFilter>.GetExtension<INReplenishmentFilterExt>(Base.Filter.Current);
    //extn.UsrMonthSelection - This value return null value customfield is selected after populating the replinishment grid.
    /monthsel - This value always 0
    monthsel = Convert.ToInt32(extn.UsrMonthSelection);
    PXUIFieldAttribute.SetVisible<INReplenishmentExtn.usrSoQtyMonthOne>(cache, null, monthsel > 0);
    PXUIFieldAttribute.SetVisible<INReplenishmentExtn.usrSoQtyMonthTwo>(cache, null, monthsel > 1);
    PXUIFieldAttribute.SetVisible<INReplenishmentExtn.usrSoQtyMonthThree>(cache, null, monthsel > 2);
    PXUIFieldAttribute.SetVisible<INReplenishmentExtn.usrSoQtyMonthFour>(cache, null, monthsel > 3);
    PXUIFieldAttribute.SetVisible<INReplenishmentExtn.usrSoQtyMonthFive>(cache, null, monthsel > 4);
    PXUIFieldAttribute.SetVisible<INReplenishmentExtn.usrSoQtyMonthSix>(cache, null, monthsel > 5);
}

1 回答

  • 0

    您的字段被声明为非持久(未绑定):

    [PXString(1)]
    

    发生的情况是字段值在内存中正确保存,但是当文档失效时,它无法从数据库中恢复该值,因为它首先没有保留在那里 .

    将其更改为绑定字段(PXDB而不是PX)并确保数据库表中存在相应的列应解决您的问题 .

    [PXDBString(1, IsFixed=true)]
    

    EDIT: 看看你的问题编辑,DAC你在这个上下文中理解你的问题,截图中的字段显然不是空的,因为你说它没有你可以检查它的值的情况,缺少一些东西 .

相关问题