You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Acumatica AP301000切换分支时获取分支扩展信息失败排查

问题:AP301000切换分支时部分分支无法获取BAccount扩展数据

环境与需求

  • Acumatica版本:Acumatica Cloud ERP 2025 R1 Build 25.101.0153+
  • 需求:在*Bills and Adjustments(AP301000)*页面切换分支时,自动填充分支的扩展数据

实现代码

using GLBranch = PX.Objects.GL.Branch;
public static BAccountExt GetBranchContext(PXGraph graph, int? Id)
{       
    // Get the active branch
    GLBranch activeBranch = PXSelect<GLBranch,
        Where<GLBranch.branchID, Equal<Required<GLBranch.branchID>>>>
        .Select(graph, Id);

    PXTrace.WriteInformation($"Id: {Id}");

    if (activeBranch == null)
        throw new PXException("❌ Active Branch not found 1");

    BAccount branchAccount = PXSelect<BAccount,
        Where<BAccount.bAccountID, Equal<Required<BAccount.bAccountID>>>>
        .Select(graph, activeBranch.BAccountID);

    if (branchAccount == null)
        throw new PXException("❌ Branch BAccount not found 1");

    BAccountExt branchExt = PXCache<BAccount>.GetExtension<BAccountExt> (branchAccount);

    if (branchExt == null)
        throw new PXException("❌ BranchExt not found 1");

    return branchExt;
}

问题现象

  • 分支ID为16时,代码正常运行,日志输出Id: 16
  • 切换到分支ID为20时,日志输出Id: 20后报错Branch BAccount not found 1,已确认两种场景均传入了对应分支ID
  • 相同代码在Invoices和Invoices & Memos模块中,对所有分支都能正常执行

内容的提问来源于stack exchange,提问作者Adrien

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 10:22:08