【问题标题】:Dynamically changing Warehouse Selector in AcumaticaAcumatica 中动态变化的仓库选择器
【发布时间】: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)
                {

                }
            }
        }

【问题讨论】:

    标签: c# acumatica


    【解决方案1】:

    我会在 soLine 上添加一个自定义未绑定字段(作为 int?usrSiteEntityID),该字段由您的字段更新设置(确保默认设置),然后按如下方式覆盖 SiteID 选择器(这是一个非常粗略的示例) :

    搜索 INSite.siteId,其中 INSite.branch 等于 usrSiteEntityID 或 INSite.company 等于 usrSiteEntityID

    然后你可以用一个简单的选择器来做

    【讨论】:

      猜你喜欢
      • 2021-11-05
      • 1970-01-01
      • 2016-09-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-06
      • 2016-08-31
      • 1970-01-01
      • 2018-03-01
      相关资源
      最近更新 更多