在SOLine Acumatica上添加InventoryID选择器列
我需要在销售订单行上添加InventoryID选择器的“客户零件号”和“供应商零件号”列,以便用户在创建SO行时能够按零件号选择InventoryID。将“自定义项目>自定义数据类>选择器列”中的列添加到选择器中是没有帮助的。因此,我尝试自定义该属性,但仍然没有成功,因为SOLine DAC上InventoryID字段的定义如下:在SOLine Acumatica上添加InventoryID选择器列,acumatica,Acumatica,我需要在销售订单行上添加InventoryID选择器的“客户零件号”和“供应商零件号”列,以便用户在创建SO行时能够按零件号选择InventoryID。将“自定义项目>自定义数据类>选择器列”中的列添加到选择器中是没有帮助的。因此,我尝试自定义该属性,但仍然没有成功,因为SOLine DAC上InventoryID字段的定义如下: [SOLineInventoryItem(Filterable=true)] [PXDefault()] 需要帮助了解如何自定义此类属性。在Acumatica中,客
[SOLineInventoryItem(Filterable=true)]
[PXDefault()]
需要帮助了解如何自定义此类属性。在Acumatica中,客户和供应商零件号存储在库存项目屏幕上的交叉参考选项卡中。如下面的屏幕截图所示,AlternateID在INItemXRef DAC中声明,并且InventoryItem和INItemXRef DAC之间存在一对多关系: 因此,不可能将客户和供应商零件号列添加到InventoryID选择器中,因为这将导致重复的InventoryItem记录 另一种解决方案是在InventoryItem DAC中创建一个自定义文本字段,然后覆盖InventoryItemMaint BLC扩展中的Persist,以连接备用ID并将结果存储在自定义文本字段(DB列)中:
公共类InventoryItemMaint_扩展名:pxGrapherExtension
{
[PXOverride]
公共无效持续(操作del)
{
使用(PXTransactionScope ts=new PXTransactionScope())
{
InventoryItem=Base.item.Current;
if(item!=null&&Base.itemxrefrecords.Cache.IsDirty)
{
string alternateIDs=string.Empty;
foreach(Base.itemrefrecords.Select()中的INItemXRef crossRef)
{
alternateIDs=string.IsNullOrEmpty(alternateIDs)?
crossRef.AlternateID:AlternateID+“;”+crossRef.AlternateID;
}
item.GetExtension().usralternateId=AlternateId;
基础.项目.更新(项目);
}
del();
ts.完成();
}
}
}
为了简化初始设置,您还可以在InventoryItemMaint BLC扩展中实现RecalAlternateIDS操作。RecalcAlternateIDs操作将循环应用程序中的所有库存项,并连接备用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();
}
});
}
}
公共类InventoryItemMaint_扩展名:pxGrapherExtension
{
...
公共行动-再培训;
[按钮]
[PXUIField(DisplayName=“连接备用ID”)]
受保护的无效RecalCalAlternateIDs()
{
PXLongOperation.StartOperation(基本,()=>
{
InventoryItemMaint-itemMaint=PXGraph.CreateInstance();
var items=PXSelect.Select(itemMaint);
foreach(库存项目中的项目)
{
itemMaint.Clear();
itemMaint.Item.Current=项目;
itemMaint.itemxrefrecords.Cache.IsDirty=true;
itemMaint.Actions.PressSave();
}
});
}
}
默认情况下,所有选择器控件都会根据关键字(定义时为SubstituteKey)和描述(如果定义)字段构建搜索索引。要扩展此列表,您可以将Aspx中PXSelector/PXSegmentMask控件的FilterByalFields属性设置为True,或者按照以下步骤使用FastFilterFields。在我看来,FastFilterFields似乎是解决您的请求的更好的选择
接下来的步骤需要将USRALTernateId列添加到InventoryID选择器中
<px:PXSegmentMask CommitChanges=“True" ID="edInventoryID" runat="server" DataField="InventoryID" AllowEdit="True" />
Acumatica中的客户和供应商零件号存储在库存项目屏幕上的交叉参考选项卡中。如下面的屏幕截图所示,AlternateID在INItemXRef DAC中声明,并且InventoryItem和INItemXRef DAC之间存在一对多关系: 因此,不可能将客户和供应商零件号列添加到InventoryID选择器中,因为这将导致重复的InventoryItem记录 另一种解决方案是在InventoryItem DAC中创建一个自定义文本字段,然后覆盖InventoryItemMaint BLC扩展中的Persist,以连接备用ID并将结果存储在自定义文本字段(DB列)中:
公共类InventoryItemMaint_扩展名:pxGrapherExtension
{
[PXOverride]
公共无效持续(操作del)
{
使用(PXTransactionScope ts=new PXTransactionScope())
{
InventoryItem=Base.item.Current;
if(item!=null&&Base.itemxrefrecords.Cache.IsDirty)
{
string alternateIDs=string.Empty;
foreach(Base.itemrefrecords.Select()中的INItemXRef crossRef)
{
alternateIDs=string.IsNullOrEmpty(alternateIDs)?
crossRef.AlternateID:AlternateID+“;”+crossRef.AlternateID;
}
item.GetExtension().usralternateId=AlternateId;
基础.项目.更新(项目);
}
del();
ts.完成();
}
}
}
为了简化初始设置,您还可以在InventoryItemMaint BLC扩展中实现RecalAlternateIDS操作。RecalcAlternateIDs操作将循环应用程序中的所有库存项,并连接备用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();
}
});
}
}
公共类InventoryItemMaint_扩展名:pxGrapherExtension
{
...
公共行动-再培训;
[按钮]
[PXUIField(DisplayName=“连接备用ID”)]
受保护的无效RecalCalAlternateIDs()
{
PXLongOperation.StartOperation(基本,()=>
{
InventoryItemMaint-itemMaint=PXGraph.CreateInstance();
var items=PXSelect.Select(itemMaint);
foreach(其中的InventoryItem)
<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>