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

如何为Acumatica套件装配屏幕(IN307000)添加报表下拉菜单

在Acumatica IN307000屏幕添加自定义报表操作项

嘿,我来帮你搞定在Acumatica的套件装配屏幕(IN307000)添加自定义报表下拉菜单的事儿!下面是具体的实现步骤和代码示例,完全贴合你的需求——把基于KitInventoryID的标签报表加到操作项里:

1. 编写图扩展类处理报表触发逻辑

首先你需要创建一个INKitAssemblyEntry的图扩展,在里面定义报表操作按钮,并处理数据传递(把当前屏幕的套件ID传给报表):

using System.Collections.Generic;
using PX.Data;
using PX.Objects.IN;
using PX.Reports;

public class INKitAssemblyEntry_Extension : PXGraphExtension<INKitAssemblyEntry>
{
    // 定义报表操作按钮
    public PXAction<INKitAssembly> PrintKitLabels;

    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Print Kit Labels", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
    protected virtual IEnumerable printKitLabels(PXAdapter adapter)
    {
        // 获取当前选中的套件装配记录
        INKitAssembly currentKit = Base.Document.Current;
        if (currentKit == null) return adapter.Get();

        // 准备报表参数,这里要和你自定义报表的参数名称匹配
        Dictionary<string, string> reportParams = new Dictionary<string, string>();
        reportParams["KitInventoryID"] = currentKit.InventoryID.ToString();

        // 触发报表打印,替换"YourCustomLabelReportID"为你实际的报表ID
        throw new PXReportRequiredException(reportParams, "YourCustomLabelReportID", PXBaseRedirectException.WindowMode.NewWindow, "Print Kit Labels");
    }
}

2. 在定制项目中配置操作项显示

写完代码后,需要在Acumatica的定制项目里把这个操作加到屏幕的菜单中:

  • 打开你的定制项目,导航到**IN307000(套件装配)**屏幕
  • 找到顶部的Actions菜单节点,右键选择添加操作
  • 在弹出的窗口中,选择你刚才定义的PrintKitLabels操作
  • 可以设置它的显示顺序、分组(比如放到"Reports"分组下),保存定制项目并发布

关键注意事项

  • 确保你的自定义报表已经正确配置了KitInventoryID参数,并且参数名称和代码里的完全一致
  • CommitChanges = true这个属性很重要,它会确保打印前保存当前屏幕的修改,避免数据不一致
  • 如果需要支持批量打印多条记录,可以遍历adapter.Get()来获取所有选中的记录,把多个KitInventoryID传给报表(报表也要支持多值参数)
  • 替换代码里的YourCustomLabelReportID为你实际的报表ID(可以在报表设计器的属性里找到)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 04:29:04