InventoryLines 的 PXCacheExtension,以便 PXprojection 工作

问题描述 投票:0回答:1

我为 Portal DAC InventoryLines 创建了一个扩展,它使用 PXProjection 进行填充。

添加所需字段后,新字段不想填充。

我做错了什么?

namespace SP.Objects.IN
{
    // Copied over from InventoryLines
    [Serializable]
    [PXProjection(typeof(
        Select2<InventoryItem,
            InnerJoin<PortalSetup,
                On<PortalSetup.IsCurrentPortal>,
            InnerJoin<Branch, On<PortalSetup.sellingBranchID, Equal<Branch.branchID>>,
            LeftJoin<InventoryItemCurySettings, On2<InventoryItemCurySettings.FK.Inventory,
                And<InventoryItemCurySettings.curyID, Equal<Branch.baseCuryID>>>,
            LeftJoin<INUnit,
                On<INUnit.inventoryID, Equal<InventoryItem.inventoryID>,
                And<INUnit.fromUnit, Equal<InventoryItem.salesUnit>,
                And<INUnit.toUnit, Equal<InventoryItem.baseUnit>>>>,
            LeftJoin<InventoryAvailability,
                On<InventoryItem.inventoryID, Equal<InventoryAvailability.inventoryID>>>>>>>,
        Where<InventoryItem.itemStatus, In3<InventoryItemStatus.active, InventoryItemStatus.noPurchases, InventoryItemStatus.noRequest>,
            And2<Exists<Select<INItemCategory, Where<INItemCategory.inventoryID, Equal<InventoryItem.inventoryID>>>>,
            And<Where<CurrentMatch<InventoryItem, AccessInfo.userName>>>>>
            >), Persistent = false)]

    public class InventoryLinesExt : PXCacheExtension<InventoryLines>
    {
        #region StkItem
        [PXDBBool]
        [PXDefault(true)]
        [PXUIField(DisplayName = "Stock Item")]
        public virtual Boolean? StkItem { get; set; }
        public abstract class stkItem : BqlBool.Field<stkItem> { }
        #endregion

        #region ItemClassID
        [PXDBInt]
        [PXUIField(DisplayName = "Item Class", Visibility = PXUIVisibility.SelectorVisible)]
        [PXDimensionSelector(INItemClass.Dimension, typeof(Search<INItemClass.itemClassID>), typeof(INItemClass.itemClassCD), DescriptionField = typeof(INItemClass.descr), CacheGlobal = true)]
        [PXDefault(typeof(
            Search2<INItemClass.itemClassID, InnerJoin<INSetup,
                On<stkItem.FromCurrent.IsEqual<False>.And<INSetup.dfltNonStkItemClassID.IsEqual<INItemClass.itemClassID>>.
                Or<stkItem.FromCurrent.IsEqual<True>.And<INSetup.dfltStkItemClassID.IsEqual<INItemClass.itemClassID>>>>>>))]
        [PXUIRequired(typeof(INItemClass.stkItem))]
        public virtual int? ItemClassID { get; set; }
        public abstract class itemClassID : BqlInt.Field<itemClassID> { }
        #endregion
    }
}

acumatica
1个回答
0
投票

您忘记将新的投影字段映射到真实的 InventoryItem 字段。

库存商品字段:

[PXDBBool(BqlField = typeof(InventoryItem.stkItem))]

ItemClassID 字段:

[PXDBInt(BqlField = typeof(InventoryItem.itemClassID))]

这是一篇关于 PXProjection 的非常好的文章:Understanding Acumatica’s PXProjection Attribute

© www.soinside.com 2019 - 2024. All rights reserved.