c# - Acumatica 中动态变化的仓库选择器
问题描述
我想在以下屏幕上动态更改 Acumatica 中的仓库选择器结果:
- 机会
- 销售订单
- 订单
- 销售报价
- 请购单
,由公司(选定公司下的所有仓库)或分公司。我添加到库存首选项屏幕的自定义字段将满足该条件。
我得出的结论是必须使用自定义选择器属性,但我不确定如何实现这一点。
任何指导和帮助将不胜感激。
请参阅我的自定义 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)
{
}
}
}
解决方案
我将在 soLine 上添加一个自定义未绑定字段(作为 int?usrSiteEntityID),该字段由您的字段更新设置(确保默认设置),然后按如下方式覆盖 SiteID 选择器(这是一个非常粗略的示例):
搜索 INSite.siteId,其中 INSite.branch 等于 usrSiteEntityID 或 INSite.company 等于 usrSiteEntityID
然后你可以用一个简单的选择器来做
推荐阅读
- c# - 更新 ComboBox 源不会更新 ComboBox
- javascript - 如何在 Drupal 8 中更新我的视图而不返回第一页?
- python - 如何更快地为图像生成噪声?
- pdf - 是否可以使用 Google Script 将位于 Google Drive 中的不可搜索的 PDF 转换为可搜索的 PDF?
- python - 在 __init__.py 中导入模块
- acumatica - 如何使用上传按钮将值插入/更新到网格的自定义字段中
- mysql - 如何访问在其他计算机上使用的 Java 应用程序的数据库?
- r - 我怎样才能编写这个工作代码来提高性能?
- eclipse - currentSelection 和 activeMenuSelection 的区别
- algorithm - 是否有一种算法可以选择一组项目,以使结果满足每个属性的所需百分比?