如何在Acumatica的 Bills and Adjustments(AP301000)中检索某个分支的扩展信息?
我正在使用这个版本的Acumatica: Acumatica Cloud ERP 2025 R1 Build 25.101.0153 +
我希望在Bills and Adjustments中切换分支时,能够填充该分支的扩展数据。
我得到了这段代码:
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:
Id: 16
但切换到另一个分支时,在跟踪中出现了这个错误:
Id: 20
Branch BAccount not found 1
在这两种情况下,输入的Id都来自于输入。
我在发票和发票及备忘录上也使用了同样的代码,并且对所有分支都能正常工作。
解决方案
There's nothing wrong with your app code.
The graph contains a valid record for 16, but not for 20.
We can't see that graph, but it sounds like you want to
improve its contents.
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。