CreateSalesPrice 方法中的数据分配错误
Data allocation error in the CreateSalesPrice method
情况:
我必须在供应商价格工作表屏幕和供应商价格屏幕上为每个子项目指定价格。
当在 Vendor Price Worksheets 中按下释放按钮时,必须在 APVendorPrice table 中创建 APPriceWorksheetDetail table 中的记录,显然我必须分配 SubItemID 字段值APPriceWorksheetDetail table 到 APVendorPrice table.
的 UsrSubItemID 字段
备注:
没有必要在供应商价格工作表网格中创建 SubItemID 字段,因为它已经存在于详细信息数据视图中。
我在供应商价格网格中创建了 SubItemID 字段,因为它在记录数据视图中不存在。
这是我的供应商价格工作表屏幕
这是我的供应商价格屏幕
这是我的 APVendorPriceExtensions DAC
using PX.Data;
using PX.Objects.AP;
using PX.Objects.CM;
using PX.Objects.IN;
using PX.Objects.CS;
using PX.Objects;
using System.Collections.Generic;
using System;
namespace PX.Objects.AP
{
public class APVendorPriceExt : PXCacheExtension<PX.Objects.AP.APVendorPrice>
{
#region UsrSubItemID
[PXDefault(typeof(Search<InventoryItem.defaultSubItemID,
Where<InventoryItem.inventoryID, Equal<Current<APVendorPrice.inventoryID>>,
And<InventoryItem.defaultSubItemOnEntry, Equal<boolTrue>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]
[PXFormula(typeof(Default<APVendorPrice.inventoryID>))]
[SubItem(typeof(APVendorPrice.inventoryID))]
public virtual int? UsrSubItemID { get; set; }
public abstract class usrSubItemID : PX.Data.BQL.BqlInt.Field<usrSubItemID> { }
#endregion
}
}
我找到了在 APPriceWorkSheetMain 图中分配值的方法,该方法称为 CreateSalesPrice,我试图重写该方法以放置我的自定义 UsrSubItemID 字段,但我收到以下错误:“CS0117:'APVendorPrice' 不包含 'UsrSubItemID'" 的定义。
这是我的APPriceWorkSheetMain_Extension
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Objects.Common;
using PX.Objects.Common.Extensions;
using PX.Objects.CS;
using PX.Objects.CM;
using PX.Objects.IN;
using PX.Objects.GL;
using PX.Api;
using PX.Objects;
using PX.Objects.AP;
namespace PX.Objects.AP
{
public class APPriceWorksheetMaint_Extension : PXGraphExtension<APPriceWorksheetMaint>
{
#region Event Handlers
public delegate APVendorPrice CreateSalesPriceDelegate(APPriceWorksheetDetail priceLine, Nullable<Boolean> isPromotional, Nullable<DateTime> effectiveDate, Nullable<DateTime> expirationDate);
[PXOverride]
public APVendorPrice CreateSalesPrice(APPriceWorksheetDetail priceLine, Nullable<Boolean> isPromotional, Nullable<DateTime> effectiveDate, Nullable<DateTime> expirationDate, CreateSalesPriceDelegate baseMethod)
{
APVendorPrice newSalesPrice = new APVendorPrice
{
VendorID = priceLine.VendorID,
InventoryID = priceLine.InventoryID,
UsrSubItemID = priceLine.SubItemID,
SiteID = priceLine.SiteID,
UOM = priceLine.UOM,
BreakQty = priceLine.BreakQty,
SalesPrice = priceLine.PendingPrice,
CuryID = priceLine.CuryID,
IsPromotionalPrice = isPromotional,
EffectiveDate = effectiveDate,
ExpirationDate = expirationDate,
};
return newSalesPrice;
}
#endregion
}
}
对此有何建议?
您是否尝试过使用以下方法? (通过扩展 DAC 更新):
APVendorPrice newSalesPrice = new APVendorPrice
{
VendorID = priceLine.VendorID,
InventoryID = priceLine.InventoryID,
SiteID = priceLine.SiteID,
UOM = priceLine.UOM,
BreakQty = priceLine.BreakQty,
SalesPrice = priceLine.PendingPrice,
CuryID = priceLine.CuryID,
IsPromotionalPrice = isPromotional,
EffectiveDate = effectiveDate,
ExpirationDate = expirationDate,
};
var vendorPriceExt = PXCache<APVendorPrice>.GetExtension<APVendorPriceExt>(newSalesPrice);
vendorPriceExt.UsrSubItemID = priceLine.SubItemID;
return newSalesPrice;
情况:
我必须在供应商价格工作表屏幕和供应商价格屏幕上为每个子项目指定价格。
当在 Vendor Price Worksheets 中按下释放按钮时,必须在 APVendorPrice table 中创建 APPriceWorksheetDetail table 中的记录,显然我必须分配 SubItemID 字段值APPriceWorksheetDetail table 到 APVendorPrice table.
的 UsrSubItemID 字段备注:
没有必要在供应商价格工作表网格中创建 SubItemID 字段,因为它已经存在于详细信息数据视图中。
我在供应商价格网格中创建了 SubItemID 字段,因为它在记录数据视图中不存在。
这是我的供应商价格工作表屏幕
这是我的供应商价格屏幕
这是我的 APVendorPriceExtensions DAC
using PX.Data;
using PX.Objects.AP;
using PX.Objects.CM;
using PX.Objects.IN;
using PX.Objects.CS;
using PX.Objects;
using System.Collections.Generic;
using System;
namespace PX.Objects.AP
{
public class APVendorPriceExt : PXCacheExtension<PX.Objects.AP.APVendorPrice>
{
#region UsrSubItemID
[PXDefault(typeof(Search<InventoryItem.defaultSubItemID,
Where<InventoryItem.inventoryID, Equal<Current<APVendorPrice.inventoryID>>,
And<InventoryItem.defaultSubItemOnEntry, Equal<boolTrue>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]
[PXFormula(typeof(Default<APVendorPrice.inventoryID>))]
[SubItem(typeof(APVendorPrice.inventoryID))]
public virtual int? UsrSubItemID { get; set; }
public abstract class usrSubItemID : PX.Data.BQL.BqlInt.Field<usrSubItemID> { }
#endregion
}
}
我找到了在 APPriceWorkSheetMain 图中分配值的方法,该方法称为 CreateSalesPrice,我试图重写该方法以放置我的自定义 UsrSubItemID 字段,但我收到以下错误:“CS0117:'APVendorPrice' 不包含 'UsrSubItemID'" 的定义。
这是我的APPriceWorkSheetMain_Extension
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Objects.Common;
using PX.Objects.Common.Extensions;
using PX.Objects.CS;
using PX.Objects.CM;
using PX.Objects.IN;
using PX.Objects.GL;
using PX.Api;
using PX.Objects;
using PX.Objects.AP;
namespace PX.Objects.AP
{
public class APPriceWorksheetMaint_Extension : PXGraphExtension<APPriceWorksheetMaint>
{
#region Event Handlers
public delegate APVendorPrice CreateSalesPriceDelegate(APPriceWorksheetDetail priceLine, Nullable<Boolean> isPromotional, Nullable<DateTime> effectiveDate, Nullable<DateTime> expirationDate);
[PXOverride]
public APVendorPrice CreateSalesPrice(APPriceWorksheetDetail priceLine, Nullable<Boolean> isPromotional, Nullable<DateTime> effectiveDate, Nullable<DateTime> expirationDate, CreateSalesPriceDelegate baseMethod)
{
APVendorPrice newSalesPrice = new APVendorPrice
{
VendorID = priceLine.VendorID,
InventoryID = priceLine.InventoryID,
UsrSubItemID = priceLine.SubItemID,
SiteID = priceLine.SiteID,
UOM = priceLine.UOM,
BreakQty = priceLine.BreakQty,
SalesPrice = priceLine.PendingPrice,
CuryID = priceLine.CuryID,
IsPromotionalPrice = isPromotional,
EffectiveDate = effectiveDate,
ExpirationDate = expirationDate,
};
return newSalesPrice;
}
#endregion
}
}
对此有何建议?
您是否尝试过使用以下方法? (通过扩展 DAC 更新):
APVendorPrice newSalesPrice = new APVendorPrice
{
VendorID = priceLine.VendorID,
InventoryID = priceLine.InventoryID,
SiteID = priceLine.SiteID,
UOM = priceLine.UOM,
BreakQty = priceLine.BreakQty,
SalesPrice = priceLine.PendingPrice,
CuryID = priceLine.CuryID,
IsPromotionalPrice = isPromotional,
EffectiveDate = effectiveDate,
ExpirationDate = expirationDate,
};
var vendorPriceExt = PXCache<APVendorPrice>.GetExtension<APVendorPriceExt>(newSalesPrice);
vendorPriceExt.UsrSubItemID = priceLine.SubItemID;
return newSalesPrice;