【问题标题】:Acumatica Customer Location AllowEditAcumatica 客户位置允许编辑
【发布时间】:2020-04-28 11:48:59
【问题描述】:

我有一个用户字段,用于在 QuoteMaint.CopyQuoteFilter 和 OpportunityMaint.CopyQuoteFilter 中存储企业帐户和位置。在屏幕布局上,我输入了 AllowEdit = true。当用户单击铅笔时,它会打开供应商位置,即使他们正在从事销售工作。有没有办法让我强制它打开客户位置?

这是我要钻取的位置 ID 的 DAC。

[LocationID(typeof(Where<Location.bAccountID, Equal<Current<usrBAccountId>>>),
        DisplayName = "Location",
        DescriptionField = typeof(Location.descr),
        BqlField = typeof(usrLocationID))] // typeof(Location.locationID))]
[PXDefault(typeof(Search<CROpportunity.locationID, Where<CROpportunity.opportunityID, Equal<Current<CRQuote.opportunityID>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual int? UsrLocationID { get; set; }
public abstract class usrLocationID : PX.Data.BQL.BqlInt.Field<usrLocationID> { }

谢谢!

【问题讨论】:

  • PO 和 SO 页面重定向到相应的供应商/客户位置页面。在您的场景中也应该是可行的。请分享新字段的 DAC 扩展定义
  • 感谢费尔南多的回复,我已更新我的帖子以包含用户字段的 DAC。

标签: acumatica


【解决方案1】:

您需要使用 PXAction 手动执行此操作。添加一个 PXButton(可以选择使用编辑图像对其进行样式设置)或链接控件,然后添加一个事件处理程序,您可以在其中创建目标图形并重定向到它。

这是一个重定向到多个图形处理位置 DAC 之一的事件处理程序示例:

    public PXDBAction<BAccount> addLocation;
    [PXUIField(DisplayName = Messages.AddNewLocation)]
    [PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntry)]
    public virtual void AddLocation()
    {
        var row = BAccount.Current;
        if (row == null || row.BAccountID == null) return;

        LocationMaint graph = null;
        switch (row.Type)
        {
            case BAccountType.VendorType:
                graph = PXGraph.CreateInstance<AP.VendorLocationMaint>();
                break;
            case BAccountType.CustomerType:
                graph = PXGraph.CreateInstance<AR.CustomerLocationMaint>();
                break;
            default:
                graph = PXGraph.CreateInstance<LocationMaint>();
                break;
        }


        var newLocation = (Location)graph.Location.Cache.CreateInstance();
        newLocation.BAccountID = row.BAccountID;
        var locType = LocTypeList.CustomerLoc;
        switch (row.Type)
        {
            case BAccountType.VendorType:
                locType = LocTypeList.VendorLoc;
                break;
            case BAccountType.CombinedType:
                locType = LocTypeList.CombinedLoc;
                break;
        }
        newLocation.LocType = locType;
        graph.Location.Insert(newLocation);
        PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);

    }

出现此问题的原因是 Location DAC 有许多 PXPrimaryGraph,并且在运行时它不知道在您的上下文中使用哪个,因此它回退到列表中的第一个。

[PXCacheName("Location")]
[PXPrimaryGraph(new[] { typeof(VendorLocationMaint), 
                        typeof(CustomerLocationMaint), 
                        typeof(BranchMaint), 
                        typeof(EmployeeMaint), 
                        typeof(LocationMaint) }, 
                new[] { typeof(Select<Location, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Where<Current<locType>, Equal<LocTypeList.vendorLoc>, Or<Current<locType>, Equal<LocTypeList.combinedLoc>>>>>>>), 
                        typeof(Select<Location, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Where<Current<locType>, Equal<LocTypeList.customerLoc>, Or<Current<locType>, Equal<LocTypeList.combinedLoc>>>>>>>), 
                        typeof(Select2<Branch, InnerJoin<BAccount, On<BAccount.bAccountID, Equal<Branch.bAccountID>>, InnerJoin<Location, On<bAccountID, Equal<BAccount.bAccountID>, And<locationID, Equal<BAccount.defLocationID>>>>>, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Current<locType>, Equal<LocTypeList.companyLoc>>>>>), 
                        typeof(Select2<EPEmployee, InnerJoin<Location, On<bAccountID, Equal<EPEmployee.bAccountID>, And<locationID, Equal<EPEmployee.defLocationID>>>>, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>, And<Current<locType>, Equal<LocTypeList.employeeLoc>>>>>), 
                        typeof(Select<Location, Where<bAccountID, Equal<Current<bAccountID>>, And<locationID, Equal<Current<locationID>>>>>) })]
[PXProjection(typeof(Select2<Location, LeftJoin<LocationAPAccountSub, On<LocationAPAccountSub.bAccountID, Equal<bAccountID>, And<LocationAPAccountSub.locationID, Equal<vAPAccountLocationID>>>, LeftJoin<LocationARAccountSub, On<LocationARAccountSub.bAccountID, Equal<bAccountID>, And<LocationARAccountSub.locationID, Equal<cARAccountLocationID>>>, LeftJoin<LocationAPPaymentInfo, On<LocationAPPaymentInfo.bAccountID, Equal<bAccountID>, And<LocationAPPaymentInfo.locationID, Equal<vPaymentInfoLocationID>>>, LeftJoin<BAccountR, On<BAccountR.bAccountID, Equal<bAccountID>>>>>>>), Persistent = true)]
public class Location : IBqlTable, IPaymentTypeDetailMaster, ILocation
{
}

【讨论】:

  • 这就是我所怀疑的。我还没有尝试过,但我想我可以尝试将其设置为 CustomerLocation 类型,看看是否可行。我会告诉你进展如何。
  • 我成功测试了手动重定向。不确定设置当前上下文是否有效,但值得一试: Base.Caches[typeof(Location)].Current.LocType = LocTypeList.CustomerLoc or Base.Caches[typeof(Location)] .Current.LocType = LocTypeList.CombinedLoc
  • 我不得不对其进行一些修改以满足我的需要,但这有效 - 感谢您的帮助!
猜你喜欢
  • 1970-01-01
  • 2023-03-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多