高级自定义 > 业务逻辑自定义 > 报告生成 > 报告选择列表自定义
报告选择列表自定义
PSB 功能区自定义
右击菜单自定义
PSB 功能区自定义
您可以在 PSB 功能区工具栏中的“报告”菜单下添加自定义报告。
此功能仅适用于部件信息页面“结构”选项卡 (PSB) 中的“报告”菜单;而在其他结构中不受支持。
最多可以提供 25 个自定义报告。
必须将自定义报告添加到现有预设报告的末尾。
无法在预设报告列表中插入自定义报告。
无法重新排序现有预设报告。
可以隐藏预设报告而仅显示自定义报告。
自定义步骤
1. 创建资源束 Java 文件。例如:
a. 创建 <Windchill>\src\com\customReports\psb\ 目录,并创建一个名为 psbCustomActionsRB.java 的文件 (请参阅下面的示例源代码)。
b. 在 Windchill shell 中,转至 <Windchill>\src 目录并编译 java 文件 (根据需要替换 <Windchill>):
javac -cp <Windchill>\codebase;<Windchill>\codebase\WEB-INF\lib\*;<Windchill>\lib\* com\customReports\psb\psbActionsRB.java -d <Windchill>\codebase
例如:
javac -cp C:\ptc\Windchill\codebase;C:\ptc\Windchill\codebase\WEB-INF\lib\*;C:\ptc\Windchill\lib\* com\customReports\psb\psbActionsRB.java -d C:\ptc\Windchill\codebase
这样会将 RB 信息文件编译到 <Windchill>\codebase\com\customReports\psb 目录中。
2. 将操作定义条目添加到 <Windchill>\codebase\config\actions\custom-actions.xml (请参阅下面的示例源代码)。
a. 必须将每个操作的 url 参数都更改为指向自定义报告 url。
b. 注意:在 <objecttype name="psb" resourceBundle="com. customReports.psb.psbActionsRB"> 元素中指定的 resourceBundle 名称必须与上述步骤 1 中所创建的资源束的 java 类名称相匹配。
3. 将操作模型定义添加到 <Windchill>\codebase\config\actions\custom-actionModels.xml (请参阅下面的示例源代码)。
a. 注意:此操作将覆盖在 <Windchill>\codebase\config\actions\psb-actionModels.xml 中找到的 PSB 的工具栏操作模型定义。如果安装了用于修改 psb-actionModels.xml 的其他修补程序,则必须将这些更改合并到 custom-actionModels.xml 文件中。
b. 取消注释以黄色突出显示的代码段中所需的自定义报告数。
c. "separator" 条目是可选的,可放置在任何自定义报告条目之间。
d. 请勿更改操作的名称。
e. 预设报告条目可被注释掉
示例代码:psbCustomActionsRB.java
* 
移除第 02 行到第 25 行自定义报告的示例代码以提高可读性。
package com.customReports.psb;
import wt.util.resource.RBComment;
import wt.util.resource.RBEntry;
import wt.util.resource.RBPseudo;
import wt.util.resource.RBUUID;
import wt.util.resource.WTListResourceBundle;
@RBUUID("com.customReports.psb.psbCustomActionsRB")
public final class psbCustomActionsRB extends WTListResourceBundle {
/********
* Custom Report 01
*/
@RBEntry("Custom Report 01 Description")
// this is what is displayed in the menu
public static final String PSB_CUSTOMREPORTGWT01_DESCRIPTION
= "psb.psbCustomReportGWT01.description";
@RBEntry("Custom Report 01")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TITLE
= "psb.psbCustomReportGWT01.title";
@RBEntry("Custom Report 01 Tooltip")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TOOLTIP
= "psb.psbCustomReportGWT01.tooltip";
@RBEntry("height=900,width=1000")
// specifies the size in pixels of the report window
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_MOREURLINFO
= "psb.psbCustomReportGWT01.moreurlinfo";
@RBEntry("report_view.png")
// the name of the icon file, as found in <Windchill>/netmarkets/images
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_ICON
= "psb.psbCustomReportGWT01.icon";

[ Sample code for custom reports 02 through 25 removed for readability ]
} // end class
package com.customReports.psb;
import wt.util.resource.RBComment;
import wt.util.resource.RBEntry;
import wt.util.resource.RBPseudo;
import wt.util.resource.RBUUID;
import wt.util.resource.WTListResourceBundle;
@RBUUID("com.customReports.psb.psbCustomActionsRB")
public final class psbCustomActionsRB extends WTListResourceBundle {
/********
* Custom Report 01
*/
@RBEntry("Custom Report 01 Description")
// this is what is displayed in the menu
public static final String PSB_CUSTOMREPORTGWT01_DESCRIPTION
= "psb.psbCustomReportGWT01.description";
@RBEntry("Custom Report 01")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TITLE
= "psb.psbCustomReportGWT01.title";
@RBEntry("Custom Report 01 Tooltip")
// not used, but is here for completeness in case used in the future
public static final String PSB_CUSTOMREPORTGWT01_TOOLTIP
= "psb.psbCustomReportGWT01.tooltip";
@RBEntry("height=900,width=1000")
// specifies the size in pixels of the report window
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_MOREURLINFO
= "psb.psbCustomReportGWT01.moreurlinfo";
@RBEntry("report_view.png")
// the name of the icon file, as found in <Windchill>/netmarkets/images
@RBPseudo(false)
@RBComment("DO NOT TRANSLATE")
public static final String PSB_CUSTOMREPORTGWT01_ICON
= "psb.psbCustomReportGWT01.icon";

[ Sample code for custom reports 02 through 25 removed for readability ]
} // end class
示例代码:custom-actions.xml
请确保使用资源束的 Java 类名称正确设置 resourceBundle 参数。
* 
移除第 02 行到第 25 行自定义报告的示例代码以提高可读性。
<listofactions>
<objecttype name="psb"
resourceBundle="com.customReports.psb.psbCustomActionsRB">
<action name="psbCustomReportGWT01" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchURLAction"
method="execute" url="/ptc1/psb/customAction" windowType="popup"/>
<supportedTypes>
<type value="wt.part.WTPart"/>
<type value="wt.part.WTPartUsageLink"/>
<type value="wt.part.PartUsesOccurrence"/>
<type value="wt.part.RTPartPathOccurrence"/>
</supportedTypes>
</action>
[ Sample code for custom reports 02 through 25 removed for readability ]
</objecttype>
</listofactions>
示例代码:custom-actionModels.xml
取消注释下面以黄色突出显示的代码段中所需的自定义报告数。"separator" 条目是可选的,可放置在任何自定义报告条目之间。 请勿更改操作的名称。
* 
取消注释含 psbCustomReportGWT 操作名称的代码段中所需的自定义报告数。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE actionmodels SYSTEM "actionmodels.dtd">
<actionmodels>
<model name="psbRelatedPartsTreeToolBar">
<action name="editingGroupGWT" type="psb" />
<action name="insertExistingPartStructureGWT" type="psb" />
<action name="removeGWT" type="psb" />
<action name="insertNewPartStructureSplitGWT" type="psb" />
<action name="insertNewPartStructureGWT" type="psb" />
<action name="insertMultiNewPartStructureGWT" type="psb" />
<action name="editSplitGWT" type="psb" />
<action name="editGWT" type="psb" />
<action name="editUsageLinkTreeGWT" type="psb" />
<action name="editCommonAttrsGWT" type="psb" />
<action name="separator" type="separator" />
<action name="renameGWT" type="psb" />
<action name="createOccurrencesGWT" type="psb" />
<action name="checkInOutGroupGWT" type="psb" />
<action name="checkoutGWT" type="psb" />
<action name="undocheckoutGWT" type="psb" />
<action name="checkinGWT" type="psb" />
<action name="findCheckoutItemsGWT" type="psb" />
<action name="clipboardGroupGWT" type="psb" />
<action name="pasteFromClipboardToTreeWithLargeIconGWT" type="psb" />
<action name="copyToWindchillWithLargeIconGWT" type="cat" />
<action name="pasteFromClipboardToTreeGWT" type="psb" />
<action name="pasteSelectToTreeGWT" type="psb" />
<action name="viewingGroupGWT" type="psb" />
<action name="relatedObjectsWithLargeIconGWT" type="psb" />
<action name="configurableTableViewGWT" type="cat" />
<action name="configurableTableViewListGWT" type="cat" />
<action name="separator" type="separator" />
<action name="saveStructureViewGWT" type="cat" />
<action name="configurableTableViewManagerGWT" type="cat" />
<action name="separator" type="cat" />
<action name="sourcingContextGWT" type="psb" />
<action name="sourcingContextListGWT" type="psb" />
<action name="separator" type="cat" />
<action name="findSourcingContextGWT" type="psb" />
<action name="displayGWT" type="cat" />
<action name="displayOccurrencesGWT" type="psb" />
<action name="separator" type="separator" />
<action name="selectAllGWT" type="cat" />
<action name="separator" type="separator" />
<action name="expandAllLevelsFromRootGWT" type="cat" />
<action name="psbExpandSubmenuGWT" type="psb" />
<action name="expandOneLevelGWT" type="cat" />
<action name="expandTwoLevelsGWT" type="cat" />
<action name="expandThreeLevelsGWT" type="cat" />
<action name="expandFourLevelsGWT" type="cat" />
<action name="expandFiveLevelsGWT" type="cat" />
<action name="separator" type="separator" />
<action name="expandAllSelectedLevelsGWT" type="cat" />
<action name="expandNLevelsGWT" type="cat" />
<action name="collapseAllLevelsGWT" type="cat" />
<action name="psbEndExpandSubmenuGWT" type="psb" />
<action name="separator" type="separator" />
<action name="viewLayout2Panel" type="cat" />
<action name="viewLayout3Panel" type="cat" />
<action name="separator" type="separator" />
<action name="refreshGWT" type="cat" />
<action name="newAddToGroupGWT" type="psb" />
<action name="newActionsGWT" type="psb" />
<action name="saveAsGWT" type="psb" />
<action name="separator" type="separator" />
<action name="newPromotionRequestTreeGWT" type="psb" />
<action name="newPartConfigGWT" type="psb" />
<action name="newRepresentationTreeGWT" type="psb" />
<action name="newPARGWT" type="psb"/>
<action name="addToActionsGWT" type="psb" />
<action name="addToBaselineGWT" type="cat" />
<action name="addToPackageGWT" type="cat" />
<action name="SBAddToPrj" type="cat" />
<action name="filterGroupGWT" type="ec" />
<action name="editFilterWithLargeIconGWT" type="ec" />
<action name="filterPropertiesGWT" type="ec" />
<action name="savedFiltersGWT" type="ec" />
<action name="toolsGroupGWT" type="psb" />
<action name="compareActionsGWT" type="psb" />
<action name="launchStructureCompareGWT" type="psb" />
<action name="launchCompareToCADGWT" type="dsv" />
<action name="openActionsGWT" type="psb" />
<action name="openInProductViewGWT" type="psb" />
<action name="openInPSEGWT" type="psb" />
<action name="openInMPSEGWT" type="psb" />
<action name="openInSPSEGWT" type="psb" />
<action name="psbReportsGroupGWT" type="psb" />
<action name="psbReportsGWT" type="psb" />
<action name="psbReportMultiLevelCompListGWT" type="psb" />
<action name="separator" type="separator" />
<action name="psbReportSingleLevelConsolBOMGWT" type="psb" />
<action name="psbReportSingleLevelBOMGWT" type="psb" />
<action name="psbReportSingleLevelBOMWithNotesGWT" type="psb" />
<action name="separator" type="separator" />
<action name="psbReportMultiLevelBOMGWT" type="psb" />
<action name="psbReportMultiLevelBOMWithReplacementsGWT" type="psb" />
<action name="psbReportMultiLevelBOMWithAMLAVLGWT" type="psb" />
<action name="psbReportMultiLevelBOMWithAMLGWT" type="psb" />
<action name="separator" type="separator" />
<action name="singleSourceOEMPartsGWT" type="psb" />
<action name="uniqueManufacturerPartsGWT" type="psb" />
<action name="separator" type="separator" />
<action name="changeBaselineReportGWT" type="change" />

<!--<action name="separator" type="separator" />
<action name="psbCustomReportGWT01" type="psb" />
<action name="psbCustomReportGWT02" type="psb" />
<action name="psbCustomReportGWT03" type="psb" />
<action name="psbCustomReportGWT04" type="psb" />
<action name="psbCustomReportGWT05" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT06" type="psb" />
<action name="psbCustomReportGWT07" type="psb" />
<action name="psbCustomReportGWT08" type="psb" />
<action name="psbCustomReportGWT09" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT10" type="psb" />
<action name="psbCustomReportGWT11" type="psb" />
<action name="psbCustomReportGWT12" type="psb" />
<action name="psbCustomReportGWT13" type="psb" />
<action name="psbCustomReportGWT14" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT15" type="psb" />
<action name="psbCustomReportGWT16" type="psb" />
<action name="psbCustomReportGWT17" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT18" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT19" type="psb" />
<action name="psbCustomReportGWT20" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT21" type="psb" />
<action name="psbCustomReportGWT22" type="psb" />
<action name="psbCustomReportGWT23" type="psb" />
<action name="psbCustomReportGWT24" type="psb" />
<action name="separator" type="separator" />
<action name="psbCustomReportGWT25" type="psb" />-->

<action name="exportActionsGWT" type="cat"/>
<action name="exportCsvGWT" type="cat" />
<action name="exportHtmlGWT" type="cat" />
<action name="exportPdfGWT" type="cat" />
<action name="exportTextGWT" type="cat" />
<action name="exportXlsGWT" type="cat" />
<action name="exportXlsxGWT" type="cat" />
<action name="exportXlsReportGWT" type="cat" />
<action name="exportXmlGWT" type="cat" />
</model>
</actionmodels>
右击菜单自定义
但是,可以将菜单项添加到结构中可启动操作或其他 jsp 页面 (例如,报告) 的右击上下文菜单。有一个示例操作可用作创建自定义操作或报告的基础。
要查看示例操作,请执行以下步骤。
1. 下列位置安装有一个示例 jsp 文件:<Windchill>\codebase\netmarkets\jsp\part\custom\customAction.jsp
2. <Windchill>\codebase\config\actions\psb-actionmodels.xml 中,查找 psbRelatedPartsTreeContextMenu 模型,并通过移除 <!----> 分隔符取消注释 "customActionGWT" 操作。
<model name="psbRelatedPartsTreeContextMenu">
...<snip>...
<!-- <action name="customActionGWT" type="psb"/> -->
</model>
customActionGWT<Windchill>\codebase\config\actions\psb-actions.xml 文件中进行了定义:
<action name="customActionGWT" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchURLAction"
method="execute" url="/ptc1/psb/customAction" windowType="popup"/>
<supportedTypes>
<type value="wt.part.WTPart" />
<type value="wt.part.WTPartUsageLink" />
<type value="wt.part.PartUsesOccurrence" />
<type value="wt.part.RTPartPathOccurrence" />
</supportedTypes>
</action>
3. 重新启动 MethodServer 并导航至部件信息页面的“结构”选项卡。
4. 右键单击结构中的任一部件,然后在菜单中选择“自定义操作”。由此启动由 customAction.jsp 定义的窗口。
5. 要创建自定义操作或报告,请将 customActionGWT 用作示例,在相应的 *-actions.xml 文件 (例如,psb-actions.xml) 中定义操作。
根据需要更改操作的名称、url 参数和 supportedTypes
添加 resourceBundle 参数以指定其中包含操作标签的文件 (请参阅“资源信息 (.rbInfo) 文件”一节)。
然后,在相应的 *-actionmodels.xml 文件中更新模型定义,以包含所定义的操作。
这对您有帮助吗?