我需要在销售订单行上添加InventoryID选择器的客户部件号和供应商部件号列,以便用户在创建SO行时按部件号选择InventoryID . 将“自定义项目”>“自定义数据类”>“选择器列”中的列添加到选择器无法提供帮助 . 所以,我尝试自定义属性但仍然没有成功,因为SOLINE DAC上的InventoryID字段的定义如下:
[SOLineInventoryItem(Filterable=true)] [PXDefault()]
需要帮助来弄清楚如何自定义这种属性 .
在Acumatica中,客户和供应商部件号存储在“库存项目”屏幕上的“交叉引用”选项卡中 . 如下面的屏幕截图所示,AlternateID在INItemXRef DAC中声明,并且InventoryItem和INItemXRef DAC之间存在一对多关系:
话虽如此,不可能将Customer和Vendor Part Number列添加到InventoryID选择器中,因为这将导致重复的InventoryItem记录 .
另一种解决方案是在InventoryItem DAC中创建自定义文本字段,然后覆盖InventoryItemMaint BLC扩展中的Persist以连接备用ID并将结果存储在自定义文本字段(DB列)中:
public class InventoryItemMaint_Extension : PXGraphExtension<InventoryItemMaint> { [PXOverride] public void Persist(Action del) { using (PXTransactionScope ts = new PXTransactionScope()) { InventoryItem item = Base.Item.Current; if (item != null && Base.itemxrefrecords.Cache.IsDirty) { string alternateIDs = string.Empty; foreach (INItemXRef crossRef in Base.itemxrefrecords.Select()) { alternateIDs = string.IsNullOrEmpty(alternateIDs) ? crossRef.AlternateID : alternateIDs + "; " + crossRef.AlternateID; } item.GetExtension<InventoryItemExt>().UsrAlternateIDs = alternateIDs; Base.Item.Update(item); } del(); ts.Complete(); } } }
要简化初始设置,您还可以在InventoryItemMaint BLC扩展中实现RecalcAlternateIDs操作 . RecalcAlternateIDs操作将循环应用程序中的所有Stock Items并连接Alternate ID:
public class InventoryItemMaint_Extension : PXGraphExtension<InventoryItemMaint> { ... public PXAction<InventoryItem> RecalcAlternateIDs; [PXButton] [PXUIField(DisplayName = "Concatenate Alternate IDs")] protected void recalcAlternateIDs() { PXLongOperation.StartOperation(Base, () => { InventoryItemMaint itemMaint = PXGraph.CreateInstance<InventoryItemMaint>(); var items = PXSelect<InventoryItem, Where<InventoryItem.stkItem, Equal<boolTrue>>>.Select(itemMaint); foreach (InventoryItem item in items) { itemMaint.Clear(); itemMaint.Item.Current = item; itemMaint.itemxrefrecords.Cache.IsDirty = true; itemMaint.Actions.PressSave(); } }); } }
默认情况下,所有选择器控件都会根据键(或定义时为SubstituteKey)和描述(如果已定义)字段构建搜索索引 . 要扩展此列表,可以在Aspx中为PXSelector / PXSegmentMask控件将FilterByAllFields属性设置为True,或者按照以下步骤使用FastFilterFields . 在我看来,FastFilterFields似乎是解决您的请求的更好选择 .
将UsrAlternateIDs列添加到InventoryID选择器中需要后续步骤
<px:PXSegmentMask CommitChanges=“True" ID="edInventoryID" runat="server" DataField="InventoryID" AllowEdit="True" />
<px:PXSegmentMask CommitChanges="True" ID="edInventoryID" runat="server" DataField="InventoryID" AllowEdit="True" > <GridProperties FastFilterFields="UsrAlternateIDs"> <Columns> <px:PXGridColumn DataField="UsrAlternateIDs" AutoGenerateOption="Add" Width="250px" /> </Columns> </GridProperties> </px:PXSegmentMask>
1 回答
在Acumatica中,客户和供应商部件号存储在“库存项目”屏幕上的“交叉引用”选项卡中 . 如下面的屏幕截图所示,AlternateID在INItemXRef DAC中声明,并且InventoryItem和INItemXRef DAC之间存在一对多关系:
话虽如此,不可能将Customer和Vendor Part Number列添加到InventoryID选择器中,因为这将导致重复的InventoryItem记录 .
另一种解决方案是在InventoryItem DAC中创建自定义文本字段,然后覆盖InventoryItemMaint BLC扩展中的Persist以连接备用ID并将结果存储在自定义文本字段(DB列)中:
要简化初始设置,您还可以在InventoryItemMaint BLC扩展中实现RecalcAlternateIDs操作 . RecalcAlternateIDs操作将循环应用程序中的所有Stock Items并连接Alternate ID:
默认情况下,所有选择器控件都会根据键(或定义时为SubstituteKey)和描述(如果已定义)字段构建搜索索引 . 要扩展此列表,可以在Aspx中为PXSelector / PXSegmentMask控件将FilterByAllFields属性设置为True,或者按照以下步骤使用FastFilterFields . 在我看来,FastFilterFields似乎是解决您的请求的更好选择 .
将UsrAlternateIDs列添加到InventoryID选择器中需要后续步骤