【发布时间】:2021-10-01 10:18:31
【问题描述】:
我想在以下屏幕上动态更改 Acumatica 中的仓库选择器结果:
- 机会
- 销售订单
- 采购订单
- 销售报价
- 请购单
,按公司(所选公司下的所有仓库)或分公司。我添加到库存首选项屏幕的自定义字段将满足该条件。
我得出的结论是必须使用自定义选择器属性,但我不确定如何实现。
任何指导和帮助将不胜感激。
请参阅我的自定义 DAC 字段的附加代码和销售订单图的代码:
DAC
public class INSetupExt : PXCacheExtension<PX.Objects.IN.INSetup>
{
#region UsrAllowBlockin
[PXDBBool]
[PXDefault(false)]
[PXUIField(DisplayName="Block Normal Journal Posting by Creator")]
public virtual bool? UsrAllowBlockin { get; set; }
public abstract class usrAllowBlockin : PX.Data.BQL.BqlBool.Field<usrAllowBlockin> { }
#endregion
#region UsrByCompany
[PXDBBool]
[PXDefault(true)]
[PXUIField(DisplayName="By Company")]
[PXUIEnabled(typeof(Where<usrAllowBlockin, NotEqual<False>>))]
[PXUIVisible(typeof(Where<usrAllowBlockin, NotEqual<False>>))]
public virtual bool? UsrByCompany { get; set; }
public abstract class usrByCompany : PX.Data.BQL.BqlBool.Field<usrByCompany> { }
#endregion
#region UsrByBranch
[PXDBBool]
[PXDefault(false)]
[PXUIField(DisplayName="By Branch")]
[PXUIEnabled(typeof(Where<usrAllowBlockin, NotEqual<False>>))]
[PXUIVisible(typeof(Where<usrAllowBlockin, NotEqual<False>>))]
public virtual bool? UsrByBranch { get; set; }
public abstract class usrByBranch : PX.Data.BQL.BqlBool.Field<usrByBranch> { }
#endregion
}
图表
protected void SOLine_BranchID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (SOLine)e.Row;
INSetupExt extINSetup = Base.insetup.SelectSingle().GetExtension<INSetupExt>();
if (row != null)
{
//retrieve current branch
int? currentSelectedBranch = Base.Document.Current?.BranchID;
int currentSelectedCompany = PX.Data.Update.PXInstanceHelper.CurrentCompany;
//See what condition is selected
//If filter by branch is selected, based on the branch selected in the financial tab,
//allow selection of all warehouses linked the transaction branch only
//Else if filter by company is selected,
//allow selection of all warehouses linked to the company or branches within the company associated with the document branch.
if (extINSetup.UsrAllowBlockin == true && extINSetup.UsrByBranch == true)
{
}
else if (extINSetup.UsrAllowBlockin == true && extINSetup.UsrByCompany == true)
{
}
}
}
【问题讨论】: