Обновление полей расширения линии SO при вводе инвентарного идентификатора (фиксация) - PullRequest
0 голосов
/ 09 апреля 2020

Я создаю расширение DA C для POVendorInventory и SOLine, чтобы отображать мои новые поля инвентаризации поставщика ПО в деталях документа SO. Я должен отобразить поля со следующим кодом, но не могу обновить поля при вводе поля ID инвентаря.

ExtensionSOLine.cs

using PX.Data;
using PX.Data.BQL;
using PX.Objects.IN;
using PX.Objects.PO;
using PX.Objects.SO;


namespace PX.KWW.PreferredVendorFields.DAC
{
    public class ExtensionSOLine : PXCacheExtension<SOLine>
    {
        #region UsrPreferredVendorID
        public abstract class usrPreferredVendorID : BqlInt.Field<usrPreferredVendorID> { }

        [PXInt()]
        [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItem.preferredVendorID>))]
        public virtual int? UsrPreferredVendorID { get; set; }
        #endregion

        #region UsrPreferredVendorLocationID
        public abstract class usrPreferredVendorLocationID : BqlInt.Field<usrPreferredVendorLocationID> { }

        [PXInt()]
        [PXFormula(typeof(Selector<SOLine.inventoryID, InventoryItem.preferredVendorLocationID>))]
        public virtual int? UsrPreferredVendorLocationID { get; set; }
        #endregion

        #region UsrVendorTotalQty
        public abstract class usrVendorTotalQty : BqlInt.Field<usrVendorTotalQty> { }

        [PXInt]
        [PXUIField(DisplayName = "Total Vendor Qty", Enabled = false, IsReadOnly = true)]
        [PXDBScalar(typeof(Search2<ExtensionPOVendorInventory.usrVendorTotalQty,
                           InnerJoin<InventoryItem,
                               On<InventoryItem.inventoryID, Equal<SOLine.inventoryID>>>,
                           Where<POVendorInventory.inventoryID, Equal<SOLine.inventoryID>,
                               And<POVendorInventory.vendorID, Equal<ExtensionSOLine.usrPreferredVendorID>,
                               And<POVendorInventory.vendorLocationID, Equal<ExtensionSOLine.usrPreferredVendorLocationID>>>>>))]
        public virtual int? UsrVendorTotalQty { get; set; }
        #endregion

        #region UsrNearestWhsQty
        public abstract class usrVendorNearestWhsQty : BqlInt.Field<usrVendorNearestWhsQty> { }

        [PXInt]
        [PXUIField(DisplayName = "Nearest Wh Qty", Enabled = false, IsReadOnly = true)]
        [PXDBScalar(typeof(Search2<ExtensionPOVendorInventory.usrVendorNearestWhseQty,
                           InnerJoin<InventoryItem,
                               On<InventoryItem.inventoryID, Equal<SOLine.inventoryID>>>,
                           Where<POVendorInventory.inventoryID, Equal<InventoryItem.inventoryID>,
                               And<POVendorInventory.vendorID, Equal<InventoryItem.preferredVendorID>,
                               And<POVendorInventory.vendorLocationID, Equal<InventoryItem.preferredVendorLocationID>>>>>))]
        public virtual int? UsrVendorNearestWhsQty { get; set; }
        #endregion

        #region UsrVendorTransitTime
        public abstract class usrLeadTimeFromNearestWhse : BqlInt.Field<usrLeadTimeFromNearestWhse> { }

        [PXInt]
        [PXUIField(DisplayName = "Transit Time", Enabled = false, IsReadOnly = true)]
        [PXDBScalar(typeof(Search2<ExtensionPOVendorInventory.usrLeadTimeFromNearestWhse,
                           InnerJoin<InventoryItem,
                               On<InventoryItem.inventoryID, Equal<SOLine.inventoryID>>>,
                           Where<POVendorInventory.inventoryID, Equal<InventoryItem.inventoryID>,
                               And<POVendorInventory.vendorID, Equal<InventoryItem.preferredVendorID>,
                               And<POVendorInventory.vendorLocationID, Equal<InventoryItem.preferredVendorLocationID>>>>>))]
        public virtual int? UsrLeadTimeFromNearestWhse { get; set; }
        #endregion

        #region UsrVendorContractPrice
        public abstract class usrVendorContractPrice : BqlDecimal.Field<usrVendorContractPrice> { }

        [PXDecimal(2)]
        //[PXDefault(TypeCode.Decimal, "0", PersistingCheck = PXPersistingCheck.Nothing)]
        [PXUIField(DisplayName = "Vendor Contract Price", Enabled = false, IsReadOnly = true)]
        [PXDBScalar(typeof(Search2<ExtensionPOVendorInventory.usrVendorContractPrice,
                           InnerJoin<InventoryItem,
                               On<InventoryItem.inventoryID, Equal<SOLine.inventoryID>>>,
                           Where<POVendorInventory.inventoryID, Equal<InventoryItem.inventoryID>,
                               And<POVendorInventory.vendorID, Equal<InventoryItem.preferredVendorID>,
                               And<POVendorInventory.vendorLocationID, Equal<InventoryItem.preferredVendorLocationID>>>>>))]
        public virtual decimal? UsrVendorContractPrice { get; set; }
        #endregion
    }
}

ExtensionPOVendorInventory

using PX.Data;
using PX.Data.BQL;
using PX.Objects.PO;

namespace PX.KWW.PreferredVendorFields.DAC
{
    public class ExtensionPOVendorInventory : PXCacheExtension<POVendorInventory>
    {
        #region UsrLeadTimeFromNearestWhse
        public abstract class usrLeadTimeFromNearestWhse : BqlInt.Field<usrLeadTimeFromNearestWhse> { }
        [PXDBInt]
        [PXUIField(DisplayName = "Nearest WH Lead Time", IsReadOnly = true)]
        public virtual int? UsrLeadTimeFromNearestWhse { get; set; }
        #endregion

        #region UsrNearestWhse
        public abstract class usrNearestWhse : BqlString.Field<usrNearestWhse> { }
        [PXDBString]
        [PXUIField(DisplayName = "Nearest WH", IsReadOnly = true)]
        public virtual string UsrNearestWhse { get; set; }
        #endregion

        #region UsrVendorContractPrice
        public abstract class usrVendorContractPrice : BqlDecimal.Field<usrVendorContractPrice> { }
        [PXDBDecimal]
        [PXUIField(DisplayName = "Contract Price", IsReadOnly = true)]
        public virtual decimal? UsrVendorContractPrice { get; set; }
        #endregion

        #region UsrVendorNearestWhseQty
        public abstract class usrVendorNearestWhseQty : BqlInt.Field<usrVendorNearestWhseQty> { }
        [PXDBInt]
        [PXUIField(DisplayName = "Nearest WH Qty", IsReadOnly = true)]
        public virtual int? UsrVendorNearestWhseQty { get; set; }
        #endregion

        #region UsrVendorTotalQty
        public abstract class usrVendorTotalQty : BqlInt.Field<usrVendorTotalQty> { }
        [PXDBInt]
        [PXUIField(DisplayName = "Total Qty", IsReadOnly = true)]
        public virtual int? UsrVendorTotalQty { get; set; }
        #endregion
    }
}
...