commit
3ef96a7452
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="lib" path="sqljdbc4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/jxl.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/swingx-1.6.1.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.connor.lidy</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,7 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,34 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Lidy
|
||||||
|
Bundle-SymbolicName: com.connor.lidy;singleton:=true
|
||||||
|
Bundle-Version: 1.0.0
|
||||||
|
Bundle-Localization: plugin
|
||||||
|
Bundle-Activator: com.connor.lidy.Activator
|
||||||
|
Bundle-Vendor: CONNOR
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
com.teamcenter.rac.kernel;bundle-version="13000.1.0",
|
||||||
|
com.teamcenter.rac.aifrcp;bundle-version="13000.1.0",
|
||||||
|
com.teamcenter.rac.util;bundle-version="13000.1.0",
|
||||||
|
com.teamcenter.rac.commonclient;bundle-version="13000.1.0",
|
||||||
|
TcSoaCoreRac;bundle-version="13000.1.0",
|
||||||
|
com.teamcenter.rac.ui;bundle-version="13000.1.0",
|
||||||
|
com.teamcenter.rac.schedule;bundle-version="13000.1.0",
|
||||||
|
org.apache.poi.39;bundle-version="3.9.0",
|
||||||
|
com.teamcenter.rac.common;bundle-version="13000.1.0",
|
||||||
|
Fnd0SoaAuditManagerRac;bundle-version="13000.1.0",
|
||||||
|
TcSoaWorkflowRac;bundle-version="13000.1.0"
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
|
Automatic-Module-Name: com.connor.lidy
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Import-Package: com.teamcenter.rac.kernel,
|
||||||
|
com.teamcenter.rac.stylesheet,
|
||||||
|
org.dom4j,
|
||||||
|
org.dom4j.io
|
||||||
|
Export-Package: com.microsoft.sqlserver.jdbc,
|
||||||
|
org.jdesktop.swingx
|
||||||
|
Bundle-ClassPath: sqljdbc4.jar,
|
||||||
|
.,
|
||||||
|
lib/jxl.jar,
|
||||||
|
lib/swingx-1.6.1.jar
|
@ -0,0 +1 @@
|
|||||||
|
/com/
|
@ -0,0 +1,8 @@
|
|||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.,\
|
||||||
|
plugin.xml,\
|
||||||
|
sqljdbc4.jar,\
|
||||||
|
lib/jxl.jar,\
|
||||||
|
lib/swingx-1.6.1.jar
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,375 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse version="3.4"?>
|
||||||
|
<plugin>
|
||||||
|
<extension point="org.eclipse.ui.commands">
|
||||||
|
<command name="流程模板导出" id="WorkflowReportHandler"/>
|
||||||
|
<command name="审签信息导出" id="WorkMemberReportHandler"/>
|
||||||
|
<command name="竞品分析报表导出" id="CompetitiveReportHandler"/>
|
||||||
|
<command name="专利申请维护明细表导出" id="PatentApplyReportHandler"/>
|
||||||
|
<command name="项目运行跟踪表-产品类" id="ProjectBoardHandler"/>
|
||||||
|
<command name="项目运行跟踪表-技术类" id="TechProjectBoardHandler"/>
|
||||||
|
<command name="项目文档归档明细-产品类" id="ProjectDocReportHandler"/>
|
||||||
|
<command name="项目文档归档明细-技术类" id="TechProjectDocReportHandler"/>
|
||||||
|
<command name="代码创建报表" id="CodeCreateReportHandler"/>
|
||||||
|
<command name="物料数据明细" id="MaterialsListReportHandler"/>
|
||||||
|
<command name="有效数据报表" id="EffectiveDataReportHandler"/>
|
||||||
|
<command name="审核错误明细" id="RejectedListReportHandler"/>
|
||||||
|
<command name="审核错误统计表" id="RejectedCountReportHandler"/>
|
||||||
|
<command name="新建与更改统计" id="NewAndChangedReportHandler"/>
|
||||||
|
<command name="产品型号更改表" id="TypeChangedReportHandler"/>
|
||||||
|
<command name="使用于机型清单" id="UsedbyProductReportHandler"/>
|
||||||
|
<command name="游离物料输出" id="InvalidListReportHandler"/>
|
||||||
|
<command name="标准化系数报表" id="StandardRateReportHandler"/>
|
||||||
|
<command name="物料父级使用清单" id="ParentListReportHandler"/>
|
||||||
|
<command name="型谱结构创建" id="SpectrumStructureHandler"/>
|
||||||
|
<command name="物料设计文档关联" id="PictureMaterialSaveHandler"/>
|
||||||
|
<command name="物料项目重新选择" id="PictureMaterialHandler"/>
|
||||||
|
<command name="查询审批意见" id="QueryTaskOpinionHandler"/>
|
||||||
|
<command name="产品明细表" id="ProductListReportHandler"/>
|
||||||
|
<command name="我执行的工作流程历史" id="WorkflowHistoryHandler"/>
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.ui.handlers">
|
||||||
|
<handler commandId="WorkflowReportHandler" class="com.connor.lidy.workflow.WorkflowReportHandler"/>
|
||||||
|
<handler commandId="WorkMemberReportHandler" class="com.connor.lidy.workflow.WorkMemberReportHandler"/>
|
||||||
|
<handler commandId="CompetitiveReportHandler" class="com.connor.lidy.report.CompetitiveReportHandler"/>
|
||||||
|
<handler commandId="PatentApplyReportHandler" class="com.connor.lidy.report.CompetitiveReportHandler"/>
|
||||||
|
<handler commandId="ProjectBoardHandler" class="com.connor.lidy.report.ProjectBoardHandler"/>
|
||||||
|
<handler commandId="TechProjectBoardHandler" class="com.connor.lidy.report.TechProjectBoardHandler"/>
|
||||||
|
<handler commandId="TechProjectDocReportHandler" class="com.connor.lidy.report.TechProjectDocReportHandler"/>
|
||||||
|
<handler commandId="ProjectDocReportHandler" class="com.connor.lidy.report.ProjectDocReportHandler"/>
|
||||||
|
<handler commandId="CodeCreateReportHandler" class="com.connor.lidy.workflow.CodeCreateReportHandler"/>
|
||||||
|
<handler commandId="MaterialsListReportHandler" class="com.connor.lidy.workflow.MaterialsListReportHandler"/>
|
||||||
|
<handler commandId="EffectiveDataReportHandler" class="com.connor.lidy.workflow.EffectiveDataReportHandler"/>
|
||||||
|
<handler commandId="RejectedListReportHandler" class="com.connor.lidy.workflow.RejectedListReportHandler"/>
|
||||||
|
<handler commandId="RejectedCountReportHandler" class="com.connor.lidy.workflow.RejectedCountReportHandler"/>
|
||||||
|
<handler commandId="NewAndChangedReportHandler" class="com.connor.lidy.workflow.NewAndChangedReportHandler"/>
|
||||||
|
<handler commandId="TypeChangedReportHandler" class="com.connor.lidy.workflow.TypeChangedReportHandler"/>
|
||||||
|
<handler commandId="UsedbyProductReportHandler" class="com.connor.lidy.report.UsedbyProductReportHandler"/>
|
||||||
|
<handler commandId="InvalidListReportHandler" class="com.connor.lidy.workflow.InvalidListReportHandler"/>
|
||||||
|
<handler commandId="StandardRateReportHandler" class="com.connor.lidy.report.StandardRateReportHandler"/>
|
||||||
|
<handler commandId="ParentListReportHandler" class="com.connor.lidy.report.ParentListReportHandler"/>
|
||||||
|
<handler commandId="SpectrumStructureHandler" class="com.connor.lidy.create.SpectrumStructureHandler"/>
|
||||||
|
<handler commandId="PictureMaterialSaveHandler" class="com.connor.lidy.create.PictureMaterialSaveHandler"/>
|
||||||
|
<handler commandId="PictureMaterialHandler" class="com.connor.lidy.create.PictureMaterialHandler"/>
|
||||||
|
<handler commandId="QueryTaskOpinionHandler" class="com.connor.lidy.task.QueryTaskOpinionHandler"/>
|
||||||
|
<handler commandId="ProductListReportHandler" class="com.connor.lidy.report.ProductListReportHandler"/>
|
||||||
|
<handler commandId="WorkflowHistoryHandler" class="com.connor.lidy.workflow.WorkflowHistoryHandler"/>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.bindings">
|
||||||
|
<key commandId="com.connor.chint.sap2.commands.TestCommand"
|
||||||
|
sequence="M3+D"
|
||||||
|
schemeId="com.teamcenter.rac.scheme">
|
||||||
|
</key>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.menus">
|
||||||
|
|
||||||
|
<!--menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions"-->
|
||||||
|
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||||
|
<menu id="lidyReport" label="报表菜单"/>
|
||||||
|
</menuContribution>
|
||||||
|
<menuContribution locationURI="menu:lidyReport?after=additions">
|
||||||
|
<command commandId="WorkflowReportHandler" label="流程模板导出" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="WorkflowReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="WorkMemberReportHandler" label="审签信息导出" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="WorkMemberReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="CompetitiveReportHandler" label="竞品分析报表导出" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="CompetitiveReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="PatentApplyReportHandler" label="专利申请维护明细表导出" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="PatentApplyReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ProjectBoardHandler" label="项目运行跟踪表-产品类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ProjectBoardHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="TechProjectBoardHandler" label="项目运行跟踪表-技术类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="TechProjectBoardHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="TechProjectDocReportHandler" label="项目文档归档明细-技术类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="TechProjectDocReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ProjectDocReportHandler" label="项目文档归档明细-产品类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ProjectDocReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="CodeCreateReportHandler" label="代码创建报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="CodeCreateReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="MaterialsListReportHandler" label="物料数据明细" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="MaterialsListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="EffectiveDataReportHandler" label="有效数据报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="EffectiveDataReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="RejectedListReportHandler" label="审核错误明细" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="RejectedListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="RejectedCountReportHandler" label="审核错误统计表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="RejectedCountReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="NewAndChangedReportHandler" label="新建与更改统计" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="NewAndChangedReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="TypeChangedReportHandler" label="产品型号更改表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="TypeChangedReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="UsedbyProductReportHandler" label="使用于机型清单" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="UsedbyProductReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="InvalidListReportHandler" label="游离物料输出" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="InvalidListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="StandardRateReportHandler" label="标准化系数报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="StandardRateReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ParentListReportHandler" label="物料父级使用清单" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ParentListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="SpectrumStructureHandler" label="型谱结构创建" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="SpectrumStructureHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="PictureMaterialSaveHandler" label="物料设计文档关联" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="PictureMaterialSaveHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="PictureMaterialHandler" label="物料项目重新选择" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="PictureMaterialHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ProductListReportHandler" label="产品明细表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ProductListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<!--command commandId="WorkflowHistoryHandler" label="我执行的工作流程历史" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="WorkflowHistoryHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="QueryTaskOpinionHandler" label="查询审批意见" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="QueryTaskOpinionHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command-->
|
||||||
|
</menuContribution>
|
||||||
|
</extension>
|
||||||
|
</plugin>
|
@ -0,0 +1,439 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse version="3.4"?>
|
||||||
|
<plugin>
|
||||||
|
<extension point="org.eclipse.ui.commands">
|
||||||
|
<command name="流程模板报表" id="WorkflowReportHandler"/>
|
||||||
|
<command name="流程模板节点报表" id="WorkMemberReportHandler"/>
|
||||||
|
<command name="竞品分析报表" id="CompetitiveReportHandler"/>
|
||||||
|
<command name="专利申请维护明细表导出" id="PatentApplyReportHandler"/>
|
||||||
|
<command name="项目运行跟踪表-产品类" id="ProjectBoardHandler"/>
|
||||||
|
<command name="项目运行跟踪表-技术类" id="TechProjectBoardHandler"/>
|
||||||
|
<command name="项目文档归档明细-产品类" id="ProjectDocReportHandler"/>
|
||||||
|
<command name="项目文档归档明细-技术类" id="TechProjectDocReportHandler"/>
|
||||||
|
<command name="代码创建报表" id="CodeCreateReportHandler"/>
|
||||||
|
<command name="物料数据明细报表" id="MaterialsListReportHandler"/>
|
||||||
|
<command name="有效数据报表" id="EffectiveDataReportHandler"/>
|
||||||
|
<command name="审核错误明细报表" id="RejectedListReportHandler"/>
|
||||||
|
<command name="审核错误统计报表" id="RejectedCountReportHandler"/>
|
||||||
|
<command name="新建与更改统计报表" id="NewAndChangedReportHandler"/>
|
||||||
|
<command name="产品型号更改表" id="TypeChangedReportHandler"/>
|
||||||
|
<command name="使用于机型清单" id="UsedbyProductReportHandler"/>
|
||||||
|
<command name="游离物料报表" id="InvalidListReportHandler"/>
|
||||||
|
<command name="标准化系数报表" id="StandardRateReportHandler"/>
|
||||||
|
<command name="物料父级使用清单" id="ParentListReportHandler"/>
|
||||||
|
<command name="型谱结构创建" id="SpectrumStructureHandler"/>
|
||||||
|
<command name="物料设计文档关联" id="PictureMaterialSaveHandler"/>
|
||||||
|
<command name="项目表单更新" id="PictureMaterialHandler"/>
|
||||||
|
<command name="查询流程审批意见" id="QueryTaskOpinionHandler"/>
|
||||||
|
<command name="产品明细表" id="ProductListReportHandler"/>
|
||||||
|
<command name="我执行的工作流程历史" id="WorkflowHistoryHandler"/>
|
||||||
|
<command name="批量发起流程" id="BatchTaskCreateHandler"/>
|
||||||
|
<command name="查看最新发布设计文档" id="FindDesignHandler"/>
|
||||||
|
<command name="标准化审核" id="AssignProjectHandler"/>
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.ui.handlers">
|
||||||
|
<handler commandId="WorkflowReportHandler" class="com.connor.lidy.workflow.WorkflowReportHandler"/>
|
||||||
|
<handler commandId="WorkMemberReportHandler" class="com.connor.lidy.workflow.WorkMemberReportHandler"/>
|
||||||
|
<handler commandId="CompetitiveReportHandler" class="com.connor.lidy.report.CompetitiveReportHandler"/>
|
||||||
|
<handler commandId="PatentApplyReportHandler" class="com.connor.lidy.report.CompetitiveReportHandler"/>
|
||||||
|
<handler commandId="ProjectBoardHandler" class="com.connor.lidy.report.ProjectBoardHandler"/>
|
||||||
|
<handler commandId="TechProjectBoardHandler" class="com.connor.lidy.report.TechProjectBoardHandler"/>
|
||||||
|
<handler commandId="TechProjectDocReportHandler" class="com.connor.lidy.report.TechProjectDocReportHandler"/>
|
||||||
|
<handler commandId="ProjectDocReportHandler" class="com.connor.lidy.report.ProjectDocReportHandler"/>
|
||||||
|
<handler commandId="CodeCreateReportHandler" class="com.connor.lidy.workflow.CodeCreateReportHandler"/>
|
||||||
|
<handler commandId="MaterialsListReportHandler" class="com.connor.lidy.workflow.MaterialsListReportHandler"/>
|
||||||
|
<handler commandId="EffectiveDataReportHandler" class="com.connor.lidy.workflow.EffectiveDataReportHandler"/>
|
||||||
|
<handler commandId="RejectedListReportHandler" class="com.connor.lidy.workflow.RejectedListReportHandler"/>
|
||||||
|
<handler commandId="RejectedCountReportHandler" class="com.connor.lidy.workflow.RejectedCountReportHandler"/>
|
||||||
|
<handler commandId="NewAndChangedReportHandler" class="com.connor.lidy.workflow.NewAndChangedReportHandler"/>
|
||||||
|
<handler commandId="TypeChangedReportHandler" class="com.connor.lidy.workflow.TypeChangedReportHandler"/>
|
||||||
|
<handler commandId="UsedbyProductReportHandler" class="com.connor.lidy.report.UsedbyProductReportHandler"/>
|
||||||
|
<handler commandId="InvalidListReportHandler" class="com.connor.lidy.workflow.InvalidListReportHandler"/>
|
||||||
|
<handler commandId="StandardRateReportHandler" class="com.connor.lidy.report.StandardRateReportHandler"/>
|
||||||
|
<handler commandId="ParentListReportHandler" class="com.connor.lidy.report.ParentListReportHandler"/>
|
||||||
|
<handler commandId="SpectrumStructureHandler" class="com.connor.lidy.create.SpectrumStructureHandler"/>
|
||||||
|
<handler commandId="PictureMaterialSaveHandler" class="com.connor.lidy.create.PictureMaterialSaveHandler"/>
|
||||||
|
<handler commandId="PictureMaterialHandler" class="com.connor.lidy.create.PictureMaterialHandler"/>
|
||||||
|
<handler commandId="QueryTaskOpinionHandler" class="com.connor.lidy.task.QueryTaskOpinionHandler"/>
|
||||||
|
<handler commandId="ProductListReportHandler" class="com.connor.lidy.report.ProductListReportHandler"/>
|
||||||
|
<handler commandId="WorkflowHistoryHandler" class="com.connor.lidy.workflow.WorkflowHistoryHandler"/>
|
||||||
|
<handler commandId="BatchTaskCreateHandler" class="com.connor.lidy.workflow.BatchTaskCreateHandler"/>
|
||||||
|
<handler commandId="FindDesignHandler" class="com.connor.lidy.dialog.FindDesignHandler"/>
|
||||||
|
<handler commandId="AssignProjectHandler" class="com.connor.lidy.dialog.StandardHandler"/>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.bindings">
|
||||||
|
<key commandId="com.connor.chint.sap2.commands.TestCommand"
|
||||||
|
sequence="M3+D"
|
||||||
|
schemeId="com.teamcenter.rac.scheme">
|
||||||
|
</key>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.menus">
|
||||||
|
|
||||||
|
<menuContribution locationURI="menu:cn.net.connor.ml.plm.menus3?after=additions">
|
||||||
|
<command commandId="BatchTaskCreateHandler" label="批量发起流程" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="BatchTaskCreateHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="FindDesignHandler" label="查看最新发布设计文档" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<and>
|
||||||
|
<or>
|
||||||
|
<reference definitionId="com.teamcenter.rac.ui.inMainPerspective"/>
|
||||||
|
<reference definitionId="com.teamcenter.rac.pse.inMainView"/>
|
||||||
|
</or>
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="FindDesignHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</and>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
<!--menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions"-->
|
||||||
|
<!--menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||||
|
<menu id="lidyReport" label="报表菜单"/>
|
||||||
|
</menuContribution>
|
||||||
|
<menuContribution locationURI="menu:lidyReport?after=additions">
|
||||||
|
<command commandId="WorkflowReportHandler" label="流程模板报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="WorkflowReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="WorkMemberReportHandler" label="流程模板节点报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="WorkMemberReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="CompetitiveReportHandler" label="竞品分析报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="CompetitiveReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="PatentApplyReportHandler" label="专利申请维护明细表导出" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="PatentApplyReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ProjectBoardHandler" label="项目运行跟踪表-产品类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ProjectBoardHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="TechProjectBoardHandler" label="项目运行跟踪表-技术类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="TechProjectBoardHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="TechProjectDocReportHandler" label="项目文档归档明细-技术类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="TechProjectDocReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ProjectDocReportHandler" label="项目文档归档明细-产品类" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ProjectDocReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="CodeCreateReportHandler" label="代码创建报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="CodeCreateReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="MaterialsListReportHandler" label="物料数据明细报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="MaterialsListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="EffectiveDataReportHandler" label="有效数据报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="EffectiveDataReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="RejectedListReportHandler" label="审核错误明细报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="RejectedListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="RejectedCountReportHandler" label="审核错误统计报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="RejectedCountReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="NewAndChangedReportHandler" label="新建与更改统计报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="NewAndChangedReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="TypeChangedReportHandler" label="产品型号更改表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="TypeChangedReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="UsedbyProductReportHandler" label="使用于机型清单" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="UsedbyProductReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="InvalidListReportHandler" label="游离物料报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="InvalidListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="StandardRateReportHandler" label="标准化系数报表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="StandardRateReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ParentListReportHandler" label="物料父级使用清单" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ParentListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="SpectrumStructureHandler" label="型谱结构创建" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="SpectrumStructureHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="PictureMaterialSaveHandler" label="物料设计文档关联" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="PictureMaterialSaveHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="PictureMaterialHandler" label="物料项目重新选择" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="PictureMaterialHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="ProductListReportHandler" label="产品明细表" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="ProductListReportHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="WorkflowHistoryHandler" label="我执行的工作流程历史" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="WorkflowHistoryHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="QueryTaskOpinionHandler" label="查询审批意见" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="QueryTaskOpinionHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution-->
|
||||||
|
<menuContribution locationURI="popup:org.eclipse.ui.popup.any">
|
||||||
|
<command commandId="QueryTaskOpinionHandler" label="查询流程审批意见" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="QueryTaskOpinionHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command commandId="AssignProjectHandler" label="标准化审核" style="push">
|
||||||
|
<visibleWhen checkEnabled="true">
|
||||||
|
<with variable="rac_command_suppression">
|
||||||
|
<not>
|
||||||
|
<iterate operator="or">
|
||||||
|
<equals value="AssignProjectHandler">
|
||||||
|
</equals>
|
||||||
|
</iterate>
|
||||||
|
</not>
|
||||||
|
</with>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
|
</extension>
|
||||||
|
</plugin>
|
Binary file not shown.
@ -0,0 +1,44 @@
|
|||||||
|
package com.connor.lidy;
|
||||||
|
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The activator class controls the plug-in life cycle
|
||||||
|
*/
|
||||||
|
public class Activator extends AbstractUIPlugin {
|
||||||
|
|
||||||
|
// The plug-in ID
|
||||||
|
public static final String PLUGIN_ID = "com.connor.lidy"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// The shared instance
|
||||||
|
private static Activator plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor
|
||||||
|
*/
|
||||||
|
public Activator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
super.start(context);
|
||||||
|
plugin = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
plugin = null;
|
||||||
|
super.stop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared instance
|
||||||
|
*
|
||||||
|
* @return the shared instance
|
||||||
|
*/
|
||||||
|
public static Activator getDefault() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,233 @@
|
|||||||
|
package com.connor.lidy.create;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class DbPool {
|
||||||
|
|
||||||
|
public static Connection connection = null;
|
||||||
|
public static PreparedStatement ps = null;
|
||||||
|
public static ResultSet rs = null;
|
||||||
|
|
||||||
|
private static DbPool instance = null;
|
||||||
|
|
||||||
|
public static synchronized Connection getConnection() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new DbPool();
|
||||||
|
}
|
||||||
|
return instance._getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Connection _getConnection() {
|
||||||
|
try {
|
||||||
|
String sDBDriver = null;
|
||||||
|
String sConnection = null;
|
||||||
|
String sUser = null;
|
||||||
|
String sPassword = null;
|
||||||
|
// Properties p = new Properties();
|
||||||
|
// InputStream is = getClass().getResourceAsStream(
|
||||||
|
// "/sqlconn.properties");
|
||||||
|
// p.load(is);
|
||||||
|
// sDBDriver = p.getProperty("DBDriver", "1");
|
||||||
|
// sConnection = p.getProperty("Connection", "2");
|
||||||
|
// sUser = p.getProperty("User", "");
|
||||||
|
// sPassword = p.getProperty("Password", "");
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
TCPreferenceService service = session.getPreferenceService();
|
||||||
|
String[] array = service.getStringValues("TC13_SqlServer_Link");
|
||||||
|
//TCPreferenceService.TC_preference_site, "TC13_SqlServer_Link");
|
||||||
|
|
||||||
|
if (array != null)
|
||||||
|
{
|
||||||
|
for (String str : array) {
|
||||||
|
// System.out.println(" ORACLE = " + str);
|
||||||
|
if (str != null && str.startsWith("DBDriver=")) {
|
||||||
|
sDBDriver = str.substring(str.indexOf("=") + 1,
|
||||||
|
str.length());
|
||||||
|
} else if (str != null && str.startsWith("Connection=")) {
|
||||||
|
sConnection = str.substring(str.indexOf("=") + 1, str.length());
|
||||||
|
} else if (str != null && str.startsWith("User=")) {
|
||||||
|
sUser = str.substring(str.indexOf("=") + 1,
|
||||||
|
str.length());
|
||||||
|
} else if (str != null
|
||||||
|
&& str.startsWith("Password=")) {
|
||||||
|
sPassword = str.substring(str.indexOf("=") + 1,
|
||||||
|
str.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// String driver_temp = reg.getString("ORACEL_DRIVER");
|
||||||
|
// String url = reg.getString("ORACEL_URL");// getProperties("URL");
|
||||||
|
// String dbName = reg.getString("ORACEL_NAME");//
|
||||||
|
// Util.getProperties("dbName");
|
||||||
|
// String dbPassword = reg.getString("ORACEL_PASSWORD");//
|
||||||
|
// Util.getProperties("dbPassword");
|
||||||
|
|
||||||
|
if (sDBDriver == null || sConnection == null || sUser == null
|
||||||
|
|| sPassword == null) {
|
||||||
|
|
||||||
|
MessageBox.post("请检查数据库首选项是否配置正确", "错误提示", MessageBox.ERROR);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Class.forName(sDBDriver);
|
||||||
|
connection = DriverManager.getConnection(sConnection, sUser,
|
||||||
|
sPassword);
|
||||||
|
return connection;
|
||||||
|
} catch (Exception se) {
|
||||||
|
System.out.println(se);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void executeUpdateSql(String sql) throws SQLException {
|
||||||
|
Statement st = connection.createStatement();
|
||||||
|
try {
|
||||||
|
connection.setAutoCommit(false);
|
||||||
|
System.out.println("sql===" + sql);
|
||||||
|
st.executeUpdate(sql);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// System.out.println(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
if (st != null)
|
||||||
|
st.close();
|
||||||
|
connection.rollback();
|
||||||
|
connection.close();
|
||||||
|
} finally {
|
||||||
|
if (st != null)
|
||||||
|
st.close();
|
||||||
|
// connection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void executeDeleteSql(String sql) throws SQLException {
|
||||||
|
Statement st = connection.createStatement();
|
||||||
|
try {
|
||||||
|
connection.setAutoCommit(false);
|
||||||
|
System.out.println("sql===" + sql);
|
||||||
|
st.executeUpdate(sql);
|
||||||
|
connection.commit();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
if (st != null)
|
||||||
|
st.close();
|
||||||
|
connection.rollback();
|
||||||
|
connection.close();
|
||||||
|
} finally {
|
||||||
|
if (st != null)
|
||||||
|
st.close();
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultSet executeSelectSql(String sql) throws SQLException {
|
||||||
|
Statement st = connection.createStatement();
|
||||||
|
try {
|
||||||
|
connection.setAutoCommit(false);
|
||||||
|
System.out.println("sql===" + sql);
|
||||||
|
rs = st.executeQuery(sql);
|
||||||
|
// conn.commit();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
if (st != null)
|
||||||
|
st.close();
|
||||||
|
connection.rollback();
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
return rs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源
|
||||||
|
*/
|
||||||
|
public final static void free(ResultSet resultSet) {
|
||||||
|
free(resultSet, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源
|
||||||
|
*/
|
||||||
|
public final static void free(Statement statement) {
|
||||||
|
free(null, statement, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源
|
||||||
|
*/
|
||||||
|
public final static void free(Connection connection) {
|
||||||
|
free(null, null, connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源
|
||||||
|
*/
|
||||||
|
public final static void free(ResultSet resultSet, Statement statement) {
|
||||||
|
free(resultSet, statement, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源
|
||||||
|
*/
|
||||||
|
public final static void free(Statement statement, Connection connection) {
|
||||||
|
free(null, statement, connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源(不传参数默认部分)
|
||||||
|
*/
|
||||||
|
public final static void free() {
|
||||||
|
free(DbPool.rs, DbPool.ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源(全部释放)
|
||||||
|
*/
|
||||||
|
public final static void freeAll() {
|
||||||
|
free(DbPool.rs, DbPool.ps, DbPool.connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放资源(传满参数也要全部释放)
|
||||||
|
*/
|
||||||
|
public final static void free(ResultSet resultSet, Statement statement,
|
||||||
|
Connection connection) {
|
||||||
|
try {
|
||||||
|
if (resultSet != null) {
|
||||||
|
try {
|
||||||
|
resultSet.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (statement != null) {
|
||||||
|
try {
|
||||||
|
statement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (connection != null) {
|
||||||
|
try {
|
||||||
|
connection.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.connor.lidy.create;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class PictureMaterialHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("PictureMaterialHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
new Thread() {
|
||||||
|
public void run(){
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
InterfaceAIFComponent target = app.getTargetComponent();
|
||||||
|
if(target==null || !(target instanceof TCComponentItemRevision)) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) target;
|
||||||
|
// TCComponentItemRevision[] revs = rev.getItem().getWorkingItemRevisions();
|
||||||
|
// if(revs.length==0) {
|
||||||
|
// MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// System.out.println("Working:"+revs[0]);
|
||||||
|
// if(!rev.equals(revs[revs.length-1])) {
|
||||||
|
// MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
if(rev.getReferenceListProperty("release_status_list").length>0) {
|
||||||
|
MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!rev.getProperty("item_revision_id").equals("A")) {
|
||||||
|
AIFComponentContext[] forms = rev.getChildren("ML8_ProjectRelation");
|
||||||
|
if(forms.length>0) {
|
||||||
|
MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String pref = "ML8_PictureMaterial";
|
||||||
|
String options[] = session.getPreferenceService().getStringValues(pref);
|
||||||
|
if(options==null || options.length==0) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String type = rev.getItem().getType();
|
||||||
|
boolean props = false;
|
||||||
|
for(String s : options) {
|
||||||
|
if(s.equals(type))
|
||||||
|
props = true;
|
||||||
|
}
|
||||||
|
if(!props) {
|
||||||
|
MessageBox.post(desktop, "选择的版本类型不在范围内", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AIFComponentContext[] children = rev.getChildren("ML8_ProjectRelation");
|
||||||
|
if(children.length>0) {
|
||||||
|
int choose = JOptionPane.showOptionDialog(desktop, "选中对象已有项目表单,是否替换?", "提示",
|
||||||
|
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new String[] {"是","否"}, "结束操作");
|
||||||
|
if(choose!=0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new PictureMaterialDialog(session, rev, options[0], null);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.connor.lidy.create;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.kernel.TCUserService;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class PictureMaterialOperation extends AbstractAIFOperation{
|
||||||
|
private Map<Integer, TCComponent> tableMap;
|
||||||
|
private int row;
|
||||||
|
private TCComponentItemRevision target;
|
||||||
|
private AbstractAIFDialog dialog;
|
||||||
|
private String exec;
|
||||||
|
private String search;
|
||||||
|
private TCSession session;
|
||||||
|
public PictureMaterialOperation(Map<Integer, TCComponent> tableMap,int row,TCComponentItemRevision target,AbstractAIFDialog dialog,String search,String exec,TCSession session) {
|
||||||
|
this.tableMap=tableMap;
|
||||||
|
this.row=row;
|
||||||
|
this.target=target;
|
||||||
|
this.dialog=dialog;
|
||||||
|
this.exec = exec;
|
||||||
|
this.search = search;
|
||||||
|
this.session = session;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void executeOperation() throws Exception {
|
||||||
|
switch (exec) {
|
||||||
|
case "µ¼³ö":
|
||||||
|
export();
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "²éѯ":
|
||||||
|
((PictureMaterialDialog)dialog).search(search);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void export() throws TCException {
|
||||||
|
TCComponent comp = tableMap.get(row);
|
||||||
|
AIFComponentContext[] children = target.getChildren("ML8_ProjectRelation");
|
||||||
|
if(children.length>0) {
|
||||||
|
for(AIFComponentContext c : children)
|
||||||
|
target.remove("ML8_ProjectRelation", (TCComponent)c.getComponent());
|
||||||
|
}
|
||||||
|
target.add("ML8_ProjectRelation", comp);
|
||||||
|
|
||||||
|
TCUserService userservice = session.getUserService();
|
||||||
|
Object[] obj = new Object[1];
|
||||||
|
obj[0] = target;
|
||||||
|
Object res = userservice.call("updateFormChangeDesc", obj);
|
||||||
|
|
||||||
|
|
||||||
|
// AIFComponentContext[] forms = comp.getChildren("ML8_ProjectRelation");
|
||||||
|
// System.out.println("forms:"+forms.length);
|
||||||
|
// if(forms.length>0) {
|
||||||
|
// for(AIFComponentContext c : forms)
|
||||||
|
// target.add("ML8_ProjectRelation", (TCComponent)c.getComponent());
|
||||||
|
// }
|
||||||
|
MessageBox.post(dialog, "ÐÞ¸ÄÍê³É", "INFO", MessageBox.INFORMATION);
|
||||||
|
dialog.dispose();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,236 @@
|
|||||||
|
package com.connor.lidy.create;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Vector;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentPseudoFolder;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.stylesheet.PropertyDateComponent;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class PictureMaterialSaveDialog extends AbstractAIFDialog {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private TCSession session;
|
||||||
|
private JButton searchBtn;
|
||||||
|
private JButton exportBtn;
|
||||||
|
private JButton closeBtn;
|
||||||
|
private JTable impTable;
|
||||||
|
private DefaultTableModel impModel;
|
||||||
|
private Map<String, JComponent> compMap;
|
||||||
|
private Map<Integer, TCComponent> tableMap;
|
||||||
|
|
||||||
|
public PictureMaterialSaveDialog(TCSession session, TCComponentItemRevision target, String search, String[] options) throws Exception {
|
||||||
|
super(AIFUtility.getActiveDesktop());
|
||||||
|
this.session = session;
|
||||||
|
compMap = new HashMap<>();
|
||||||
|
tableMap = new HashMap<>();
|
||||||
|
setTitle("有图件物料另存");
|
||||||
|
|
||||||
|
JPanel msgPanel = new JPanel(new GridLayout(0,3,2,5));
|
||||||
|
// msgPanel.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), "时间表属性"));
|
||||||
|
|
||||||
|
JLabel label1 = new JLabel("产品代号");
|
||||||
|
label1.setPreferredSize(new Dimension(100, 23));
|
||||||
|
JPanel propPanel1 = new JPanel(new BorderLayout());
|
||||||
|
propPanel1.add(BorderLayout.WEST, label1);
|
||||||
|
JTextField field1 = new JTextField();
|
||||||
|
field1.setPreferredSize(new Dimension(118, 23));
|
||||||
|
propPanel1.add(BorderLayout.CENTER, field1);
|
||||||
|
msgPanel.add(propPanel1);
|
||||||
|
compMap.put(label1.getText(), field1);
|
||||||
|
JLabel label2 = new JLabel("产品型号");
|
||||||
|
label2.setPreferredSize(new Dimension(100, 23));
|
||||||
|
JPanel propPanel2 = new JPanel(new BorderLayout());
|
||||||
|
propPanel2.add(BorderLayout.WEST, label2);
|
||||||
|
JTextField field2 = new JTextField();
|
||||||
|
field2.setPreferredSize(new Dimension(118, 23));
|
||||||
|
propPanel2.add(BorderLayout.CENTER, field2);
|
||||||
|
msgPanel.add(propPanel2);
|
||||||
|
compMap.put(label2.getText(), field2);
|
||||||
|
JLabel label3 = new JLabel("图号");
|
||||||
|
label3.setPreferredSize(new Dimension(100, 23));
|
||||||
|
JPanel propPanel3 = new JPanel(new BorderLayout());
|
||||||
|
propPanel3.add(BorderLayout.WEST, label3);
|
||||||
|
JTextField field3 = new JTextField();
|
||||||
|
field3.setPreferredSize(new Dimension(118, 23));
|
||||||
|
propPanel3.add(BorderLayout.CENTER, field3);
|
||||||
|
msgPanel.add(propPanel3);
|
||||||
|
compMap.put(label3.getText(), field3);
|
||||||
|
|
||||||
|
searchBtn = new JButton("查询");
|
||||||
|
exportBtn = new JButton("确定");
|
||||||
|
closeBtn = new JButton("关闭");
|
||||||
|
JPanel btnPanel = new JPanel(new FlowLayout());
|
||||||
|
btnPanel.add(searchBtn);
|
||||||
|
btnPanel.add(exportBtn);
|
||||||
|
btnPanel.add(closeBtn);
|
||||||
|
JPanel topPanel = new JPanel(new BorderLayout());
|
||||||
|
topPanel.add(BorderLayout.CENTER, msgPanel);
|
||||||
|
topPanel.add(BorderLayout.SOUTH, btnPanel);
|
||||||
|
|
||||||
|
String[] tableHeader = new String[] { "序号", "文档编码", "版本", "文档名称", "项目名称", "产品代号", "材料", "净重", "物料名称后缀" };
|
||||||
|
|
||||||
|
impModel = new DefaultTableModel(tableHeader, 0);
|
||||||
|
impTable = new JTable() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int row, int col) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
impTable.getTableHeader().setReorderingAllowed(false);
|
||||||
|
impTable.setFillsViewportHeight(true);
|
||||||
|
// impTable.setEnabled(false);
|
||||||
|
impTable.setEnabled(true);
|
||||||
|
// impTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
|
||||||
|
impTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||||
|
impTable.setModel(impModel);
|
||||||
|
for(int i=1; i<impModel.getColumnCount(); i++)
|
||||||
|
impTable.getColumnModel().getColumn(i).setPreferredWidth(150);
|
||||||
|
JScrollPane tablePanel = new JScrollPane(impTable);
|
||||||
|
|
||||||
|
addActionListener(target, search, options);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
add(BorderLayout.NORTH, topPanel);
|
||||||
|
add(BorderLayout.CENTER, tablePanel);
|
||||||
|
pack();
|
||||||
|
setSize(new Dimension(1300, 700));
|
||||||
|
setDefaultLookAndFeelDecorated(true);
|
||||||
|
Dimension screen = getToolkit().getScreenSize();
|
||||||
|
setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2);
|
||||||
|
// setAlwaysOnTop(true);
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
private void addActionListener(TCComponentItemRevision target, String search, String[] options) {
|
||||||
|
final AbstractAIFDialog dialog = this;
|
||||||
|
searchBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
try {
|
||||||
|
if(impModel.getRowCount()>0) {
|
||||||
|
for(int i=impModel.getRowCount(); i>0; i--)
|
||||||
|
impModel.removeRow(i-1);
|
||||||
|
}
|
||||||
|
Vector<String> keyV = new Vector<>();
|
||||||
|
Vector<String> valueV = new Vector<>();
|
||||||
|
for(Entry<String, JComponent> e : compMap.entrySet()) {
|
||||||
|
JComponent c = e.getValue();
|
||||||
|
String text = "";
|
||||||
|
if(c instanceof JTextField)
|
||||||
|
text = ((JTextField)c).getText();
|
||||||
|
else if(c instanceof PropertyDateComponent)
|
||||||
|
text = ((PropertyDateComponent)c).getDateViewModel().getDateString();
|
||||||
|
else
|
||||||
|
text = ((JComboBox<?>)c).getSelectedItem().toString();
|
||||||
|
if(text!=null && !text.isEmpty()) {
|
||||||
|
keyV.add(e.getKey());
|
||||||
|
valueV.add("*"+text+"*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(keyV.size()==0)
|
||||||
|
throw new Exception("请输入查询条件");
|
||||||
|
TCComponent[] result = TCUtil.query(session, search, keyV, valueV);
|
||||||
|
System.out.println("result:"+result.length);
|
||||||
|
for(int i=0; i<result.length; i++) {
|
||||||
|
Vector<String> v = new Vector<>();
|
||||||
|
v.add(i+1+"");//序号
|
||||||
|
v.add(result[i].getProperty("item_id"));//文档编码
|
||||||
|
v.add(result[i].getProperty("item_revision_id"));//版本
|
||||||
|
v.add(result[i].getProperty("object_name"));//文档名称
|
||||||
|
|
||||||
|
AIFComponentContext[] children = result[i].getChildren("ML8_ProjectRelation");
|
||||||
|
if(children.length>0) {
|
||||||
|
TCComponent form = (TCComponent)children[0].getComponent();
|
||||||
|
v.add(form.getProperty("object_name"));//项目名称
|
||||||
|
v.add(form.getProperty("ml8_ProductCode"));//产品代号
|
||||||
|
}else {
|
||||||
|
v.add("");//项目名称
|
||||||
|
v.add("");//产品代号
|
||||||
|
}
|
||||||
|
|
||||||
|
v.add(result[i].getProperty("ml8_Materials"));//材料
|
||||||
|
v.add(result[i].getProperty("ml8_Suttle"));//净重
|
||||||
|
v.add(result[i].getProperty("ml8_NameSuffix"));//物料名称后缀
|
||||||
|
|
||||||
|
tableMap.put(i, result[i]);
|
||||||
|
impModel.addRow(v);
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post(dialog, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
exportBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
try {
|
||||||
|
int row = impTable.getSelectedRow();
|
||||||
|
if(row<0)
|
||||||
|
throw new Exception("请选择设计文档");
|
||||||
|
TCComponent comp = tableMap.get(row);
|
||||||
|
for(String s : options) {
|
||||||
|
if(!s.contains("="))
|
||||||
|
continue;
|
||||||
|
String[] ss = s.split("=");
|
||||||
|
target.setProperty(ss[0], comp.getProperty(ss[1]));
|
||||||
|
}
|
||||||
|
AIFComponentContext[] children = target.getChildren("ML8_ProjectRelation");
|
||||||
|
if(children.length>0) {
|
||||||
|
for(AIFComponentContext c : children)
|
||||||
|
target.remove("ML8_ProjectRelation", (TCComponent)c.getComponent());
|
||||||
|
}
|
||||||
|
AIFComponentContext[] forms = comp.getChildren("ML8_ProjectRelation");
|
||||||
|
System.out.println("forms:"+forms.length);
|
||||||
|
if(forms.length>0) {
|
||||||
|
for(AIFComponentContext c : forms)
|
||||||
|
target.add("ML8_ProjectRelation", (TCComponent)c.getComponent());
|
||||||
|
}
|
||||||
|
TCComponentPseudoFolder TC_Is_Represented_By = TCUtil.getPseudoFolder(target, "TC_Is_Represented_By");
|
||||||
|
AIFComponentContext[] cs = TC_Is_Represented_By.getChildren();
|
||||||
|
if(cs.length>0) {
|
||||||
|
for(AIFComponentContext c : cs)
|
||||||
|
TC_Is_Represented_By.remove("TC_Is_Represented_By", (TCComponent)c.getComponent());
|
||||||
|
}
|
||||||
|
target.add("TC_Is_Represented_By", comp);
|
||||||
|
MessageBox.post(dialog, "修改完成", "INFO", MessageBox.INFORMATION);
|
||||||
|
dispose();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post(dialog, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
closeBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.connor.lidy.create;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class PictureMaterialSaveHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("PictureMaterialSaveHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
InterfaceAIFComponent target = app.getTargetComponent();
|
||||||
|
if(target==null || !(target instanceof TCComponentItemRevision)) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) target;
|
||||||
|
// TCComponentItemRevision[] revs = rev.getItem().getWorkingItemRevisions();
|
||||||
|
// if(revs.length==0) {
|
||||||
|
// MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// System.out.println("Working:"+revs[0]);
|
||||||
|
// if(!rev.equals(revs[revs.length-1])) {
|
||||||
|
// MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
if(rev.getReferenceListProperty("release_status_list").length>0) {
|
||||||
|
MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if(!rev.getProperty("item_revision_id").equals("A")) {
|
||||||
|
AIFComponentContext[] forms = rev.getChildren("ML8_ProjectRelation");
|
||||||
|
if(forms.length>0) {
|
||||||
|
MessageBox.post(desktop, "请选择未发布版本进行创建", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String pref = "ML8_PictureMaterialSave";
|
||||||
|
String options[] = session.getPreferenceService().getStringValues(pref);
|
||||||
|
if(options==null || options.length==0) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String type = rev.getItem().getType()+":";
|
||||||
|
String[] props = null;
|
||||||
|
for(String s : options) {
|
||||||
|
if(s.startsWith(type))
|
||||||
|
props = s.substring(type.length()).split(";");
|
||||||
|
}
|
||||||
|
if(props==null) {
|
||||||
|
MessageBox.post(desktop, "选择的版本类型不在范围内", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if(rev.getProperty("ml8_FigureNum").isEmpty()) {
|
||||||
|
MessageBox.post(desktop, "选择的版本为无图件,无法使用此功能", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
new PictureMaterialSaveDialog(session, rev, options[0], props);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.connor.lidy.create;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class SpectrumStructureHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("SpectrumStructureHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
String pref = "ML8_SpectrumStructure";
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
String options = session.getPreferenceService().getStringValue(pref);
|
||||||
|
if(options==null || options.isEmpty()) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options);//AKLAAInU5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("XMLRenderingStylesheet")) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
InterfaceAIFComponent target = app.getTargetComponent();
|
||||||
|
new SpectrumStructureDialog(session, (TCComponent)target, (TCComponentDataset)model);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.connor.lidy.dialog;
|
||||||
|
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class AssignProjectHandler extends AbstractHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException
|
||||||
|
{
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
try {
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
final InterfaceAIFComponent[] pasteTargets = app.getTargetComponents();
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
new AssignProjectDialog(session, pasteTargets);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
MessageBox.post(exception, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.dialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author vearn
|
||||||
|
*/
|
||||||
|
public class FindDesignBean {
|
||||||
|
|
||||||
|
private Object[] values;
|
||||||
|
|
||||||
|
public Object[] getValues() {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
public void setValues(Object[] values) {
|
||||||
|
this.values = values;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,346 @@
|
|||||||
|
package com.connor.lidy.dialog;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.ListSelectionModel;
|
||||||
|
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.jdesktop.swingx.decorator.HighlighterFactory;
|
||||||
|
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.ProgressReporterDialog;
|
||||||
|
import com.connor.lidy.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class FindDesignDialog extends AbstractAIFDialog {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private TCSession session;
|
||||||
|
private JButton exportBtn;
|
||||||
|
private JButton closeBtn;
|
||||||
|
private FindDesignTable impTable;
|
||||||
|
private FindDesignModel impModel;
|
||||||
|
|
||||||
|
public FindDesignDialog(TCSession session, InterfaceAIFComponent[] targets, String[] options, ProgressReporterDialog reporter) throws Exception {
|
||||||
|
super(AIFUtility.getActiveDesktop());
|
||||||
|
this.session = session;
|
||||||
|
setTitle("查看设计文档");
|
||||||
|
|
||||||
|
exportBtn = new JButton("导出");
|
||||||
|
closeBtn = new JButton("关闭");
|
||||||
|
JPanel btnPanel = new JPanel(new FlowLayout());
|
||||||
|
btnPanel.add(exportBtn);
|
||||||
|
btnPanel.add(closeBtn);
|
||||||
|
|
||||||
|
ArrayList<String[]> list = new ArrayList<>();
|
||||||
|
String[] tableHeader = new String[options.length-1];// { "物料版本", "设计文档版本" };
|
||||||
|
for(int i=1; i<options.length; i++) {
|
||||||
|
String[] sp = options[i].split("=");
|
||||||
|
tableHeader[i-1] = sp[0];
|
||||||
|
list.add(sp[1].split("\\."));
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultMutableTreeTableNode node = getBomPropertyToNode(session, topline);
|
||||||
|
DefaultMutableTreeTableNode top = new DefaultMutableTreeTableNode(new FindDesignBean());
|
||||||
|
if(targets[0] instanceof TCComponentBOMLine) {
|
||||||
|
getNode((TCComponentBOMLine) targets[0], top, list);
|
||||||
|
}else {
|
||||||
|
getNode(targets, top, list);
|
||||||
|
}
|
||||||
|
impTable = getJTreeTable(top, tableHeader);
|
||||||
|
JScrollPane tablePanel = new JScrollPane(impTable);
|
||||||
|
|
||||||
|
addActionListener(tableHeader, options[0]);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
add(BorderLayout.NORTH, btnPanel);
|
||||||
|
add(BorderLayout.CENTER, tablePanel);
|
||||||
|
pack();
|
||||||
|
setSize(new Dimension(1400, 700));
|
||||||
|
setDefaultLookAndFeelDecorated(true);
|
||||||
|
Dimension screen = getToolkit().getScreenSize();
|
||||||
|
setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2);
|
||||||
|
// setAlwaysOnTop(true);
|
||||||
|
reporter.requestCanceling();
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addActionListener(String[] heads, String uid) {
|
||||||
|
exportBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
FileInputStream input = null;
|
||||||
|
FileOutputStream output = null;
|
||||||
|
try {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
File directory = TCUtil.saveExcelChooserAsk("物料及文档明细数据"+sdf.format(new Date()));
|
||||||
|
if(directory==null)
|
||||||
|
return;
|
||||||
|
TCComponentTcFile[] files = ((TCComponentDataset)session.stringToComponent(uid)).getTcFiles();
|
||||||
|
File file = files[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
XSSFWorkbook wb = new XSSFWorkbook(input);
|
||||||
|
XSSFSheet sheet = wb.getSheetAt(0);
|
||||||
|
XSSFRow row = getRow(sheet, 0);
|
||||||
|
XSSFCell cell;
|
||||||
|
int cols = heads.length;
|
||||||
|
for(int i=0; i<cols; i++) {
|
||||||
|
cell = getCell(row, i);
|
||||||
|
cell.setCellValue(heads[i]);
|
||||||
|
}
|
||||||
|
for(int i=0; i<impTable.getRowCount(); i++) {
|
||||||
|
row = getRow(sheet, i+1);
|
||||||
|
for(int j=0; j<cols; j++) {
|
||||||
|
cell = getCell(row, j);
|
||||||
|
cell.setCellValue(impTable.getValueAt(i, j).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output = new FileOutputStream(file.getPath());
|
||||||
|
wb.write(output);
|
||||||
|
input.close();
|
||||||
|
output.close();
|
||||||
|
file.renameTo(directory);
|
||||||
|
MessageBox.post(FindDesignDialog.this, "导出完成", "INFO", MessageBox.INFORMATION);
|
||||||
|
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post(FindDesignDialog.this, "错误:" + e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}finally {
|
||||||
|
if(input!=null)
|
||||||
|
try {
|
||||||
|
input.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(output!=null)
|
||||||
|
try {
|
||||||
|
output.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
closeBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Jtable通用方法
|
||||||
|
private FindDesignTable getJTreeTable(DefaultMutableTreeTableNode node, String[] titleNames) {
|
||||||
|
int simpleLen = 100;
|
||||||
|
int totleLen = 1500;
|
||||||
|
ArrayList<Integer> isNotEditableRow = new ArrayList<Integer>();
|
||||||
|
isNotEditableRow.add(0);
|
||||||
|
isNotEditableRow.add(1);
|
||||||
|
|
||||||
|
this.impModel = new FindDesignModel(node, titleNames);
|
||||||
|
this.impModel.setIsNotEditableRow(isNotEditableRow);
|
||||||
|
//map.setColumnIdentifiers(titleNames);
|
||||||
|
|
||||||
|
FindDesignTable partsTable = new FindDesignTable(impModel);
|
||||||
|
partsTable.setIsNotEditableRow(isNotEditableRow);
|
||||||
|
partsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
|
// partsTable.setRowHeight(1, 50);
|
||||||
|
// partsTable.setRowHeight(2, 100);
|
||||||
|
partsTable.setRowHeight(30);
|
||||||
|
partsTable.expandAll(); // 展开全部节点
|
||||||
|
// 隐藏列
|
||||||
|
// partsTable.HiddenCell(0);
|
||||||
|
|
||||||
|
partsTable.getColumnModel().getColumn(0).setPreferredWidth(188); // 设置第一列宽度
|
||||||
|
partsTable.getColumnModel().getColumn(1).setPreferredWidth(150); // 设置第二列宽度
|
||||||
|
|
||||||
|
partsTable.setHighlighters(HighlighterFactory.createSimpleStriping());
|
||||||
|
|
||||||
|
if (simpleLen * titleNames.length >= totleLen) {
|
||||||
|
for (int i = 0; i < titleNames.length; i++) {
|
||||||
|
partsTable.getColumnModel().getColumn(i).setPreferredWidth(simpleLen);
|
||||||
|
}
|
||||||
|
partsTable.setAutoResizeMode(0);
|
||||||
|
} else {
|
||||||
|
partsTable.setAutoResizeMode(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return partsTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getNode(InterfaceAIFComponent[] targets, DefaultMutableTreeTableNode pnode, ArrayList<String[]> list) {
|
||||||
|
try {
|
||||||
|
for(InterfaceAIFComponent c : targets) {
|
||||||
|
FindDesignBean bean = new FindDesignBean();
|
||||||
|
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) c;
|
||||||
|
TCComponentItem item = rev.getItem();
|
||||||
|
TCComponentItemRevision drev = null;
|
||||||
|
TCComponentItem ditem = null;
|
||||||
|
AIFComponentContext[] ds = TCUtil.getPseudoFolder(rev, "TC_Is_Represented_By").getChildren();
|
||||||
|
System.out.println("rev:"+rev+"=="+ds.length);
|
||||||
|
|
||||||
|
if(ds!=null && ds.length>0) {
|
||||||
|
long time = 0;
|
||||||
|
for(AIFComponentContext d : ds) {
|
||||||
|
TCComponentItemRevision dr = (TCComponentItemRevision) d.getComponent();
|
||||||
|
TCComponent[] status = dr.getReferenceListProperty("release_status_list");
|
||||||
|
if(status==null || status.length==0)
|
||||||
|
continue;
|
||||||
|
System.out.println("status:"+status[0]);
|
||||||
|
if(!status[0].getProperty("name").equals("TCM 已发布"))//TCM_Released
|
||||||
|
continue;
|
||||||
|
long t = dr.getDateProperty("creation_date").getTime();
|
||||||
|
if(t < time)
|
||||||
|
continue;
|
||||||
|
// value = dr.toString();
|
||||||
|
drev = dr;
|
||||||
|
ditem = drev.getItem();
|
||||||
|
time = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object[] v = new Object[list.size()];
|
||||||
|
for(int i=0; i<list.size(); i++) {
|
||||||
|
String[] prop = list.get(i);
|
||||||
|
if(prop[0].equals("part")) {
|
||||||
|
if(prop[1].equals("item")) {
|
||||||
|
v[i] = item.getProperty(prop[2]);
|
||||||
|
}else if(prop[1].equals("rev")) {
|
||||||
|
v[i] = rev.getProperty(prop[2]);
|
||||||
|
}else {
|
||||||
|
v[i] = "";
|
||||||
|
}
|
||||||
|
}else if(prop[0].equals("design")) {
|
||||||
|
if(drev==null) {
|
||||||
|
v[i] = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(prop[1].equals("item")) {
|
||||||
|
v[i] = ditem.getProperty(prop[2]);
|
||||||
|
}else if(prop[1].equals("rev")) {
|
||||||
|
v[i] = drev.getProperty(prop[2]);
|
||||||
|
}else {
|
||||||
|
v[i] = "";
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
v[i] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bean.setValues(v);
|
||||||
|
DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(bean);
|
||||||
|
pnode.add(node);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getNode(TCComponentBOMLine line, DefaultMutableTreeTableNode pnode, ArrayList<String[]> list) {
|
||||||
|
try {
|
||||||
|
FindDesignBean bean = new FindDesignBean();
|
||||||
|
|
||||||
|
TCComponentItemRevision rev = line.getItemRevision();
|
||||||
|
TCComponentItem item = line.getItem();
|
||||||
|
TCComponentItemRevision drev = null;
|
||||||
|
TCComponentItem ditem = null;
|
||||||
|
AIFComponentContext[] ds = TCUtil.getPseudoFolder(rev, "TC_Is_Represented_By").getChildren();
|
||||||
|
System.out.println("line:"+line+"=="+ds.length);
|
||||||
|
|
||||||
|
if(ds!=null && ds.length>0) {
|
||||||
|
long time = 0;
|
||||||
|
for(AIFComponentContext d : ds) {
|
||||||
|
TCComponentItemRevision dr = (TCComponentItemRevision) d.getComponent();
|
||||||
|
TCComponent[] status = dr.getReferenceListProperty("release_status_list");
|
||||||
|
if(status==null || status.length==0)
|
||||||
|
continue;
|
||||||
|
System.out.println("status:"+status[0]);
|
||||||
|
if(!status[0].getProperty("name").equals("TCM 已发布"))//TCM_Released
|
||||||
|
continue;
|
||||||
|
long t = dr.getDateProperty("creation_date").getTime();
|
||||||
|
if(t < time)
|
||||||
|
continue;
|
||||||
|
// value = dr.toString();
|
||||||
|
drev = dr;
|
||||||
|
ditem = drev.getItem();
|
||||||
|
time = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object[] v = new Object[list.size()];
|
||||||
|
for(int i=0; i<list.size(); i++) {
|
||||||
|
String[] prop = list.get(i);
|
||||||
|
if(prop[0].equals("part")) {
|
||||||
|
if(prop[1].equals("item")) {
|
||||||
|
v[i] = item.getProperty(prop[2]);
|
||||||
|
}else if(prop[1].equals("rev")) {
|
||||||
|
v[i] = rev.getProperty(prop[2]);
|
||||||
|
}else {
|
||||||
|
v[i] = "";
|
||||||
|
}
|
||||||
|
}else if(prop[0].equals("design")) {
|
||||||
|
if(drev==null) {
|
||||||
|
v[i] = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(prop[1].equals("item")) {
|
||||||
|
v[i] = ditem.getProperty(prop[2]);
|
||||||
|
}else if(prop[1].equals("rev")) {
|
||||||
|
v[i] = drev.getProperty(prop[2]);
|
||||||
|
}else {
|
||||||
|
v[i] = "";
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
v[i] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bean.setValues(v);
|
||||||
|
DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode(bean);
|
||||||
|
pnode.add(node);
|
||||||
|
for(AIFComponentContext child : line.getChildren()) {
|
||||||
|
getNode((TCComponentBOMLine) child.getComponent(), node, list);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private XSSFRow getRow(XSSFSheet sheet, int num) throws Exception {
|
||||||
|
XSSFRow row = sheet.getRow(num);
|
||||||
|
if(row==null)
|
||||||
|
row = sheet.createRow(num);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
private XSSFCell getCell(XSSFRow row, int col) throws Exception {
|
||||||
|
XSSFCell cell = row.getCell(col);
|
||||||
|
if(cell==null)
|
||||||
|
cell = row.createCell(col);
|
||||||
|
// if(row.getRowNum()>1)
|
||||||
|
// cell.setCellStyle(getCell(sourceRow, col).getCellStyle());
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.dialog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
|
||||||
|
import org.jdesktop.swingx.treetable.DefaultTreeTableModel;
|
||||||
|
import org.jdesktop.swingx.treetable.TreeTableNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author vearn
|
||||||
|
*/
|
||||||
|
public class FindDesignModel extends DefaultTreeTableModel {
|
||||||
|
|
||||||
|
private String[] _names;
|
||||||
|
|
||||||
|
|
||||||
|
private List<Integer> isNotEditableRow;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FindDesignModel(TreeTableNode node) {
|
||||||
|
super(node);
|
||||||
|
_names = new String[] { "DBOM对象", "EBOM对象","选中", "EBOMID", "物料描述","数量","发布状态","对应父节点"};
|
||||||
|
}
|
||||||
|
|
||||||
|
public FindDesignModel(TreeTableNode node, String[] _names) {
|
||||||
|
super(node);
|
||||||
|
this._names = _names;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Integer> getIsNotEditableRow() {
|
||||||
|
return isNotEditableRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsNotEditableRow(List<Integer> isNotEditableRow) {
|
||||||
|
this.isNotEditableRow = isNotEditableRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列的数量
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return _names.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表头显示的内容
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getColumnName(int column) {
|
||||||
|
return _names[column];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回在单元格中显示的Object
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object getValueAt(Object node, int column) {
|
||||||
|
Object value = null;
|
||||||
|
if (node instanceof DefaultMutableTreeTableNode) {
|
||||||
|
DefaultMutableTreeTableNode mutableNode = (DefaultMutableTreeTableNode) node;
|
||||||
|
Object o = mutableNode.getUserObject();
|
||||||
|
if (o != null && o instanceof FindDesignBean) {
|
||||||
|
FindDesignBean bean = (FindDesignBean) o;
|
||||||
|
if(bean.getValues() != null)
|
||||||
|
value = bean.getValues()[column];
|
||||||
|
/*switch (column) {
|
||||||
|
case 0:
|
||||||
|
value = bean.getDbom();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
value = bean.getEbom();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
value = bean.getLabel();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
value = bean.getEbomId();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
value = bean.getEbomDesc();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
value = bean.getNum();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
value = bean.getRefreshStatus();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
value = bean.getParentString();
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置所有单元格都不能编辑
|
||||||
|
*
|
||||||
|
* @param the node (i.e. row) for which editing is to be determined
|
||||||
|
* @param the column for which editing is to be determined
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(Object node, int column) {
|
||||||
|
//if(column == 5)
|
||||||
|
//{
|
||||||
|
return true;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.connor.lidy.dialog;
|
||||||
|
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.table.TableCellEditor;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
import javax.swing.table.TableColumn;
|
||||||
|
|
||||||
|
import org.jdesktop.swingx.JXTreeTable;
|
||||||
|
|
||||||
|
public class FindDesignTable extends JXTreeTable {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private List<Integer> isNotEditableRow;
|
||||||
|
//CheckBoxCellEditor checkBoxCellEditor = new CheckBoxCellEditor(this);
|
||||||
|
// TableCellCheckboxRenderer checkboxRenderer = new TableCellCheckboxRenderer(this);
|
||||||
|
|
||||||
|
public List<Integer> getIsNotEditableRow() {
|
||||||
|
return isNotEditableRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsNotEditableRow(List<Integer> isNotEditableRow) {
|
||||||
|
this.isNotEditableRow = isNotEditableRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FindDesignTable(FindDesignModel testTreeTableModel) {
|
||||||
|
// Auto-generated constructor stub
|
||||||
|
super(testTreeTableModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int arg0, int arg1) {
|
||||||
|
// Auto-generated method stub
|
||||||
|
return true;//super.isCellEditable(arg0, arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableCellEditor getCellEditor(int row, int column) {
|
||||||
|
// Auto-generated method stub
|
||||||
|
//if(isNotEditableRow.contains(row) && column == 2)
|
||||||
|
|
||||||
|
|
||||||
|
return cellEditor;
|
||||||
|
//return super.getCellEditor(row, column);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToolTipText(MouseEvent e) {
|
||||||
|
int row = this.rowAtPoint(e.getPoint());
|
||||||
|
int col = this.columnAtPoint(e.getPoint());
|
||||||
|
String tiptextString = null;
|
||||||
|
if (row > -1 && col > -1) {
|
||||||
|
Object value = this.getValueAt(row, col);
|
||||||
|
if (null != value && !"".equals(value))
|
||||||
|
tiptextString = value.toString();// 技륫鞫刻데禱목코휭
|
||||||
|
}
|
||||||
|
return tiptextString;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableCellRenderer getCellRenderer(int row, int column) {
|
||||||
|
return super.getCellRenderer(row, column);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 茶꾜죗
|
||||||
|
public void HiddenCell(int column) {
|
||||||
|
TableColumn tc = this.getTableHeader().getColumnModel().getColumn(column);
|
||||||
|
tc.setMaxWidth(0);
|
||||||
|
tc.setPreferredWidth(0);
|
||||||
|
tc.setWidth(0);
|
||||||
|
tc.setMinWidth(0);
|
||||||
|
this.getTableHeader().getColumnModel().getColumn(column).setMaxWidth(0);
|
||||||
|
this.getTableHeader().getColumnModel().getColumn(column).setMinWidth(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,354 @@
|
|||||||
|
package com.connor.lidy.dialog;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.TableColumnModel;
|
||||||
|
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.dom4j.io.SAXReader;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.TCUtil;
|
||||||
|
//import com.connor.ml.tcm.outfile.util.MethodUtil;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTask;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class StandardDialog extends JFrame {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private TCSession session;
|
||||||
|
private JTextArea remark;
|
||||||
|
private JButton remarkBtn;
|
||||||
|
private JButton exportBtn;
|
||||||
|
private JButton closeBtn;
|
||||||
|
private JTable impTable;
|
||||||
|
private DefaultTableModel impModel;
|
||||||
|
private ArrayList<TCComponentItemRevision> revlist;
|
||||||
|
private String[] mark;
|
||||||
|
private int mrow = -1;
|
||||||
|
// private HashMap<String, Integer> map;
|
||||||
|
// private LinkedHashMap<String, String[]> ruleOpsMap;
|
||||||
|
|
||||||
|
// public DrawingNoApplyDialog(TCSession session, String tables[], String[] options, String[] sqlOptions, InterfaceAIFComponent[] targets) throws Exception {
|
||||||
|
public StandardDialog(TCSession session, TCComponent[] models, TCComponentTask task, LinkedHashMap<String, String[]> ruleOpsMap) throws Exception {
|
||||||
|
// super(AIFUtility.getActiveDesktop());
|
||||||
|
this.session = session;
|
||||||
|
// list = new ArrayList<>();
|
||||||
|
// map = new HashMap<>();
|
||||||
|
// this.ruleOpsMap = ruleOpsMap;
|
||||||
|
// System.out.println(ruleOpsMap.toString());
|
||||||
|
setTitle("标准化审核");
|
||||||
|
remark = new JTextArea();
|
||||||
|
// remark.setPreferredSize(new Dimension(10, 10));
|
||||||
|
remark.setLineWrap(true);
|
||||||
|
remarkBtn = new JButton("修改备注");
|
||||||
|
exportBtn = new JButton("导出Excel");
|
||||||
|
closeBtn = new JButton("关闭");
|
||||||
|
JPanel btnPanel = new JPanel(new FlowLayout());
|
||||||
|
btnPanel.add(remarkBtn);
|
||||||
|
btnPanel.add(exportBtn);
|
||||||
|
btnPanel.add(closeBtn);
|
||||||
|
JScrollPane remarkPanel = new JScrollPane(remark);
|
||||||
|
remarkPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
JPanel topPanel = new JPanel(new BorderLayout());
|
||||||
|
topPanel.add(BorderLayout.NORTH, new JLabel("标准化备注"));
|
||||||
|
topPanel.add(BorderLayout.CENTER, remarkPanel);
|
||||||
|
topPanel.add(BorderLayout.SOUTH, btnPanel);
|
||||||
|
|
||||||
|
// ArrayList<String[]> props = new ArrayList<>();
|
||||||
|
// String[] tableHeader = new String[] { "序号", "itemID", "名称", "版本", "加工类型", "产品分类码", "课题号", "配置码", "部件码", "图纸类型", "新图号" };
|
||||||
|
// String[] tables = options.get(0);
|
||||||
|
String[] tableHeader = new String[ruleOpsMap.size() + 1];
|
||||||
|
tableHeader[0] = "序号";
|
||||||
|
int h = 1;
|
||||||
|
for (String s : ruleOpsMap.keySet()) {
|
||||||
|
// String[] split = tables[h].split("=");
|
||||||
|
// props.add(split[1].split("\\."));
|
||||||
|
tableHeader[h] = s;
|
||||||
|
if(s.equals("标准化备注")) {
|
||||||
|
mark = ruleOpsMap.get(s);
|
||||||
|
mrow = h;
|
||||||
|
}
|
||||||
|
// map.put(split[1], h);
|
||||||
|
h++;
|
||||||
|
}
|
||||||
|
if(mrow < 0)
|
||||||
|
throw new Exception("首选项Jd_Standard_UI配置不正确");
|
||||||
|
impModel = new DefaultTableModel(tableHeader, 0);
|
||||||
|
impTable = new JTable() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int row, int col) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
impTable.getTableHeader().setReorderingAllowed(false);
|
||||||
|
impTable.setFillsViewportHeight(true);
|
||||||
|
// impTable.setEnabled(false);
|
||||||
|
impTable.setEnabled(true);
|
||||||
|
// impTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
|
||||||
|
impTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||||
|
impTable.setModel(impModel);
|
||||||
|
for (int i = 1; i < impModel.getColumnCount(); i++)
|
||||||
|
impTable.getColumnModel().getColumn(i).setPreferredWidth(150);
|
||||||
|
|
||||||
|
setDatas(task, (TCComponentDataset) models[0], ruleOpsMap);
|
||||||
|
addActionListener(models);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
add(BorderLayout.EAST, topPanel);
|
||||||
|
add(BorderLayout.CENTER, new JScrollPane(impTable));
|
||||||
|
pack();
|
||||||
|
setSize(new Dimension(1400, 500));
|
||||||
|
setDefaultLookAndFeelDecorated(true);
|
||||||
|
Dimension screen = getToolkit().getScreenSize();
|
||||||
|
setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2);
|
||||||
|
// setAlwaysOnTop(true);
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
private void setDatas(TCComponentTask task, TCComponentDataset model, LinkedHashMap<String, String[]> ruleOpsMap) throws Exception {
|
||||||
|
TCComponentTcFile[] files = model.getTcFiles();
|
||||||
|
File file = files[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
SAXReader saxReader = new SAXReader();
|
||||||
|
Document doc = saxReader.read(file);
|
||||||
|
Element root = doc.getRootElement();
|
||||||
|
Element condizione = root.element("condizione");
|
||||||
|
List typeEs = condizione.element("object_type").elements();
|
||||||
|
ArrayList<String> types = new ArrayList<>();
|
||||||
|
for(Object e : typeEs) {
|
||||||
|
types.add(((Element)e).getText());
|
||||||
|
}
|
||||||
|
List regolaEs = condizione.element("object_type").elements();
|
||||||
|
HashMap<String, Boolean> regolas = new HashMap<>();
|
||||||
|
for(Object e : regolaEs) {
|
||||||
|
String t = ((Element)e).getText();
|
||||||
|
String name = ((Element)e).getName();
|
||||||
|
if(name.equals("item"))
|
||||||
|
name = "object_type";
|
||||||
|
if(t.equals("*")) {
|
||||||
|
regolas.put(name, false);
|
||||||
|
}else {
|
||||||
|
regolas.put(name, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List rows = root.element("data").elements();
|
||||||
|
AIFComponentContext[] contexts = TCUtil.getPseudoFolder(task, "root_target_attachments").getChildren();
|
||||||
|
revlist = new ArrayList<>();
|
||||||
|
for(AIFComponentContext c : contexts) {
|
||||||
|
if(!types.contains(c.getComponent().getType()))
|
||||||
|
continue;
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) c.getComponent();
|
||||||
|
HashMap<String, String> props = new HashMap<>();
|
||||||
|
for(String s : regolas.keySet()) {
|
||||||
|
if(rev.getTCProperty(s) == null) {
|
||||||
|
System.out.println(rev+" >> "+s+"\n属性未找到");
|
||||||
|
throw new Exception("判断条件配置错误,请检查配置信息");
|
||||||
|
}
|
||||||
|
props.put(s, rev.getProperty(s));
|
||||||
|
}
|
||||||
|
ROW:for(Object e : rows) {
|
||||||
|
for(Object t : ((Element)e).elements()) {
|
||||||
|
String name = ((Element)t).getName();
|
||||||
|
if(!props.containsKey(name))
|
||||||
|
continue;
|
||||||
|
String text = ((Element)t).getText();
|
||||||
|
String val = props.get(name);
|
||||||
|
if(regolas.get(name)) {
|
||||||
|
if(!val.equals(text) || text.equals("null") && !val.isEmpty())
|
||||||
|
continue ROW;
|
||||||
|
}else if(!regolas.get(name) && !val.contains(text)) {
|
||||||
|
continue ROW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TCComponentItem item = rev.getItem();
|
||||||
|
String[] row = new String[ruleOpsMap.size()+1];
|
||||||
|
row[0] = impTable.getRowCount()+1+"";
|
||||||
|
int i = 1;
|
||||||
|
for(String n : ruleOpsMap.keySet()) {
|
||||||
|
row[i] = getProp(ruleOpsMap.get(n), item, rev);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
System.out.println("row:"+Arrays.toString(row));
|
||||||
|
impModel.addRow(row);
|
||||||
|
revlist.add(rev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addActionListener(TCComponent[] models) {
|
||||||
|
impTable.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
try {
|
||||||
|
int row = impTable.getSelectedRow();
|
||||||
|
if(row < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
remark.setText(""+impTable.getValueAt(row, mrow));
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post(StandardDialog.this, "错误:" + e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
remarkBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
try {
|
||||||
|
int row = impTable.getSelectedRow();
|
||||||
|
if(row < 0) {
|
||||||
|
MessageBox.post(StandardDialog.this, "请选择要编辑的行!", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String text = remark.getText();
|
||||||
|
TCComponentItemRevision rev = revlist.get(row);
|
||||||
|
TCComponentItem item = rev.getItem();
|
||||||
|
if(mark[0].equals("item") && item.isCheckedOut()) {
|
||||||
|
MessageBox.post(StandardDialog.this, item+" 已签出,无法修改!", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}else if(mark[0].equals("rev") && rev.isCheckedOut()) {
|
||||||
|
MessageBox.post(StandardDialog.this, rev+" 已签出,无法修改!", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// MethodUtil.openByPass(session);
|
||||||
|
if(mark[0].equals("item")) {
|
||||||
|
item.setProperty(mark[1], text);
|
||||||
|
}else if(mark[0].equals("rev")) {
|
||||||
|
rev.setProperty(mark[1], text);
|
||||||
|
}
|
||||||
|
impTable.setValueAt(text, row, mrow);
|
||||||
|
// MethodUtil.closeByPass(session);
|
||||||
|
}catch(Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post(StandardDialog.this, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//TODO
|
||||||
|
exportBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
FileInputStream input = null;
|
||||||
|
FileOutputStream output = null;
|
||||||
|
XSSFWorkbook wb = null;
|
||||||
|
try {
|
||||||
|
File directory = TCUtil.saveExcelChooser("");
|
||||||
|
if(directory==null)
|
||||||
|
return;
|
||||||
|
if(directory.exists())
|
||||||
|
directory.delete();
|
||||||
|
TCComponentDataset model = (TCComponentDataset) models[1];
|
||||||
|
TCComponentTcFile[] files = model.getTcFiles();
|
||||||
|
File file = files[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
wb = new XSSFWorkbook(input);
|
||||||
|
XSSFSheet sheet = wb.getSheetAt(0);
|
||||||
|
XSSFRow row;
|
||||||
|
XSSFCell cell;
|
||||||
|
row = getRow(sheet, 0);
|
||||||
|
TableColumnModel cm = impTable.getColumnModel();
|
||||||
|
for(int i=0; i<cm.getColumnCount(); i++) {
|
||||||
|
cell = getCell(row, i);
|
||||||
|
cell.setCellValue(cm.getColumn(i).getHeaderValue().toString());
|
||||||
|
}
|
||||||
|
for(int i=0; i<impTable.getRowCount(); i++) {
|
||||||
|
row = getRow(sheet, i+1);
|
||||||
|
for(int j=0; j<impTable.getColumnCount(); j++) {
|
||||||
|
cell = getCell(row, j);
|
||||||
|
cell.setCellValue(impTable.getValueAt(i, j).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output = new FileOutputStream(file.getPath());
|
||||||
|
wb.write(output);
|
||||||
|
input.close();
|
||||||
|
output.close();
|
||||||
|
file.renameTo(directory);
|
||||||
|
MessageBox.post(StandardDialog.this, "导出完成!", "提示", MessageBox.INFORMATION);
|
||||||
|
}catch(Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post(StandardDialog.this, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}finally {
|
||||||
|
if(input!=null)
|
||||||
|
try {
|
||||||
|
input.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(output!=null)
|
||||||
|
try {
|
||||||
|
output.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
closeBtn.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getProp(String[] ps, TCComponentItem item, TCComponentItemRevision rev) throws Exception {
|
||||||
|
if(ps[0].equals("item")) {
|
||||||
|
return item.getProperty(ps[1]);
|
||||||
|
}else if(ps[0].equals("rev")) {
|
||||||
|
return rev.getProperty(ps[1]);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private XSSFRow getRow(XSSFSheet sheet, int num) throws Exception {
|
||||||
|
XSSFRow row = sheet.getRow(num);
|
||||||
|
if(row==null)
|
||||||
|
row = sheet.createRow(num);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
private XSSFCell getCell(XSSFRow row, int col) throws Exception {
|
||||||
|
XSSFCell cell = row.getCell(col);
|
||||||
|
if(cell==null)
|
||||||
|
cell = row.createCell(col);
|
||||||
|
// if(row.getRowNum()>1)
|
||||||
|
// cell.setCellStyle(getCell(sourceRow, col).getCellStyle());
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class CompetitiveReportHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("CompetitiveReportHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
String pref, title;
|
||||||
|
if(arg0.getCommand().getId().equals("CompetitiveReportHandler")) {
|
||||||
|
pref = "ML8_CompetitiveReport";
|
||||||
|
title = "竞品分析报表";
|
||||||
|
}else{
|
||||||
|
pref = "ML8_PatentApplyReport";
|
||||||
|
title = "专利申请维护明细表";
|
||||||
|
}
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
String options[] = session.getPreferenceService().getStringValues(pref);
|
||||||
|
if(options==null || options.length<2) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options[0]);//wONAAIWd5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
new CompetitiveReportDialog(session, title, options, (TCComponentDataset)model);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class ParentListReportHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("ParentListReportHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
InterfaceAIFComponent target = app.getTargetComponent();
|
||||||
|
if(target==null) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String type = target.getType();
|
||||||
|
if(!type.equals("ML8_PartRevision") && !type.equals("ML8_RawMaterialRevision")) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String option = session.getPreferenceService().getStringValue("ML8_ParentListReport");
|
||||||
|
if(option==null || option.isEmpty()) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ParentListReport配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(option);//AODAAInI5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ParentListReport中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ParentListReportOperation operation = new ParentListReportOperation(session, (TCComponentItemRevision)target, (TCComponentDataset)model);
|
||||||
|
session.queueOperation(operation);
|
||||||
|
// MessageBox.post(desktop, "传递结果:", "提示", MessageBox.INFORMATION);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,172 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class ParentListReportOperation extends AbstractAIFOperation {
|
||||||
|
|
||||||
|
// private TCSession session;
|
||||||
|
private TCComponentItemRevision target;
|
||||||
|
private TCComponentDataset model;
|
||||||
|
private XSSFRow sourceRow;
|
||||||
|
private final static String [] REV_TYPES = { "ML8_UnProductRevision", "ML8_RefrigeratorRevision", "ML8_WashingRevision", "ML8_ColdRevision",
|
||||||
|
"ML8_OthersRevision", "ML8_PartRevision", "ML8_RawMaterialRevision" };
|
||||||
|
public ParentListReportOperation(TCSession session, TCComponentItemRevision target, TCComponentDataset model) {
|
||||||
|
// this.session = session;
|
||||||
|
this.target = target;
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() throws Exception {
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
FileInputStream input = null;
|
||||||
|
FileOutputStream output = null;
|
||||||
|
try {
|
||||||
|
TCComponentItemRevision newRev = target.getItem().getLatestItemRevision();
|
||||||
|
// getParents(target);
|
||||||
|
Date now = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
File directory = TCUtil.saveExcelChooser(newRev.getProperty("item_id")+"物料父级使用清单"+sdf.format(now));
|
||||||
|
if(directory==null)
|
||||||
|
return;
|
||||||
|
if(directory.exists())
|
||||||
|
directory.delete();
|
||||||
|
String path = directory.getPath();
|
||||||
|
|
||||||
|
TCComponentTcFile[] files = model.getTcFiles();
|
||||||
|
File file = files[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
XSSFWorkbook wb = new XSSFWorkbook(input);
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
XSSFSheet sheet = wb.getSheetAt(0);
|
||||||
|
XSSFRow row;
|
||||||
|
XSSFCell cell;
|
||||||
|
sourceRow = getRow(sheet, i);
|
||||||
|
System.out.println("当前物料:"+newRev);
|
||||||
|
TCComponent[] ps = newRev.whereUsed(TCComponent.WHERE_USED_ALL);
|
||||||
|
if(ps!=null)
|
||||||
|
System.out.println("找到被使用的数量:"+ps.length);
|
||||||
|
else
|
||||||
|
System.out.println("未找到父级使用");
|
||||||
|
for(TCComponent c : ps) {
|
||||||
|
TCComponentItem item = ((TCComponentItemRevision)c).getItem();
|
||||||
|
System.out.println("找到对象:"+item);
|
||||||
|
if(!c.equals(item.getLatestItemRevision())) {
|
||||||
|
System.out.println("不是最新版本");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String type = c.getType();
|
||||||
|
System.out.println("当前类型:"+type);
|
||||||
|
List<String> asList = Arrays.asList(REV_TYPES);
|
||||||
|
if(!asList.contains(type)) {
|
||||||
|
System.out.println("跳过");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String id = c.getProperty("item_id");
|
||||||
|
if(id.indexOf("-")>-1)
|
||||||
|
continue;
|
||||||
|
// if(!id.startsWith("89") && !id.startsWith("ML")&& !id.startsWith("80"))
|
||||||
|
// continue;
|
||||||
|
row = getRow(sheet, i);
|
||||||
|
cell = getCell(row, 0);
|
||||||
|
cell.setCellValue(i);//序号
|
||||||
|
cell = getCell(row, 1);
|
||||||
|
cell.setCellValue(id);//物料代码
|
||||||
|
cell = getCell(row, 2);
|
||||||
|
cell.setCellValue(c.getProperty("object_desc"));//物料描述
|
||||||
|
cell = getCell(row, 3);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_StdDesc"));//标准描述
|
||||||
|
cell = getCell(row, 4);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_FigureNum"));//图号
|
||||||
|
cell = getCell(row, 5);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_Colour"));//颜色
|
||||||
|
cell = getCell(row, 6);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_Materials"));//材料
|
||||||
|
cell = getCell(row, 7);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_Specifications"));//规格
|
||||||
|
cell = getCell(row, 8);
|
||||||
|
cell.setCellValue(item.getProperty("ml8_Status"));//优选方式
|
||||||
|
cell = getCell(row, 9);
|
||||||
|
TCComponent[] released = c.getReferenceListProperty("release_status_list");
|
||||||
|
if(released!=null && released.length>0) {
|
||||||
|
// System.out.println("released:"+released[0].getProperty("object_name"));
|
||||||
|
String status = released[0].getProperty("object_name");
|
||||||
|
if(status.equals("ML8_Freeze") || status.equals("ML8_Abolish"))
|
||||||
|
cell.setCellValue("是");//是否被取代
|
||||||
|
else
|
||||||
|
cell.setCellValue("否");//是否被取代
|
||||||
|
}else
|
||||||
|
cell.setCellValue("否");//是否被取代
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
output = new FileOutputStream(file.getPath());
|
||||||
|
wb.write(output);
|
||||||
|
input.close();
|
||||||
|
output.close();
|
||||||
|
// System.out.println("file:"+file.getPath());
|
||||||
|
String newPath = System.getProperty("java.io.tmpdir")+path.substring(path.lastIndexOf("\\"));
|
||||||
|
File reFile = new File(newPath);
|
||||||
|
file.renameTo(reFile);
|
||||||
|
// System.out.println("new directory:"+reFile.getPath());
|
||||||
|
reFile.renameTo(directory);
|
||||||
|
|
||||||
|
// MessageBox.post(desktop, "导出完成", "INFO", MessageBox.INFORMATION);
|
||||||
|
int choose = JOptionPane.showOptionDialog(desktop, "已导出至:"+directory.getPath()+",是否打开?", "提示",
|
||||||
|
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new String[] {"是","否"}, "结束操作");
|
||||||
|
if(choose==0) {
|
||||||
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
runtime.exec("cmd /c start exit &&\"" + directory + "\" ");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}finally {
|
||||||
|
if(input!=null)
|
||||||
|
input.close();
|
||||||
|
if(output!=null)
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private XSSFRow getRow(XSSFSheet sheet, int num) throws Exception {
|
||||||
|
XSSFRow row = sheet.getRow(num);
|
||||||
|
if(row==null)
|
||||||
|
row = sheet.createRow(num);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
private XSSFCell getCell(XSSFRow row, int col) throws Exception {
|
||||||
|
XSSFCell cell = row.getCell(col);
|
||||||
|
if(cell==null)
|
||||||
|
cell = row.createCell(col);
|
||||||
|
if(row.getRowNum()>2)
|
||||||
|
cell.setCellStyle(getCell(sourceRow, col).getCellStyle());
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
//import com.connor.lidy.util.ProgressReporterDialog;
|
||||||
|
//import com.connor.lidy.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class ProjectBoardHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("ProjectBoardHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
// ProjectBoardDialog.getComps(session.stringToComponent("AyJAAIWu5kSPsC"));
|
||||||
|
String options[] = session.getPreferenceService().getStringValues("ML8_ProjectReport");
|
||||||
|
if(options==null || options.length<2) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ProjectReport配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options[0]);//wtGAAIma5kSPsC SearchProjectSchedule
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ProjectReport中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String departments[] = session.getPreferenceService().getStringValues("ML8_ProjectDepart");
|
||||||
|
if(departments==null || departments.length==0) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ProjectDepart配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
// System.out.println((sdf.parse("2022-01-10").getTime()-sdf.parse("2021-12-11").getTime())/(1000*60*60*24));
|
||||||
|
new ProjectBoardDialog(session, options, (TCComponentDataset)model, departments);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
/*new Thread() {
|
||||||
|
public void run(){
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
// ProjectBoardDialog.getComps(session.stringToComponent("AyJAAIWu5kSPsC"));
|
||||||
|
String options[] = session.getPreferenceService().getStringValues("ML8_ProjectReport");
|
||||||
|
if(options==null || options.length<2) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ProjectReport配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options[0]);//wtGAAIma5kSPsC SearchProjectSchedule
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_ProjectReport中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
File directory = TCUtil.saveExcelChooserAsk("项目运行跟踪表-产品类"+ sdf.format(new Date()));
|
||||||
|
if(directory==null)
|
||||||
|
return;
|
||||||
|
ProgressReporterDialog reporter = new ProgressReporterDialog("提示");
|
||||||
|
reporter.reportProgressMessage("正在导出,请稍候...");
|
||||||
|
new Thread(reporter).start();
|
||||||
|
new Thread() {
|
||||||
|
public void run(){
|
||||||
|
try {
|
||||||
|
new ProjectBoardOperation(session, options, (TCComponentDataset)model, directory, reporter).executeOperation();
|
||||||
|
} catch (Exception e) {
|
||||||
|
reporter.requestCanceling();
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class ProjectDocReportHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("ProjectDocReportHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
String pref = "ML8_ProjectDocReport", title = "项目文档归档明细-产品类";
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
String options[] = session.getPreferenceService().getStringValues(pref);
|
||||||
|
if(options==null || options.length<2) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options[0]);//A_OAAIm_5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
new ProjectDocReportDialog(session, title, options, (TCComponentDataset)model);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class StandardRateReportHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("StandardRateReportHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
InterfaceAIFComponent target = app.getTargetComponent();
|
||||||
|
if(target==null) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent comp = (TCComponent)target;
|
||||||
|
if(!comp.isTypeOf(new String[] { "ML8_WashingRevision", "ML8_ColdRevision", "ML8_RefrigeratorRevision", "ML8_OthersRevision" })) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String option = session.getPreferenceService().getStringValue("ML8_StandardRateReport");
|
||||||
|
if(option==null || option.isEmpty()) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_StandardRateReport配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(option);//ASFAAInA5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_StandardRateReport中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
StandardRateReportOperation operation = new StandardRateReportOperation(session, (TCComponentItemRevision)target, (TCComponentDataset)model);
|
||||||
|
session.queueOperation(operation);
|
||||||
|
// MessageBox.post(desktop, "传递结果:", "提示", MessageBox.INFORMATION);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,212 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class StandardRateReportOperation extends AbstractAIFOperation {
|
||||||
|
|
||||||
|
private TCSession session;
|
||||||
|
private TCComponentItemRevision target;
|
||||||
|
private TCComponentDataset model;
|
||||||
|
// private XSSFRow sourceRow;
|
||||||
|
private HashSet<String> idSet;
|
||||||
|
private String ProductCode;
|
||||||
|
private double[] count;
|
||||||
|
|
||||||
|
public StandardRateReportOperation(TCSession session, TCComponentItemRevision target, TCComponentDataset model) {
|
||||||
|
this.session = session;
|
||||||
|
this.target = target;
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() throws Exception {
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
FileInputStream input = null;
|
||||||
|
FileOutputStream output = null;
|
||||||
|
try {
|
||||||
|
idSet = new HashSet<>();
|
||||||
|
count = new double[] { 0, 0, 0 };
|
||||||
|
Date now = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
File directory = TCUtil.saveExcelChooser("标准化系数报表"+sdf.format(now));
|
||||||
|
if(directory==null)
|
||||||
|
return;
|
||||||
|
if(directory.exists())
|
||||||
|
directory.delete();
|
||||||
|
String path = directory.getPath();
|
||||||
|
|
||||||
|
TCComponentRevisionRule[] rules = TCComponentRevisionRule.listAllRules(session);
|
||||||
|
TCComponentRevisionRule taskRule = null;
|
||||||
|
for(TCComponentRevisionRule rule : rules) {
|
||||||
|
System.out.println("rule:"+rule);
|
||||||
|
if(rule.toString().equals("产品明细表导出规则")) {
|
||||||
|
taskRule = rule;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TCComponentBOMWindow window = TCUtil.getWindow(session, taskRule);
|
||||||
|
TCComponentBOMLine line = TCUtil.getBOMLine(session, window, target);
|
||||||
|
AIFComponentContext[] pfs = target.getChildren("ML8_ProjectRelation");
|
||||||
|
String ProductType;
|
||||||
|
if(pfs!=null && pfs.length>0) {
|
||||||
|
TCComponent pf = (TCComponent) pfs[0].getComponent();
|
||||||
|
ProductCode = pf.getProperty("ml8_ProductCode");//产品代号
|
||||||
|
ProductType = pf.getProperty("ml8_ProductType");//产品型号
|
||||||
|
}else {
|
||||||
|
ProductCode = target.getProperty("ml8_ProductCode");
|
||||||
|
ProductType = "";
|
||||||
|
}
|
||||||
|
System.out.println("target:"+target+"=="+ProductCode);
|
||||||
|
// TCComponentItem item = line.getItem();
|
||||||
|
// if(!(item.isTypeOf("ML8_RawMaterial")) && !(line.getProperty("ML8_MBOM").equals("MBOM"))) {
|
||||||
|
// count[0]++;
|
||||||
|
// }
|
||||||
|
recycelBom(line.getChildren());
|
||||||
|
window.close();
|
||||||
|
|
||||||
|
TCComponentTcFile[] files = model.getTcFiles();
|
||||||
|
File file = files[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
XSSFWorkbook wb = new XSSFWorkbook(input);
|
||||||
|
|
||||||
|
XSSFSheet sheet = wb.getSheetAt(0);
|
||||||
|
// XSSFRow row;
|
||||||
|
XSSFCell cell;
|
||||||
|
System.out.println(count[0]+"=="+count[1]+"=="+count[2]);
|
||||||
|
|
||||||
|
cell = getCell(getRow(sheet, 1), 1);
|
||||||
|
cell.setCellValue(ProductCode);//产品代号
|
||||||
|
cell = getCell(getRow(sheet, 6), 1);
|
||||||
|
cell.setCellValue(ProductType);//产品型号
|
||||||
|
|
||||||
|
// cell = getCell(getRow(sheet, 1), 1);
|
||||||
|
// cell.setCellValue(target.getProperty("ml8_ProductCode"));//产品代号
|
||||||
|
cell = getCell(getRow(sheet, 2), 1);
|
||||||
|
cell.setCellValue(count[0]); //总件数∑
|
||||||
|
cell = getCell(getRow(sheet, 3), 1);
|
||||||
|
cell.setCellValue(count[0]==0 ? 0:(count[0]-count[1])/count[0]);//标准化率
|
||||||
|
cell = getCell(getRow(sheet, 4), 1);
|
||||||
|
cell.setCellValue(count[0]==0 ? 0:count[2]/count[0]); //通用化率
|
||||||
|
cell = getCell(getRow(sheet, 5), 1);
|
||||||
|
cell.setCellValue(count[1]); //专用件数
|
||||||
|
// cell = getCell(getRow(sheet, 6), 1);
|
||||||
|
// cell.setCellValue(target.getProperty("ml8_ProductType"));//产品型号
|
||||||
|
|
||||||
|
output = new FileOutputStream(file.getPath());
|
||||||
|
wb.write(output);
|
||||||
|
input.close();
|
||||||
|
output.close();
|
||||||
|
// System.out.println("file:"+file.getPath());
|
||||||
|
String newPath = System.getProperty("java.io.tmpdir")+path.substring(path.lastIndexOf("\\"));
|
||||||
|
File reFile = new File(newPath);
|
||||||
|
file.renameTo(reFile);
|
||||||
|
// System.out.println("new directory:"+reFile.getPath());
|
||||||
|
reFile.renameTo(directory);
|
||||||
|
|
||||||
|
MessageBox.post(desktop, "导出完成", "INFO", MessageBox.INFORMATION);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}finally {
|
||||||
|
if(input!=null)
|
||||||
|
input.close();
|
||||||
|
if(output!=null)
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private XSSFRow getRow(XSSFSheet sheet, int num) throws Exception {
|
||||||
|
XSSFRow row = sheet.getRow(num);
|
||||||
|
if(row==null)
|
||||||
|
row = sheet.createRow(num);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
private XSSFCell getCell(XSSFRow row, int col) throws Exception {
|
||||||
|
XSSFCell cell = row.getCell(col);
|
||||||
|
if(cell==null)
|
||||||
|
cell = row.createCell(col);
|
||||||
|
// if(row.getRowNum()>2)
|
||||||
|
// cell.setCellStyle(getCell(sourceRow, col).getCellStyle());
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
private void recycelBom(AIFComponentContext[] context) throws Exception {
|
||||||
|
for(AIFComponentContext c : context) {
|
||||||
|
TCComponentBOMLine line = (TCComponentBOMLine)c.getComponent();
|
||||||
|
String id = line.getProperty("bl_item_item_id");
|
||||||
|
if(idSet.contains(id))
|
||||||
|
continue;
|
||||||
|
idSet.add(id);
|
||||||
|
System.out.println("line:"+line);
|
||||||
|
// System.out.println(line+":"+count[0]+"=="+count[1]+"=="+count[2]);
|
||||||
|
TCComponentItem item = line.getItem();
|
||||||
|
if(item.isTypeOf("ML8_RawMaterial") || line.getProperty("ML8_MBOM").equals("MBOM"))
|
||||||
|
continue;
|
||||||
|
System.out.println("总数 "+id);
|
||||||
|
count[0]++;//总数
|
||||||
|
// if(line.getItemRevision().getProperty("ml8_FigureNum").equals(target.getProperty("item_id"))) {
|
||||||
|
TCComponentItemRevision rev = line.getItemRevision();
|
||||||
|
String figureNum = rev.getProperty("ml8_FigureNum");
|
||||||
|
if(figureNum.contains(".")) {
|
||||||
|
figureNum = figureNum.substring(0, figureNum.indexOf("."));
|
||||||
|
}
|
||||||
|
System.out.println("ml8_ProductCode:"+figureNum);
|
||||||
|
// if(rev.getProperty("ml8_ProductCode").equals(ProductCode)) {
|
||||||
|
if(figureNum.equals(ProductCode)) {
|
||||||
|
System.out.println("专用 "+id);
|
||||||
|
count[1]++;//专用
|
||||||
|
}
|
||||||
|
// AIFComponentContext[] ML8_ProjectRelation = rev.getChildren("ML8_ProjectRelation");
|
||||||
|
// if(ML8_ProjectRelation==null || ML8_ProjectRelation.length==0) {
|
||||||
|
//// throw new Exception(line+"版本下未找到项目名称表单");
|
||||||
|
//// System.out.println("ml8_ProductCode:"+rev.getProperty("ml8_ProductCode"));
|
||||||
|
// System.out.println("ml8_ProductCode:"+rev.getProperty("ml8_FigureNum"));
|
||||||
|
//// if(rev.getProperty("ml8_ProductCode").equals(ProductCode)) {
|
||||||
|
// if(rev.getProperty("ml8_FigureNum").equals(ProductCode)) {
|
||||||
|
// System.out.println("专用 "+id);
|
||||||
|
// count[1]++;//专用
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// String s = ML8_ProjectRelation[0].getComponent().getProperty("ml8_FigureNum");
|
||||||
|
//// String s = ML8_ProjectRelation[0].getComponent().getProperty("ml8_ProductCode");
|
||||||
|
// System.out.println("ml8_ProductCode:"+s);
|
||||||
|
// if(s.equals(ProductCode)) {
|
||||||
|
// System.out.println("专用 "+id);
|
||||||
|
// count[1]++;//专用
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
System.out.println("ml8_Status:"+item.getProperty("ml8_Status"));
|
||||||
|
if(item.getProperty("ml8_Status").contains("优选")) {
|
||||||
|
System.out.println("优选 "+id);
|
||||||
|
count[2]++;//优选
|
||||||
|
}
|
||||||
|
|
||||||
|
AIFComponentContext[] child = line.getChildren();
|
||||||
|
if(child!=null && child.length>0)
|
||||||
|
recycelBom(line.getChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class TechProjectBoardHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("TechProjectBoardHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
// ProjectBoardDialog.getComps(session.stringToComponent("AyJAAIWu5kSPsC"));
|
||||||
|
String options[] = session.getPreferenceService().getStringValues("ML8_TechProjectReport");
|
||||||
|
if(options==null || options.length<2) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_TechProjectReport配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options[0]);//wtGAAIma5kSPsC SearchProjectSchedule
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_TechProjectReport中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String departments[] = session.getPreferenceService().getStringValues("ML8_TechProjectDepart");
|
||||||
|
if(departments==null || departments.length==0) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_TechProjectDepart配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
new TechProjectBoardDialog(session, options, (TCComponentDataset)model, departments);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class TechProjectDocReportHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("TechProjectDocReportHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
String pref = "ML8_TechProjectDocReport", title = "项目文档归档明细-技术类";
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
String options[] = session.getPreferenceService().getStringValues(pref);
|
||||||
|
if(options==null || options.length<2) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(options[0]);//A_OAAIm_5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项"+pref+"中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
new TechProjectDocReportDialog(session, title, options, (TCComponentDataset)model);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
//创建常规文件夹结构
|
||||||
|
public class UsedbyProductReportHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("UsedbyProductReportHandler");
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
try {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
InterfaceAIFComponent target = app.getTargetComponent();
|
||||||
|
if(target==null) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String type = target.getType();
|
||||||
|
if(!type.equals("ML8_PartRevision") && !type.equals("ML8_RawMaterialRevision")) {
|
||||||
|
MessageBox.post(desktop, "请选择零组件或原辅材料版本进行导出", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String option = session.getPreferenceService().getStringValue("ML8_UsedbyProductReport");
|
||||||
|
if(option==null || option.isEmpty()) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_UsedbyProductReport配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponent model = session.stringToComponent(option);//AGFAAIXI5kSPsC
|
||||||
|
if(model==null || !model.isTypeOf("MSExcelX")) {
|
||||||
|
MessageBox.post(desktop, "首选项ML8_UsedbyProductReport中模板UID配置不正确", "ERROR", MessageBox.ERROR);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
UsedbyProductReportOperation operation = new UsedbyProductReportOperation(session, (TCComponentItemRevision)target, (TCComponentDataset)model);
|
||||||
|
session.queueOperation(operation);
|
||||||
|
// MessageBox.post(desktop, "传递结果:", "提示", MessageBox.INFORMATION);
|
||||||
|
}catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,191 @@
|
|||||||
|
package com.connor.lidy.report;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AIFDesktop;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class UsedbyProductReportOperation extends AbstractAIFOperation {
|
||||||
|
|
||||||
|
private TCSession session;
|
||||||
|
private TCComponentItemRevision target;
|
||||||
|
private List<TCComponent> parents;
|
||||||
|
private TCComponentDataset model;
|
||||||
|
private XSSFRow sourceRow;
|
||||||
|
|
||||||
|
public UsedbyProductReportOperation(TCSession session, TCComponentItemRevision target, TCComponentDataset model) {
|
||||||
|
this.session = session;
|
||||||
|
this.target = target;
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() throws Exception {
|
||||||
|
AIFDesktop desktop = AIFUtility.getActiveDesktop();
|
||||||
|
FileInputStream input = null;
|
||||||
|
FileOutputStream output = null;
|
||||||
|
try {
|
||||||
|
parents = new ArrayList<>();
|
||||||
|
TCComponentItemRevision newRev = target.getItem().getLatestItemRevision();
|
||||||
|
getParents(target);
|
||||||
|
Date now = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
File directory = TCUtil.saveExcelChooser("使用于机型清单"+sdf.format(now));
|
||||||
|
if(directory==null)
|
||||||
|
return;
|
||||||
|
if(directory.exists())
|
||||||
|
directory.delete();
|
||||||
|
String path = directory.getPath();
|
||||||
|
|
||||||
|
TCComponentTcFile[] files = model.getTcFiles();
|
||||||
|
File file = files[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
XSSFWorkbook wb = new XSSFWorkbook(input);
|
||||||
|
|
||||||
|
int i = 2;
|
||||||
|
XSSFSheet sheet = wb.getSheetAt(0);
|
||||||
|
XSSFRow row;
|
||||||
|
XSSFCell cell;
|
||||||
|
sourceRow = getRow(sheet, i);
|
||||||
|
for(TCComponent c : parents) {
|
||||||
|
String ID=String.valueOf(c.getProperty("item_id"));
|
||||||
|
if(ID.indexOf("-")>-1) {
|
||||||
|
System.out.println("已过滤ID=======>"+ID);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
row = getRow(sheet, i);
|
||||||
|
cell = getCell(row, 0);
|
||||||
|
cell.setCellValue(i-1);//序号
|
||||||
|
cell = getCell(row, 1);
|
||||||
|
cell.setCellValue(c.getProperty("item_id"));//物料代码
|
||||||
|
cell = getCell(row, 2);
|
||||||
|
cell.setCellValue(c.getProperty("object_name"));//产品名称
|
||||||
|
cell = getCell(row, 3);
|
||||||
|
cell.setCellValue(c.getProperty("object_desc"));//物料描述
|
||||||
|
cell = getCell(row, 4);
|
||||||
|
cell.setCellValue(c.getProperty("ML8_SalesMode"));//是否出口订单
|
||||||
|
cell = getCell(row, 5);
|
||||||
|
cell.setCellValue(c.getProperty("item_revision_id"));//版本
|
||||||
|
cell = getCell(row, 6);
|
||||||
|
TCComponentItemRevision parent = (TCComponentItemRevision)c;
|
||||||
|
// System.out.println(newRev+"=="+c.equals(newRev)+"=="+parents.contains(newRev));
|
||||||
|
AIFComponentContext[] pfs = parent.getChildren("ML8_ProjectRelation");
|
||||||
|
TCComponentBOMWindow window = TCUtil.getWindow(session);
|
||||||
|
TCComponentBOMLine line = TCUtil.getBOMLine(session, window, parent);
|
||||||
|
if(!target.equals(newRev)) {
|
||||||
|
cell.setCellValue("是");//是否被取代
|
||||||
|
}else if(isUsed(line.getChildren(), target.getProperty("item_id"))) {
|
||||||
|
cell.setCellValue("否");//是否被取代
|
||||||
|
}else {
|
||||||
|
cell.setCellValue("是");//是否被取代
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
if(pfs!=null && pfs.length>0) {
|
||||||
|
TCComponent pf = (TCComponent) pfs[0].getComponent();
|
||||||
|
cell = getCell(row, 7);
|
||||||
|
cell.setCellValue(pf.getProperty("ml8_ProductCode"));//产品代号
|
||||||
|
cell = getCell(row, 8);
|
||||||
|
cell.setCellValue(pf.getProperty("ml8_ProductType"));//产品型号
|
||||||
|
}else {
|
||||||
|
cell = getCell(row, 7);
|
||||||
|
cell.setCellValue("");//产品代号
|
||||||
|
cell = getCell(row, 8);
|
||||||
|
cell.setCellValue("");//产品型号
|
||||||
|
}
|
||||||
|
cell = getCell(row, 9);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_NativeProducts"));//原生产品
|
||||||
|
cell = getCell(row, 10);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_ProductCode"));//历史产品代号
|
||||||
|
cell = getCell(row, 11);
|
||||||
|
cell.setCellValue(c.getProperty("ml8_ProductType"));//历史产品型号
|
||||||
|
cell = getCell(row, 12);
|
||||||
|
cell.setCellValue(c.getProperty("release_status_list"));//产品状态
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
output = new FileOutputStream(file.getPath());
|
||||||
|
wb.write(output);
|
||||||
|
input.close();
|
||||||
|
output.close();
|
||||||
|
// System.out.println("file:"+file.getPath());
|
||||||
|
String newPath = System.getProperty("java.io.tmpdir")+path.substring(path.lastIndexOf("\\"));
|
||||||
|
File reFile = new File(newPath);
|
||||||
|
file.renameTo(reFile);
|
||||||
|
// System.out.println("new directory:"+reFile.getPath());
|
||||||
|
reFile.renameTo(directory);
|
||||||
|
|
||||||
|
MessageBox.post(desktop, "导出完成", "INFO", MessageBox.INFORMATION);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(desktop, "错误:"+e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}finally {
|
||||||
|
if(input!=null)
|
||||||
|
input.close();
|
||||||
|
if(output!=null)
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private XSSFRow getRow(XSSFSheet sheet, int num) throws Exception {
|
||||||
|
XSSFRow row = sheet.getRow(num);
|
||||||
|
if(row==null)
|
||||||
|
row = sheet.createRow(num);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
private XSSFCell getCell(XSSFRow row, int col) throws Exception {
|
||||||
|
XSSFCell cell = row.getCell(col);
|
||||||
|
if(cell==null)
|
||||||
|
cell = row.createCell(col);
|
||||||
|
if(row.getRowNum()>2)
|
||||||
|
cell.setCellStyle(getCell(sourceRow, col).getCellStyle());
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
private void getParents(TCComponent rev) throws Exception {
|
||||||
|
TCComponent[] ps = rev.whereUsed(TCComponent.WHERE_USED_ALL);
|
||||||
|
if(ps==null || ps.length==0){
|
||||||
|
TCComponentItemRevision newRev = ((TCComponentItemRevision)rev).getItem().getLatestItemRevision();
|
||||||
|
if(!rev.equals(target) && !parents.contains(newRev) && newRev.getProperty("item_id").startsWith("ML")) {
|
||||||
|
parents.add(newRev);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(TCComponent parent : ps) {
|
||||||
|
System.out.println(rev+">>"+parent);
|
||||||
|
getParents(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private boolean isUsed(AIFComponentContext[] context, String id) throws Exception {
|
||||||
|
for(AIFComponentContext c : context) {
|
||||||
|
TCComponentBOMLine line = (TCComponentBOMLine)c.getComponent();
|
||||||
|
if(line.getProperty("bl_item_item_id").equals(id))
|
||||||
|
return true;
|
||||||
|
AIFComponentContext[] children = line.getChildren();
|
||||||
|
if(children!=null && children.length>0) {
|
||||||
|
if(isUsed(children, id))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: QueryTaskOpinionHandler.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCAttachmentType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentProcessType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTaskTemplate;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTaskTemplateType;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class CustAddReleaseHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
try {
|
||||||
|
TCPreferenceService preSer = session.getPreferenceService();
|
||||||
|
String[] value = preSer.getStringArray(4, "Cust_Release_Templates");
|
||||||
|
|
||||||
|
if(value == null || value.length < 1){
|
||||||
|
MessageBox.post("Cust_Release_Templates配置不正确,请联系管理员!", "WARNING", 1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCComponentProcessType procType = (TCComponentProcessType) session.getTypeComponent("Job");
|
||||||
|
TCComponentTaskTemplateType taskTempType = (TCComponentTaskTemplateType) session.getTypeComponent("EPMTaskTemplate");
|
||||||
|
TCComponentTaskTemplate taskTemp = taskTempType.find(value[0], TCComponentTaskTemplate.PROCESS_TEMPLATE_TYPE);
|
||||||
|
|
||||||
|
InterfaceAIFComponent[] selectComps = app.getTargetComponents();
|
||||||
|
if(selectComps.length > 0){
|
||||||
|
int[] intArr = new int[selectComps.length];
|
||||||
|
TCComponent[] comps = new TCComponent[selectComps.length];
|
||||||
|
for (int i = 0; i < intArr.length; i++) {
|
||||||
|
intArr[i] = TCAttachmentType.TARGET;
|
||||||
|
comps[i] = (TCComponent) selectComps[i];
|
||||||
|
}
|
||||||
|
procType.create("自动发起", "添加状态", taskTemp, comps, intArr, null);
|
||||||
|
MessageBox.post("添加状态成功!", "Info", 0);
|
||||||
|
}else{
|
||||||
|
MessageBox.post("请选择对象执行此功能,谢谢!", "WARNING", 1);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: QueryTaskOpinionHandler.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 上午10:18:54 tyl Ini 初始化文件
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCAttachmentType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentProcessType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTaskTemplate;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTaskTemplateType;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class CustRemoveReleaseHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
try {
|
||||||
|
TCPreferenceService preSer = session.getPreferenceService();
|
||||||
|
String[] value = preSer.getStringArray(4, "Cust_Release_Templates");
|
||||||
|
|
||||||
|
if(value == null || value.length < 2){
|
||||||
|
MessageBox.post("Cust_Release_Templates配置不正确,请联系管理员!", "WARNING", 1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCComponentProcessType procType = (TCComponentProcessType) session.getTypeComponent("Job");
|
||||||
|
TCComponentTaskTemplateType taskTempType = (TCComponentTaskTemplateType) session.getTypeComponent("EPMTaskTemplate");
|
||||||
|
TCComponentTaskTemplate taskTemp = taskTempType.find(value[1], TCComponentTaskTemplate.PROCESS_TEMPLATE_TYPE);
|
||||||
|
|
||||||
|
InterfaceAIFComponent[] selectComps = app.getTargetComponents();
|
||||||
|
if(selectComps.length > 0){
|
||||||
|
int[] intArr = new int[selectComps.length];
|
||||||
|
TCComponent[] comps = new TCComponent[selectComps.length];
|
||||||
|
for (int i = 0; i < intArr.length; i++) {
|
||||||
|
intArr[i] = TCAttachmentType.TARGET;
|
||||||
|
comps[i] = (TCComponent) selectComps[i];
|
||||||
|
}
|
||||||
|
procType.create("自动发起", "移除状态", taskTemp, comps, intArr, null);
|
||||||
|
MessageBox.post("移除状态成功!", "Info", 0);
|
||||||
|
}else{
|
||||||
|
MessageBox.post("请选择对象执行此功能,谢谢!", "WARNING", 1);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: ExportSearchResult.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 下午03:43:41 tyl Ini 初始化文件
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import jxl.Workbook;
|
||||||
|
import jxl.write.Label;
|
||||||
|
import jxl.write.WritableSheet;
|
||||||
|
import jxl.write.WritableWorkbook;
|
||||||
|
import com.connor.lidy.task.SearchResultDialog.SearchResults;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class ExportSearchResult {
|
||||||
|
public ExportSearchResult(List<SearchResults> tableInfos, PackExcelInfo excelInfo) {
|
||||||
|
createExcel(tableInfos, excelInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createExcel(List<SearchResults> tableInfos, PackExcelInfo excelInfo) {
|
||||||
|
Workbook workbook = null;
|
||||||
|
WritableSheet sourceSheet;
|
||||||
|
WritableWorkbook writeWorkbook;
|
||||||
|
File file = new File(excelInfo.getTemplateFileName());
|
||||||
|
int listsize = tableInfos.size();
|
||||||
|
int pageSize = excelInfo.getPageSize();
|
||||||
|
List<Object> listTemp = new ArrayList<Object>();
|
||||||
|
try {
|
||||||
|
workbook = Workbook.getWorkbook(file);
|
||||||
|
writeWorkbook = Workbook.createWorkbook(new File(excelInfo.getTargetFileName()), workbook);
|
||||||
|
sourceSheet = writeWorkbook.getSheet(0);
|
||||||
|
WritableSheet sheet = writeWorkbook.getSheet(0);
|
||||||
|
|
||||||
|
String sourceSheetName = sourceSheet.getName();
|
||||||
|
int page = listsize / pageSize;
|
||||||
|
if (((listsize % pageSize) > 0)) {
|
||||||
|
page = page + 1;
|
||||||
|
}
|
||||||
|
for (int i = 1; i <= page; i++) {
|
||||||
|
sheet = null;
|
||||||
|
listTemp = new ArrayList<Object>();
|
||||||
|
writeWorkbook.copySheet(sourceSheetName, "第" + i + "页", i);
|
||||||
|
sheet = writeWorkbook.getSheet("第" + i + "页");
|
||||||
|
for (int j = (i - 1) * pageSize; (j < pageSize * (i)) && ((j < listsize)); j++) {
|
||||||
|
listTemp.add(tableInfos.get(j));
|
||||||
|
}
|
||||||
|
addDataToExcel(sourceSheet, sheet, listTemp, i, excelInfo);
|
||||||
|
}
|
||||||
|
writeWorkbook.removeSheet(0);
|
||||||
|
writeWorkbook.write();
|
||||||
|
writeWorkbook.close();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
MessageBox.post("请检查:文件是否正在使用,请关闭", "信息提示", MessageBox.INFORMATION);
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addDataToExcel(WritableSheet sourceSheet, WritableSheet sheet, List<Object> listTemp, int currentpage, PackExcelInfo excelInfo) {
|
||||||
|
int row = excelInfo.getInitRow();
|
||||||
|
try {
|
||||||
|
for (row = 0; row < 34; row++) {
|
||||||
|
for (int col = 0; col < 15; col++) {
|
||||||
|
if (row >= 4) {
|
||||||
|
SearchResults result = (SearchResults) listTemp.get(row - 4);
|
||||||
|
if (result != null) {
|
||||||
|
if (col == 0) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getIndex());
|
||||||
|
} else if (col == 1) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_name());
|
||||||
|
} else if (col == 2) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_executor());
|
||||||
|
} else if (col == 3) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_createDate());
|
||||||
|
} else if (col == 4) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_finishDate());
|
||||||
|
} else if (col == 5) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_status());
|
||||||
|
} else if (col == 6) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_note());
|
||||||
|
} else if (col == 7) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getTask_type());
|
||||||
|
} else if (col == 8) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_executor());
|
||||||
|
} else if (col == 9) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_name());
|
||||||
|
} else if (col == 10) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_createDate());
|
||||||
|
} else if (col == 11) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_finishDate());
|
||||||
|
} else if (col == 12) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_lastModeUser());
|
||||||
|
} else if (col == 13) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_status());
|
||||||
|
} else if (col == 14) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, result.getProcess_templateName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((row == 0) && (col == 0)) {
|
||||||
|
insertCell(sourceSheet, sheet, col, row, excelInfo.getTitle());
|
||||||
|
} else
|
||||||
|
insertCell(sourceSheet, sheet, col, row, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertCell(WritableSheet sourceSheet, WritableSheet sheet, int col, int row, String value) {
|
||||||
|
try {
|
||||||
|
if ((value.trim().length() == 0) || (value == null)) {
|
||||||
|
Label lab = new Label(col, row, sourceSheet.getCell(col, row).getContents());
|
||||||
|
if (lab != null) {
|
||||||
|
if (sourceSheet.getCell(col, row) != null) {
|
||||||
|
if (sourceSheet.getCell(col, row).getCellFormat() != null) {
|
||||||
|
lab.setCellFormat(sourceSheet.getCell(col, row).getCellFormat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sheet.addCell(lab);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Label lab = new Label(col, row, value);
|
||||||
|
if (lab != null) {
|
||||||
|
if (sourceSheet.getCell(col, row) != null) {
|
||||||
|
if (sourceSheet.getCell(col, row).getCellFormat() != null) {
|
||||||
|
lab.setCellFormat(sourceSheet.getCell(col, row).getCellFormat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sheet.addCell(lab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} }
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: PackExcelInfo.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 ÏÂÎç03:45:50 tyl Ini ³õʼ»¯Îļþ
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
public class PackExcelInfo {
|
||||||
|
private String templateFileName = "c:\\viewTaskTemplate.xls";
|
||||||
|
private int pageSize = 30;
|
||||||
|
private String targetFileName = "c:\\report.xls";
|
||||||
|
private int initRow = 0;
|
||||||
|
private int initColumn = 0;
|
||||||
|
private int secondePageSize = 0;
|
||||||
|
private String title = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the initRow
|
||||||
|
*/
|
||||||
|
public int getInitRow() {
|
||||||
|
return initRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initRow the initRow to set
|
||||||
|
*/
|
||||||
|
public void setInitRow(int initRow) {
|
||||||
|
this.initRow = initRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the title
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param title the title to set
|
||||||
|
*/
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the initColumn
|
||||||
|
*/
|
||||||
|
public int getInitColumn() {
|
||||||
|
return initColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initColumn the initColumn to set
|
||||||
|
*/
|
||||||
|
public void setInitColumn(int initColumn) {
|
||||||
|
this.initColumn = initColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the pageSize
|
||||||
|
*/
|
||||||
|
public int getPageSize() {
|
||||||
|
return pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pageSize the pageSize to set
|
||||||
|
*/
|
||||||
|
public void setPageSize(int pageSize) {
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the targetFileName
|
||||||
|
*/
|
||||||
|
public String getTargetFileName() {
|
||||||
|
return targetFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param targetFileName the targetFileName to set
|
||||||
|
*/
|
||||||
|
public void setTargetFileName(String targetFileName) {
|
||||||
|
this.targetFileName = targetFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the templateFileName
|
||||||
|
*/
|
||||||
|
public String getTemplateFileName() {
|
||||||
|
return templateFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param templateFileName the templateFileName to set
|
||||||
|
*/
|
||||||
|
public void setTemplateFileName(String templateFileName) {
|
||||||
|
this.templateFileName = templateFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the secondePageSize
|
||||||
|
*/
|
||||||
|
public int getSecondePageSize() {
|
||||||
|
return secondePageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param secondePageSize the secondePageSize to set
|
||||||
|
*/
|
||||||
|
public void setSecondePageSize(int secondePageSize) {
|
||||||
|
this.secondePageSize = secondePageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: QueryTaskOpinionCommand.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 上午10:19:09 tyl Ini 初始化文件
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import com.connor.lidy.util.ProgressReporterDialog;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
|
||||||
|
|
||||||
|
public class QueryTaskOpinionCommand extends AbstractAIFCommand {
|
||||||
|
|
||||||
|
public AbstractAIFUIApplication application;
|
||||||
|
public QueryTaskOpinionCommand(AbstractAIFUIApplication abstractaifapplication) throws TCException {
|
||||||
|
application = abstractaifapplication;
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execute() throws TCException {
|
||||||
|
ProgressReporterDialog reporter = new ProgressReporterDialog("提示");
|
||||||
|
reporter.reportProgressMessage("正在导出,请稍候...");
|
||||||
|
new Thread(reporter).start();
|
||||||
|
new Thread() {
|
||||||
|
public void run(){
|
||||||
|
new QueryTaskOpinionOperation(application, reporter);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: QueryTaskOpinionHandler.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 ÉÏÎç10:18:54 tyl Ini ³õʼ»¯Îļþ
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
|
||||||
|
public class QueryTaskOpinionHandler extends AbstractHandler implements IHandler{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
||||||
|
*/
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("QueryTaskOpinionHandler");
|
||||||
|
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
try {
|
||||||
|
QueryTaskOpinionCommand command = new QueryTaskOpinionCommand(app);
|
||||||
|
command.executeModal();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: QueryTaskProcessCommand.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 上午10:19:35 tyl Ini 初始化文件
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.connor.lidy.task.util.GetAllUserIds;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
|
||||||
|
public class QueryTaskProcessCommand extends AbstractAIFCommand {
|
||||||
|
|
||||||
|
public AbstractAIFUIApplication application;
|
||||||
|
|
||||||
|
public QueryTaskProcessCommand(AbstractAIFUIApplication abstractaifapplication) throws TCException {
|
||||||
|
application = abstractaifapplication;
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execute() throws TCException {
|
||||||
|
System.out.println(" QueryTaskProcessCommand ");
|
||||||
|
GetAllUserIds.setUsers(new GetAllUserIds(application).getAllUsers());
|
||||||
|
new Thread() {
|
||||||
|
public void run() {
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
List<String> users = GetAllUserIds.getUsers();
|
||||||
|
if ((users == null) || (users.size() == 0)) {
|
||||||
|
System.out.println("--------------1000");
|
||||||
|
sleep(20000);
|
||||||
|
} else {
|
||||||
|
new SearchTaskDialog(application, "任务查询", false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: QueryTaskProcessHandler.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 ÉÏÎç10:19:51 tyl Ini ³õʼ»¯Îļþ
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.core.commands.IHandler;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
|
||||||
|
public class QueryTaskProcessHandler extends AbstractHandler implements IHandler {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
|
||||||
|
* ExecutionEvent)
|
||||||
|
*/
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
final AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||||
|
try {
|
||||||
|
QueryTaskProcessCommand command = new QueryTaskProcessCommand(app);
|
||||||
|
command.executeModal();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: SearchResultTableModel.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 下午03:46:12 tyl Ini 初始化文件
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task;
|
||||||
|
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.JTableHeader;
|
||||||
|
import javax.swing.table.TableColumn;
|
||||||
|
|
||||||
|
import com.connor.lidy.task.SearchResultDialog.SearchResults;
|
||||||
|
|
||||||
|
public class SearchResultTableModel extends DefaultTableModel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of EditBatchProcessLineTableModel.
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
public SearchResultTableModel(String[] names, List<SearchResults> data, int index) {
|
||||||
|
super(getData(data, index), names);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object[][] getData(List<SearchResults> data, int index) {
|
||||||
|
Object[][] datas = new Object[data.size()][];
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
if (index == 0) {
|
||||||
|
String[] info = new String[15];
|
||||||
|
info[0] = String.valueOf(i + 1);
|
||||||
|
info[1] = data.get(i).getTask_name();
|
||||||
|
info[2] = data.get(i).getTask_executor();
|
||||||
|
info[3] = data.get(i).getTask_createDate();
|
||||||
|
info[4] = data.get(i).getTask_finishDate();
|
||||||
|
info[5] = data.get(i).getTask_status();
|
||||||
|
info[6] = data.get(i).getTask_note();
|
||||||
|
info[7] = data.get(i).getTask_type();
|
||||||
|
info[8] = data.get(i).getProcess_executor();
|
||||||
|
info[9] = data.get(i).getProcess_name();
|
||||||
|
info[10] = data.get(i).getProcess_createDate();
|
||||||
|
info[11] = data.get(i).getProcess_finishDate();
|
||||||
|
info[12] = data.get(i).getProcess_lastModeUser();
|
||||||
|
info[13] = data.get(i).getProcess_status();
|
||||||
|
info[14] = data.get(i).getProcess_templateName();
|
||||||
|
datas[i] = info;
|
||||||
|
} else {
|
||||||
|
if (index == 1) {
|
||||||
|
String[] info = new String[8];
|
||||||
|
info[0] = String.valueOf(i + 1);
|
||||||
|
info[1] = data.get(i).getProcess_executor();
|
||||||
|
info[2] = data.get(i).getProcess_name();
|
||||||
|
info[3] = data.get(i).getTask_name();
|
||||||
|
info[4] = data.get(i).getProcess_createDate();
|
||||||
|
info[5] = data.get(i).getProcess_finishDate();
|
||||||
|
info[6] = data.get(i).getProcess_lastModeUser();
|
||||||
|
info[7] = data.get(i).getProcess_status();
|
||||||
|
datas[i] = info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int row, int column) {
|
||||||
|
if (column == 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置列宽
|
||||||
|
public void setTableColumnsWidth(JTable myTable, int index) {
|
||||||
|
if (index == 0) {
|
||||||
|
myTable.getColumnModel().getColumn(0).setPreferredWidth(30);
|
||||||
|
myTable.getColumnModel().getColumn(1).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(2).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(3).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(4).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(5).setPreferredWidth(60);
|
||||||
|
myTable.getColumnModel().getColumn(6).setPreferredWidth(60);
|
||||||
|
myTable.getColumnModel().getColumn(7).setPreferredWidth(60);
|
||||||
|
myTable.getColumnModel().getColumn(8).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(9).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(10).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(11).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(12).setPreferredWidth(80);
|
||||||
|
myTable.getColumnModel().getColumn(13).setPreferredWidth(50);
|
||||||
|
myTable.getColumnModel().getColumn(14).setPreferredWidth(80);
|
||||||
|
} else {
|
||||||
|
if (index == 1) {
|
||||||
|
myTable.getColumnModel().getColumn(0).setPreferredWidth(30);
|
||||||
|
myTable.getColumnModel().getColumn(1).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(2).setPreferredWidth(120);
|
||||||
|
myTable.getColumnModel().getColumn(3).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(4).setPreferredWidth(120);
|
||||||
|
myTable.getColumnModel().getColumn(5).setPreferredWidth(120);
|
||||||
|
myTable.getColumnModel().getColumn(6).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(7).setPreferredWidth(80);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置列宽:
|
||||||
|
public void FitTableColumns(JTable myTable) {
|
||||||
|
JTableHeader header = myTable.getTableHeader();
|
||||||
|
// header.getColumnModel().getColumn(0)
|
||||||
|
int rowCount = myTable.getRowCount();
|
||||||
|
Enumeration<TableColumn> columns = myTable.getColumnModel().getColumns();
|
||||||
|
while (columns.hasMoreElements()) {
|
||||||
|
TableColumn column = (TableColumn) columns.nextElement();
|
||||||
|
int col = header.getColumnModel().getColumnIndex(column.getIdentifier());
|
||||||
|
int width = (int) myTable.getTableHeader().getDefaultRenderer().getTableCellRendererComponent(myTable, column.getIdentifier(), false, false, -1, col).getPreferredSize().getWidth();
|
||||||
|
for (int row = 0; row < rowCount; row++) {
|
||||||
|
int preferedWidth = (int) myTable.getCellRenderer(row, col).getTableCellRendererComponent(myTable, myTable.getValueAt(row, col), false, false, row, col).getPreferredSize().getWidth();
|
||||||
|
width = Math.max(width, preferedWidth);
|
||||||
|
}
|
||||||
|
header.setResizingColumn(column);
|
||||||
|
column.setWidth(width + myTable.getIntercellSpacing().width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# File name: CheckBoxColumnRender.java
|
||||||
|
# File description:
|
||||||
|
#=============================================================================
|
||||||
|
# Date Name Action Description of Change
|
||||||
|
# 2011-4-20 liqz Ini ³õʼ»¯(From Shaangu)
|
||||||
|
#=============================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
|
public class CheckBoxColumnRender extends DefaultTableCellRenderer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public CheckBoxColumnRender() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
|
//µÃµ½±íÍ·
|
||||||
|
JCheckBox checkBox=new JCheckBox();
|
||||||
|
// JTableHeader header = table.getTableHeader();
|
||||||
|
// if (header != null) {
|
||||||
|
// setForeground(header.getForeground());
|
||||||
|
// setBackground(header.getBackground());
|
||||||
|
// setFont(header.getFont());
|
||||||
|
// }
|
||||||
|
setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
checkBox.setSelected(Boolean.valueOf(value.toString()));
|
||||||
|
// (value == null) ? "" : value.toString()
|
||||||
|
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||||
|
return checkBox;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,205 @@
|
|||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
import javax.swing.table.JTableHeader;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
import javax.swing.table.TableColumn;
|
||||||
|
|
||||||
|
public class ColumnGroup {
|
||||||
|
protected TableCellRenderer renderer;
|
||||||
|
|
||||||
|
protected Vector<Object> v;
|
||||||
|
|
||||||
|
protected String text;
|
||||||
|
|
||||||
|
protected int margin = 0;
|
||||||
|
|
||||||
|
public ColumnGroup(String text) {
|
||||||
|
this(null, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnGroup(TableCellRenderer renderer, String text) {
|
||||||
|
if (renderer == null) {
|
||||||
|
this.renderer = new DefaultTableCellRenderer() {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
|
JTableHeader header = table.getTableHeader();
|
||||||
|
if (header != null) {
|
||||||
|
setForeground(header.getForeground());
|
||||||
|
setBackground(header.getBackground());
|
||||||
|
setFont(header.getFont());
|
||||||
|
}
|
||||||
|
setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
this.setText((value == null) ? "" : value.toString());
|
||||||
|
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.renderer = renderer;
|
||||||
|
}
|
||||||
|
this.text = text;
|
||||||
|
v = new Vector<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param obj TableColumn or ColumnGroup
|
||||||
|
*/
|
||||||
|
public void add(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
v.addElement(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param c TableColumn
|
||||||
|
* @param v ColumnGroups
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Vector<Object> getColumnGroups(TableColumn c, Vector<Object> g) {
|
||||||
|
g.addElement(this);
|
||||||
|
if (v.contains(c))
|
||||||
|
return g;
|
||||||
|
Enumeration<Object> enumeration = v.elements();
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
Object obj = enumeration.nextElement();
|
||||||
|
if (obj instanceof ColumnGroup) {
|
||||||
|
Vector<Object> groups = (Vector<Object>) ((ColumnGroup) obj).getColumnGroups(c, (Vector<Object>) g.clone());
|
||||||
|
if (groups != null)
|
||||||
|
return groups;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableCellRenderer getHeaderRenderer() {
|
||||||
|
return renderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getHeaderValue() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
return v == null ? 0 : v.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dimension getSize(JTable table) {
|
||||||
|
Component comp = renderer.getTableCellRendererComponent(table, getHeaderValue(), false, false, -1, -1);
|
||||||
|
int height = comp.getPreferredSize().height;
|
||||||
|
int width = 0;
|
||||||
|
Enumeration<Object> enumeration = v.elements();
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
Object obj = enumeration.nextElement();
|
||||||
|
if (obj instanceof TableColumn) {
|
||||||
|
TableColumn aColumn = (TableColumn) obj;
|
||||||
|
width += aColumn.getWidth();
|
||||||
|
width += margin;
|
||||||
|
} else {
|
||||||
|
width += ((ColumnGroup) obj).getSize(table).width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Dimension(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建日期:(2003-7-14 10:53:26)
|
||||||
|
* @return java.lang.String
|
||||||
|
*/
|
||||||
|
public java.lang.String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表头中删除Column 创建日期:(2002-9-25 15:49:00)
|
||||||
|
*/
|
||||||
|
public boolean removeColumn(ColumnGroup ptg, TableColumn tc) {
|
||||||
|
boolean retFlag = false;
|
||||||
|
if (tc != null) {
|
||||||
|
for (int i = 0; i < ptg.v.size(); i++) {
|
||||||
|
Object tmpObj = ptg.v.get(i);
|
||||||
|
if (tmpObj instanceof ColumnGroup) {
|
||||||
|
retFlag = removeColumn((ColumnGroup) tmpObj, tc);
|
||||||
|
// 如果找到返回
|
||||||
|
if (retFlag)
|
||||||
|
break;
|
||||||
|
} else if (tmpObj instanceof TableColumn) {
|
||||||
|
// 判断是否查找的对象
|
||||||
|
if (tmpObj == tc) {
|
||||||
|
ptg.v.remove(i);
|
||||||
|
retFlag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表头中删除ColumnGrp 删除返回true,否则返回false; 创建日期:(2002-9-25 15:49:00)
|
||||||
|
*/
|
||||||
|
public boolean removeColumnGrp(ColumnGroup ptg, ColumnGroup tg) {
|
||||||
|
boolean retFlag = false;
|
||||||
|
if (tg != null) {
|
||||||
|
for (int i = 0; i < ptg.v.size(); i++) {
|
||||||
|
Object tmpObj = ptg.v.get(i);
|
||||||
|
if (tmpObj instanceof ColumnGroup) {
|
||||||
|
// 判断是否查找的对象
|
||||||
|
if (tmpObj == tg) {
|
||||||
|
ptg.v.remove(i);
|
||||||
|
retFlag = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
retFlag = removeColumnGrp((ColumnGroup) tmpObj, tg);
|
||||||
|
// 如果找到返回
|
||||||
|
if (retFlag)
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (tmpObj instanceof TableColumn) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnMargin(int margin) {
|
||||||
|
this.margin = margin;
|
||||||
|
Enumeration<Object> enumeration = v.elements();
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
Object obj = enumeration.nextElement();
|
||||||
|
if (obj instanceof ColumnGroup) {
|
||||||
|
((ColumnGroup) obj).setColumnMargin(margin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderRenderer(TableCellRenderer renderer) {
|
||||||
|
if (renderer != null) {
|
||||||
|
this.renderer = renderer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建日期:(2003-7-14 10:53:26)
|
||||||
|
* @param newText java.lang.String
|
||||||
|
*/
|
||||||
|
public void setText(java.lang.String newText) {
|
||||||
|
text = newText;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,251 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: 搜索数据集
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date Name Action Description of Change
|
||||||
|
# 20090301 Matt Shan Ini 搜索数据集
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.kernel.TCAccessControlService;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentQuery;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentQueryType;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.kernel.TCTextService;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
public class DataSetFinder {
|
||||||
|
|
||||||
|
private TCSession session = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索数据集
|
||||||
|
* @param session 系统session
|
||||||
|
*/
|
||||||
|
public DataSetFinder(TCSession pSession) {
|
||||||
|
queryType = null;
|
||||||
|
datasetQuery = null;
|
||||||
|
boolean flag = false;
|
||||||
|
try {
|
||||||
|
session = pSession;
|
||||||
|
its = session.getTextService();
|
||||||
|
queryType = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
|
||||||
|
}
|
||||||
|
catch (TCException imane) {
|
||||||
|
imane.printStackTrace();
|
||||||
|
imane.dump();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
datasetQuery = (TCComponentQuery) queryType.find("数据集...");
|
||||||
|
}
|
||||||
|
catch (TCException imane) {
|
||||||
|
imane.printStackTrace();
|
||||||
|
imane.dump();
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (datasetQuery == null || flag) {
|
||||||
|
try {
|
||||||
|
datasetQuery = (TCComponentQuery) queryType.find(its.getTextValue("DataSet..."));
|
||||||
|
}
|
||||||
|
catch (TCException imane) {
|
||||||
|
imane.printStackTrace();
|
||||||
|
imane.dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据集
|
||||||
|
* @param datasetname 数据集名称
|
||||||
|
* @return 根据数据集名称查询数据集
|
||||||
|
*/
|
||||||
|
public TCComponentDataset FindDatasetByName(String datasetname, String pOwningUser, String pOwningGroup, String pDatasetType) {
|
||||||
|
System.out.println("-----------FindDatasetByName");
|
||||||
|
try {
|
||||||
|
//String f_dataset_name[] = { its.getTextValue("Name"), its.getTextValue("OwningUser"), its.getTextValue("OwningGroup"), its.getTextValue("DatasetType") };
|
||||||
|
String f_dataset_name[] = new String[4];
|
||||||
|
f_dataset_name[0] = its.getTextValue("Name");
|
||||||
|
if(f_dataset_name[0] == null){
|
||||||
|
f_dataset_name[0] = "Name";
|
||||||
|
}
|
||||||
|
f_dataset_name[1] = its.getTextValue("OwningUser");
|
||||||
|
if(f_dataset_name[1] == null){
|
||||||
|
f_dataset_name[1] = "Owning User";
|
||||||
|
}
|
||||||
|
f_dataset_name[2] = its.getTextValue("OwningGroup");
|
||||||
|
if(f_dataset_name[2] == null){
|
||||||
|
f_dataset_name[2] = "Owning Group";
|
||||||
|
}
|
||||||
|
f_dataset_name[3] = its.getTextValue("DatasetType");
|
||||||
|
if(f_dataset_name[3] == null){
|
||||||
|
f_dataset_name[3] = "Dataset Type";
|
||||||
|
}
|
||||||
|
f_dataset_name_value = new String[4];
|
||||||
|
f_dataset_name_value[0] = datasetname;
|
||||||
|
f_dataset_name_value[1] = pOwningUser;
|
||||||
|
f_dataset_name_value[2] = pOwningGroup;
|
||||||
|
f_dataset_name_value[3] = pDatasetType;
|
||||||
|
com.teamcenter.rac.kernel.TCComponent dataset[] = datasetQuery.execute(f_dataset_name, f_dataset_name_value);
|
||||||
|
if (dataset == null || dataset.length == 0) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
TCComponentDataset dataset0 = (TCComponentDataset) dataset[0];
|
||||||
|
TCComponentDataset dataset1 = dataset0.latest();
|
||||||
|
return dataset1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (TCException imane) {
|
||||||
|
imane.printStackTrace();
|
||||||
|
imane.dump();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模版数据集
|
||||||
|
* @param datasetname 数据集名称
|
||||||
|
* @return 根据数据集名称查询数据集
|
||||||
|
*/
|
||||||
|
public TCComponentDataset FindDatasetByName(String datasetname) {
|
||||||
|
TCComponent[] components = null;
|
||||||
|
try {
|
||||||
|
TCComponentItemRevision revision =null;
|
||||||
|
TCComponentItemType tccomItemType = (TCComponentItemType) session.getTypeComponent("Item");
|
||||||
|
TCComponentItem[]items =tccomItemType.findItems(datasetname);
|
||||||
|
if(items.length >0){
|
||||||
|
revision=items[0].getLatestItemRevision() ;
|
||||||
|
}
|
||||||
|
components = revision.getRelatedComponents("IMAN_specification");// 通过关系找对象
|
||||||
|
for (TCComponent component : components) {
|
||||||
|
if (component instanceof TCComponentDataset) {
|
||||||
|
TCComponentDataset dataset = (TCComponentDataset) component;
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (TCException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据集相关文件到指定路径
|
||||||
|
* @param dataset 数据集
|
||||||
|
* @param nameRef 数据集名称
|
||||||
|
* @param filename 新命名文件
|
||||||
|
* @param dir 导出到得路径
|
||||||
|
* @return 新生成文件
|
||||||
|
*/
|
||||||
|
public File ExportFileToDir(TCComponentDataset dataset, String nameRef, String filename, String dir) {
|
||||||
|
File exportFile = null;
|
||||||
|
try {
|
||||||
|
String workdir = dir;
|
||||||
|
File tFile = new File(workdir, filename);
|
||||||
|
if (tFile.exists())
|
||||||
|
tFile.delete();
|
||||||
|
if (!checkAccessPrivilige(session.getUser(), dataset, "EXPORT")) {
|
||||||
|
MessageBox.post("您没有权限下载报表模板文件!", "提示", MessageBox.WARNING);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponentTcFile files[] = dataset.getTcFiles();
|
||||||
|
if (files.length != 1) {
|
||||||
|
MessageBox.post("请检查报表模板文件是否配置正确!", "提示", MessageBox.WARNING);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
exportFile = files[i].getFile(workdir, filename);
|
||||||
|
}
|
||||||
|
return exportFile;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkAccessPrivilige(TCComponentUser user, TCComponent comp, String accessName) throws TCException {
|
||||||
|
TCAccessControlService accessService = ((TCSession) session).getTCAccessControlService();
|
||||||
|
boolean returnboolean = accessService.checkUsersPrivilege(user, comp, accessName);
|
||||||
|
return returnboolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据集相关文件到指定路径
|
||||||
|
* @param dataset 数据集
|
||||||
|
* @param nameRef 数据集名称
|
||||||
|
* @param filename 新命名文件
|
||||||
|
* @param dir 导出到得路径
|
||||||
|
* @return 新生成文件
|
||||||
|
*/
|
||||||
|
public File ExportFileToDir(TCComponentDataset dataset, String filename, String dir) {
|
||||||
|
File exportFile = null;
|
||||||
|
try {
|
||||||
|
String workdir = dir;
|
||||||
|
File tFile = new File(workdir, filename);
|
||||||
|
if (tFile.exists())
|
||||||
|
tFile.delete();
|
||||||
|
if (!checkAccessPrivilige(session.getUser(), dataset, "EXPORT")) {
|
||||||
|
MessageBox.post("您没有权限下载报表模板文件!", "提示", MessageBox.WARNING);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponentTcFile files[] = dataset.getTcFiles();
|
||||||
|
if (files.length != 1) {
|
||||||
|
MessageBox.post("请检查报表模板文件是否配置正确!", "提示", MessageBox.WARNING);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
exportFile = files[i].getFile(workdir, filename);
|
||||||
|
}
|
||||||
|
return exportFile;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File ExportFileToDir(TCComponentDataset dataset, String dir) {
|
||||||
|
File exportFile = null;
|
||||||
|
try {
|
||||||
|
String workdir = dir;
|
||||||
|
if (!checkAccessPrivilige(session.getUser(), dataset, "EXPORT")) {
|
||||||
|
MessageBox.post("您没有权限下载报表模板文件!", "提示", MessageBox.WARNING);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
TCComponentTcFile files[] = dataset.getTcFiles();
|
||||||
|
if (files.length != 1) {
|
||||||
|
MessageBox.post("请检查报表模板文件是否配置正确!", "提示", MessageBox.WARNING);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
exportFile = files[i].getFile(workdir);
|
||||||
|
}
|
||||||
|
return exportFile;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TCComponentQueryType queryType;
|
||||||
|
private TCComponentQuery datasetQuery;
|
||||||
|
private TCTextService its;
|
||||||
|
private String f_dataset_name_value[];
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: GetChoosePath.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 下午03:45:21 tyl Ini 初始化文件
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
|
||||||
|
public class GetChoosePath {
|
||||||
|
|
||||||
|
public String getPath(String filename) {
|
||||||
|
String tempPath = System.getProperty("java.io.tmpdir");
|
||||||
|
File tempFile = new File(tempPath + filename);
|
||||||
|
JFileChooser jfc = null;
|
||||||
|
if (!tempFile.exists()) {
|
||||||
|
try {
|
||||||
|
tempFile.createNewFile();
|
||||||
|
jfc = new JFileChooser();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tempFile.exists()) {
|
||||||
|
BufferedReader in;
|
||||||
|
try {
|
||||||
|
in = new BufferedReader(new InputStreamReader(new FileInputStream(tempFile)));
|
||||||
|
String line;
|
||||||
|
try {
|
||||||
|
line = in.readLine();
|
||||||
|
if ((line != null) && (line.length() > 0)) {
|
||||||
|
File file = new File(line);
|
||||||
|
if (file.exists()) {
|
||||||
|
jfc = new JFileChooser(file);
|
||||||
|
} else {
|
||||||
|
jfc = new JFileChooser();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jfc = new JFileChooser();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jfc.setFileSelectionMode(JFileChooser.SAVE_DIALOG);
|
||||||
|
jfc.setInheritsPopupMenu(true);
|
||||||
|
// jfc.setDialogTitle("...");
|
||||||
|
jfc.setMultiSelectionEnabled(false);
|
||||||
|
|
||||||
|
jfc.setFileFilter(new javax.swing.filechooser.FileFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File f) {
|
||||||
|
if (f.isDirectory())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return null;//写的是文件的类型
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
int openOrCancel = jfc.showSaveDialog(null);
|
||||||
|
if (openOrCancel == 0) {
|
||||||
|
try {
|
||||||
|
BufferedWriter output;
|
||||||
|
output = new BufferedWriter(new FileWriter(tempFile));
|
||||||
|
output.write(jfc.getSelectedFile().getAbsolutePath());
|
||||||
|
output.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
File file = jfc.getSelectedFile();
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,255 @@
|
|||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.plaf.basic.BasicTableHeaderUI;
|
||||||
|
import javax.swing.table.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多表头TableHeaderUI
|
||||||
|
*
|
||||||
|
* @author flyx
|
||||||
|
*/
|
||||||
|
public class GroupableTableHeaderUI extends BasicTableHeaderUI {
|
||||||
|
private int m_height;
|
||||||
|
|
||||||
|
private Dimension createHeaderSize(long width) {
|
||||||
|
TableColumnModel columnModel = header.getColumnModel();
|
||||||
|
width += columnModel.getColumnMargin() * columnModel.getColumnCount();
|
||||||
|
if (width > Integer.MAX_VALUE) {
|
||||||
|
width = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
return new Dimension((int) width, getHeaderHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得该多表头下的基本列数(zjb) 递归 创建日期:(02-4-8 18:03:56)
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @param cg
|
||||||
|
* nc.ui.pub.beans.table.ColumnGroup
|
||||||
|
*/
|
||||||
|
private int getColCountUnderColGroup(ColumnGroup cg, int iCount) {
|
||||||
|
Vector<Object> v = cg.v;
|
||||||
|
for (int i = 0; i < v.size(); i++) {
|
||||||
|
Object obj = v.elementAt(i);
|
||||||
|
if (obj instanceof ColumnGroup)
|
||||||
|
iCount = getColCountUnderColGroup((ColumnGroup) obj, iCount);
|
||||||
|
else
|
||||||
|
iCount++;
|
||||||
|
}
|
||||||
|
return iCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeaderHeight() {
|
||||||
|
int height = 0;
|
||||||
|
TableColumnModel columnModel = header.getColumnModel();
|
||||||
|
for (int column = 0; column < columnModel.getColumnCount(); column++) {
|
||||||
|
TableColumn aColumn = columnModel.getColumn(column);
|
||||||
|
TableCellRenderer renderer = aColumn.getHeaderRenderer();
|
||||||
|
//
|
||||||
|
if (renderer == null) {
|
||||||
|
renderer = new DefaultTableCellRenderer() {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Component getTableCellRendererComponent(
|
||||||
|
JTable table, Object value, boolean isSelected,
|
||||||
|
boolean hasFocus, int row, int column) {
|
||||||
|
JTableHeader header = table.getTableHeader();
|
||||||
|
if (header != null) {
|
||||||
|
setForeground(header.getForeground());
|
||||||
|
setBackground(header.getBackground());
|
||||||
|
setFont(header.getFont());
|
||||||
|
}
|
||||||
|
setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
setText((value == null) ? "" : value.toString());
|
||||||
|
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
|
Component comp = renderer.getTableCellRendererComponent(header
|
||||||
|
.getTable(), aColumn.getHeaderValue(), false, false, -1,
|
||||||
|
column);
|
||||||
|
int cHeight = comp.getPreferredSize().height;
|
||||||
|
Enumeration<Object> enumeration = ((GroupableTableHeader) header).getColumnGroups(aColumn);
|
||||||
|
if (enumeration != null) {
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
ColumnGroup cGroup = (ColumnGroup) enumeration
|
||||||
|
.nextElement();
|
||||||
|
cHeight += cGroup.getSize(header.getTable()).height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
height = Math.max(height, cHeight);
|
||||||
|
}
|
||||||
|
height = Math.max(height, m_height);
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dimension getPreferredSize(JComponent c) {
|
||||||
|
long width = 0;
|
||||||
|
Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
TableColumn aColumn = (TableColumn) enumeration.nextElement();
|
||||||
|
width = width + aColumn.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
return createHeaderSize(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paint(Graphics g, JComponent c) {
|
||||||
|
Rectangle clipBounds = g.getClipBounds();
|
||||||
|
if (header.getColumnModel() == null)
|
||||||
|
return;
|
||||||
|
((GroupableTableHeader) header).setColumnMargin();
|
||||||
|
int column = 0;
|
||||||
|
Dimension size = header.getSize();
|
||||||
|
Rectangle cellRect = new Rectangle(0, 0, size.width, size.height);
|
||||||
|
Hashtable<ColumnGroup, Rectangle> h = new Hashtable<>();
|
||||||
|
int columnMargin = header.getColumnModel().getColumnMargin();
|
||||||
|
Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
cellRect.height = size.height;
|
||||||
|
cellRect.y = 0;
|
||||||
|
TableColumn aColumn = (TableColumn) enumeration.nextElement();
|
||||||
|
Enumeration<Object> cGroups = ((GroupableTableHeader) header).getColumnGroups(aColumn);
|
||||||
|
if (cGroups != null) {
|
||||||
|
int groupHeight = 0;
|
||||||
|
while (cGroups.hasMoreElements()) {
|
||||||
|
ColumnGroup cGroup = (ColumnGroup) cGroups.nextElement();
|
||||||
|
Rectangle groupRect = (Rectangle) h.get(cGroup);
|
||||||
|
if (groupRect == null) {
|
||||||
|
groupRect = new Rectangle(cellRect);
|
||||||
|
Dimension d = cGroup.getSize(header.getTable());
|
||||||
|
if (!System.getProperty("java.vm.version").startsWith(
|
||||||
|
"1.2")) {
|
||||||
|
int iColCount = getColCountUnderColGroup(cGroup, 0); // 获得该多表头下的基本列数(zjb)
|
||||||
|
// System.out.println(iColCount);
|
||||||
|
groupRect.width = d.width - iColCount
|
||||||
|
* columnMargin;
|
||||||
|
} else
|
||||||
|
groupRect.width = d.width;
|
||||||
|
groupRect.height = d.height;
|
||||||
|
h.put(cGroup, groupRect);
|
||||||
|
}
|
||||||
|
paintCell(g, groupRect, cGroup);
|
||||||
|
groupHeight += groupRect.height;
|
||||||
|
cellRect.height = size.height - groupHeight;
|
||||||
|
cellRect.y = groupHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!System.getProperty("java.vm.version").startsWith("1.2"))
|
||||||
|
cellRect.width = aColumn.getWidth();
|
||||||
|
else
|
||||||
|
cellRect.width = aColumn.getWidth() + columnMargin;
|
||||||
|
|
||||||
|
if (cellRect.intersects(clipBounds)) {
|
||||||
|
paintCell(g, cellRect, column);
|
||||||
|
}
|
||||||
|
cellRect.x += cellRect.width;
|
||||||
|
column++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void paintCell(Graphics g, Rectangle cellRect, int columnIndex) {
|
||||||
|
TableColumn aColumn = header.getColumnModel().getColumn(columnIndex);
|
||||||
|
TableCellRenderer renderer = aColumn.getHeaderRenderer();
|
||||||
|
//
|
||||||
|
if (renderer == null) {
|
||||||
|
renderer = new DefaultTableCellRenderer() {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Component getTableCellRendererComponent(JTable table,
|
||||||
|
Object value, boolean isSelected, boolean hasFocus,
|
||||||
|
int row, int column) {
|
||||||
|
JTableHeader header = table.getTableHeader();
|
||||||
|
if (header != null) {
|
||||||
|
setForeground(header.getForeground());
|
||||||
|
setBackground(header.getBackground());
|
||||||
|
setFont(header.getFont());
|
||||||
|
}
|
||||||
|
setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
setText((value == null) ? "" : value.toString());
|
||||||
|
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Component component =
|
||||||
|
// renderer.getTableCellRendererComponent(header.getTable(),
|
||||||
|
// aColumn.getHeaderValue(), false, false, -1, columnIndex);
|
||||||
|
//
|
||||||
|
String headerValue = aColumn.getHeaderValue().toString();
|
||||||
|
Component component = renderer.getTableCellRendererComponent(header
|
||||||
|
.getTable(), headerValue, false, false, -1, columnIndex);
|
||||||
|
|
||||||
|
rendererPane.add(component);
|
||||||
|
rendererPane.paintComponent(g, component, header, cellRect.x,
|
||||||
|
cellRect.y, cellRect.width, cellRect.height, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void paintCell(Graphics g, Rectangle cellRect, ColumnGroup cGroup) {
|
||||||
|
TableCellRenderer renderer = cGroup.getHeaderRenderer();
|
||||||
|
//
|
||||||
|
if (renderer == null) {
|
||||||
|
renderer = new DefaultTableCellRenderer() {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Component getTableCellRendererComponent(JTable table,
|
||||||
|
Object value, boolean isSelected, boolean hasFocus,
|
||||||
|
int row, int column) {
|
||||||
|
JTableHeader header = table.getTableHeader();
|
||||||
|
if (header != null) {
|
||||||
|
setForeground(header.getForeground());
|
||||||
|
setBackground(header.getBackground());
|
||||||
|
setFont(header.getFont());
|
||||||
|
}
|
||||||
|
setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
setText((value == null) ? "" : value.toString());
|
||||||
|
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Component component =
|
||||||
|
// renderer.getTableCellRendererComponent(header.getTable(),
|
||||||
|
// cGroup.getHeaderValue(), false, false, -1, -1);
|
||||||
|
//
|
||||||
|
String headerValue = cGroup.getHeaderValue().toString();
|
||||||
|
Component component = renderer.getTableCellRendererComponent(header
|
||||||
|
.getTable(), headerValue, false, false, -1, -1);
|
||||||
|
|
||||||
|
rendererPane.add(component);
|
||||||
|
rendererPane.paintComponent(g, component, header, cellRect.x,
|
||||||
|
cellRect.y, cellRect.width, cellRect.height, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderHeight(int iHeight) {
|
||||||
|
m_height = iHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# File name: PackFailDownInfo.java
|
||||||
|
# File description:
|
||||||
|
#=============================================================================
|
||||||
|
# Date Name Action Description of Change
|
||||||
|
# 2011-4-20 liqz Ini ³õʼ»¯(From Shaangu)
|
||||||
|
#=============================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
|
||||||
|
public class PackFailDownInfo {
|
||||||
|
private TCComponentItemRevision itemRev=null;
|
||||||
|
private String itemId;
|
||||||
|
private String rev;
|
||||||
|
private String datasetName;
|
||||||
|
private String reference_file;
|
||||||
|
private TCComponentDataset dataSet;
|
||||||
|
private String filePath="";
|
||||||
|
private String reason="";
|
||||||
|
private String owner="";
|
||||||
|
private String needDown="false";
|
||||||
|
/**
|
||||||
|
* @return the owner
|
||||||
|
*/
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the itemRev
|
||||||
|
*/
|
||||||
|
public TCComponentItemRevision getItemRev() {
|
||||||
|
return itemRev;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param itemRev the itemRev to set
|
||||||
|
*/
|
||||||
|
public void setItemRev(TCComponentItemRevision itemRev) {
|
||||||
|
this.itemRev = itemRev;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param owner the owner to set
|
||||||
|
*/
|
||||||
|
public void setOwner(String owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the itemId
|
||||||
|
*/
|
||||||
|
public String getItemId() {
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param itemId the itemId to set
|
||||||
|
*/
|
||||||
|
public void setItemId(String itemId) {
|
||||||
|
this.itemId = itemId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the rev
|
||||||
|
*/
|
||||||
|
public String getRev() {
|
||||||
|
return rev;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param rev the rev to set
|
||||||
|
*/
|
||||||
|
public void setRev(String rev) {
|
||||||
|
this.rev = rev;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the datasetName
|
||||||
|
*/
|
||||||
|
public String getDatasetName() {
|
||||||
|
return datasetName;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param datasetName the datasetName to set
|
||||||
|
*/
|
||||||
|
public void setDatasetName(String datasetName) {
|
||||||
|
this.datasetName = datasetName;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the reference_file
|
||||||
|
*/
|
||||||
|
public String getReference_file() {
|
||||||
|
return reference_file;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param reference_file the reference_file to set
|
||||||
|
*/
|
||||||
|
public void setReference_file(String reference_file) {
|
||||||
|
this.reference_file = reference_file;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the dataSet
|
||||||
|
*/
|
||||||
|
public TCComponentDataset getDataSet() {
|
||||||
|
return dataSet;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param dataSet the dataSet to set
|
||||||
|
*/
|
||||||
|
public void setDataSet(TCComponentDataset dataSet) {
|
||||||
|
this.dataSet = dataSet;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the filePath
|
||||||
|
*/
|
||||||
|
public String getFilePath() {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param filePath the filePath to set
|
||||||
|
*/
|
||||||
|
public void setFilePath(String filePath) {
|
||||||
|
this.filePath = filePath;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the reason
|
||||||
|
*/
|
||||||
|
public String getReason() {
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param reason the reason to set
|
||||||
|
*/
|
||||||
|
public void setReason(String reason) {
|
||||||
|
this.reason = reason;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return the needDown
|
||||||
|
*/
|
||||||
|
public String getNeedDown() {
|
||||||
|
return needDown;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param needDown the needDown to set
|
||||||
|
*/
|
||||||
|
public void setNeedDown(String needDown) {
|
||||||
|
this.needDown = needDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# opyright (c) 2009 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# File name: PackSuccessfulInfo.java
|
||||||
|
# File description:
|
||||||
|
#=============================================================================
|
||||||
|
# Date Name Action Description of Change
|
||||||
|
# 2011-4-20 liqz Ini ³õʼ»¯(From Shaangu)
|
||||||
|
#=============================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
public class PackSuccessfulInfo {
|
||||||
|
private String index = "";
|
||||||
|
private String itemID = "";
|
||||||
|
private String itemRev = "";
|
||||||
|
private String itemOwner = "";
|
||||||
|
private String dataset = "";
|
||||||
|
private String refFile = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the index
|
||||||
|
*/
|
||||||
|
public String getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param index the index to set
|
||||||
|
*/
|
||||||
|
public void setIndex(String index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the itemID
|
||||||
|
*/
|
||||||
|
public String getItemID() {
|
||||||
|
return itemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param itemID the itemID to set
|
||||||
|
*/
|
||||||
|
public void setItemID(String itemID) {
|
||||||
|
this.itemID = itemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the itemRev
|
||||||
|
*/
|
||||||
|
public String getItemRev() {
|
||||||
|
return itemRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param itemRev the itemRev to set
|
||||||
|
*/
|
||||||
|
public void setItemRev(String itemRev) {
|
||||||
|
this.itemRev = itemRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the itemOwner
|
||||||
|
*/
|
||||||
|
public String getItemOwner() {
|
||||||
|
return itemOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param itemOwner the itemOwner to set
|
||||||
|
*/
|
||||||
|
public void setItemOwner(String itemOwner) {
|
||||||
|
this.itemOwner = itemOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the dataset
|
||||||
|
*/
|
||||||
|
public String getDataset() {
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dataset the dataset to set
|
||||||
|
*/
|
||||||
|
public void setDataset(String dataset) {
|
||||||
|
this.dataset = dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the refFile
|
||||||
|
*/
|
||||||
|
public String getRefFile() {
|
||||||
|
return refFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param refFile the refFile to set
|
||||||
|
*/
|
||||||
|
public void setRefFile(String refFile) {
|
||||||
|
this.refFile = refFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# File name: ResultTableModel.java
|
||||||
|
# File description:
|
||||||
|
#=============================================================================
|
||||||
|
# Date Name Action Description of Change
|
||||||
|
# 2011-4-20 liqz Ini 初始化(From Shaangu)
|
||||||
|
#=============================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
import javax.swing.table.JTableHeader;
|
||||||
|
import javax.swing.table.TableColumn;
|
||||||
|
|
||||||
|
|
||||||
|
public class ResultTableModel extends DefaultTableModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static String[] names = { "*", "零组件ID", "版本", "所有者","数据集", "命名的引用" ,"原因","可重新下载"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of EditBatchProcessLineTableModel.
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
public ResultTableModel(List<PackFailDownInfo> data) {
|
||||||
|
super(getData(data), names);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object[][] getData(List<PackFailDownInfo> data) {
|
||||||
|
Object[][] datas = new Object[data.size()][];
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
String[] info = new String[8];
|
||||||
|
info[0] = String.valueOf(i + 1);
|
||||||
|
info[1] = data.get(i).getItemId();
|
||||||
|
info[2] = data.get(i).getRev();
|
||||||
|
info[3] = data.get(i).getOwner();
|
||||||
|
info[4] = data.get(i).getDatasetName();
|
||||||
|
info[5] = data.get(i).getReference_file();
|
||||||
|
info[6] = data.get(i).getReason();
|
||||||
|
info[7] = data.get(i).getNeedDown();
|
||||||
|
datas[i] = info;
|
||||||
|
}
|
||||||
|
return datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int row, int column) {
|
||||||
|
if (column < 7) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据标题大小设置列宽
|
||||||
|
public void FitTableColumns(JTable myTable) {
|
||||||
|
JTableHeader header = myTable.getTableHeader();
|
||||||
|
int rowCount = myTable.getRowCount();
|
||||||
|
Enumeration<TableColumn> columns = myTable.getColumnModel().getColumns();
|
||||||
|
while (columns.hasMoreElements()) {
|
||||||
|
TableColumn column = (TableColumn) columns.nextElement();
|
||||||
|
int col = header.getColumnModel().getColumnIndex(column.getIdentifier());
|
||||||
|
int width = (int) myTable.getTableHeader().getDefaultRenderer().getTableCellRendererComponent(myTable, column.getIdentifier(), false, false, -1, col).getPreferredSize().getWidth();
|
||||||
|
for (int row = 0; row < rowCount; row++) {
|
||||||
|
int preferedWidth = (int) myTable.getCellRenderer(row, col).getTableCellRendererComponent(myTable, myTable.getValueAt(row, col), false, false, row, col).getPreferredSize().getWidth();
|
||||||
|
width = Math.max(width, preferedWidth);
|
||||||
|
}
|
||||||
|
header.setResizingColumn(column);
|
||||||
|
column.setWidth(width + myTable.getIntercellSpacing().width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置列宽
|
||||||
|
public void setTableColumnsWidth(JTable myTable) {
|
||||||
|
myTable.getColumnModel().getColumn(0).setPreferredWidth(25);
|
||||||
|
myTable.getColumnModel().getColumn(1).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(2).setPreferredWidth(40);
|
||||||
|
myTable.getColumnModel().getColumn(3).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(4).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(5).setPreferredWidth(125);
|
||||||
|
myTable.getColumnModel().getColumn(6).setPreferredWidth(100);
|
||||||
|
myTable.getColumnModel().getColumn(7).setPreferredWidth(80);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,426 @@
|
|||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.swing.DefaultListModel;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JList;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.JTree;
|
||||||
|
import javax.swing.ListCellRenderer;
|
||||||
|
import javax.swing.ListSelectionModel;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.aif.common.AIFTreeNode;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.common.organization.OrgTreePanel;
|
||||||
|
import com.teamcenter.rac.common.organization.OrganizationTree;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentGroupMember;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentProject;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
import com.teamcenter.rac.util.PropertyLayout;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class SelectUserDialog extends AbstractAIFDialog {
|
||||||
|
|
||||||
|
private JButton b_ok;
|
||||||
|
private JButton b_cel;
|
||||||
|
private JButton add;
|
||||||
|
private JButton remove;
|
||||||
|
private OrganizationTree tree;
|
||||||
|
private JTree projectTree;
|
||||||
|
private JList<String> l_user;
|
||||||
|
private DefaultListModel<String> lm_user;
|
||||||
|
private JTextField editPropMap;
|
||||||
|
private String group;
|
||||||
|
private boolean isMulti;
|
||||||
|
private JTable table;
|
||||||
|
private int[] colIndex;
|
||||||
|
private int rowIndex;
|
||||||
|
private TCComponentProject project;
|
||||||
|
|
||||||
|
public SelectUserDialog(JTextField editPropMap, boolean isMulti) throws Exception {
|
||||||
|
super(true);
|
||||||
|
this.editPropMap = editPropMap;
|
||||||
|
this.isMulti = isMulti;
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getValue() {
|
||||||
|
String val = "";
|
||||||
|
if (editPropMap != null) {
|
||||||
|
val = editPropMap.getText();
|
||||||
|
} else if (table != null) {
|
||||||
|
val = (String) table.getValueAt(rowIndex, colIndex[0]);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setValue(String text) {
|
||||||
|
if (editPropMap != null) {
|
||||||
|
editPropMap.setText(text);
|
||||||
|
} else if (table != null) {
|
||||||
|
table.setValueAt(text, rowIndex, colIndex[0]);
|
||||||
|
if (colIndex.length>1)
|
||||||
|
table.setValueAt(group, rowIndex, colIndex[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectUserDialog(JTable table, boolean isMulti, int[] colIndex, int rowIndex, TCComponentProject projectID) throws Exception {
|
||||||
|
super(true);
|
||||||
|
this.table = table;
|
||||||
|
this.isMulti = isMulti;
|
||||||
|
this.colIndex = colIndex;
|
||||||
|
this.rowIndex = rowIndex;
|
||||||
|
this.project = projectID;
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUI() throws Exception {
|
||||||
|
this.setTitle("Ñ¡ÔñÈËÔ±");
|
||||||
|
this.setLayout(new BorderLayout());
|
||||||
|
int pweight = 440, pheight = 480, mweight = 280, mheight = 320;
|
||||||
|
if (isMulti) {
|
||||||
|
// this.setPreferredSize(new Dimension(640, 480));
|
||||||
|
// this.setMinimumSize(new Dimension(480, 320));
|
||||||
|
pweight = 640;
|
||||||
|
mweight = 480;
|
||||||
|
}
|
||||||
|
if(project != null) {
|
||||||
|
pheight = 700;
|
||||||
|
mheight = 700;
|
||||||
|
}
|
||||||
|
this.setPreferredSize(new Dimension(pweight, pheight));
|
||||||
|
this.setMinimumSize(new Dimension(mweight, mheight));
|
||||||
|
OrgTreePanel orgPanel = new OrgTreePanel((TCSession) AIFUtility.getCurrentApplication().getSession());
|
||||||
|
this.tree = orgPanel.getOrgTree();
|
||||||
|
|
||||||
|
if(project != null) {
|
||||||
|
JPanel panel = new JPanel(new PropertyLayout());
|
||||||
|
panel.add("1.1.center.center", orgPanel);
|
||||||
|
panel.add("2.1.center.center", initProjectPanel(orgPanel));
|
||||||
|
// FlowLayout flow = new FlowLayout();
|
||||||
|
// flow.setAlignOnBaseline(true);
|
||||||
|
// JPanel panel = new JPanel(flow);
|
||||||
|
// panel.add(orgPanel);
|
||||||
|
// panel.add(initProjectPanel(orgPanel));
|
||||||
|
this.add(BorderLayout.WEST, panel);
|
||||||
|
}else {
|
||||||
|
this.add(BorderLayout.CENTER, orgPanel);
|
||||||
|
}
|
||||||
|
this.add(BorderLayout.SOUTH, initBtnPanel());
|
||||||
|
if (isMulti) {
|
||||||
|
JPanel lp = initListPanel();
|
||||||
|
this.add(BorderLayout.EAST, lp);
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
addListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
String text = getValue();
|
||||||
|
if (text.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] split = text.split(",");
|
||||||
|
for (int i = 0; i < split.length; i++) {
|
||||||
|
lm_user.addElement(split[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel initListPanel() {
|
||||||
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
|
FlowLayout flow = new FlowLayout();
|
||||||
|
flow.setVgap(100);
|
||||||
|
JPanel btnPanel = new JPanel(flow);
|
||||||
|
btnPanel.add(this.add);
|
||||||
|
// btnPanel.add("2.1.center.center", this.remove);
|
||||||
|
this.lm_user = new DefaultListModel<>();
|
||||||
|
this.l_user = new JList<>(lm_user);
|
||||||
|
l_user.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
this.l_user.setCellRenderer(new DeleteListRenderer(l_user));
|
||||||
|
JScrollPane scroll = new JScrollPane(l_user);
|
||||||
|
scroll.setPreferredSize(new Dimension(200, 0));
|
||||||
|
// this.add.setPreferredSize(new Dimension(50, 30));
|
||||||
|
panel.add(BorderLayout.WEST, btnPanel);
|
||||||
|
panel.add(BorderLayout.CENTER, scroll);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel initBtnPanel() {
|
||||||
|
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 5));
|
||||||
|
this.b_ok = new JButton("È·¶¨");
|
||||||
|
this.b_cel = new JButton("È¡Ïû");
|
||||||
|
this.add = new JButton("+");
|
||||||
|
this.remove = new JButton("-");
|
||||||
|
panel.add(b_ok);
|
||||||
|
panel.add(b_cel);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JScrollPane initProjectPanel(OrgTreePanel orgPanel) throws Exception {//TODO
|
||||||
|
Dimension orgDimension = orgPanel.getPreferredSize();
|
||||||
|
orgPanel.setPreferredSize(new Dimension(orgDimension.width*2, orgDimension.height-100));
|
||||||
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode(project.getProjectID(), true);
|
||||||
|
projectTree = new JTree(root);
|
||||||
|
|
||||||
|
List<Object> team = project.getTeam();
|
||||||
|
TCComponent[] members = (TCComponent[])team.get(0);
|
||||||
|
for(TCComponent c : members) {
|
||||||
|
if(c instanceof TCComponentGroupMember) {
|
||||||
|
TCComponentGroupMember member = (TCComponentGroupMember)c;
|
||||||
|
DefaultMutableTreeNode childRoot = new DefaultMutableTreeNode(member, true);
|
||||||
|
root.add(childRoot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
projectTree.setPreferredSize(new Dimension(orgDimension.width*2, orgDimension.height/2));
|
||||||
|
// projectTree.setMaximumSize(new Dimension(orgDimension.width*2, orgDimension.height/2));
|
||||||
|
JScrollPane projectPane = new JScrollPane(projectTree);
|
||||||
|
return projectPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSelectUser() throws Exception {
|
||||||
|
// Object[] comps = tree.getSelectedOrgObjects();
|
||||||
|
AIFTreeNode[] comps = tree.getSelectedNodes();
|
||||||
|
// System.out.println("comps:"+(comps==null));
|
||||||
|
if (comps == null) {
|
||||||
|
if(projectTree == null)
|
||||||
|
return null;
|
||||||
|
else if(projectTree.getSelectionModel() == null)
|
||||||
|
return null;
|
||||||
|
else if(projectTree.getLastSelectedPathComponent() == null)
|
||||||
|
return null;
|
||||||
|
DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) projectTree.getLastSelectedPathComponent();
|
||||||
|
Object selectObject = selectNode.getUserObject();
|
||||||
|
if(selectObject instanceof TCComponentGroupMember) {
|
||||||
|
String member = ((TCComponentGroupMember) selectObject).toString();
|
||||||
|
if(member.indexOf(".")>0)
|
||||||
|
group = member.substring(0, member.indexOf("."));
|
||||||
|
else
|
||||||
|
group = member.substring(0, member.indexOf("/"));
|
||||||
|
TCComponentUser user = ((TCComponentGroupMember) selectObject).getUser();
|
||||||
|
if (user != null) {
|
||||||
|
return user.getProperty("user_name");
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// System.out.println("comps:"+comps.length);
|
||||||
|
for (int i = 0; i < comps.length; i++) {
|
||||||
|
// OrgObject comp = (OrgObject) comps[i];
|
||||||
|
TCComponent gm = (TCComponent) comps[i].getContextComponent().getComponent();
|
||||||
|
// System.out.println("gm:"+gm);
|
||||||
|
if (gm != null && (gm instanceof TCComponentGroupMember)) {
|
||||||
|
TCComponentUser user = ((TCComponentGroupMember) gm).getUser();
|
||||||
|
if (user != null) {
|
||||||
|
group = ((DefaultMutableTreeNode)comps[i].getParent().getParent()).getUserObject().toString();
|
||||||
|
return user.getProperty("user_name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addListeners() {
|
||||||
|
this.b_cel.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.b_ok.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
try {
|
||||||
|
if (isMulti) {
|
||||||
|
int size = lm_user.getSize();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String text = lm_user.getElementAt(i);
|
||||||
|
if (text != null) {
|
||||||
|
sb.append(text).append(";");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.setLength(sb.length() - 1);
|
||||||
|
}
|
||||||
|
setValue(sb.toString());
|
||||||
|
} else {
|
||||||
|
String user = getSelectUser();
|
||||||
|
if (user != null) {
|
||||||
|
setValue(user);
|
||||||
|
} else {
|
||||||
|
setValue("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
disposeDialog();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post("Error:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tree.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
try {
|
||||||
|
super.mouseClicked(e);
|
||||||
|
if(projectTree != null)
|
||||||
|
projectTree.clearSelection();
|
||||||
|
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
|
||||||
|
String user = getSelectUser();
|
||||||
|
System.out.println("user:"+user);
|
||||||
|
if (user != null) {
|
||||||
|
if (isMulti) {
|
||||||
|
if (!lm_user.contains(user.toString())) {
|
||||||
|
lm_user.addElement(user.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setValue(user.toString());
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post("Error:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(projectTree != null) {
|
||||||
|
projectTree.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
try {
|
||||||
|
super.mouseClicked(e);
|
||||||
|
tree.clearSelection();
|
||||||
|
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
|
||||||
|
String user = getSelectUser();
|
||||||
|
if (user != null) {
|
||||||
|
if (isMulti) {
|
||||||
|
if (!lm_user.contains(user.toString())) {
|
||||||
|
lm_user.addElement(user.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setValue(user.toString());
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post("Error:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.l_user.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
super.mouseClicked(e);
|
||||||
|
int ind = l_user.getSelectedIndex();
|
||||||
|
if (ind >= 0) {
|
||||||
|
lm_user.remove(ind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
super.mouseEntered(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e) {
|
||||||
|
super.mouseExited(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
this.add.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
try {
|
||||||
|
String user = getSelectUser();
|
||||||
|
System.out.println("user:"+user);
|
||||||
|
if (user != null) {
|
||||||
|
if (!lm_user.contains(user.toString())) {
|
||||||
|
lm_user.addElement(user.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
MessageBox.post("Error:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.remove.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
disposeDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
private class DeleteListRenderer extends JPanel implements ListCellRenderer<String> {
|
||||||
|
|
||||||
|
JButton btn;
|
||||||
|
JLabel label;
|
||||||
|
|
||||||
|
public DeleteListRenderer(final JList<? extends String> list) {
|
||||||
|
this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 1));
|
||||||
|
this.setBackground(Color.WHITE);
|
||||||
|
btn = getDeletetBtn();
|
||||||
|
label = new JLabel("");
|
||||||
|
this.add(btn);
|
||||||
|
this.add(label);
|
||||||
|
|
||||||
|
btn.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
int ind = list.getSelectedIndex();
|
||||||
|
System.out.println(ind);
|
||||||
|
if (ind >= 0) {
|
||||||
|
list.remove(ind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index,
|
||||||
|
boolean isSelected, boolean cellHasFocus) {
|
||||||
|
label.setText(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
private JButton getDeletetBtn() {
|
||||||
|
ImageIcon icon = new ImageIcon(SelectUserDialog.class.getResource("image/delete.png"));
|
||||||
|
JButton btn = new JButton(icon);
|
||||||
|
btn.setPreferredSize(new Dimension(23, 23));
|
||||||
|
btn.setContentAreaFilled(false);
|
||||||
|
btn.setFocusPainted(false);
|
||||||
|
btn.setBorderPainted(false);
|
||||||
|
btn.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
# File name: ShowMessageDialog.java
|
||||||
|
# File description:
|
||||||
|
#=============================================================================
|
||||||
|
# Date Name Action Description of Change
|
||||||
|
# 2009-10-30 tyl 创建 显示信息
|
||||||
|
# 2010-02-10 tyl Mod 信息前减少空格
|
||||||
|
#=============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.util.PropertyLayout;
|
||||||
|
import com.teamcenter.rac.util.VerticalLayout;
|
||||||
|
|
||||||
|
public class ShowMessageDialog extends AbstractAIFDialog {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String title = "";
|
||||||
|
private String info1 = "";
|
||||||
|
private String info2 = "";
|
||||||
|
|
||||||
|
public ShowMessageDialog(String title, String info1, String info2) {
|
||||||
|
super(true);
|
||||||
|
this.title = title;
|
||||||
|
this.info1 = info1;
|
||||||
|
this.info2 = info2;
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initUI() {
|
||||||
|
setPersistentDisplay(true);
|
||||||
|
setOptimalDisplay(false);
|
||||||
|
setTitle(title);
|
||||||
|
JPanel parentPanel;
|
||||||
|
JPanel iconPanel = new JPanel();
|
||||||
|
JPanel itemInfoPanel1;
|
||||||
|
JPanel itemInfoPanel2;
|
||||||
|
parentPanel = new JPanel(new VerticalLayout(5, 2, 2, 2, 2));
|
||||||
|
itemInfoPanel2 = new JPanel(new GridLayout(2, 1));
|
||||||
|
itemInfoPanel1 = new JPanel(new PropertyLayout());
|
||||||
|
|
||||||
|
URL url = this.getClass().getResource("image/info.png");
|
||||||
|
JLabel iconLabel = new JLabel();
|
||||||
|
iconLabel.setIcon(new ImageIcon(url));
|
||||||
|
iconPanel.add(iconLabel);
|
||||||
|
|
||||||
|
itemInfoPanel2.add(new JLabel(" " + info1));
|
||||||
|
itemInfoPanel2.add(new JLabel(info2));
|
||||||
|
|
||||||
|
itemInfoPanel1.add("1.1.left.center", iconPanel);
|
||||||
|
itemInfoPanel1.add("1.2.left.center", itemInfoPanel2);
|
||||||
|
|
||||||
|
JButton buttonYes = new JButton("确定");
|
||||||
|
buttonYes.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
ShowMessageDialog.this.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
JPanel panelButton = new JPanel(new BorderLayout());
|
||||||
|
panelButton.setSize(10, 20);
|
||||||
|
panelButton.add(buttonYes, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
parentPanel.add("top.bin", new JLabel(" "));
|
||||||
|
parentPanel.add("top.bind.left.top", itemInfoPanel1);
|
||||||
|
parentPanel.add("bottom.nobind.center.top", panelButton);
|
||||||
|
|
||||||
|
getContentPane().add(parentPanel);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
Dimension screen = getToolkit().getScreenSize(); // 得到屏幕尺寸
|
||||||
|
setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2);
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
#=======================================================================================================
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Origin Enterprise Solution LTD.
|
||||||
|
#
|
||||||
|
#=======================================================================================================
|
||||||
|
# File description: TableColorRender.java
|
||||||
|
#=======================================================================================================
|
||||||
|
# Date time Name Action Description of Change
|
||||||
|
# 2011-1-17 ÏÂÎç03:46:31 tyl Ini ³õʼ»¯Îļþ
|
||||||
|
#=======================================================================================================
|
||||||
|
*/
|
||||||
|
package com.connor.lidy.task.util;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
|
||||||
|
public class TableColorRender implements TableCellRenderer {
|
||||||
|
//
|
||||||
|
public static final DefaultTableCellRenderer DEFAULT_RENDERER = new DefaultTableCellRenderer();
|
||||||
|
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
|
Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
|
|
||||||
|
Color foreground = table.getForeground();
|
||||||
|
Color background = table.getBackground();
|
||||||
|
if (isSelected) {
|
||||||
|
foreground = Color.WHITE;
|
||||||
|
background = Color.LIGHT_GRAY;
|
||||||
|
} else {
|
||||||
|
if (value != null) {
|
||||||
|
if (((String) value).startsWith("¡ô")) {
|
||||||
|
foreground = Color.RED;
|
||||||
|
background = Color.WHITE;
|
||||||
|
} else {
|
||||||
|
if (((String) value).startsWith("¡ï")) {
|
||||||
|
System.out.println("value============" + value);
|
||||||
|
foreground = Color.RED;
|
||||||
|
background = Color.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreground = table.getForeground();
|
||||||
|
background = table.getBackground();
|
||||||
|
}
|
||||||
|
renderer.setForeground(foreground);
|
||||||
|
renderer.setBackground(background);
|
||||||
|
return renderer;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue